hi, I am always getting this error when using OAuth google login to check if user is logged in or not.
Workflow: I have this authContext function which in useEffect/useLayoutEffect gets current session and loads user's google profile if logged in else redirects to /login page. When a user is logged in, it works fine else it throws this exception (see title).
I have tried both account.get and account.getSession('current') and still gets the same exception when user is not logged in. This doesn't only happen in useEffect or useLayoutEffect on button to get session (just for testing) and its same.
useLayoutEffect(() => {
getLoggedInGoogleUser();
}, []);
const getLoggedInGoogleUser = async () => {
try {
const hey = await account.getSession("current");
if (hey) console.log(hey);
} catch (error) {
console.log(error);
}
};
please help getting around this error.
thank you, best regards.
Recommended threads
- Invalid origin error in authentication
I have setup the package name same as the package name in app.json but it is constantly saying `AppwriteException: Invalid Origin. Register your new client as ...
- Problem with Google Workspace at DNS Rec...
Hello, I bought a domain at Namecheap, and Google Workspace used to work there, but now that I switched from Custom DNS to Appwrite's nameservers, it doesn't w...
- Flutter OAuth2 webAuth Bug?
I created with flutter an app where I can login in with my Microsoft Account. When I compile it to Web (WASM) or Android (aab) then there is no problem what so ...