I'm currently running into an OAuth token endpoint failure using the AspNet.Security.OAuth.Discord library during login after Discord has authenticated me and returned to my ASP.NET site. The code for authentication is detailed below, with full error logs and relevant controller, with all this running in a docker container. Any help would be greatly appreciated!
The exact error is AspNet.Security.OAuth.Discord.DiscordAuthenticationHandler[4]: Error from RemoteAuthentication: OAuth token endpoint failure: Status: BadRequest. This occurs after visiting http://.../login, which returns to the default /signin-discord URL of the library, with an expected parameter of code in /signin-discord?code=.....
Authentication Scheme when creating WebApplication:
MVC Controller:
Error Logs:



Seemingly fixed by putting
app.UseAuthentication();belowapp.UseRouting();and aboveapp.UseAuthorization();andapp.UseEndpoints();