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
- Realtime for files() works almost well, ...
I have been trying to make use of realtime, today (14.03.26) I have pulled all the latest versions of docker images, and sdk available. Whats working: - Conn...
- Function issue
Hi,idk whats wrong with my function but i made some changes to the env var and made sure they saved then i redeployed it,but then after it redeeployed it asked ...
- Function issue
Hi,idk whats wrong with my function but i made some changes to the env var and made sure they saved then i redeployed it,but then after it redeeployed it asked ...