Hello! I have a specific question about session handling between Expo and Next.js using Better Auth.

My setup:
  • Next.js web app with Better Auth
  • Expo mobile app that authenticates through Better Auth
    Everything works for authentication, but I need help with session handling.
Specifically:
In my Next.js app, this code works perfectly for web logins:
```typescript
const session = await auth.api.getSession({
headers: headersList,
});
return session?.user;


But when logging in from Expo, the session isn't recognized.
Question:
What's the correct way to ensure auth.api.getSession() can recognize and return the session for users logged in through the Expo app? Do I need to pass specific headers or use a particular configuration to make this work?
Was this page helpful?