Skip to content

Amplify.Auth.signInWithWebUI() Crashes due to Scheme Validation in Xcode #1086

@nrcrews

Description

@nrcrews

Describe the bug
Amplify.Auth.signInWithWebUI() crashes app due to scheme validation. The app is not accepting a URL scheme with "://" in it. This is not allowing a user to sign in via WebUI.

Xcode produces the following response:

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

AWS Amplify documentation does not mention a step to avoid this behavior.

To Reproduce
Steps to reproduce the behavior:

  1. Setup locally by following AWS Amplify iOS authentication documentation :
    https://docs.amplify.aws/lib/auth/getting-started/q/platform/ios
  2. Push Amplify to backend
  3. Add URL scheme to info.plist
     <key>CFBundleURLTypes</key>
     <array>
         <dict>
             <key>CFBundleURLSchemes</key>
             <array>
                 <string>myapp</string>
             </array>
         </dict>
     </array>
  1. Initialize Amplify plugins in AppDelegate.swift
  2. Call the below method
func signInWithWebUI() {
    Amplify.Auth.signInWithWebUI(presentationAnchor: self.view.window!) { result in
        switch result {
        case .success:
            print("Sign in succeeded")
        case .failure(let error):
            print("Sign in failed \(error)")
        }
    }
}

Expected behavior
WebUI window to opens up to allow for user sign in.

Screenshots
amplifyconfiguration.json
Screen Shot 2021-03-03 at 2 39 37 PM

Environment:

  • Amplify Framework Version: [1.6.1]
  • Dependency Manager: Cocoapods
  • Swift Version: 5
  • CLI Version: [4.44.2]

Device Information:

  • Device: iPhone XR
  • iOS Version: 14.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    authIssues related to the Auth categorybugSomething isn't workingpending-releaseCode has been merged but pending release Code has been merged but pending release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions