amplify-android
amplify-android copied to clipboard
Android Kotlin Auth.signOut(), customTab remains still open and has to be closed manually by user
Description
Hi all, I'm working on an android app in kotlin, using the Amplify authentication plugin. The user signs in by Auth.signInWithWebUI() api and finally signs out by calling Auth.signOut(). Everything works fine, except randomly within the signOut process the customTab remains still open and didn't close automatically. I'm using the latest version of auth plugin for android, Kotlin.
Categories
- [ ] Analytics
- [ ] API (REST)
- [ ] API (GraphQL)
- [X] Auth
- [ ] Authenticator
- [ ] DataStore
- [ ] Storage
Steps to Reproduce
- Auth.signInWithWebUI()
- Auth.signOut()
Screenshots

Platforms
- [ ] iOS
- [X] Android
- [ ] Web
- [ ] macOS
- [ ] Windows
- [ ] Linux
Android Device/Emulator API Level
API 32+
Environment
n/a
Dependencies
+--- com.amplifyframework:aws-auth-cognito:1.37.3
| +--- com.amplifyframework:core:1.37.3 (*)
| +--- androidx.appcompat:appcompat:1.2.0 -> 1.4.2 (*)
| +--- com.amazonaws:aws-android-sdk-mobile-client:2.52.1
| | +--- com.amazonaws:aws-android-sdk-auth-core:2.52.1
| | | \--- com.amazonaws:aws-android-sdk-core:2.52.1
| | | +--- com.google.code.gson:gson:2.8.9 -> 2.9.0
| | | \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | +--- com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.52.1
| | | +--- com.amazonaws:aws-android-sdk-core:2.52.1 (*)
| | | +--- com.amazonaws:aws-android-sdk-cognitoidentityprovider-asf:2.52.1
| | | | \--- com.amazonaws:aws-android-sdk-core:2.52.1 (*)
| | | \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| | \--- androidx.core:core:1.3.1 -> 1.8.0 (*)
| \--- com.amazonaws:aws-android-sdk-cognitoauth:2.52.1
| +--- com.amazonaws:aws-android-sdk-core:2.52.1 (*)
| +--- com.amazonaws:aws-android-sdk-cognitoidentityprovider-asf:2.52.1 (*)
| \--- androidx.browser:browser:1.3.0
| +--- androidx.core:core:1.1.0 -> 1.8.0 (*)
| +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
| \--- com.google.guava:listenablefuture:1.0 -> 9999.0-empty-to-avoid-conflict-with-guava
+--- com.amplifyframework:core-kotlin:0.21.3
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.31 -> 1.7.10 (*)
| +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2 -> 1.6.4 (*)
| +--- androidx.core:core-ktx:1.3.2 -> 1.8.0 (*)
| \--- com.amplifyframework:core:1.37.3 (*)
+--- aws.sdk.kotlin:cognitoidentityprovider:0.16.0
| \--- aws.sdk.kotlin:cognitoidentityprovider-jvm:0.16.0
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)
| +--- aws.sdk.kotlin:aws-config:0.16.0
| | \--- aws.sdk.kotlin:aws-config-jvm:0.16.0
| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)
| | \--- aws.sdk.kotlin:aws-core:0.16.0
| | \--- aws.sdk.kotlin:aws-core-jvm:0.16.0
| | +--- aws.smithy.kotlin:runtime-core:0.10.0
| | | \--- aws.smithy.kotlin:runtime-core-jvm:0.10.0
| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)
| | | +--- aws.smithy.kotlin:io:0.10.0
| | | | \--- aws.smithy.kotlin:io-jvm:0.10.0
| | | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)
| | | +--- aws.smithy.kotlin:utils:0.10.0
| | | | \--- aws.smithy.kotlin:utils-jvm:0.10.0
| | | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)
| | | \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1 -> 1.6.4 (*)
| | \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)
| +--- aws.sdk.kotlin:aws-core:0.16.0 (*)
| +--- aws.sdk.kotlin:aws-endpoint:0.16.0
| | \--- aws.sdk.kotlin:aws-endpoint-jvm:0.16.0
| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)
| | +--- aws.smithy.kotlin:http:0.10.0
| | | \--- aws.smithy.kotlin:http-jvm:0.10.0
| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)
| | | +--- aws.smithy.kotlin:runtime-core:0.10.0 (*)
| | | +--- aws.smithy.kotlin:utils:0.10.0 (*)
| | | +--- aws.smithy.kotlin:io:0.10.0 (*)
| | | \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1 -> 1.6.4 (*)
| | \--- aws.smithy.kotlin:aws-signing-common:0.10.0
| | \--- aws.smithy.kotlin:aws-signing-common-jvm:0.10.0
| | +--- aws.smithy.kotlin:aws-credentials:0.10.0
| | | \--- aws.smithy.kotlin:aws-credentials-jvm:0.10.0
| | | +--- aws.smithy.kotlin:runtime-core:0.10.0 (*)
| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)
| | +--- aws.smithy.kotlin:http:0.10.0 (*)
| | \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)
| \--- aws.smithy.kotlin:runtime-core:0.10.0 (*)
+--- aws.sdk.kotlin:cognitoidentity:0.16.0
| \--- aws.sdk.kotlin:cognitoidentity-jvm:0.16.0
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.7.10 (*)
| +--- aws.sdk.kotlin:aws-config:0.16.0 (*)
| +--- aws.sdk.kotlin:aws-core:0.16.0 (*)
| +--- aws.sdk.kotlin:aws-endpoint:0.16.0 (*)
| \--- aws.smithy.kotlin:runtime-core:0.10.0 (*)
Device
n/a
OS
n/a
Deployment Method
Custom Pipeline
CLI Version
n/a
Additional Context
No response
Amplify Config
n/a
Hi @lokalathlet - sorry you are facing this issue. Would you be able to share any logs around the time this occurs?
@lokalathlet I think the first step is to look into your implementation of your sign out redirect uri? Could you post the activity block in your manifest that handles sign out? If this part was not implemented, please see here: https://docs.amplify.aws/lib/auth/social/q/platform/android/#update-androidmanifestxml
Manifest:
<queries>
...
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name=
"android.support.customtabs.action.CustomTabsService" />
</intent>
</queries>
<application
android:name="de.db.xxxx.SiBaApplication"
android:allowBackup="false"
android:fullBackupContent="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:icon="@mipmap/ic_launcher"
tools:replace="android:icon"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:usesCleartextTraffic="false"
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:targetApi="s">
<activity
android:name="de.db.xxxx.ui.MainActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize"
android:launchMode="singleTask"
android:theme="@style/Theme.App.Starting"
android:exported="true">
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.amplifyframework.auth.cognito.activities.HostedUIRedirectActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sibaapp" />
</intent-filter>
</activity>
<!--
<activity
android:name="de.db.xxxx.ui.LoginActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sibaapp" android:host="redirect"/>
</intent-filter>
</activity>
<activity
android:name="de.db.xxxx.ui.LogoutActivity"
android:theme="@style/AppTheme"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sibaapp" android:host="signout"/>
</intent-filter>
</activity>
-->
Configuration Json: ` { "auth": { "plugins": { "awsCognitoAuthPlugin": { "IdentityManager": { "Default": {
}
},
"CognitoUserPool": {
"Default": {
"PoolId": "$poolId",
"AppClientId": "$clientId",
"Region": "eu-central-1"
}
},
"Auth": {
"Default": {
"authenticationFlowType": "$authenticationFlowType",
"OAuth": {
"WebDomain": "$webDomain",
"AppClientId": "$clientId",
"SignInRedirectURI": "sibaapp://redirect",
"SignOutRedirectURI": "sibaapp://signout",
"Scopes": [
$scopes
]
}
}
}
}
}
}
}
`
Hi @lokalathlet - sorry you are facing this issue. Would you be able to share any logs around the time this occurs?
I try to fetchAuthSession to get the signedIn Status (is true here).
2022-09-20 18:52:51.611 27992-27992/de.db.xxxx.abn D/MainActivity: ::onActivityResult resultCode: 0 data: null 2022-09-20 18:52:51.620 27992-27992/de.db.xxxx.abn D/BackendImpl: :handleWebUISignInResponse received requestCode : 49281 and resultCode : 0 2022-09-20 18:52:51.647 27992-27992/de.db.xxxx.abn I/BackendImpl: Initiate Signout Sequence 2022-09-20 18:52:51.686 27992-3784/de.db.xxxx.abn D/AWSMobileClient: Inspecting user state details 2022-09-20 18:52:51.704 27992-3784/de.db.xxxx.abn D/AWSMobileClient: _hostedUISignIn without federation: Putting provider and token in store 2022-09-20 18:52:51.762 27992-27992/de.db.xxxx.abn D/BackendImpl: ::isSignedIn true 2022-09-20 18:52:51.770 27992-3787/de.db.xxxx.abn W/CognitoUserSession: CognitoUserSession is not valid because idToken is null. 2022-09-20 18:53:01.891 27992-27992/de.db.xxxx.abn E/BackendImpl: :signOut Sign out failed com.amazonaws.mobileconnectors.cognitoauth.exceptions.AuthServiceException: Timed out while waiting for sign-out redirect response. 2022-09-20 18:53:01.895 27992-27992/de.db.xxxx.abn I/ViewRootImpl@9048c19[MainActivity]: stopped(false) old=false 2022-09-20 18:53:01.896 27992-27992/de.db.xxxx.abn D/MainActivity: ::onResume 2022-09-20 18:53:01.900 27992-27992/de.db.xxxx.abn D/AppStatusHelper: ::isCustomTabsPackageAvailable chromeTabsAvailable:true, chromeInstalled: true, chromeEnabled: true 2022-09-20 18:53:01.900 27992-27992/de.db.xxxx.abn D/AmplifyAuthConfigurationHelperImpl: ::handleAlreadyConfiguredState: true
@lokalathlet SignOutRedirectURI of "elbaapp://signout" doesn't match "sibaapp://signout" defined in the manifest.
Hi @lokalathlet - sorry you are facing this issue. Would you be able to share any logs around the time this occurs?
Hi @dnys1 , this is another log, were the CustomTab didn't close.
2022-09-21 07:46:19.694 18939-19302/de.db.xxxx.abn D/IdentityManager: Signing out... 2022-09-21 07:46:19.696 18939-18939/de.db.xxxx.abn I/ViewRootImpl@b3a3707[CustomTabsManagerActivity]: dispatchDetachedFromWindow 2022-09-21 07:46:19.704 18939-19354/de.db.xxxx.abn D/AuthClient: Sign-out was successful. 2022-09-21 07:46:19.705 18939-18939/de.db.xxxx.abn D/InputTransport: Input channel destroyed: '433ee07', fd=132 2022-09-21 07:46:19.728 18939-18939/de.db.xxxx.abn D/AWSMobileClient: onSignout: HostedUI signed-out 2022-09-21 07:46:19.736 18939-18939/de.db.xxxx.abn D/AuthClient: CustomTabsManagerActivity was created with a null state. 2022-09-21 07:46:19.743 18939-18939/de.db.xxxx.abn I/DecorView: [INFO] isPopOver=false, config=true 2022-09-21 07:46:19.743 18939-18939/de.db.xxxx.abn I/DecorView: updateCaptionType >> DecorView@6f8eff7[], isFloating=false, isApplication=true, hasWindowControllerCallback=true, hasWindowDecorCaption=false 2022-09-21 07:46:19.743 18939-18939/de.db.xxxx.abn D/DecorView: setCaptionType = 0, this = DecorView@6f8eff7[] 2022-09-21 07:46:19.744 18939-18939/de.db.xxxx.abn I/DecorView: getCurrentDensityDpi: from real metrics. densityDpi=420 msg=resources_loaded 2022-09-21 07:46:19.803 18939-18939/de.db.xxxx.abn D/InsetsSourceConsumer: ensureControlAlpha: for ITYPE_NAVIGATION_BAR on de.db.xxxx.abn/de.db.xxxx.ui.MainActivity 2022-09-21 07:46:19.804 18939-18939/de.db.xxxx.abn D/InsetsSourceConsumer: ensureControlAlpha: for ITYPE_STATUS_BAR on de.db.xxxx.abn/de.db.xxxx.ui.MainActivity 2022-09-21 07:46:19.805 18939-19302/de.db.xxxx.abn D/AWSMobileClient: Inspecting user state details 2022-09-21 07:46:19.824 18939-18939/de.db.xxxx.abn I/BackendImpl: :signOut Signed out locally 2022-09-21 07:46:19.827 18939-18939/de.db.xxxx.abn D/BackendImpl: :updateUserData false 2022-09-21 07:46:19.830 18939-18939/de.db.xxxx.abn I/BackendImpl$subcribeToHubChannelAUTH: Amplify.Hub SIGNED_OUT 2022-09-21 07:46:20.024 18939-18939/de.db.xxxx.abn D/InputTransport: Input channel destroyed: 'ClientS', fd=133 2022-09-21 07:46:20.405 18939-18939/de.db.xxxx.abn I/ViewRootImpl@652918c[MainActivity]: handleAppVisibility mAppVisible=true visible=false 2022-09-21 07:46:20.416 18939-18974/de.db.xxxx.abn D/OpenGLRenderer: setSurface called with nullptr 2022-09-21 07:46:20.416 18939-18974/de.db.xxxx.abn D/OpenGLRenderer: setSurface() destroyed EGLSurface 2022-09-21 07:46:20.416 18939-18974/de.db.xxxx.abn D/OpenGLRenderer: destroyEglSurface 2022-09-21 07:46:20.431 18939-18939/de.db.xxxx.abn I/ViewRootImpl@652918c[MainActivity]: Relayout returned: old=(0,0,1080,2400) new=(0,0,1080,2400) req=(1080,2400)8 dur=8 res=0x5 s={false 0} ch=true fn=241 2022-09-21 07:46:20.434 18939-18939/de.db.xxxx.abn I/ViewRootImpl@652918c[MainActivity]: stopped(true) old=false
Hi @tylerjroach, you're right, but i just missed to rename it in the snipped.
Moving this to the Android repository. FYI @lokalathlet @tylerjroach
another log
2022-09-22 08:36:40.678 6244-6244/de.db.xxxx.test I/Dialog: mIsDeviceDefault = false, mIsSamsungBasicInteraction = false, isMetaDataInActivity = false
2022-09-22 08:36:40.681 6244-6244/de.db.xxxx.test I/DecorView: [INFO] isPopOver=false, config=false
2022-09-22 08:36:40.682 6244-6244/de.db.xxxx.test I/DecorView: updateCaptionType >> DecorView@2c3f122[], isFloating=true, isApplication=true, hasWindowControllerCallback=false, hasWindowDecorCaption=false
2022-09-22 08:36:40.682 6244-6244/de.db.xxxx.test D/DecorView: setCaptionType = 0, this = DecorView@2c3f122[]
2022-09-22 08:36:40.698 6244-6244/de.db.xxxx.test D/ScrollView: initGoToTop
2022-09-22 08:36:40.719 6244-6244/de.db.xxxx.test I/ViewRootImpl@15716a0[MainActivity]: setView = com.android.internal.policy.DecorView@2c3f122 TM=true
2022-09-22 08:36:40.720 6244-6244/de.db.xxxx.test I/BackendImpl: Initiate Signout Sequence
2022-09-22 08:36:40.737 6244-6244/de.db.xxxx.test D/InsetsSourceConsumer: ensureControlAlpha: for ITYPE_NAVIGATION_BAR on de.db.xxxx.test/de.db.xxxx.ui.MainActivity
2022-09-22 08:36:40.738 6244-6244/de.db.xxxx.test D/InsetsSourceConsumer: ensureControlAlpha: for ITYPE_STATUS_BAR on de.db.xxxx.test/de.db.xxxx.ui.MainActivity
2022-09-22 08:36:40.738 6244-6244/de.db.xxxx.test I/ViewRootImpl@15716a0[MainActivity]: Relayout returned: old=(0,88,1080,2274) new=(28,760,1052,1601) req=(1024,841)0 dur=8 res=0x7 s={true -5476376629481221216} ch=true fn=-1
2022-09-22 08:36:40.739 6244-6287/de.db.xxxx.test D/OpenGLRenderer: eglCreateWindowSurface
2022-09-22 08:36:40.741 6244-6244/de.db.xxxx.test D/ScrollView: onsize change changed
2022-09-22 08:36:40.742 6244-6244/de.db.xxxx.test I/ViewRootImpl@15716a0[MainActivity]: [DP] dp(1) 1 android.view.ViewRootImpl.reportNextDraw:11442 android.view.ViewRootImpl.performTraversals:4198 android.view.ViewRootImpl.doTraversal:2924
2022-09-22 08:36:40.742 6244-6244/de.db.xxxx.test D/ViewRootImpl@15716a0[MainActivity]: Creating frameDrawingCallback nextDrawUseBlastSync=false reportNextDraw=true hasBlurUpdates=false
2022-09-22 08:36:40.742 6244-6244/de.db.xxxx.test D/ViewRootImpl@15716a0[MainActivity]: Creating frameCompleteCallback
2022-09-22 08:36:40.744 6244-8964/de.db.xxxx.test D/AWSMobileClient: Inspecting user state details
2022-09-22 08:36:40.745 6244-6306/de.db.xxxx.test D/ViewRootImpl@15716a0[MainActivity]: Received frameDrawingCallback frameNum=1. Creating transactionCompleteCallback=false
2022-09-22 08:36:40.746 6244-6287/de.db.xxxx.test I/BufferQueueProducer: ViewRootImpl@15716a0[MainActivity]#12(BLAST Consumer)12 queueBuffer: queued for the first time.
2022-09-22 08:36:40.747 6244-6287/de.db.xxxx.test D/ViewRootImpl@15716a0[MainActivity]: Received frameCompleteCallback lastAcquiredFrameNum=1 lastAttemptedDrawFrameNum=1
2022-09-22 08:36:40.749 6244-6244/de.db.xxxx.test I/ViewRootImpl@15716a0[MainActivity]: [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$addFrameCompleteCallbackIfNeeded$3$ViewRootImpl:5000 android.view.ViewRootImpl$$ExternalSyntheticLambda16.run:6 android.os.Handler.handleCallback:938
2022-09-22 08:36:40.749 6244-6244/de.db.xxxx.test I/ViewRootImpl@15716a0[MainActivity]: [DP] rdf()
2022-09-22 08:36:40.749 6244-6244/de.db.xxxx.test D/ViewRootImpl@15716a0[MainActivity]: reportDrawFinished (fn: -1)
2022-09-22 08:36:40.752 6244-6244/de.db.xxxx.test I/ViewRootImpl@5ea96bc[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
2022-09-22 08:36:40.768 6244-6244/de.db.xxxx.test I/ViewRootImpl@15716a0[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
2022-09-22 08:36:40.780 6244-8964/de.db.xxxx.test D/AWSMobileClient: hasFederatedToken: false provider: cognito-idp.eu-central-1.amazonaws.com/eu-central-1_XXXXXXX
2022-09-22 08:36:40.806 6244-6244/de.db.xxxx.test D/BackendImpl: ::isSignedIn true
2022-09-22 08:36:40.806 6244-6257/de.db.xxxx.test I/.xxxx.tes: Compiler allocated 4148KB to compile void android.widget.TextView.
@lokalathlet I want to confirm that this is happening 100% of the time for you, correct? This would indicate that there is still a problem in the signout callback flow.
Are you doing custom sign out work in your SignOutActivity? If not, that activity shouldn't be needed and you can allow HostedUIRedirectActivity to do the work.
@lokalathlet I want to confirm that this is happening 100% of the time for you, correct? This would indicate that there is still a problem in the signout callback flow.
Are you doing custom sign out work in your SignOutActivity? If not, that activity shouldn't be needed and you can allow HostedUIRedirectActivity to do the work.
Hi @tylerroach thank you for your reply. I use HostedUIRedirectActivity only (as documented) and the custom tab remains open randomly (10 %).
Thank you for your reply. I didn't realize it was working most of the time, (indicating that your redirect configuration is likely correct). I, or someone on my team, will try to replicate.
Hi @lokalathlet, I have looked into this issue and currently cannot reproduce this behavior. Does your app use multiple login methods (Such as hosted UI, api based sign in etc.) or just this single one?
I have a question regarding this. I wonder why app needs to display full screen CustomTab at first place? This is really ugly UX experience.
Hi @lokalathlet, I have looked into this issue and currently cannot reproduce this behavior. Does your app use multiple login methods (Such as hosted UI, api based sign in etc.) or just this single one?
That is my problem, too. I have five different SmartPhones on my desk. Everyone shows this behaviour from time to time. Not deterministic at all.
I have a question regarding this. I wonder why app needs to display full screen CustomTab at first place? This is really ugly UX experience.
To whom you are asking this? I'm using just the API. Otherwise my plan is to migrate to a native solution. Eliminating the HostedUi way of authorize the user. But for the first step it saves a lot of time and code. But I agree to you. It is not the best user experience.
@lokalathlet, I still don't have an answer for you on why the redirect is failing for you around 10% of the time but I do see some issues here. Let's try to resolve this 1 step at a time.
We will be working on updating the HostedUI Sign Out documentation, especially around the suggestion to add a custom Sign Out redirect activity. The documentation is missing a step that if you implement a custom sign out activity, you must manually pass AWSMobileClient.getInstance().handleAuthResponse(getIntent());
to continue the sign out process on Amplify. I can see the evidence of this issue with the provided log
AuthServiceException: Timed out while waiting for sign-out redirect response.
I would suggest that the custom intent-filters for sign in and sign out are removed, allowing HostedUIRedirectActivity to control the processes.
Please reply back once this change is made with information on if you are still seeing the issue or not.
Hi @tylerjroach, my AndroidManifest.xml currently doesn't contain any custom sign in or out Activity configurations. Nevertheless I can see the issue.
<queries>
..
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name=
"android.support.customtabs.action.CustomTabsService" />
</intent>
</queries>
<application ..
<activity
android:name="com.amplifyframework.auth.cognito.activities.HostedUIRedirectActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sibaapp" />
</intent-filter>
</activity>
@lokalathlet Thank you, thats great to know. It's possible that we are then seeing the timeouts because the redirect isn't happening (the reason the page remains open). This would appear to an issue such as the cognito url request hanging and the custom tab never redirecting back, but I would expect to see more reports of this if it were a common issue. Have you observed this issue happening with a specific browser (your screenshot appears to be Chrome).?
@tylerjroach the app force the user using chrome custom tab. Any Idea about to handle a hanging request or missing redirect back to the apps Activity. Who is responsible to handle these issues? I can't close the custom tab out of the app.
Are you explicitly setting the browser package to Chrome? A CustomTab supports more than just Chrome. By default, a CustomTab will launch with the users default browser. Was curious if you were observing any different behaviors depending on the browser. Are you observing this issue often in testing, or are you primarily seeing these issues on a logging tool?
@tylerjroach My assumption was, that the default is set to the Chrome package if not set.
* @param browserPackage Specify which browser package should be used for web sign in (e.g. "org.mozilla.firefox").
* Defaults to the Chrome package if not specified.
I observing the issue during testing.
@lokalathlet I've been able to finally replicate what you are reporting.
Sign in redirects seem to be functioning fine.
Sign out redirects work fine on me with Chrome but Firefox fails to dismiss.
We just released a new major version of Amplify (v2.0.0) and I do not observe this issue. This does appear to be a v1 library bug we will continue to look into, but if you are able to upgrade to v2, this may resolve the issue you are seeing.
@lokalathlet I've been able to finally replicate what you are reporting.
Sign in redirects seem to be functioning fine.
Sign out redirects work fine on me with Chrome but Firefox fails to dismiss.
We just released a new major version of Amplify (v2.0.0) and I do not observe this issue. This does appear to be a v1 library bug we will continue to look into, but if you are able to upgrade to v2, this may resolve the issue you are seeing.
Hi @tylerjroach , I have migrated to v2. I'm wondering that the docs doesn't mention the Response Handler handling anymore (https://docs.amplify.aws/lib-v1/auth/signin_web_ui/q/platform/android/#add-response-handler v1.n). But the callback still takes place. (WEB_UI_SIGN_IN_ACTIVITY_CODE isn't available anymore). How the user should handle a cancellation without using this feature. Or did I miss something?
Another severe issue with 2.0.0 is that Auth.fetchAuthSession().isSignedIn returns false always. That blocks me to switch to 2.0.0. Here are my dependencies.
object AWSCognito {
private const val amplify_version = "2.0.0"
private const val amplify_kotlin_version = "2.0.0"
private const val escape_hatch_version = "0.17.12-beta"
const val core = "com.amplifyframework:core:$amplify_version"
const val auth = "com.amplifyframework:aws-auth-cognito:$amplify_version"
const val coreKotlin = "com.amplifyframework:core-kotlin:$amplify_kotlin_version"
const val cognitoidentityprovider = "aws.sdk.kotlin:cognitoidentityprovider:$escape_hatch_version"
const val cognitoidentity = "aws.sdk.kotlin:cognitoidentity:$escape_hatch_version"
}
There are never releases available for amplify_kotlin_version. e.g. 0.21.8. 2.0.0 is the right one? https://search.maven.org/artifact/com.amplifyframework/core-kotlin
Hello @lokalathlet when the user cancels the sign in or any other error happens the onError callback will be called with the relevant details. You do not need to implement any callbacks. Is that not the case? If you are signed in the fetchAuthSession.isSignedIn should be true. If that is not the case please let us know and we can investigate further.
For your last question the latest release for Kotlin facade can be found here All releases that we do can be found on our releases page : https://github.com/aws-amplify/amplify-android/releases
Closing due to inactivity. Please reopen this issue or create a new issue if you have additional questions.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
gpanshu I will update to the latest release soon, and come back to you with possible issues.
@lokalathlet I have a PR up for review to fix this issue. I'll let you know when its approved and live for v1.
@lokalathlet I have a PR up for review to fix this issue. I'll let you know when its approved and live for v1.
❤️