tired of this error, after clicking the signup button its redirecting but getting this error when accessing the session here is the code in the userContext it worked well before but its giving this error for few users REACT CODE
useEffect(() => { getUser(); }, []);
const getUser = async () => { try { setIsLoading(true); // console.log("Executing the getUser function");
// Get the current session
let session = await account.getSession("current");
console.log(session, "this is session");
// console.log(session, "this is the session");
if (!session) {
// console.log("No active session found");
setUser(null);
setIsLoading(false);
return;
}
//@ts-ignore
// Update session to refresh authentication
const promise = account.updateSession("current");
promise.then(
function (response) {
console.log(response); // Success
},
function (error) {
console.log(error); // Failure
}
);
// Get user details after refreshing session
const userData = await account.get();
setUser(userData);
// console.log(userData, "This is the user");
} catch (error) {
console.log("Failed to fetch user:", error);
setUser(null);
} finally {
setIsLoading(false);
}
};
and the login button const handleGoogleLogin = async () => { try { await account.createOAuth2Session( OAuthProvider.Google, "http://localhost:8080/", "http://localhost:8080/" ); } catch (error) { console.error("Google login failed", error); } };
Recommended threads
- Getting current user has been blocked
Getting current user has been blocked error while signing in the appwrite console. Got this during I am testing with the my saas web project. Please help to unb...
- vorafy.studio domain already exists erro...
My domain vorafy.studio is stuck/locked from a previously deleted project. I created a new project but can't add the domain — getting 'already exists' error. Pl...
- How can I disable client-side account re...
Hi everyone! I’m currently building a game backend using Appwrite, and I’d like to prevent users from creating new accounts directly through the client. My go...