I'm trying to get the user data after i log in with otp but it get this error :
AppwriteException: User (role: guests) missing scopes (["account"]) at Generator.next (<anonymous>) { code: 401, type: 'general_unauthorized_scope', response: '{"message":"User (role: guests) missing scopes (["account"])","code":401,"type":"general_unauthorized_scope","version":"1.8.0"}' } Failed to get authenticated user
the error comes from the getAuthunticatedUser function, I also attached 3 images shows my two server actions and the sdk setup repo for full code: https://github.com/MohamedZakidev/store-it
did you follow this tutorial for authentication with SSR? https://appwrite.io/docs/tutorials/nextjs-ssr-auth/step-1
yes actually my code was exactly like the docs but the problem is i donot get a session secret to put as a value in the cookie but one of the lead engineers in appwrite told me that i donot have to setup the cookie it will be set automatically but i still have the same issue
btw iam using otp and not sure this is the reason i donot get a session secret
@Guille
I haven't used it with OTP, when you said you don't get the secret, it's after create the session? Are you using cloud or self-hosting?
Who/where/what were you told?
You're probably not getting the secret because you're not setting an API key
Iam using a dev api key
Ya, you're doing SSR, so you need to do these SSR things
Btw, best to not create duplicate support threads.
Dev key is not API key
I thought it is the same but for development
I can not find the setkey method i only get setDevKey
Maybe you're not using the node SDK
So i should import from node/appwrite not appwrite
Thx i wil try these changes
Yes you need to import from (you need to add it to your project previously)
import { Client } from 'node-appwrite'
thx it works now
[SOLVED] Can not get the logged in user data in NextJS app
Recommended threads
- 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...
- Google Auth not working in a React App
Authentication with Google has failed. It redirects back to the signin route in React. Attached screenshots for configuration of Google console and Appwrite Go...
- Dokploy docker compose
Hey guys hope y'all doing well, I was wondering if anyone could share a working 1.8.0 docker-compose that works with Dokploy I tried making it but it just does...