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
- Error can not create `tablesdb` event wi...
When i'm trying to add an event with `tablesdb` i get an error message My event value: `tablesdb.mtg-decklist-dev.tables.queue_parsing.rows.*.create` Same err...
- GitHub Student Login Loop Issue
signed up using my GitHub Student Developer Pack. However, whenever I click "Sign in with GitHub", I get stuck on the login page. No matter how many times I try...
- Google OAuth Not Working on Brave/Firefo...
I'm having an issue with Google OAuth in my React + Appwrite app. After login, the dashboard is accessible only in Microsoft Edge, but fails in Brave and Firefo...