> ## Documentation Index
> Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Implement authentication methods in your Unity application with Dynamic SDK.

The Dynamic Unity SDK supports multiple authentication methods. After successful authentication, the SDK automatically populates the wallet list.

## Email OTP

```csharp theme={"system"}
// Send OTP
await DynamicSDK.Instance.Auth.Email.SendOTP("user@example.com");

// Verify OTP (on a separate screen)
await DynamicSDK.Instance.Auth.Email.VerifyOTP("123456");

// Resend if needed
await DynamicSDK.Instance.Auth.Email.ResendOTP();
```

## SMS OTP

```csharp theme={"system"}
await DynamicSDK.Instance.Auth.Sms.SendOTP(new PhoneData
{
    DialCode = "+1",
    Iso2 = "US",
    Phone = "5551234567",
});

await DynamicSDK.Instance.Auth.Sms.VerifyOTP("123456");
```

## Social login

```csharp theme={"system"}
await DynamicSDK.Instance.Auth.Social.Connect(SocialProvider.Google);
await DynamicSDK.Instance.Auth.Social.Connect(SocialProvider.Apple);
await DynamicSDK.Instance.Auth.Social.Connect(SocialProvider.Farcaster);
```

## Passkey sign-in

<Warning>
  Passkey sign-in only works on native devices (iOS/Android), not in the Unity Editor or macOS.
</Warning>

```csharp theme={"system"}
await DynamicSDK.Instance.Auth.Passkey.SignIn();
```

## External JWT

For integrating with your own authentication system:

```csharp theme={"system"}
await DynamicSDK.Instance.Auth.ExternalAuth.SignInWithExternalJwt(
    new SignInWithExternalJwtParams
    {
        ExternalJwt = jwtToken,
        ExternalUserId = userId,
    });
```

## Dynamic Widget (built-in auth UI)

The easiest way to add authentication is using the built-in UI:

```csharp theme={"system"}
DynamicSDK.Instance.UI.ShowAuth();
```

This displays a full authentication flow with all enabled authentication methods.

## Next steps

* [Session Management](/docs/unity/session-management) - Manage user sessions
* [Wallet Creation](/docs/unity/wallet-creation) - Wallets created after authentication
