auth0-samples / auth0-aspnetcore-mvc-samples

Auth0 Integration Samples for ASP.NET Core MVC Web Applications
https://auth0.com/docs/quickstart/webapp/aspnet-core
MIT License
152 stars 199 forks source link

Update Program.cs #93

Open mistermik opened 8 months ago

mistermik commented 8 months ago

App always redirect to localhost and not the current domain so, this does not work when using codespaces as the callback is a public domain. Fixing this problem by using UseForwardedHeaders, you ensure that your application correctly handles requests in scenarios where it is behind a proxy, which can affect URL generation and redirection.

frederikprijck commented 8 months ago

Thanks, as mentioned, this sample is to help quickstart people with setting up auth0 in asp.net. Running things behind a proxy and whatnot is confusing for those not familiar with the concept, is not relevant to setting up auth0, and people will just copy this in their production app.

We want to keep it as minimal, yet useful as possible.

Closing

mistermik commented 8 months ago

@frederikprijck CIC certification demands customers to pick up a quickstart and use github codespaces; however, if customers choose the .NET sample, this will fail because the request will always redirect back to localhost as CallBack. If you search online, you will find a number of issues with this sample raised in the Okta developer community. That is why I am proposing the change. At the very least, you can check to see if codespaces are being used and, if so, make the changes I suggested. My two cents on making a sample work for anyone taking CIC training or certification without wasting time on fixing something that should just work out of the box.

frederikprijck commented 8 months ago

Thanks for that context!

I was not aware of the sample being used in that context, will need to look into that to understand more.