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
- Updating GitHub App access throws error
Steps to reproduce - 1. Have some private repos allowed on the install access 2. New Site/Func > Connect GitHub > see the side card saying `Missing a repo` > cl...
- Update row sheet not loading
After right clicking a row header and click update, the sidebar fails to load (never-ending skeleton)
- Bug report: Race condition in Flutter SD...
Hi team, I've found an intermittent bug in the Flutter SDK (v20.3.0) when using `createOAuth2Session` on Android. **Symptoms** After `createOAuth2Session` re...