Lock.swift:パスワードレス
Lock Passwordlessは、メールおよび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)
Was this helpful?
/
パスワードレス認証は、単一の接続でのみ使用でき、SMSよりもメール接続が優先されます。
パスワードレス認証方法
Lock Passwordlessを使用する際、デフォルトのpasswordlessMethod
は.code
です。これにより、ユーザーにワンタイムパスコードが送信され、ユーザーはそのコードを使用してログインします。ユニバーサルリンクを使用したい場合は、次のコードを追加できます。
.withOptions {
$0.passwordlessMethod = .magicLink
}
Was this helpful?
/
アクティビティコールバック
Lock Passwordlessを使用しており、ユーザーにユニバーサルリンクを送信するために.magicLink
オプションを指定した場合は、次のコードをAppDelegate.swift
に追加する必要があります。
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
return Lock.continueAuth(using: userActivity)
}
Was this helpful?
/