Appwrite account.get() returns null and session cookie not stored on localhost #10825
Replies: 1 comment
-
|
This is almost always a cookie/redirect issue with OAuth on localhost. Here's what's likely happening and how to fix it: Most common fix: Add localhost as a Web platform In the Appwrite Console:
Without this, Appwrite won't set the session cookie for your origin. This is the most commonly missed step. Check your SDK setup: import { Client, Account } from 'appwrite'
const client = new Client()
.setEndpoint('https://fra.cloud.appwrite.io/v1')
.setProject('YOUR_PROJECT_ID')
const account = new Account(client)After the OAuth redirect returns to your app, the session should already be established. Make sure you're calling Check your redirect URLs:
Debug with DevTools: SameSite cookie note: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem:
When I call account.get() after login, it returns null.
I also noticed that the session cookie isn’t being stored in the browser.
Setup:
React app running on http://localhost:5173
Appwrite endpoint: https://fra.cloud.appwrite.io/v1
Using OAuth login (Google) with success and failure URLs pointing to localhost
Browser: Chrome, third-party cookies are allowed
What I’ve tried:
Verified success/failure URLs in Appwrite console
Allowed third-party cookies in Chrome
Beta Was this translation helpful? Give feedback.
All reactions