capacitor-community / generic-oauth2

Generic Capacitor OAuth 2 client plugin. Stop the war in Ukraine!
MIT License
223 stars 106 forks source link

Bug: Getting ERR_STATES_NOT_MATCH when doing authentication with android #177

Closed kapten96 closed 2 years ago

kapten96 commented 2 years ago

Capacitor version:

OAuth Provider:

Your Plugin Configuration

{
"@byteowls/capacitor-oauth2": "^2.1.0",
"@capacitor/android": "^2.1.2",
"@capacitor/cli": "^2.1.2",
"@capacitor/core": "^2.1.2",
"@capacitor/ios": "^2.1.2",
}

Affected Platform(s):

Current Behavior

We are using Capacitor version 2.1.2 and @byteowls/capacitor-oauth2 version 2.1.0. For the authentication we are using identityServer 4 and I have no issue while authenticating from WEB, but when it comes to android i managed to authenticate and while returning to app i am getting following error.

image

Our identityServer we are using has following setup AllowedGrantTypes = GrantTypes.Implicit and on capacitor level, we have following config.

image

Expected Behavior

I expect to receive token when the plugin resolves

Sample Code or Sample Application Repo

image

CharlieAndLouise commented 2 years ago

I use 3.0.1. Same problem here.

I am run auth flow against Azure AD. In android, I can get authorization code correctly, but when i switch responseType = 'token', I received ERR_STATES_NOT_MATCH.

moberwasserlechner commented 2 years ago

ok but please give the information the issue template tries ask

kapten96 commented 2 years ago

@moberwasserlechner I have updated more information based on the template.

I managed to make it work by updating identityServer to handle responsetype Code. But it would be great to know why responseType token does not work

moberwasserlechner commented 2 years ago

@kapten96 Unfortunately I never used Identity Server so I have no clue why it does not worked with your previous responseTypes.

In my experience most of the time the server config is responsible.

If you can, upgrade the plugin to 3.x.x as there is a new logging option, that would give you more insights.

I'm closing this issue as nobody else seems to have solution for you.