
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
- Confused whether to use GDrive or Appwri...
I am making a blogging site. right now I'm using GDrive to host the blog post's banner + inline images. my thinking was that since GDrive has 15GB storage I sho...
- getting error while creating membership
i am getting some errors what is the correct way to write this? i am using react and appwrite
- One-time login
Sometimes, for example, when a user logins in on a public computer, they want the login status to be one-time. How to achieve this?
