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
- Request for JWKS Endpoint and OIDC Disco...
Hey Appwrite Team, Do you have plans to support JWKS and a well-known OIDC discovery endpoint? This would let us verify Appwrite JWTs in other services using st...
- Cloud 500 error
- Sites are not opening
my all sites are not opening so plz check what is the issue, when i am opening the sites showing an error like, Access to XMLHttpRequest at 'https://cloud.appw...