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
- CORS errors in Obsidian custom plugin
Hi, anyone here familiar with obsidian community plugins? In short: it's a local first note app which supports writing your own add-ons / plugin But I keep get...
- > AppwriteException: The requested servi...
When trying to read or write from my database I get the following error: > AppwriteException: The requested service is disabled. You can enable the service from...
- Courtesy limit reset for non-profit migr...
Hi Team! I'm the architect for a 501(c)(3) non-profit project (Aaria's Blue Elephant) and we just hit our Free plan Database Read limit (currently at 164%). Th...