Skip to content

Commit 2654d56

Browse files
authored
fix(amplify_auth_cognito): throws signedout exception (#730)
1 parent c351199 commit 2654d56

File tree

1 file changed

+9
-1
lines changed
  • packages/amplify_auth_cognito/android/src/main/kotlin/com/amazonaws/amplify/amplify_auth_cognito

1 file changed

+9
-1
lines changed

packages/amplify_auth_cognito/android/src/main/kotlin/com/amazonaws/amplify/amplify_auth_cognito/AuthCognito.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,15 @@ public class AuthCognito : FlutterPlugin, ActivityAware, MethodCallHandler, Plug
571571
}
572572

573573
fun prepareCognitoSessionFailure(@NonNull flutterResult: Result, @NonNull result: AWSCognitoAuthSession) {
574-
errorHandler.handleAuthError(flutterResult, AuthException.SessionExpiredException())
574+
// If a User Pool token's error is a SignedOutException, we send SignedOutException as
575+
// method call response because this indicates that the problem is not expired tokens,
576+
// but total lack of authentication (i.e. the user is signed out)
577+
var sessionException: AuthException = if (result.userPoolTokens.error is AuthException.SignedOutException) {
578+
AuthException.SignedOutException()
579+
} else {
580+
AuthException.SessionExpiredException()
581+
}
582+
errorHandler.handleAuthError(flutterResult, sessionException)
575583
}
576584

577585
fun prepareSessionResult(@NonNull flutterResult: Result, @NonNull result: AuthSession) {

0 commit comments

Comments
 (0)