-
Notifications
You must be signed in to change notification settings - Fork 202
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
Refresh token issues #3337
Comments
Transferred the issue from @aws-sdk-ios to @amplify-swift. |
To help us debug further, would you be able to provide the following details?
|
After turning on verbose logging I noticed a few errors. Despite these errors my auth is still valid at this point. I haven't found a way to trigger the issue where the refresh fails consistently.
Here is amplifyconfiguration.json {
"auth": {
"__Environment": "Dev",
"plugins": {
"awsCognitoAuthPlugin": {
"IdentityManager": {
"Default": {}
},
"CognitoUserPool": {
"Default": {
"PoolId": "us-west-2_xxxxxxxxx",
"AppClientId": "xxxxxxxxxxxxxxxxx",
"Region": "us-west-2"
}
},
}
}
}
} |
Here are the events leading up to that error: ` { tcp_output [C2.1.1:3] flags=14 seq=2,860,365,088, ack=3,699,069,078, win=2,032 state=0 rcv_nxt=3,699,069,078, snd_una=2,860,365,064 loadingStoredCredentials error(KeychainStoreError: Unable to find the keychain item |
These errors that you see are more of warnings.. I will work with my team to correct this logging type. Even if you see these errors, your Auth should just work fine. I see that your user pool config is also correct. To help on this further, I would need the entire verbose logs when the refresh token issue happens. |
Ok it just happened. Had a valid signed in user yesterday. Launched the app today and it's signed out.
|
@smclelland So I inspected the logs and what I can see that Amplify is not able to retrieve the session from Keychain
This could happen because of a few reasons. Like first time installations or there was no user signed in before. I would like to understand what steps were taken before it was launched today? Are you absolutely sure it was logged in before you launched? Its not able to refresh the tokens, because it cannot find anything. Few more questions:
|
Yes absolutely sure that it was logged in before the launch.
Was it working before correctly?
Did any other environment change? App upgrades or something else that might have happened
|
Ok, I believe this issue is resolved and was in fact caused by "Keychain Sharing". Since removing I haven't been able to replicate it. Best guess: the keychain was shared across our apps using a common key. Since some of our users have both dev and prod builds installed on the same device and are authenticated with two different Cognito users, it might have been overwriting bits that Amplify requires for token refresh in the same keychain. This ultimately led to Cognito revoking the refresh token due to suspicious activity or a mismatch, etc. Thanks for your help! Will close for now. |
We've been using Amplify/Cognito for several years without issue. We started noticing that users are suddenly being signed out after token refresh fails. We are using 2.21.1 of amplify-swift. I'm not seeing anything obvious on our end that might have caused this.
After calling:
Amplify.Auth.fetchAuthSession()
It throws:
The operation couldn’t be completed. (Amplify.AuthError error 6.)
The text was updated successfully, but these errors were encountered: