I'm currently working on a project using Next.js and have set up Google OAuth authentication. The consent screen flow is functioning correctly, and it redirects users to the target redirect URI, /success. However, I'm not receiving the expected session data, and I'm unsure what's going wrong. I've looked through similar issues in the threads and saw a suggestion to enable the allow third-party cookie setting, which I have done, but the issue persists. Although user data is available in the Appwrite console, I'm not getting the results I expected.
await account.createOAuth2Session(
OAuthProvider.Google,
redirectUri,
failureUri,
["email", "profile", "openid"]
);
} catch (error) {
console.error("OAuth session creation failed:", error);
toast({
title: "Oh no!",
description: "Something went wrong! Please try again later.",
variant: "destructive",
});
}
am facing the same issue
What information are you not getting that you were expecting to get?
If you're using SSR, you should probably follow this: https://appwrite.io/docs/products/auth/server-side-rendering#oauth2
It is not SSR and this is the message I am getting in the console log in the /success page
/success.tsx
useEffect(() => {
const handleSuccess = async () => {
try {
const session = await account.getSession("current");
if (session) {
const user = await account.get();
dispatch(login());
toast({
title: "Login successful!",
description: `Welcome, ${user.name}!`,
variant: "success",
duration: 2000,
});
router.push("/user-profile");
} else {
throw new Error("No session found");
}
} catch (error) {
console.error("Auth success error:", error);
toast({
title: "Login failed!",
description: "Something went wrong. Please try again.",
variant: "destructive",
duration: 2000,
});
router.push("/sign-in");
} finally {
setIsLoading(false);
}
};
did it solve?
Then, it's probably a 3rd party cookie problem.
For local development, maybe you can change your browser settings to enable 3rd party cookies.
In production, you'll need to use custom domains
Recommended threads
- type generation on same columns in table
is there way to prevent this ? or only need to update column name like table prefix?
- Unable to send verification email
Hi! I’m trying to access my project on Appwrite Cloud (fra.cloud.appwrite.io), but I keep getting this popup saying: “To continue using Appwrite Cloud, please...
- Converting circularstructure to JSON
Hello đź‘‹, when this will be fixed on Appwrite Sites? It's draining our quotas for Sentry, it must be a problem with the default logger which is always on for Ap...