Back

oAuth Problem with session (Google)

  • 0
  • Web
TrxsTer
29 Oct, 2024, 10:08

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.

TypeScript
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",
  });
}
TL;DR
Developers are experiencing an issue with Google OAuth in a project using Next.js. The consent flow works, but expected session data is not received at /success. The solution to consider is enabling the "allow third-party cookie" setting.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more