Implementing Google OAuth throws an error after logging in
I'm losing my mind over this, I'm sure it's a minor fix but I can't seem to get it working, I've setup the Google OAuth controller, and everything seems to be working at glance, the application builds, the url gets me to google, i can select my account, but once it tries to call the callback, it says the oauth state is missing or invalid
https://github.com/lumijiez/raven/blob/dev/auth/server/Raven/Raven.Auth/Controllers/GoogleOAuthController.cs
https://github.com/lumijiez/raven/blob/dev/auth/server/Raven/Raven.Auth/Startup.cs
here are the relevant files
GitHub
raven/server/Raven/Raven.Auth/Controllers/GoogleOAuthController.cs ...
Contribute to lumijiez/raven development by creating an account on GitHub.
GitHub
raven/server/Raven/Raven.Auth/Startup.cs at dev/auth · lumijiez/raven
Contribute to lumijiez/raven development by creating an account on GitHub.
10 Replies
if think instead of setting "options.CallbackPath = "/oauth/google/callback";" inside AddGoogle. Remove setting that CallbackPath. and just use the RedirectUri that u set in the AuthenticationProperties. It will then correctly first redirect to the internal path of default value of CallbackPath and then to your endpoint.
that wont work because im not using the default google url, so i need to put it there, if i remove the callback path setting, google just shows a redirect mismatch
Then you might need to check to do that properly because that setting is: CallbackPath is not supposed to refer to a controller, it refers to a unique path handled by the auth middleware (defaults to /signin-google). It will redirect back to your controller when it's done.
ohh, i see
then
so, it means this returns a wrong url if im getting a mismatch right?
maybe you could rename your callback and keep the options.CallbackPath = "/oauth/google/callback"; in so the internal middleware catches /oauth/google/callback
im sorry, im bad with terms
let me rephrase
yeah, i understood, i did that and it worked lol
thank you SO MUCH
ah ok
i misunderstood what callbackpath did
thank you, i hope you have a beautiful life
yea, there are some issues opened about that too, so its not just you i think ahaha, and youre welcome!
thank you once again