Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HostedUIASWebAuthenticationSession.showHostedUI never calls the continuation when aswebAuthenticationSession.canStart is false #3678

Closed
ahavamorse opened this issue May 6, 2024 · 3 comments
Labels
auth Issues related to the Auth category bug Something isn't working

Comments

@ahavamorse
Copy link

ahavamorse commented May 6, 2024

Describe the bug

When canStart is false a warning is printed to the console because the continuation is never called.
SWIFT TASK CONTINUATION MISUSE: showHostedUI(url:callbackScheme:inPrivate:presentationAnchor:) leaked its continuation!
This is caused by the change in #3466 to only start the session if canStart is true. The resulting behavior is that the web UI is never presented and the continuation is never called. If the session is not started, the continuation must be called

The canStart variable was only temporarily false (due to an animation) and if we waited a short amount of time it would resolve within half a second. We therefore fixed it by adding a wait and then checking canStart again after a short pause. We check several times and then time out after a few seconds. We either start the session or else call the continuation with an error. This way the continuation is always called and the app is never left hanging.

Steps To Reproduce

Steps to reproduce the behavior:
1. Call the `Amplify.Auth.signInWithWebUI` method and successfully sign in
2. Without restarting the app call `Amplify.Auth.signOut()` (which will never return)

Expected behavior

If the session will not be started an error should be returned that says canStart is false (In our case this was because the presentation anchor was not yet presented)

Amplify Framework Version

2.28.0

Amplify Categories

Auth

Dependency manager

Swift PM

Swift version

5.9

CLI version

n/a

Xcode version

15.0

Relevant log output

SWIFT TASK CONTINUATION MISUSE: showHostedUI(url:callbackScheme:inPrivate:presentationAnchor:) leaked its continuation!

Is this a regression?

No

Regression additional context

No response

Platforms

iOS

OS Version

iOS 17.4.1

Device

iPhone SE (2nd Generation)

Specific to simulators

No response

Additional context

No response

@ruisebas ruisebas added bug Something isn't working auth Issues related to the Auth category labels May 6, 2024
@ruisebas
Copy link
Member

ruisebas commented May 6, 2024

Hi @ahavamorse, thanks for opening this issue.

The team will take a look and post any updates here.

@phantumcode
Copy link
Member

Issue fixed and released in version 2.34.1

Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Issues related to the Auth category bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants