KindeK
Kinde2y ago
1 reply
Dev

Session cookie does not persist after reload in React SDK

main.js:
<KindeProvider
     clientId={import.meta.env.VITE_KINDE_CLIENT_ID}
     domain={import.meta.env.VITE_KINDE_DOMAIN}
     {redirectUri}
     {redirectUri.replace("/dashboard", "/")}    
>
     <ThemeProvider>
          <App />
     </ThemeProvider>
</KindeProvider>


i have setup admin subdomain in my site, thats why the redirectUri and logoutUri is different from what's defined in the react setup docs

So, when i try to login using this setting, it logs in for a moment but when i reload, it logs me out immediately

i had a look in the applications tab in the browser console, the cookies had some enduser_session_id field in it, and when i reload, this field vanishes

I tried using isDangerouslyUseLocalStorage={true} in the above setting, it kept me logged in until i manually log out, the local storage had kinde_refresh_token this time

and if i log out, the kinde_refresh_token & enduser_session_id vanishes from local storage and cookies resp.

I cannot keep using isDangerouslyUseLocalStorage={true} as it is not secure, and i'm wondering why the kinde_refresh_token not getting saved in the cookie instead of local storage?

is this a bug? if not is there a workaround to make it work
Was this page helpful?