# 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](/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](/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](/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

<HoverCardLayout>
  <HoverCardLink description="Learn how to authenticate users with email and password or OTP" href="/products/embedded-wallet/javascript/auth/password" title="Authenticating with email" subtitle="Email authentication" icon={Mail} color="#8B5CF6" />

  <HoverCardLink description="Learn how to authenticate users with phone number and SMS OTP" href="/products/embedded-wallet/javascript/auth/phone-login" title="Authenticating with phone" subtitle="Phone authentication" icon={Phone} color="#10B981" />

  <HoverCardLink description="Create a non-custodial signer for your users" href="/products/embedded-wallet/javascript/signer/recovery" title="Non-custodial signer" subtitle="Embedded wallet signer" icon={Key} color="#EC4899" />

  <HoverCardLink description="Create session keys with smart wallets" href="/products/embedded-wallet/javascript/smart-wallet/advanced/session-keys" title="Session keys" subtitle="Smart wallet sessions" icon={Clock} color="#F59E0B" />
</HoverCardLayout>

## Templates

<HoverCardLayout>
  <HoverCardLink description="Openfort complete sample solution for NextJS" href="https://github.com/openfort-xyz/openfort-js/tree/main/examples/apps/auth-sample" title="Auth with NextJS" subtitle="GitHub repository" icon={Code} color="#0EA5E9" />

  <HoverCardLink description="Integration with third-party auth providers like Firebase" href="https://github.com/openfort-xyz/embedded-wallet-firebase-auth-sample-nextjs" title="Auth with Firebase" subtitle="GitHub repository" icon={Flame} color="#F97316" />
</HoverCardLayout>
