
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
- Show execution status 500 unable to set ...
I want to set the labels at the time user signup to my application , all things work , users data save in auth, updateprefs set , a verification email sent , bu...
- Oauth provider access token is empty
I created oauth with github it seems the provider access token is empty how to fix this?
- No access control allow origin -blocked ...
im not sure what exaclty im doing wrong - its my first time using appwrite - and im watching a tutorial about how to create a movie app and followed everything ...
