To link to your development build or standalone app, you need to specify a custom URL scheme for your app. You can register a scheme in your app config (app.json, app.config.js) by adding a string under the scheme
key:
In your project's auth settings add the redirect URL, e.g. com.supabase://**
.
Finally, implement the OAuth and linking handlers. See the supabase-js reference for instructions on initializing the supabase-js client in React Native.
import { Button } from "react-native";
import { makeRedirectUri } from "expo-auth-session";
import * as QueryParams from "expo-auth-session/build/QueryParams";
import * as WebBrowser from "expo-web-browser";
import * as Linking from "expo-linking";
import { supabase } from "app/utils/supabase";
WebBrowser.maybeCompleteAuthSession(); // required for web only
const redirectTo = makeRedirectUri();
const createSessionFromUrl = async (url: string) => {
const { params, errorCode } = QueryParams.getQueryParams(url);
if (errorCode) throw new Error(errorCode);
const { access_token, refresh_token } = params;
if (!access_token) return;
const { data, error } = await supabase.auth.setSession({
const performOAuth = async () => {
const { data, error } = await supabase.auth.signInWithOAuth({
skipBrowserRedirect: true,
const res = await WebBrowser.openAuthSessionAsync(
if (res.type === "success") {
await createSessionFromUrl(url);
const sendMagicLink = async () => {
const { error } = await supabase.auth.signInWithOtp({
email: "example@email.com",
emailRedirectTo: redirectTo,
export default function Auth() {
// Handle linking into app from email app.
const url = Linking.useURL();
if (url) createSessionFromUrl(url);
<Button onPress={performOAuth} title="Sign in with Github" />
<Button onPress={sendMagicLink} title="Send Magic Link" />
For the best user experience it is recommended to use universal links which require a more elaborate setup. You can find the detailed setup instructions in the Expo docs.