
is AppwriteException: User (role: guests) missing scope (account) at l.<anonymous> (https://patiyala.vercel.app/_next/static/chunks/169-669b8aff7908ca0e.js:38:8845) at Generator.next (<anonymous>) at a (https://patiyala.vercel.app/_next/static/chunks/169-669b8aff7908ca0e.js:38:2628) page-568c20c68195f2df.js:1
this error occurs only in vercel and doesnt occur in localhost when the user tries to login via google and is redirected afterlogin. Please help.

@Moderator

Could someone help me. it was working just a moment ago and now it doesnt

{ "message": "User (role: guests) missing scope (account)", "code": 401, "type": "general_unauthorized_scope", "version": "0.12.121" }

sessions are getting created though

SSR support comes with 1.5. Cloud is for now in 1.4

Oh

so what do i do now?

The problem is only with google auth and normal sign up works just fine

Hey could you please help me out and maybe provide me with a tutorial or documentation which implements google auth on next js with appwrite?

const currentSession =async()=>{ try{ const session = await account.get();
console.log(session);
console.log(session.userId);
setLoggedInUser(session)
console.log(session.providerEmail);
}
catch(err){
console.log(err)
}
} this is how i am trying to find the user's account which is logged in. this works just fine on local host but doesnt work on the vercel app


"use client";

Hey thanks a lot, but as i told the normal login does work for me its just that google auth is not

the account and the sessions are getting created its just that on redirect it says that AppwriteException: User (role: guests) missing scope (account) and couldnt get the logged in account info

Please help me out with this one

Do you have added the use client in oauth?

yes

How are you handling the success URL of the oauth2?

So i have a function which will check if the users account is used for the first time and then it is pushed db with the basic info of the user

Hey i am still facing the same issue. Could anyone help me pls?

: (

Using this works.
'use client'; // ESSENTIAL!
import { createWebClient } from '@/api/database/createWebClient';
export async function getWebLoggedInUser() {
const { account } = createWebClient();
try {
return await account.get();
} catch (e) {
return null;
}
}

export function createWebClient() {
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1')
.setProject('YOUR_PROJECT');
return {
get account() {
return new Account(client);
}
};
}
export const ID = AID;

What's the browser you're using?
Recommended threads
- OAuth Login Doesn’t Work on iPhone (Safa...
hey there! i am trying to use a custom domain for auth. as i am currently using https://nyc.cloud.appwrite.io/v1 but auth doesn’t work on iphone or safari bec...
- Runtime secret not found. Please re-crea...
Functions aren't working for my project suddenly, They worked fine for the past few weeks and were also working 15-20 minutes ago.
- Unable to see delete option to delete id...
see attached image.
