'Getting different JWT token for Android and iOS from Okta OIDC PKCE
I'm using following flutter library for Okta integration
https://github.com/sonikro/flutter-okta-sdk
Code is of course, same for Android and iOS App but the JWT token generated for Android and iOS app is having different information when decoded.
Because of this difference token generated by iOS App is getting authenticated by backend server but token generated by Android app is getting rejected as invalid token. This is probably because backend code is configured for "aud" as api://default
Token generated by iOS looks like below. It contains "iss" ending with oauth2/default and aud as api://default.
{
"ver": 1,
"jti": "AT.Mbk7V5Sp1hNRzpHA4JKBoF9dniS4AO_WBPSUgNqJ4Pk",
"iss": "https://org-dev.oktapreview.com/oauth2/default",
"aud": "api://default",
"iat": 1650342083,
"exp": 1650345683,
"cid": "0otyt767ytytE41d7",
"uid": "00iuererere77def1d7",
"scp": [
"email",
"openid",
"profile"
],
"auth_time": 1650342081,
"sub": "[email protected]"
}
But in case of Android, "iss" is just "https://org-dev.oktapreview.com" and aud is also "https://org-dev.oktapreview.com"
{
"ver": 1,
"jti": "AT.VMgUDc-wJnEXTx4n5I-QyKTI0yMGTqBWw8HA9FE6EPY",
"iss": "https://org-dev.oktapreview.com",
"aud": "https://org-dev.oktapreview.com",
"sub": "[email protected]",
"iat": 1649419357,
"exp": 1649422957,
"cid": "0otyt767ytytE41d7",
"uid": "00iuererere77def1d7",
"scp": [
"openid",
"profile",
"email"
],
"auth_time": 1649419354
}
Please suggest if something we should do on our code or in flutter okta sdk or backend code
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
