Can't login with Discord #88

Open
opened 2025-10-17 04:18:07 +00:00 by quickflick346 · 5 comments
quickflick346 commented 2025-10-17 04:18:07 +00:00 (Migrated from github.com)

Trying to sign in with Discord takes me to https://gex.honu.pw/auth/callback?code=IFp22BgH...... with the following error:

{
"type": "/auth/callback",
"title": "internal server error: An error was encountered while handling the remote login.",
"status": 500,
"detail": "Microsoft.AspNetCore.Authentication.AuthenticationFailureException: An error was encountered while handling the remote login.\n ---\u003E Microsoft.AspNetCore.Authentication.AuthenticationFailureException: Correlation failed.\n --- End of inner exception stack trace ---\n at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler1.HandleRequestAsync()\n at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\n at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)\n at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)\n at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)\n at Microsoft.AspNetCore.RateLimiting.RateLimitingMiddleware.InvokeInternal(HttpContext context, EnableRateLimitingAttribute enableRateLimitingAttribute)\n at gex.Code.ExceptionHandlerMiddleware.Invoke(HttpContext context, ILogger1 logger) in /home/gex/gex/gex/Code/ExceptionHandlerMiddleware.cs:line 32",
"instance": "error:dc4152eb-cdcf-40b8-9539-9bf73c448769",
"extensions": {

}
}

Trying to sign in with Discord takes me to `https://gex.honu.pw/auth/callback?code=IFp22BgH......` with the following error: > { > "type": "/auth/callback", > "title": "internal server error: An error was encountered while handling the remote login.", > "status": 500, > "detail": "Microsoft.AspNetCore.Authentication.AuthenticationFailureException: An error was encountered while handling the remote login.\n ---\u003E Microsoft.AspNetCore.Authentication.AuthenticationFailureException: Correlation failed.\n --- End of inner exception stack trace ---\n at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()\n at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\n at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)\n at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)\n at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)\n at Microsoft.AspNetCore.RateLimiting.RateLimitingMiddleware.InvokeInternal(HttpContext context, EnableRateLimitingAttribute enableRateLimitingAttribute)\n at gex.Code.ExceptionHandlerMiddleware.Invoke(HttpContext context, ILogger`1 logger) in /home/gex/gex/gex/Code/ExceptionHandlerMiddleware.cs:line 32", > "instance": "error:dc4152eb-cdcf-40b8-9539-9bf73c448769", > "extensions": { > > } > }
Varunda commented 2025-10-17 15:57:49 +00:00 (Migrated from github.com)

additional warning before the error:

WARN [AspNet.Security.OAuth.Discord.DiscordAuthenticationHandler] [CorrelationCookieNotFound] '.AspNetCore.Correlation.5UOMY7CEJtfm8pa<snip>' cookie not found.

i'm able to login successfully. is there anything in the browser console that might indicate the error? does this consistently happen always? or did it start recently?

additional warning before the error: `WARN [AspNet.Security.OAuth.Discord.DiscordAuthenticationHandler] [CorrelationCookieNotFound] '.AspNetCore.Correlation.5UOMY7CEJtfm8pa<snip>' cookie not found.` i'm able to login successfully. is there anything in the browser console that might indicate the error? does this consistently happen always? or did it start recently?
fcaps commented 2026-01-24 13:49:25 +00:00 (Migrated from github.com)

got a related issue, but i may have a hint, the callback_url is http and redirected to https.
Did somebody lately sign in for the first time?
here is mine:

  "type": "/auth/callback",
  "title": "internal server error: An error was encountered while handling the remote login.",
  "status": 500,
  "detail": "Microsoft.AspNetCore.Authentication.AuthenticationFailureException: An error was encountered while handling the remote login.\n ---> System.NullReferenceException: Object reference not set to an instance of an object.\n   at gex.Startup.<>c.<ConfigureServices>b__4_19(JsonElement user) in /home/gex/gex/gex/Startup.cs:line 195\n   at Microsoft.AspNetCore.Authentication.OAuth.Claims.CustomJsonClaimAction.Run(JsonElement userData, ClaimsIdentity identity, String issuer)\n   at Microsoft.AspNetCore.Authentication.OAuth.OAuthCreatingTicketContext.RunClaimActions(JsonElement userData)\n   at AspNet.Security.OAuth.Discord.DiscordAuthenticationHandler.CreateTicketAsync(ClaimsIdentity identity, AuthenticationProperties properties, OAuthTokenResponse tokens)\n   at Microsoft.AspNetCore.Authentication.OAuth.OAuthHandler`1.HandleRemoteAuthenticateAsync()\n   at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()\n   --- End of inner exception stack trace ---\n   at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()\n   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\n   at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)\n   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)\n   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)\n   at Microsoft.AspNetCore.RateLimiting.RateLimitingMiddleware.InvokeInternal(HttpContext context, EnableRateLimitingAttribute enableRateLimitingAttribute)\n   at gex.Code.ExceptionHandlerMiddleware.Invoke(HttpContext context, ILogger`1 logger) in /home/gex/gex/gex/Code/ExceptionHandlerMiddleware.cs:line 32",
  "instance": "error:0c1930bd-ad13-4feb-ad6d-7b1fc959fcde",
  "extensions": {}
}

Related: 

{
  "type": "/auth/callback",
  "title": "internal server error: An error was encountered while handling the remote login.",
  "status": 500,
  "detail": "Microsoft.AspNetCore.Authentication.AuthenticationFailureException: An error was encountered while handling the remote login.\n ---> Microsoft.AspNetCore.Authentication.AuthenticationFailureException: Correlation failed.\n   --- End of inner exception stack trace ---\n   at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()\n   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\n   at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)\n   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)\n   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)\n   at Microsoft.AspNetCore.RateLimiting.RateLimitingMiddleware.InvokeInternal(HttpContext context, EnableRateLimitingAttribute enableRateLimitingAttribute)\n   at gex.Code.ExceptionHandlerMiddleware.Invoke(HttpContext context, ILogger`1 logger) in /home/gex/gex/gex/Code/ExceptionHandlerMiddleware.cs:line 32",
  "instance": "error:6bb2255b-ebc3-4019-858a-ed6a60457342",
  "extensions": {}
}

got a related issue, but i may have a hint, the callback_url is http and redirected to https. Did somebody lately sign in for the first time? here is mine: ```{ "type": "/auth/callback", "title": "internal server error: An error was encountered while handling the remote login.", "status": 500, "detail": "Microsoft.AspNetCore.Authentication.AuthenticationFailureException: An error was encountered while handling the remote login.\n ---> System.NullReferenceException: Object reference not set to an instance of an object.\n at gex.Startup.<>c.<ConfigureServices>b__4_19(JsonElement user) in /home/gex/gex/gex/Startup.cs:line 195\n at Microsoft.AspNetCore.Authentication.OAuth.Claims.CustomJsonClaimAction.Run(JsonElement userData, ClaimsIdentity identity, String issuer)\n at Microsoft.AspNetCore.Authentication.OAuth.OAuthCreatingTicketContext.RunClaimActions(JsonElement userData)\n at AspNet.Security.OAuth.Discord.DiscordAuthenticationHandler.CreateTicketAsync(ClaimsIdentity identity, AuthenticationProperties properties, OAuthTokenResponse tokens)\n at Microsoft.AspNetCore.Authentication.OAuth.OAuthHandler`1.HandleRemoteAuthenticateAsync()\n at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()\n --- End of inner exception stack trace ---\n at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()\n at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\n at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)\n at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)\n at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)\n at Microsoft.AspNetCore.RateLimiting.RateLimitingMiddleware.InvokeInternal(HttpContext context, EnableRateLimitingAttribute enableRateLimitingAttribute)\n at gex.Code.ExceptionHandlerMiddleware.Invoke(HttpContext context, ILogger`1 logger) in /home/gex/gex/gex/Code/ExceptionHandlerMiddleware.cs:line 32", "instance": "error:0c1930bd-ad13-4feb-ad6d-7b1fc959fcde", "extensions": {} } Related: { "type": "/auth/callback", "title": "internal server error: An error was encountered while handling the remote login.", "status": 500, "detail": "Microsoft.AspNetCore.Authentication.AuthenticationFailureException: An error was encountered while handling the remote login.\n ---> Microsoft.AspNetCore.Authentication.AuthenticationFailureException: Correlation failed.\n --- End of inner exception stack trace ---\n at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()\n at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\n at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)\n at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)\n at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)\n at Microsoft.AspNetCore.RateLimiting.RateLimitingMiddleware.InvokeInternal(HttpContext context, EnableRateLimitingAttribute enableRateLimitingAttribute)\n at gex.Code.ExceptionHandlerMiddleware.Invoke(HttpContext context, ILogger`1 logger) in /home/gex/gex/gex/Code/ExceptionHandlerMiddleware.cs:line 32", "instance": "error:6bb2255b-ebc3-4019-858a-ed6a60457342", "extensions": {} } ```
Varunda commented 2026-02-09 03:06:02 +00:00 (Migrated from github.com)

yeah, this keeps popping up every once in a while and it seems like just trying again works? super inconsistent. would need to know browser and OS to see if there's a pattern

yeah, this keeps popping up every once in a while and it seems like just trying again works? super inconsistent. would need to know browser and OS to see if there's a pattern
ville81 commented 2026-04-12 12:28:22 +00:00 (Migrated from github.com)

I get this 100% of the time on my phone using either Samsung Internet browser or Google Chrome browser. And 100% of the time on my windows 10 computer with Chrome or Edge. Have never been able to login.

{
"type": "/auth/callback",
"title": "internal server error: An error was encountered while handling the remote login.",
"status": 500,
"detail": "Microsoft.AspNetCore.Authentication.AuthenticationFailureException: An error was encountered while handling the remote login.\n ---> System.NullReferenceException: Object reference not set to an instance of an object.\n at gex.Startup.<>c.b__4_19(JsonElement user) in /home/gex/gex/gex/Startup.cs:line 195\n at Microsoft.AspNetCore.Authentication.OAuth.Claims.CustomJsonClaimAction.Run(JsonElement userData, ClaimsIdentity identity, String issuer)\n at Microsoft.AspNetCore.Authentication.OAuth.OAuthCreatingTicketContext.RunClaimActions(JsonElement userData)\n at AspNet.Security.OAuth.Discord.DiscordAuthenticationHandler.CreateTicketAsync(ClaimsIdentity identity, AuthenticationProperties properties, OAuthTokenResponse tokens)\n at Microsoft.AspNetCore.Authentication.OAuth.OAuthHandler1.HandleRemoteAuthenticateAsync()\n at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler1.HandleRequestAsync()\n --- End of inner exception stack trace ---\n at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler1.HandleRequestAsync()\n at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\n at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)\n at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)\n at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)\n at Microsoft.AspNetCore.RateLimiting.RateLimitingMiddleware.InvokeInternal(HttpContext context, EnableRateLimitingAttribute enableRateLimitingAttribute)\n at gex.Code.ExceptionHandlerMiddleware.Invoke(HttpContext context, ILogger1 logger) in /home/gex/gex/gex/Code/ExceptionHandlerMiddleware.cs:line 32",
"instance": "error:0a11b9da-d03e-4f5e-836d-bc40b69b3585",
"extensions": {}
}

After reading the code on line 195 in Startup.cs an guess is that the because I have never chosen an avatar on Discord. This might result in line 198 user.GetString("avatar")!.StartsWith("a_") to crash with a System.NullReferenceException: Object reference not set to an instance of an object. exeption. Note the "!" after GetString.

I get this 100% of the time on my phone using either Samsung Internet browser or Google Chrome browser. And 100% of the time on my windows 10 computer with Chrome or Edge. Have never been able to login. { "type": "/auth/callback", "title": "internal server error: An error was encountered while handling the remote login.", "status": 500, "detail": "Microsoft.AspNetCore.Authentication.AuthenticationFailureException: An error was encountered while handling the remote login.\n ---> System.NullReferenceException: Object reference not set to an instance of an object.\n at gex.Startup.<>c.<ConfigureServices>b__4_19(JsonElement user) in /home/gex/gex/gex/Startup.cs:line 195\n at Microsoft.AspNetCore.Authentication.OAuth.Claims.CustomJsonClaimAction.Run(JsonElement userData, ClaimsIdentity identity, String issuer)\n at Microsoft.AspNetCore.Authentication.OAuth.OAuthCreatingTicketContext.RunClaimActions(JsonElement userData)\n at AspNet.Security.OAuth.Discord.DiscordAuthenticationHandler.CreateTicketAsync(ClaimsIdentity identity, AuthenticationProperties properties, OAuthTokenResponse tokens)\n at Microsoft.AspNetCore.Authentication.OAuth.OAuthHandler`1.HandleRemoteAuthenticateAsync()\n at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()\n --- End of inner exception stack trace ---\n at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()\n at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\n at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)\n at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)\n at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)\n at Microsoft.AspNetCore.RateLimiting.RateLimitingMiddleware.InvokeInternal(HttpContext context, EnableRateLimitingAttribute enableRateLimitingAttribute)\n at gex.Code.ExceptionHandlerMiddleware.Invoke(HttpContext context, ILogger`1 logger) in /home/gex/gex/gex/Code/ExceptionHandlerMiddleware.cs:line 32", "instance": "error:0a11b9da-d03e-4f5e-836d-bc40b69b3585", "extensions": {} } After reading the code on line 195 in Startup.cs an guess is that the because I have never chosen an avatar on Discord. This might result in line 198 user.GetString("avatar")!.StartsWith("a_") to crash with a System.NullReferenceException: Object reference not set to an instance of an object. exeption. Note the "!" after GetString.
ville81 commented 2026-04-12 12:51:59 +00:00 (Migrated from github.com)

After uploading an avatar on Discord I can now login so it seems related to that.

After uploading an avatar on Discord I can now login so it seems related to that.
Sign in to join this conversation.
No description provided.