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
- Bug Report: Appwrite Console UI Issue on...
Steps to Reproduce: - Navigate to any collection page in the Appwrite console UI. - Open the menu and click on "Create Collection." - Observe that the dialog to...
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...