Files
Chris Chinchillaandcoderabbitai[bot] c0f7e7dfd1 docs: Rework Expo React native social auth (#43017)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

Reworks Expo React native social to use appropriate auth methods and
restructures to use external code.

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-02-23 08:54:17 +01:00

35 lines
907 B
TypeScript

import AsyncStorage from '@react-native-async-storage/async-storage';
import { createClient } from '@supabase/supabase-js';
import 'react-native-url-polyfill/auto';
const isSSR = typeof window === 'undefined';
const ExpoWebSecureStoreAdapter = {
getItem: (key: string) => {
if (isSSR) return null;
console.debug("getItem", { key })
return AsyncStorage.getItem(key)
},
setItem: (key: string, value: string) => {
if (isSSR) return;
return AsyncStorage.setItem(key, value)
},
removeItem: (key: string) => {
if (isSSR) return;
return AsyncStorage.removeItem(key)
},
};
export const supabase = createClient(
process.env.EXPO_PUBLIC_SUPABASE_URL ?? '',
process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY ?? '',
{
auth: {
storage: ExpoWebSecureStoreAdapter,
autoRefreshToken: true,
persistSession: true,
detectSessionInUrl: false,
},
},
);