I have a code where, when the user tries to query a route, it checks the token in this way:
final AuthSession result = await Amplify.Auth.fetchAuthSession(
options: const FetchAuthSessionOptions(
forceRefresh: true,
)
);
result as CognitoAuthSession;
In some cases, it returns this error:
SessionExpiredException {
"message": "The tokens could not be refreshed",
"recoverySuggestion": "Invoke Amplify.Auth.signIn to re-authenticate the user",
"underlyingException": "NotAuthorizedException {\n message=Refresh Token has been revoked,\n}"
}
Could someone help me by explaining why this error occurs and if there’s a way to work around it without the user needing to log in again?
I read the Amplify documentation but didn’t find a clear explanation about this issue
1