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
- general_route_not_found - Auth Guide
If you’ve just added a subdomain to your project, verified your DNS records, and confirmed your SSL certificate is working, but you're still hitting a `general_...
- Can't resume paused project
I have logged in in incognito, done the email verification and still get the invalid fingerprint error. What's the issue.
- How to Display File in Web?
I'm trying to use Appwrite's Storage to store images and display them in my app, however when I use the `getFileView`, `getFileDownload` or `getFilePreview` met...