Lock Passwordless for iOS

Versionv2

Passwordless functionality should not be embedded in native apps until Auth0 libraries can be updated to properly support it. Until that time, passwordless authentication can still be achieved by using Universal Login via the web.

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