I want to get the current user with account.get after an OAuth login like Google but I always GET https://cloud.appwrite.io/v1/account 401 (Unauthorized) User (role: guests) missing scopes (["account"]). I can't find a way to fix it. Can someone help me? Many thanks! FYI: everything works when logging in with email and password
Can you please share your OAuth setup? And more details of your console error?
This is the OAuth function: ```async OAuth() {
try {
return await account.createOAuth2Session({
provider: OAuthProvider.Google,
success: ${process.env.NEXT_PUBLIC_WEBSITE_URL}/dashboard,
failure: ${process.env.NEXT_PUBLIC_WEBSITE_URL}/
});
} catch (error:any) {
throw(error)
}
}```
The console error is nothing more than this: GET https://cloud.appwrite.io/v1/account 401 (Unauthorized) with AppwriteException: User (role: guests) missing scopes (["account"]).
Do you have your client initialized? Like this: const client = new Client()
.setEndpoint("https://cloud.appwrite.io/v1")
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT)
.setSession("current");
Recommended threads
- Auth not working on expo react native
I'm trying to launch a development server with expo go and appwrite as a backend. On my windows pc, I've got a local docker instance of appwrite running as my b...
- createMembership is not sending email wi...
Parameters should be correct. Account and Membership are successfully created. I have a next.js project with localhost origin allowed. I checked spam etc. i...
- Bulk delete failed with 401
- I created a transaction to bulk delete rows in a table has `done` equal `true` follow documentation. But when run, it returns 401 unauthorized error as screen...