After creating an OAuth2 session using createOAuth2Session in Appwrite, the session is created successfully in the cloud console, but when I try to fetch user details on the frontend, account.get() returns null. My web platform is properly connected. What could be causing this and how can I fix it?
code: export async function loader(){ try { return await account.get(); } catch(e) { console.log(e); } }
Exception: User (role: guests) missing scopes (["account"])
This happens because your frontend isn’t getting the Appwrite session cookie, so account.get() runs as a guest. Usually caused by wrong domain settings or calling it server-side. I can help fix it are you running account.get() in the browser or in a server loader?
in the browser
Got it since it’s in the browser, the session cookie still isn’t being set. That usually means the OAuth redirect URL or Web Platform domain in Appwrite is slightly wrong. I can help you fix it quickly if you want feel free to message me and I’ll walk you through the exact setup and get the session working properly. @Sriram
ya Can you say me the exact setup
I am running my application in http://localhost:5173
If you’re on http://localhost:5173, then Appwrite must have that exact URL added in the Web Platform even a small mismatch breaks the session cookie. I can help you check your platform settings and OAuth redirect URLs so the cookie starts working. Just send me a message and I’ll sort it out with you.
Recommended threads
- MFA TOTP State Inconsistency After Disab...
MFA TOTP State Inconsistency After Disable/Re-enable Flow — Invalid Token During Verification Environment: - Next.js - node-appwrite - Session-based authentica...
- Payment Problem
I have got the Pro added the required details but still the Pro is not active
- Getting internal server error 500
Getting internal server error 500 opening my project. Any issues? Thanks