Expo Router V2 Authentication session value is null in /(auth)/_layouts.tsx

  1. SDK Version: 49.0.13
  2. Platforms(Android/iOS/web/all): Android

I have created a new expo app using: npx create-expo-app@latest --template tabs@49

If I follow the instructions on Authentication in Expo Router - Expo Documentation but tweaking the ctx.tsx file to authenticate against my oauth provider then after successful sign in which I can see in my logs the app does not render the screen under the (auth) folder but continues to display the sign-in screen.

After adding some more debug logging, I can see that it does actually end up trying to display the page in the (auth) folder but the code in the /(auth)/_layouts.tsx gets to the line checking if (!session) and ends up redirecting back to the sign-in screen. If I log the value of session it says its null. When it redirects back to the sign-in screen and I log the value of session in that screen then it is not null.

If I reload the app at this point then session under /(auth)/_layouts.tsx is not null and renders correctly.

Any idea why session is null on /(auth)/_layouts.tsx immediately after successful sign in and how to fix it?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.