Closed RolandMostoha closed 4 months ago
" because sign out->in is not possible in guest mode" You can absolutely sign out in guest mode which will clear out all tokens. Please try that and try again.
Thanks, I could force refresh the token by:
Amplify.Auth.fetchAuthSession(
AuthFetchSessionOptions.builder()
.forceRefresh(true)
.build(),
{},
{},
)
Do you have any idea why the token expiration is happening on migration?
Hello @RolandMostoha, can you post your aws dependencies you are using in the app?
@RolandMostoha, if you are still having issues, please provide the answer to @ankpshah's question. Our suspicion is that an AWS Android SDK library still may be in use. Amplify v2 and the AWS Android SDK are not compatible with each other and will cause token clearing issues.
Thanks, I could force refresh the token by:
Amplify.Auth.fetchAuthSession( AuthFetchSessionOptions.builder() .forceRefresh(true) .build(), {}, {}, )
Do you have any idea why the token expiration is happening on migration?
This solved my issue, but I still think this is a workaround and the migration from 1.x -> 2.x broke the token and SDK got into a state where no matter what you do, the provided token expires error occurring for every SDK api call. From my side the issue can be closed.
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.
Before opening, please confirm:
Language and Async Model
Kotlin
Amplify Categories
Authentication, Storage
Gradle script dependencies
Environment information
Please include any relevant guides or documentation you're referencing
When I refer to guest mode, i mean the Cognito guest/unauth/anonymous method without user/password. https://docs.aws.amazon.com/location/latest/developerguide/authenticating-using-cognito.html
Describe the bug
Upgrading my app from 1.x Amplify version to 2.x, the originally stored token expires and cannot be used afterwards. Only clear cache solves the issue.
Result:
S3Exception: The provided token has expired.
I'm hopeless in this situation, because the S3 download request does not refresh the token automatically and I cannot force refresh it with guest auth, because sign out->in is not possible in guest mode. I don't understand how the app is stuck in this state, I assumed token management is happening in the background automatically, especially for guest mode where we cannot control authentication.
The only thing which works if I clear app data and init Amplify from scratch. My app is in production so it is very unfortunate that I have to ask people to clear cache/reinstall the app to fix this issue.
Any help would be appreciated how can I initiate re-login in guest auth, force refresh or reset session token.
Reproduction steps (if applicable)
Code Snippet
The auth sessions result:
Log output
amplifyconfiguration.json
No response
GraphQL Schema
Additional information and screenshots
No response