Skip to content

feature-auth setup

Styles

Import them once, in the stylesheet where you load Tailwind:

@import "@evolve-storefront/feature-auth/styles.css";

Translations

The package ships its texts in @evolve-storefront/feature-auth/messages. evolve messages merges them into your message files and never overwrites a text you changed.

AuthProvider

Single provider for the auth feature. Supplies the app-owned session seam the forms/hooks delegate to on success — feature-auth never sets cookies itself (AUTH-R-B4/B6). Email + password only; the identity provider is a seam.

import { AuthProvider } from "@evolve-storefront/feature-auth/provider";
PropTypeDescription
childrenReactNode
onAuthenticated?((customer: AuthCustomer) => void)

Called after a successful login / register / password-reset (set the session).

onLoggedOut?(() => void)

Called after a successful logout (tear down the session).

logout?(() => Promise<void>)

End the session where the refresh token cookie is sent — useAuth().logout, which posts to /graphql/auth. Without it useLogout posts customerLogout to the fetcher's endpoint, which never receives that cookie, so the refresh token outlives the logout.

redirectAfterLogin?string

Where a document navigation goes after signing in, unless the URL's returnTo names a safe path. A full load, so the proxy reads the new session cookies, and assign with a path, so the page's query — a reset token — does not travel on.

redirectAfterLogout?string

Where a document navigation goes after signing out.