-8

I'm using this code to try to get the auth from Google:

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

The thing is the redirect always take the HTTP url even if I'm running it from https url.

The url with https://something-sss.com is already whitelisted on the GCP API identifiers.

But it always take the Uri with http

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • can you include a reproducible piece of code? How close is this document[1] to what you are doing? [1] https://learn.microsoft.com/en-us/aspnet/core/security/authentication/social/google-logins?view=aspnetcore-2.1&tabs=aspnetcore2x – Antonio Ramirez Mar 22 '21 at 23:13
  • 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 – Youness Abbassi Mar 24 '21 at 13:11
  • Thank you for your reply. Since Stackoverflow is a question and answer site I have taken your comment and posted it as a wiki answer so that it may help others. – Antonio Ramirez Mar 24 '21 at 17:51
  • I'm not so familiar with this wiki and stuff .. but I'm happy to help. Thank you Antonio – Youness Abbassi Mar 24 '21 at 19:26

1 Answers1

1

To expose my docker app I used to use Expose http://*:80 and even if the associated domain was started with an HTTPS, inside the app it was always an HTTP call, so all the redirects were done through the http protocol.
I have changed the way I expose my app from http://*:80 to https://*:443 in the code I used kestrel to launch the app and it's working perfectly now.

Antonio Ramirez
  • 943
  • 6
  • 15