Search code examples
oauth-2.0

Google OAuth2.0 Access right


when using the google oAuth2. I keep getting Erreur 400 : redirect_uri_mismatch The redirect URI in the request, http://hostname/signin-google, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: with the HTTP access. but I'm using the https access to access the url. I don't know why it's redirecting by HTTP not HTTPS . For the auth I'm using

await HttpContext.ChallengeAsync("Google", new AuthenticationProperties() {RedirectUri = "/"})

-- Note : when trying to Add my hostname with http on the redirect_uris acceepted on the GCP, it doesn't accept http, but only HTTPS

thanks a lot


Solution

  • In fact, it's the way you expose your app that is taken in parameters.. For me I'm using the dockerfile to expose my app, and I used to use Expose http://*:80 And even if the associated domain was started with an HTTPS, inside the app it's always an HTTP call, so all the redirect are done through the http protocole. I'v changed the way I expose my app from http://:80 to https://:443 And in the code I used kestrel to launch the app and it's working perfectly now Thank you