I’m using .net core 3.1 and I’m not able to run any of my applications in codespaces because they fail during the oauth authentication step. This appears to be because the server is creating the wrong redirect_uri when creating an oauth request, which is happening because the server SCHEME and HOST context variables are coming back incorrectly.
To show this issue, I’ve created a bare-bones repository at https://github.com/ucdavis/codespaces-netcore3 which is just a new .net core MVC project with the github oauth provider.
The problem then happens if I click to go to a secure page. The oauth provider will then make a request similar to github.com/login/oauth/authorize?client_id=abc&scope=&response_type=code&redirect_uri=https%3A%2F%2Flocalhost%2Fsignin-github. As you can see the redirect_uri is incorrect as it doesn’t contain the 5001 port any more. If you do continue and authorize the github app, you are redirected of course to the redirect uri it will fail with a generic connection refused because there is nothing listening on localhost at all.
I’m not sure how the port forwarding mechanism works but it seems to be redirect_uri should be set to the [guid]-5001.apps.codespaces.githubusercontent.com/ uri or perhaps localhost:5001, but definitely not just localhost.
If I clone my repo and run it locally with
dotnet watch run everything works as expected.