FeroxFoxxo
FeroxFoxxo

Reputation: 615

OAuth token endpoint failure on AspNet.Security.OAuth.Discord login: BadRequest

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:

Authentication scheme

MVC Controller:

Authentication controller

Error Logs:

Error logs

Upvotes: 0

Views: 702

Answers (1)

FeroxFoxxo
FeroxFoxxo

Reputation: 615

Seemingly fixed by putting app.UseAuthentication(); below app.UseRouting(); and above app.UseAuthorization(); and app.UseEndpoints();

Upvotes: 3

Related Questions