Open ScottLu77 opened 5 months ago
Do you have your signout redirect url configured correctly through Cognito and your SAML provider?
Please post how HostedUIRedirectActivity
is configured in your manifest. The redirect comes from the browser. If the app is correctly configured to receive the redirect, then there is a misconfiguration on the service side in failing to provide the redirect.
Thanks for your reply and here are my configurations
1. we declare SignOutActivity in AndroidManifest.xml as follows
2. Here is my amplifyconfiguration.json
3. Here are the settings in AWS Cognito App integration
Besides, we have turned on "Sign-out flow" to log out Microsoft Entra which is our identity provider when calling Amplify.Auth.signout()
In this case, we found that during sign out, it will popup WebView and open two pages The first one shows Microsoft account has been logged out. The second one shows your AWS account has been logged out.
By the way, I found that the second WebView Uri is abnormal as follows "https://login.microsoftonline.com/87d9efc2-1ebc-4845-a670-4356471354cb/oauth2/logoutredirect?lc=1028" instead of "xxxxx/logout_uri=androidvortex%3A%2F%2F" I guess that's why it can't redirect to our app.
I've had another report in the past on issues with receiving the signout redirect with a Microsoft SAML and I'm not sure I ever received a final response from the customer as to what the issue was. Let me see if I can ask around some of our teams to see if they are familiar with what may be happening.
Hi tyler, thanks for your quick response. we look forward to have a solution in the future.
Same issue here, anything update? Thanks.
I believe there's a likely misconfiguration on the Entra side. I was able to test with an Entra account and both signIn
and signOut
worked without issue.
Here is how the logout redirect is configured on the Entra side.
Hi tyler, unfortunately, I followed your instruction to add logout URL, however it doesn't work.
Our application is pending in this web page and the url is as follows.
Hi @ScottLu77 I think we'e gotten the issue narrowed down.
I had not enabled the Sign Out Flow on the Cognito side. Once I did this, I was able to observe the same issue you were running into.
The Cognito documentation states: "Your IdP must send the LogoutResponse in an HTTP POST request."
I've found a post on a Microsoft support site that shows Entra does not support HTTP Post binding for sign out.
Hi Tyler, thanks for your feedback. We enabled the Sign Out Flow on the Cognito for letting user able to sso login with different social login from the same provider. We had the same request like this 1287. If there is any alternative solution, and it would be much appreciated.
I'm sorry, without support from Entra on providing the LogoutResponse as an HTTP POST request, there are no alternatives I can provide.
The other issue we face is that Chrome Custom Tabs do not allow us to clear browser session/cookie information. This is the reason the signOut method is only able to clear credentials on the Cognito side, and not third party social provider.
So you mean it's not possible letting user sso login to a different account without Google Android support? Besides of that, enabling Sign Out Flow on Cognito will run into my problem and it's unsolvable either without Entra's support?
The user could log into a different account if they open a web browser and log out of Microsoft Entra manually. I understand this is not a great experience but there are no API's that allow us to control web session/cookies from Microsoft in the browser. That is not something we have permission to do. Unfortunately due to Entra's limitation in providing the LogoutResponse, Cognito is not getting the required information it needs to complete the sign out and redirect the user back into the application.
But why is that everything works well when I switch back to android-amplify v1 (1.38.8)?
Hi @ScottLu77,
Amplify v1 had a 10 second wait on receiving the redirect. If the 10 second timeout was hit, the rest of the sign out (ex: clearing the local tokens) would succeed.
This behavior was modified in v2 to ensure that the browser signout succeeded. This decision was made because calling signInWithHostedUi after a failed browser sign out would automatically re-sign the user in as the cached user, even in the non-social sign in flow.
Can you please confirm how Amplify v1 appears on signOut. I would expect it to hang in the browser on the "An error was encountered with the requested page" screen. Then once 10 seconds is hit, or the user cancels, the local sign out proceeds.
If you are not seeing this behavior, please let me know. It would be helpful to provide logs of the v1 sign out and possibly provide a video where we can see the redirects happening.
Hi Tyler, update Amplify v1 behavior for your reference. After sign out, it will popup WebView and open two pages The first one shows Microsoft account has been logged out. The second one shows your AWS account has been logged out.
It seems that with Amplify V1, our app receive the redirect soon and sign out successfully without waiting for 10 second timeout. attach logcat for your reference
sign out timestamp is "06-17 16:18:39.893"
The second one shows your AWS account has been logged out.
I'm not sure that is showing AWS. That link is still a Microsoft link, not a Cognito link.
Do you have to close each of the windows, or does the redirect happen and automatically close the windows?
We can take a look on v1 behavior on our end and update the ticket.
The second one shows your AWS account has been logged out.
I'm not sure that is showing AWS. That link is still a Microsoft link, not a Cognito link.
Do you have to close each of the windows, or does the redirect happen and automatically close the windows?
We can take a look on v1 behavior on our end and update the ticket.
Yes, we need to programmatically close all windows and restart our app's welcome activity as follows.
val intent = Intent(context, WelcomeActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
context.startActivity(intent)
But at least the amplify v1 can be signed out successfully.
Please provide a thumbs up or comment on this feature request ticket to help us prioritize a feature request that would allow local sign out to complete even if the sign out is cancelled (custom tab closed without receiving redirect). https://github.com/aws-amplify/amplify-android/issues/2842
Before opening, please confirm:
Language and Async Model
Kotlin
Amplify Categories
Authentication
Gradle script dependencies
Environment information
Please include any relevant guides or documentation you're referencing
No response
Describe the bug
We can't sign out the user which is signInWithSocialWebUI. When I call signout and it will popup a webview instead redirect back to my app.
Reproduction steps (if applicable)
Code Snippet
Log output
amplifyconfiguration.json
GraphQL Schema
Additional information and screenshots
We are using AWS SAML provider(Azure), and enable "Sign-out flow" of the custom provider