
I have a react application that checks user authentication on render with account.get() and redirects to login page if error code is 401
It has a sign in button to execute await account.createOAuth2Session('google', 'http://localhost:5173', 'http://localhost:5173/failed');
After logging out cookies are still set but account.get() returns 401 which makes sense After completing oauth process from google appwrite redirects to the homepage which makes a request to account.get() but this request does not have any cookies set and returns 401 so the user is constantly redirected to login page.
Waiting for a second and reloading the page resolves the issue. How do I handle this in a better way?

^ request to account.get()

You could have the new tab send a message to the original tab: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
We do something like this in flutter web: https://github.com/appwrite/playground-for-flutter/blob/ad30fb232a223e118c9429ac1df75f856b6a1d9d/web/auth.html#L6
Recommended threads
- Looking for Partner
I'm looking for partner for long-term collaborating. Of course, I'll pay for you. If you are interested, Please DM me.
- Hola equipo de soporte,
Hola equipo de soporte, Estoy desarrollando una Function en Appwrite Cloud con Node.js 22 y el siguiente package.json: { "name": "upload-whitelist", "type"...
- Looking for Partner
I'm looking for partner for long-term collaborating. Of course, I'll pay for you. If you are interested, Please DM me.
