-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support max-age cookie expiration, fix impossible to sign-in #508
Comments
It might be the case that this is not really flutter_appauth issue, but more AppAuth0 or LogTo (provider), I'm not sure but please feel free to close it if you agree. |
From what I understood, what you're referring to is around details set in the session cookie. If so, cookies are to do with the identity provider you're using as they would be the one response for providing the cookies and handling the cookies properly. This would be outside the control of the plugin. Note the plugin itself doesn't read cookies either. Rather, it's browser that does so. Perhaps you've already tried it but it could be the only option is to see if you can catch this specific issue to trigger a logout first. Perhaps the cookie could be detected that it can be used to trigger logout that would then in turn would remove the cookie |
The issue is that sometimes the user uninstall the app without doing a logout, so the _session cookie is persistent in the browser, so I think is that this cookie keep a corrupted information, like an hash, because the user it belongs to has been deleted so the identity provider I think try to test with something that doesn't exist anymore and fails. More about and video here, perhaps together we can understand what's going on. |
I think there isn't a way to detect in your app programmatically which cookies has the browser or WebView and if are related to my identity provider, the solution so ugly would be to force an endSession when you login and then straight a new signIn, but this will interrupt the flow and will show 2 WebView or other times, when no _session cookie exists, the first step, in this case endSession will fail |
That is the solution I'm referring to on detecting the invalid grant error to trigger a logout. Whilst it isn't ideal, you may not have much choice. I believe this was also a scenario myself and others encountered when worked with Azure B2C. It wasn't exactly though but pretty similar and if you're worried but the scenario too then this be one you'd probably want to keep an eye on too. In this case, a user was deleted whilst they had an active session in the app. The next token refresh would fail as the user had been deleted. This was also solved by detecting an invalid grant error to trigger a logout. Based on this I believe you don't have much choice but to do the same. A search online seems to indicate the invalid grant can occur when users are deleted for other providers. IMO it is also an edge case so whilst it is "ugly", I'd suggest being careful on investing too much in searching for a ideal solution that may not exist. Worst case if a user was really impacted by it and support is needed, they can be advised to clear the browser cache |
Yeah, I think we gonna implement this for now since we can't leave unimplemented the delete user feature in our app, and hopefully the identity provider will find a better workaround. Sounds quite similar to your issue with Azure |
Problem:
There is a specific circumstance where it's impossible to sign-in anymore till the deletion of
_session
cookie in Chrome(Android) or Safari(iOS), even if theprompt=login
.Related issue here openid/AppAuth-Android#874 and how it is solved
Steps to reproduce the issue, assuming you have a signin with auto code exchange and
prompt=login
, i.e should always force a new login:PlatformException(authorize_and_exchange_code_failed, Failed to authorize: [error: invalid_grant, description: grant request is invalid], null, null)
What would be the correct flow:
prompt=login
should be a guarantee that any (corrupted or not corrupted)_session cookie previously stored in the browser won't prevent you to login againExplanations:
_session
cookie that points to "a dead" user information. The user will not be able to login anymore till he manually delete the_session
cookie in Chrome.Possible solution:
max_age: 0
along withprompt=login
perhaps inadditionalParameters
, so that the_session
cookie auto-expire. Note: 0 must be int not type String so not sure if is parsed correctly under-the-hoodThe text was updated successfully, but these errors were encountered: