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
- how to access the value of account statu...
- I can't UNPAUSE my project with the free...
I received an email notifying me that my project had been paused due to inactivity, and the email included a link to "Restore project." However, that button red...
- How to bypass the rate limit on the back...
Once a month my app has a ton of usage and I always run into the Too many requests 429 error. I am trying to optimize the queues and jobs to manage that, but a...