> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://www.openfort.io/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

# Authentication

At a high level, onboarding users onchain breaks down into three core questions: who is taking the onchain action (the user), through what means are they able to control this action (the signer), and where is the affected state (the account).

**With Openfort, your app can authenticate users, including:**

* **Email**: via password or one-time passcode (OTP)
* **Phone**: via SMS one-time passcode (OTP)
* **Wallet**: via Sign In With Ethereum ([SIWE](https://eips.ethereum.org/EIPS/eip-4361)) standard
* **Web2 social accounts**: via [OAuth2.0 Protocol](https://oauth.net/2/) (Google, Facebook, Twitter, Discord, and more)
* **Guest**: anonymous authentication that can be upgraded later

These methods can be configured as either login or [link](https://www.openfort.io/docs/products/embedded-wallet/javascript/auth/user-management) options for users. Once authenticated, Openfort creates a common `User` object that includes the user's ID and profile information, treating all users equally regardless of their authentication method.

The Openfort Auth can be plugged into any front-end/user interface you already have.

:::info
For detailed response type definitions (`AuthResponse`, `User`, `Session`), see [Authentication methods - Response types](https://www.openfort.io/docs/products/embedded-wallet/authentication#response-types).
:::

## Response types

All authentication methods return an `AuthResponse` containing the session token and user information. See [Authentication methods](https://www.openfort.io/docs/products/embedded-wallet/authentication#response-types) for the full type definitions.

The SDK automatically stores tokens after successful authentication. Use `storeCredentials` for manual token storage in OAuth implicit flows.

## Guides

* [Authenticating with email](https://www.openfort.io/docs/products/embedded-wallet/javascript/auth/password) — Email authentication. Learn how to authenticate users with email and password or OTP.
* [Authenticating with phone](https://www.openfort.io/docs/products/embedded-wallet/javascript/auth/phone-login) — Phone authentication. Learn how to authenticate users with phone number and SMS OTP.
* [Non-custodial signer](https://www.openfort.io/docs/products/embedded-wallet/javascript/signer/recovery) — Embedded wallet signer. Create a non-custodial signer for your users.
* [Session keys](https://www.openfort.io/docs/products/embedded-wallet/javascript/smart-wallet/advanced/session-keys) — Smart wallet sessions. Create session keys with smart wallets.

## Templates

* [Auth with NextJS](https://github.com/openfort-xyz/openfort-js/tree/main/examples/apps/auth-sample) — GitHub repository. Openfort complete sample solution for NextJS.
* [Auth with Firebase](https://github.com/openfort-xyz/embedded-wallet-firebase-auth-sample-nextjs) — GitHub repository. Integration with third-party auth providers like Firebase.
