member_routes.sign_in and member_routes.sign_out in your theme. Fluid handles authentication and the session; you choose the markup, text, classes, and styles.
Add links to your navigation
Place ordinary anchors in your storefront header or member layout:member to choose which link that page includes. member is available only in authorized member-page renders. The existence of member_routes.sign_out does not mean a visitor is signed in.
Use the variables instead of hardcoding your company domain, the auth domain, or a callback URL. Local and deployed environments can use different authentication hosts.
What happens when you sign in
- On the storefront, the sign-in link starts authentication on the current host and redirects to your company’s Fluid sign-in screen. In production, Fluid hosts authentication at
auth.fluid.app. - After successful authentication, the browser returns to the same host’s session callback. Fluid verifies the result and creates the member session cookie.
- The browser returns to the requested local path. If no safe return path is available, it returns to
/on that host.
member_routes.root is the root of the current host. It does not switch between the storefront and the account host.
Sign-in always uses hosted authentication
Both hosts use/auth/sign_in to redirect directly to the configured authentication app. It does not render a members_login theme template. Your theme does not need a login template or its own password form.
A guest who opens a protected member page also goes directly to hosted authentication and returns to the requested page after signing in.
What happens when you sign out
Followingmember_routes.sign_out ends the member session on the current host and redirects to that host’s root. Fluid also revokes the member’s company-scoped real-time connections. If that cleanup fails, sign-out reports a failure and keeps the cookie so the member can retry.
Sessions are currently scoped to the host. Signing in on the storefront does not automatically sign you in on the account host, and signing out does not clear the other host’s cookie. It also does not sign you out of the hosted authentication provider. Real-time connection revocation can affect other tabs for the same member and company.
Sign-out uses a GET navigation. A link preview, prefetch, or navigation from another site can therefore sign a visitor out. Keep this as an explicit user-clicked link and do not prefetch or automatically request it. This behavior applies to sign-out; it does not remove protection from other actions.
Update an older theme
After the updated authentication release is deployed:- Replace old
/loginlinks withmember_routes.sign_in. Remove unusedmembers_logintemplates. - Replace old sign-out forms and references to the retired session-delete route with the anchor above.
- Remove
member_routes.csrf_token, hidden method overrides, and custom code used only to submit that old logout form. - Keep
content_for_headerin your layout; system screens and other theme features still need the normal header output. - Publish or regenerate your theme’s HTML so cached storefront pages receive the new links.
Test your links
- Start signed out on a storefront page, follow Sign in, and confirm you return to that storefront page after authentication.
- Follow Sign out and confirm the session ends on that host.
- On the account host, sign in, open a protected member page, and sign out. Reopening the protected page should require authentication.
- Follow the sign-in link on the account host and confirm it uses
/auth/sign_inand redirects directly to hosted authentication. - Check cached storefront HTML as both a guest and a member. It should contain stable auth links and no private member data or session token.