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

[Crash] SDK 2.36.0 AWSCognitoAuth launchUsing:uiViewController:completion: #5315

Open
skyfoxa opened this issue May 3, 2024 · 6 comments
Open
Assignees
Labels
bug Something isn't working mobile client Issues related to AWSMobileClient pending-response Issue is pending response from the issue requestor

Comments

@skyfoxa
Copy link

skyfoxa commented May 3, 2024

Describe the bug
Calling AWSMobileClient.default().showSignIn(navigationController: signInUIOptions: hostedUIOptions: _:) leads to an uncaught exception and crashes the app.

This issue started occurring when we updated the SDK from version 2.35.0 to 2.36.0. It's probably connected to the recent update from SFAuthenticationSession to ASWebAuthenticationSession. It may be the same issue as was discussed here

To Reproduce

Here is our awsconfiguration:

"Auth": {
      "Default": {
        "OAuth": {
          "WebDomain": "...",
          "AppClientId": "....",
          "SignInRedirectURI": "myapp://callback",
          "SignOutRedirectURI": "myapp://signout",
          "Scopes": ["openid", "email", "profile"]
        }
      }
    },

Steps to reproduce the behavior:

  1. Call AWSMobileClient.default().showSignIn(navigationController:signInUIOptions:hostedUIOptions:_:)
    • use HostedUIOptions(scopes: ["openid", "email", "profile"], identityProvider: "Google")

Observed Behavior

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The provided scheme is not valid. A scheme should not include special characters such as ":" or "/".'

Expected Behavior
Hosted UI is opened and user can sign in, app doesn't crash.

Stack Trace
image

Code Snippet

Unique Configuration

Areas of the SDK you are using (AWSMobileClient, Cognito, Pinpoint, IoT, etc)?
AWSMobileClient

Screenshots

Environment(please complete the following information):

  • SDK Version: 2.36.0
  • Dependency Manager: SPM
  • Swift Version : 5.10
  • Xcode Version: 15.3

Device Information (please complete the following information):

  • Device: iPhone 13 pro, iPhone 15 Pro
  • iOS Version: iOS 17.4.1
  • Specific to simulators:

Additional context

Relevant Console Output

Logs

Log Messages
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The provided scheme is not valid. A scheme should not include special characters such as ":" or "/".'
*** First throw call stack:
(0x1a677ab28 0x19e5eaf78 0x21e71b618 0x21e71b214 0x10bb3dc10 0x10bb3dae0 0x10bb3da4c 0x1a55687f4 0x1a5596d0c 0x1a5594594 0x1a5593684 0x1a559619c 0x1a5595f08 0x10c617764 0x10c6067bc 0x10c6098e0 0x10c608bb8 0x10c61aae4 0x10c61b4d8 0x202670ee4 0x202670fc0)
libc++abi: terminating due to uncaught exception of type NSException
@ruisebas
Copy link
Member

ruisebas commented May 3, 2024

Hi @skyfoxa! Thanks for opening this issue.

We will take a look and post updates here.

@ruisebas ruisebas added bug Something isn't working mobile client Issues related to AWSMobileClient labels May 3, 2024
@ruisebas ruisebas self-assigned this May 3, 2024
@ruisebas
Copy link
Member

ruisebas commented May 3, 2024

This should be fixed in the latest release 2.36.1.

Could you please update your dependency and verify? Thanks!

@ruisebas ruisebas added the pending-response Issue is pending response from the issue requestor label May 3, 2024
@skyfoxa
Copy link
Author

skyfoxa commented May 6, 2024

@ruisebas the SDK doesn't crash anymore, however it won't open the hosted UI, calling the AWSMobileClient.default().showSignIn(navigationController: signInUIOptions: hostedUIOptions: _:) method returns this error:

Error Domain=com.apple.AuthenticationServices.WebAuthenticationSession Code=2 "Cannot start ASWebAuthenticationSession without providing presentation context. Set presentationContextProvider before calling -start." UserInfo={NSDebugDescription=Cannot start ASWebAuthenticationSession without providing presentation context. Set presentationContextProvider before calling -start.}

@ruisebas
Copy link
Member

ruisebas commented May 6, 2024

@skyfoxa my apologies for that.

I've merged a fix to the main branch. Would you be able to verify it it addresses your issues?
If you cannot, no worries, we will release a new version for you to try.

Thanks!

@skyfoxa
Copy link
Author

skyfoxa commented May 7, 2024

@ruisebas I tried it, but it looks https://github.com/aws-amplify/aws-sdk-ios-spm doesn't contain that change yet, I'll probably wait for the release

@ruisebas
Copy link
Member

@skyfoxa sorry for the delay. The fix has been released in 2.36.2.

Please let us know if you still face any issues. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mobile client Issues related to AWSMobileClient pending-response Issue is pending response from the issue requestor
Projects
None yet
Development

No branches or pull requests

2 participants