> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev-docs-event-stream-action-templates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Lock.swift：パスワードレス

> Lock for iOS v2を使用したパスワードレス認証

Lock <Tooltip data-tooltip-id="react-containers-DefinitionTooltip-0" href="/docs/ja-jp/glossary?term=passwordless" tip="パスワードレス: 最初の要素としてパスワードに依存しない認証の形式。" cta="用語集の表示">Passwordless</Tooltip>は、メールおよびSMS接続を使用してパスワードレス認証を処理します。パスワードレス認証を使用するには、Lock.Swiftバージョン2.14.0以上が必要です。

Lockを表示するには、次のスニペットを`UIViewController`に追加してください。

```swift lines theme={null}
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`です。これにより、ユーザーにワンタイムパスコードが送信され、ユーザーはそのコードを使用してログインします。[ユニバーサルリンク](/docs/ja-jp/get-started/applications/enable-universal-links-support-in-apple-xcode)を使用したい場合は、次のコードを追加できます。

```swift lines theme={null}
.withOptions {
    $0.passwordlessMethod = .magicLink
}
```

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

Lock Passwordlessを使用しており、ユーザーにユニバーサルリンクを送信するために`.magicLink`オプションを指定した場合は、次のコードを`AppDelegate.swift`に追加する必要があります。

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