Menu

1 / 2

Supabase OAuth in Expo: Why Sign-In Never Comes Back to Your App

DEV Community: reactnative·Chris F A·about 22 hours ago
#QpndCxbU
#devtoreactnative#devto#dev#expo#supabase
Reading 0:00
15s threshold

TL;DR

OAuth in Expo returns to your app through a custom scheme like myapp:// .

Three things must agree: scheme in app.json , the redirectTo from makeRedirectUri() , and Supabase's Redirect URLs allowlist.

makeRedirectUri() returns exp://... in Expo Go and myapp://... in a dev build. Allowlist the one you actually use.

Changing scheme needs a rebuild. An OTA update won't do it.

Debug step one: console.log(makeRedirectUri()) on the device.

The setup

app.json :

{ "expo" : { "scheme" : "myapp" } }

Enter fullscreen mode

Exit fullscreen mode

Supabase dashboard, Authentication > URL Configuration > Redirect URLs:

myapp://**

Enter fullscreen mode

Exit fullscreen mode

( * stays inside one path segment, ** matches anything including / .)

The code

npx expo install expo-auth-session expo-web-browser expo-linking

Enter fullscreen mode

Exit fullscreen mode

import { makeRedirectUri } from ' expo-auth-session ' ; import * as QueryParams from ' expo-auth-session/build/QueryParams ' ; import * as…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.