Skip to main content
Setup in the dashboard: User Authentication
Visitor sign-in on published sites. Requires the User Authentication website feature. Visitors authenticate with Sign in with Webstorio — a platform OAuth flow scoped to your project. After sign-in, a site session cookie is set for your subdomain (and custom domain when configured).

signInWithWebstorio(returnTo?)

Start the sign-in flow. Redirects the browser to Webstorio OAuth; no return value.
Use on sign-in pages and “Sign in” buttons. If getSession() already returns a user, redirect to getAuthConfig().redirectAfterSignIn instead of showing the button.

getSession()

Get the current visitor session, or null if not signed in.
Returns:
Sends credentials (include) — the session cookie must be present.

getCurrentUser()

Shorthand for getSession() then return user or null.

getAuthConfig()

Public auth settings for your site.
Use signInPath for links to your sign-in page and redirectAfterSignIn when a signed-in visitor lands on the sign-in page.

signOut()

End the current site session.
Call from account pages or a header “Sign out” control. Then redirect or refresh UI as needed. Sign-in redirects and OAuth callbacks are handled automatically on your site’s origin. You do not configure callback URLs in page code.

Common patterns

Protect a page

Prefill checkout (with Online Store)

Order history

Requires Online Store and a signed-in session. See Store SDK.

User guide

Dashboard setup: User Authentication