Lock.swift: Passwordless

Lock Passwordless handles passwordless authentication using email and sms connections. To use Passwordless Authentication you need Lock.Swift version 2.14.0 or greater.

To show Lock, add the following snippet in your UIViewController.

Lock
    .passwordless()
    .withOptions {
         $0.oidcConformant = true
    }
    // withConnections, withOptions, withStyle, and so on.
    .onAuth { credentials in
      // Save the Credentials object
    }
    .present(from: self)

Was this helpful?

/

Passwordless can only be used with a single connection and will prioritize the use of email connections over SMS.

Passwordless Method

When using Lock Passwordless the default passwordlessMethod is .code which sends the user a one time passcode to login. If you want to use Universal Links you can add the following:

.withOptions {
    $0.passwordlessMethod = .magicLink
}

Was this helpful?

/

Activity callback

If you are using Lock Passwordless and have specified the .magicLink option to send the user a universal link then you will need to add the following to your AppDelegate.swift:

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
    return Lock.continueAuth(using: userActivity)
}

Was this helpful?

/