OpenIdConnectAuthenticationHandler: message.State is null or empty when trying to sign in with Google oAuth

514 views Asked by At

I am trying to access Google Drive from an ASP.NET MVC application, and started off with this sample by Linda Lawton (one of the contributors to the Google .NET client library).

The sample works fine when run in Visual Studio, but not when deployed to a test site. Here's what happens...

  1. I click on the navbar link to the "List files" page, which will then require authentication.

  2. I get the oAuth screen (whose URL starts https://accounts.google.com/o/oauth2/v2/auth/oauthchooseaccount) where I have to pick a Google user

  3. I get a consent screen, where I ahve to confirm that I want to app to access my Google Drive

  4. I then get redirected to http://example.com/signin-oidc - note that this is not secure, so Edge gives me a warning about this. It doesn't matter if I add the https version of the redirect URI to the credentials, it always redirects to the non-secure one

  5. If I proceed anyway, I get sent to https://example.com/signin-oidc, where I see the following...

Exception: An error was encountered while handling the remote login. Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler.HandleRequestAsync() Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Anyone any ideas what's going wrong here?

Thanks

0

There are 0 answers