Dror Rash
12/03/2025, 11:23 AM/v1/auth/logout the main difference i see is in the set-cookie header
in one env (the one that is working as expected) i see both set-cookie for DS & DSR with the domain but than when i look in the prod env set cookie for DS the domain is empty and for DSR i see the domain. so the DSR cookie is cleared but the DS is not cleared and the user can't logout.
what can i do to troubleshoot the issue?
some additional info, refresh token in both is set to "Manage in cookies" and "Session token" is set to "Manage in response body". cookie policy is LaxRahul Rijhwani
12/03/2025, 11:30 AMsessionTokenViaCookie enabled, the SDK itself sets the DS cookie.
The domain mismatch you're seeing suggests a custom domain configuration issue in your prod environment. When using cookie-based tokens, Descope requires proper custom domain setup.
Troubleshooting steps:
1. Verify custom domain configuration - Check that your prod environment's custom domain setting matches your demo environment. The custom domain should be set to something like app.example.com, with a CNAME record for auth.app.example.com pointing to cname.descope.com (US) or cname.euc1.descope.com (EU).
2. Check SDK initialization - If you're using sessionTokenViaCookie in your SDK, verify the domain configuration. You can customize the cookie domain by passing sessionTokenViaCookie: {domain: 'your-domain.com'} to ensure consistency.
3. Cookie name conflicts - If running multiple Descope projects on the same domain, ensure you're using unique cookie names via the cookieName option to avoid conflicts.
4. Manual cookie cleanup - After calling logout, you must invalidate or remove any cookies you created. If providing an http.ResponseWriter (backend) or using the SDK's logout function with proper configuration, this should happen automatically.
The key issue is likely that your prod environment's domain configuration differs from demo, causing the DS cookie to be set without a proper domain attribute, preventing it from being cleared on logout.
Docs: https://github.com/descope/descope-js/blob/main/packages/sdks/web-js-sdk/README.md
https://github.com/descope/descope-js/blob/main/packages/sdks/react-sdk/README.md
https://docs.descope.com/management/project-settings/refresh-token-storage
https://docs.descope.com/authorization/session-management/session-validation/backendDror Rash
12/03/2025, 11:31 AMDror Rash
12/04/2025, 6:45 AMsessionTokenViaCookie doesn't have the domain property in the interface
this is what is see:
interface IAuthProviderProps {
projectId: string;
baseUrl?: string;
baseStaticUrl?: string;
persistTokens?: boolean;
sessionTokenViaCookie?: boolean | {
sameSite: SameSite;
};
storeLastAuthenticatedUser?: boolean;
keepLastAuthenticatedUserAfterLogout?: boolean;
refreshCookieName?: string;
children?: React.ReactNode;
}Dror Rash
12/04/2025, 6:45 AM"name": "@descope/react-sdk",
"version": "2.7.1",Rahul Rijhwani
12/04/2025, 6:59 AMRahul Rijhwani
12/04/2025, 11:09 AMbaseUrl parameter in your SDK initialization. The baseUrl is your custom domain that must be configured to manage token response in cookies. This ensures every request to Descope goes through your custom domain.
<AuthProvider
projectId="__ProjectID__"
baseUrl="https://auth.app.example.com"
persistTokens={true}
sessionTokenViaCookie={false}
storeLastAuthenticatedUser={true}
keepLastAuthenticatedUserAfterLogout={false}
>
<App />
</AuthProvider>
Key troubleshooting steps:
1. Compare the baseUrl configuration between demo and prod environments
2. Verify your custom domain is properly configured in both environments
3. Check that the domain in your Descope project settings matches the baseUrl in both environments
4. Ensure both environments use the same cookie domain configuration in the Session Management settings
Check this doc: https://docs.descope.com/security-best-practices/session-token-storage
https://docs.descope.com/authorization/session-management/session-validation/client
https://docs.descope.com/client-sdk/initialize-sdkDror Rash
12/05/2025, 12:59 PM