aws-sdk-android
aws-sdk-android copied to clipboard
Cognito Hosted UI Sign Out Fails when Offline
Describe the bug
When offline and signed in via hosted UI (showSignIn), signing out fails.
-
When signing out with invalidateTokens=true, it leaves the user with a "no internet" error on the web page.
-
When signing out with invalidateTokens=false, the user is automatically signed in (without credentials) the next time showSignIn is called. The same thing happens when plain signOut with no parameters is called.
Neither of these paths allows for signing out while offline. This issue was recently fixed for iOS with new APIs -- https://github.com/aws-amplify/aws-sdk-ios/issues/3141 https://github.com/aws-amplify/amplify-ios/pull/1037
To Reproduce
- Sign in using hosted UI via showSignIn().
- Put android device in airplane mode.
- Try signing out via signOut with invalidateTokens=true. The user will be stuck on the web page with an error.
- Try signing out via signOut with invalidateTokens=false. Next time showSignIn() is called, the last user will be automatically signed in without entering credentials.
AWSMobileClient.getInstance().showSignIn(this.activity, signInUIOptions, object : Callback<UserStateDetails> { // ...
// ...
val signOutOptions: SignOutOptions = SignOutOptions.builder()
.invalidateTokens(isInvalidateTokens)
.signOutGlobally(isSignOutGlobally)
.build()
AWSMobileClient.getInstance().signOut(signOutOptions, object : Callback<Void> {. // ...
Which AWS service(s) are affected?
Cognito
Expected behavior
When signed in with hosted UI, the user should be able to sign out when the device is offline (no network connectivity). Currently, the user is unable to sign out properly.
Screenshots
Environment Information (please complete the following information):
- AWS Android SDK Version: 2.19.1
- Device: Pixel 3a or any device
- Android Version: 11
- Specific to simulators: No
Additional context
This issue was recently fixed in the iOS SDK with new APIs, and offline sign out is now possible -- https://github.com/aws-amplify/aws-sdk-ios/issues/3141 https://github.com/aws-amplify/amplify-ios/pull/1037
Hi, is there any update on this issue?
To signout of the hostedUI, device needs to be online. Calling local signout will clear tokens, but hostedUI signout requires calling Cognito logout endpoint. Unlike iOS, Android custom tabs does not support private sessions due to which signout has to rely on successful hostedUI request.