Closed ahavamorse closed 1 week ago
Thank you for raising the issue. I am discussing the possible solutions for this usecase internally and would update once I have more details.
Hey @ahavamorse .. I have a potential fix in a WIP branch (3766-hosted-ui-logout-issue
) .. Would you be able to take a look and see if it solves your issue? The PR with the changes is also linked to the issue.
Hey @ahavamorse .. I have a potential fix in a WIP branch (
3766-hosted-ui-logout-issue
) .. Would you be able to take a look and see if it solves your issue? The PR with the changes is also linked to the issue.
@harsh62 I tried it and that does seem to resolve the issue I was experiencing. The sign out fails and I can try again once canStart
is true.
@ahavamorse Thank you for confirming, I'll review the fix with my team and hopefully release this some time next week.
The fix has been released. Please use the latest version of Amplify.
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please 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.
Describe the bug
This is a follow up to #3678 and the solution released in version 2.34.1. It happens when
aswebAuthenticationSession.canStart
inHostedUIASWebAuthenticationSession.showHostedUI
is false andHostedUIError.unableToStartASWebAuthenticationSession
is thrown. Even after this error is returned the sign out process continues and returns as a partial result. This is a problem because we need the hosted UI to be presented, in order to clear the session and remove the browser cookies. Otherwise when we sign in again it results in unexpected behavior where a new user trying to sign in ends up having the same user as before signed in instead. The sign out API also can't be called again (whencanStart
has changed to true) because there is no user signed in and an error is returned. In order to fix this sign out should not continue when the hosted UI can't be presented. It should return an error result instead of partial and allow us to try again whencanStart
has changed.Steps To Reproduce
Expected behavior
If the session can not be started because
canStart
is false sign out should not continue and the result should be an AuthError (not a partial success)Amplify Framework Version
2.34.1
Amplify Categories
Auth
Dependency manager
Swift PM
Swift version
5.9
CLI version
n/a
Xcode version
15.4
Relevant log output
Is this a regression?
No
Regression additional context
No response
Platforms
iOS
OS Version
17.5.1
Device
iPhone SE (2nd Generation)
Specific to simulators
No response
Additional context
Again, this is a follow up to an incomplete fix to #3678: "
HostedUIASWebAuthenticationSession.showHostedUI
never calls the continuation whenaswebAuthenticationSession.canStart
is false"