Stack Auth
GuidesSDKComponentsAPI Reference
Back to home
Platform
OverviewFAQ
Getting Started
SetupComponentsUsersProduction
Concepts
API KeysBackend IntegrationCustom User DataEmailsJWT TokensOAuth
OAuth Providers
Orgs and TeamsPermissionsStack AppTeam SelectionUser OnboardingWebhooks
Customization
Custom PagesCustom StylesDark ModeInternationalization
Page Examples
Other
Self-hostMCP SetupConvex
Stack Auth Docs

StackApp Constructor Options Before SSK

The options for the StackApp constructor.

tokenStoreunionrequired

Where to store the user's session tokens. In most cases, this is "nextjs-cookie", which will store the tokens in cookies using Next.js.

"nextjs-cookie"

Persists the session tokens in window.cookie in browser environments, or Next.js cookies in server environments. This is the most common choice.

"cookie"

Persists the session tokens in window.cookie in browser environments. Will not read or write cookies on the server.

{ accessToken: string, refreshToken: string }

Reads the initial value for the session tokens from the provided object. It expects the same format as the object returned by currentUser.getAuthJson().

Does not persist changes to the tokens.

Request

Reads the initial value for the session tokens from headers of the request object. For more information, see the documentation for currentUser.getAuthHeaders().

Does not persist changes to the tokens.

baseUrlstring

The base URL for Stack Auth's API. Only override this if you are self-hosting Stack Auth. Defaults to https://api.stack-auth.com, unless overridden by the NEXT_PUBLIC_STACK_API_URL environment variable.

projectIdstring

The ID of the project that the app is associated with, as found on Stack Auth's dashboard. Defaults to the value of the NEXT_PUBLIC_STACK_PROJECT_ID environment variable.

publishableClientKeystring

The publishable client key of the app, as found on Stack Auth's dashboard. Defaults to the value of the NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY environment variable.

Stack Auth AI

Documentation assistant

Experimental: AI responses may not always be accurate—please verify important details.

For the most accurate information, please join our Discord or email us.

How can I help?

Ask me about Stack Auth while you browse the docs.