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
- 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 ...
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...