AWSCognitoAuthClientErrorType and Error are not the same type, so it never works as expected
Yes, now when the user's token is completely invalid, requesting the getTokens method will trigger an errorExpiredRefreshToken(-7000) error. At that time, as mentioned above, this conversion method will always fail, resulting in our listeners never having the opportunity to get signedOutUserPoolsTokenInvalid notification.
The right code should be like below:
if let error = error, let cognitoError = AWSCognitoAuthClientErrorType(rawValue: (error as NSError).code) {
if cognitoError == AWSCognitoAuthClientErrorType.errorExpiredRefreshToken {
...
} else {
...
}
}
Thank you for reporting the issue. I have added a PR to address this issue here - https://github.com/aws-amplify/aws-sdk-ios/pull/2739
Most helpful comment
Yes, now when the user's token is completely invalid, requesting the getTokens method will trigger an errorExpiredRefreshToken(-7000) error. At that time, as mentioned above, this conversion method will always fail, resulting in our listeners never having the opportunity to get signedOutUserPoolsTokenInvalid notification.
The right code should be like below: