Skip to main content
Lock は、メールおよびSMS接続を使用してパスワードレス認証を処理します。パスワードレス認証を使用するには、Lock.Swiftバージョン2.14.0以上が必要です。 Lockを表示するには、次のスニペットをUIViewControllerに追加してください。
Lock
    .passwordless()
    .withOptions {
         $0.oidcConformant = true
    }
    // withConnections, withOptions, withStyle, and so on.
    .onAuth { credentials in
      // Save the Credentials object
    }
    .present(from: self)
パスワードレス認証は、単一の接続でのみ使用でき、SMSよりもメール接続が優先されます。

パスワードレス認証方法

Lock Passwordlessを使用する際、デフォルトのpasswordlessMethod.codeです。これにより、ユーザーにワンタイムパスコードが送信され、ユーザーはそのコードを使用してログインします。ユニバーサルリンクを使用したい場合は、次のコードを追加できます。
.withOptions {
    $0.passwordlessMethod = .magicLink
}

アクティビティコールバック

Lock Passwordlessを使用しており、ユーザーにユニバーサルリンクを送信するために.magicLinkオプションを指定した場合は、次のコードをAppDelegate.swiftに追加する必要があります。
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
    return Lock.continueAuth(using: userActivity)
}
I