
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
- Can't create a function. The user interf...
I am trying to create a server-side function. I am on the free tier. **I already have three functions that work properly** that I created a few months ago. Now,...
- Data Diet Needed
I love the nested related data... but can we request limited data? I think my requests need to go on a diet. I return my courses, and the units all come with th...
- Appwrite Cloud Ui and Server Crashes rep...
I am having trouble with Appwrite cloud and server crashes and Ui crashed repeatedly. Raised a GitHub issue as well. https://github.com/appwrite/appwrite/issues...
