Use case
- Backend-initiated session changes: Ensure your frontend session state stays in sync when sessions are created or updated on the backend.
Session hydration
Update session tokens
Provide both the active
session_token and session_jwt to the session.updateSession() method to prime the frontend with a valid set of tokens.Make an authenticate session call
Authenticate the session using the
session.authenticate() method to validate the updated session tokens.When
HttpOnly cookies are enabled for your Stytch project, the Sessions Update method only works if there isn’t an existing session token set in an HttpOnly cookie.-
If
HttpOnlycookies are enabled, make sure your SDK client’scookieOptionsare configured to match the domain and cookie names used by Stytch’s backend. - Alternatively, you can override the session cookies via response headers from your backend. Be sure to still make a frontend authenticate session call.