Skip to content

bug: better-auth session remains null despite valid cookies in React Native/Expo #1380

@Lyons800

Description

@Lyons800

Provide environment information

System: OS: macOS 15.5 CPU: (14) arm64 Apple M4 Pro Memory: 116.08 MB / 24.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm pnpm: 9.6.0 - ~/.nvm/versions/node/v22.14.0/bin/pnpm

Describe the bug

When using better-auth with Discord OAuth in the React Native/Expo app, cookies are being set and returned correctly, but the session object remains null. The authentication flow appears to work (user gets redirected back, cookies are present), but useSession(), getSession(), and listSessions() all return null/empty results.

Link to reproduction

https://github.com/t3-oss/create-t3-turbo

To reproduce

  1. Fresh install of create-t3-turbo template
  2. Configure better-auth with Discord OAuth provider
  3. Run Expo development server
  4. Attempt to sign in with Discord
  5. Observe that cookies are set but session is null

Additional information

Expected behavior
After successful Discord OAuth flow, the session should be populated with user data.

Actual behavior
`LOG session null
LOG getSession result {"_h": 0, "_i": 0, "_j": null, "_k": null}
LOG listSessions result {"_h": 0, "_i": 0, "_j": null, "_k": null}
LOG cookies ; __Secure-better-auth.session_token=PVuP6dAgjwv......

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions