✅ Blazor Serverside Google Authentication Error 400

Hi folks, I'm trying to add Google sign in to a Blazor Serverside application, but I am consistently getting error 400: redirect_uri_mismatch. As seen in the the first screenshot, this is my API endpoint in my controller for the Google sign in, with the (temporarily) hard coded RedirectUri, since I want to go to the "/" page after a successful login. As you can see in the second screenshot, I get this error when I navigate to the google sign in page. Going to the developer console and looking at authorised redirect URIs (see screenshot), as prompted by the error, shows that it matches the redirect URI from my controller. So far, I have tried: - Remaking the entire Blazor project from scratch - Making an entirely new Google account and a brand new API on the Google Cloud Console. There is no mention of "signin-google" anywhere in the code for my project, nor in the Google cloud project. I'm completely lost here and my boss wants this prototype up and running ASAP, so any of your ideas are massively appreciated. Thanks in advance.
5 Replies
Bunda
Bunda2y ago
Does Google force you to use https://localhost:7541/sigin-google ? What I normally would do is create a route at let's say /oauth/google/callback and add some logic there if needed and at the end I will redirect to a different page where you want the user to land.
TotallyJustin
TotallyJustinOP2y ago
That's what I was thinking. I set it to "/signin-google" and made a new page to go to that loads some information from the profile just to make sure it's working, and I got a new error this time. I believe that's what this information section is referring to, I'm just not sure how to handle the part that is appended to the end.
Bunda
Bunda2y ago
Can you link to the documentation? Also I don't get notified if not @mentioned I'm thinking, maybe it is not allowed to use https for localhost redirects but I'm not sure. And I would expect the google interface to complain about that beforehand.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
TotallyJustin
TotallyJustinOP2y ago
Partially resolved
Want results from more Discord servers?
Add your server