Closed postpasspost closed 2 years ago
It would mean that the underlying Android AppAuth SDK has found an invalid ID token per the error message. This is the link to the repo for the SDK where you can go through its code and error messages https://github.com/openid/AppAuth-Android as this is something you'd need to dig further specific to your scenario
Closing this as it's outside the control of the plugin. One thing I noticed from experimenting is that I've seen this happen with Okta. It looks like AppAuth Android SDK has some logic to do some validation if your application uses the discovery document URL. If you explicitly specify all the auth-related endpoints then that validation logic isn't
I encountered the same error on Android but not iOS and investigated further on it. Error happens with example code and using demo.identityserver.io also. Only happens if doing auth code and token requests in separate steps ("sign in with node code exchange" and "exchange code" in demo).
First problem is that the underlying message "Nonce mismatch" does not propagate to the flutter side. I issued a PR for that: https://github.com/MaikuB/flutter_appauth/pull/265
Next step is that the required nonce is not set if token request is done in a separate step. If done at once, nonce is correctly set in the code as can be seen in the screenshot (nonce extracted from authResponse):
If done in two steps, nonce missing in token request parameters and thus will not be available in final token request:
I expect, nonce has to be passed to Flutter code with authorization response and than be passed again with token request parameters, the same as is done with authorizatonCode
and codeVerifier
.
Does this make sense? (for reference also see issue https://github.com/openid/AppAuth-Android/issues/650 on AppAuth-Android)
@akaegi yep that makes sense
@akaegi after https://github.com/MaikuB/flutter_appauth/pull/265 is merged in. Would you be able to help submit a PR to have nonce returned as well?
@akaegi can you add the aforementioned code block as a pr to this repo, please?
@MaikuB Are we expecting any fix for this issue, as currently it is a blocker
Not at this stage. Bear in mind that this is open sourced and maintained in my spare time. If you are blocked and have found the package useful then you can contribute back with a PR
Anyone has any idea of what this error means ?
It works on iOS, but not on Android. Same configuration files
I updated from old version of Flutter.
I did a Flutter cache clean
And here is the code