Lock Passwordless for iOS

Versionv2

This functionality has been deprecated in native. After June 2017, tenants cannot use the native passwordless flow. The functionality will continue to work for tenants that currently have it enabled. If at some point the passwordless mode feature is changed or removed from service, customers who currently use it will be notified beforehand and given ample time to migrate.

Lock Passwordless handles passwordless authentication using email and sms connections.

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

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

Notes:

  • Passwordless can only be used with a single connection and will prioritize the use of email connections over SMS.
  • The audience option is not available in Passwordless.

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
}

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)
}