Skip to content
View raw ↗

Authentication

Decide whether your app has users — and if so, how they sign in. Turn it on and your app gets login, registration, accounts, and an API, with no auth code to write.

Configure

1. Do you need users?

ChoiceWhat happens
No usersYour app has no login. Good for API services, MCP tool servers, webhook relays.
Users onYour app gets login, registration, accounts, sessions, and API keys.

2. Pick a sign-in method

MethodWhen
Built-in (Cognito)The default. Fully managed — nothing to set up.
Auth0Enterprise needs. (Advanced — coming soon.)
NoneNo login at all.

3. Email verification

Choose whether new users must verify their email, and configure the verification settings.

What's OAuth? It's the standard way apps let people log in securely — and let other apps connect on their behalf. You don't set any of it up; Foundation runs it for you.

Your app is also an OAuth provider

Every app with users is a full OAuth 2.0 provider. Other apps, bots, and services can authenticate against your app — so an API service or chatbot plugin can simply hand out tokens, no UI required. Users can also generate API keys for programmatic access, which respect the same roles and scopes.

Use in your app

Foundation runs the auth flow; your frontend calls the SDK. Use the built-in login and registration components, or build your own screens.

Tell your agent: "Add sign-in and registration using Foundation auth, and send people to the dashboard once they're logged in."

Show the code
ts
// sign in
const result = await foundation.auth.signIn(email, password)
if (result.isSignedIn) router.push('/dashboard')

// who's logged in
foundation.auth.user
foundation.auth.isAuthenticated

// react to auth changes
foundation.auth.onChange(() => refreshUI())

// sign out
await foundation.auth.logout()

On a hosted-login callback route, call foundation.auth.handleCallback().

Reference