Skip to main content

sdk.auth.email

sendOTP

Send a one-time password to a user’s email address.

Parameters

  • email (String): User’s email address

Example

verifyOTP

Verify an email OTP code and authenticate the user.

Parameters

  • token (String): OTP code entered by user

Example

resendOTP

Resend the email OTP.

Example

sdk.auth.sms

sendOTP

Send a one-time password to a user’s phone number via SMS.

Parameters

  • phoneData (PhoneData): Phone data containing dial code, ISO code, and phone number

Example

verifyOTP

Verify an SMS OTP code and authenticate the user.

Parameters

  • token (String): OTP code entered by user

Example

resendOTP

Resend the SMS OTP.

Example

sdk.auth.social

connect

Authenticate with a social provider (Google, Apple, Farcaster).

Parameters

  • provider (SocialProvider): The social provider:
    • SocialProvider.google
    • SocialProvider.apple
    • SocialProvider.farcaster

Examples

sdk.auth.passkey

signIn

Authenticate with a passkey using the device’s biometric authentication.

Example

sdk.auth.externalAuth

signInWithExternalJwt

Sign in using an external JWT token.

Parameters

  • jwt (String): The external JWT token

Example

Authentication State

authenticatedUser

Get the current authenticated user (synchronous).

Example

authenticatedUserChanges

Observe authentication state changes (reactive stream).

Example

StreamBuilder Example

token

Get the current authentication token (synchronous).

Example

tokenChanges

Observe authentication token changes (reactive stream).

Example

StreamBuilder Example

minAuthToken

Get the current minified authentication token. This is a compact JWT suitable for bandwidth-constrained environments.

Example

minAuthTokenChanges

Observe minified authentication token changes (reactive stream).

Example

StreamBuilder Example

Refreshing the user

refreshUser

Re-fetch the authenticated user from Dynamic and republish it. The SDK receives the usual authenticatedUserChanged and userWalletsChanged updates, so authenticatedUser, authenticatedUserChanges, and wallets.userWallets reflect the fresh state. Call it after an operation that changes the user server-side without a new sign-in, such as importing a private key into an embedded wallet. The wallet exists in Dynamic as soon as the import resolves, but the host’s wallet list is a snapshot taken at sign-in until it is refreshed.
Returns the fresh profile, or null when the webview answers without one. Throws if no user is currently authenticated.

Example

Logout

logout

Log out the current user.

Example

Complete Authentication Flow Example

Email Authentication

SMS Authentication

Social Authentication

Passkey Authentication

Last modified on September 29, 2026