Back

Still unauthenticated after successful oauth flow

  • 1
  • Accounts
  • Web
  • Cloud
فاااااا دي
17 Dec, 2023, 11:27

I m encoutering an error from long time and I tried to fixed but nothing seems to work. So I m trying to make a Google sign in / Login option in my locally hosted website, I did this

import { account } from "@/Appwrite/Appwrite_config"; const google_auth =async () => { try { await account.createOAuth2Session("google", "http://localhost:3000/", "http://localhost:3000/ }catch(err){ console.log(err) } };

then I click and sign with my Google account everything work and I find myself in the Auth / users section, but whenever I ties to get that user info or the session info it comes with this error

Unhandled Runtime Error AppwriteException: User (role: guests) missing scope (account) [Profil].jsx: GET https://cloud.appwrite.io/v1/account 401 (Unauthorized)

Btw this is how I did to get the info in [profil].jsx

TypeScript
const getAccount = async () => {
    const accountData = await account.get();
    console.log("rrrrrrrrrrrrrrrrr",accountData);
  };

  useEffect(() => {
    getAccount();
  }, []);

Please what's is the problem ?

TL;DR
User is experiencing an issue where they are still unauthenticated after a successful OAuth flow. They suspect it may be related to 3rd party cookies. The suggested solution is to enable 3rd party cookies. In production, a custom domain is needed. The user also mentions a formatting tip for using code blocks. They provide their code and error message. The error message suggests a missing scope for the user. The user also includes code where they try to fetch user info, but it results in a 401 Unauthorized error. They ask for help in identifying the problem. Solution: The user is missing the required scope (account). They need
Drake
17 Dec, 2023, 19:36

Please use a clear summary in the title to make it easier for people to quickly understand your problem and search for it if they face the same problem

Also, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting

Drake
17 Dec, 2023, 19:39

You're probably running into a problem with 3rd party cookies. You can search around for discord for similar questions.

In short, you can try to enable 3rd party cookies. You can try to enable 3rd party cookies to test.

In production, you'll need a custom domain: https://appwrite.io/docs/custom-domains

Drake
17 Dec, 2023, 19:40

Still unauthenticated after successful oauth flow

فاااااا دي
17 Dec, 2023, 23:47

Best support ever seen 🙏

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