Exception: E_OAUTH_STATE_MISMATCH (Ally 2.1.0)
Package version
"version": "4.1.0", "adonis-version": "4.1.0",
@adonisjs/[email protected] @adonisjs/[email protected] @adonisjs/[email protected] @adonisjs/[email protected] @adonisjs/[email protected] @adonisjs/[email protected] @adonisjs/[email protected] @adonisjs/[email protected] @adonisjs/[email protected] @adonisjs/[email protected] @adonisjs/[email protected]
Node.js and npm version
NodeJS v10.9.0 npm 6.2.0
Sample Code (to reproduce the issue)
I have this exception when I try to access to Google API since I upgraded Ally to version 2.1.0. This code works on the previous version (2.0.5)
OAuthException
E_OAUTH_STATE_MISMATCH: Oauth state mis-match
start/routes
Route.get('auth/google', async ({ ally }) => {
await ally.driver('google').redirect()
})
Route.get('authenticated/google', async ({ ally }) => {
const user = await ally.driver('google').getUser()
return user
})
Should be good with v2.1.1
Thank you!
happened to me too on v2.1.3
@radiegtya, I fixed it by downgrading to v2.1.1 from v2.1.3. @thetutlage, this issue should get opened again or a new one should be created. Preferably a new one for v2.1.3.
I opened new issue related to this. #96
not working v2.1.3
Also confirming issues with v2.1.3.
I have had some success with it, but it fails when it shouldn't. I haven't determined why it has spotty success.
Edit: After re-installing 2.1.3, it seemed to work for me. Not sure what the cause was.
@mattkenefick Can you open a separate issue and share more information to debug the issue. The common cause for E_OAUTH_STATE_MISMATCH is having sameSite cookies enabled. Once you disable them, it should work fine