mirror of
https://github.com/supabase/supabase.git
synced 2026-10-18 15:49:09 +03:00
## 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>
32 lines
961 B
TypeScript
32 lines
961 B
TypeScript
import { createClient } from '@supabase/supabase-js';
|
|
import { deleteItemAsync, getItemAsync, setItemAsync } from 'expo-secure-store';
|
|
|
|
const ExpoSecureStoreAdapter = {
|
|
getItem: (key: string) => {
|
|
console.debug("getItem", { key, getItemAsync })
|
|
return getItemAsync(key)
|
|
},
|
|
setItem: (key: string, value: string) => {
|
|
if (value.length > 2048) {
|
|
console.warn('Value being stored in SecureStore is larger than 2048 bytes and it may not be stored successfully. In a future SDK version, this call may throw an error.')
|
|
}
|
|
return setItemAsync(key, value)
|
|
},
|
|
removeItem: (key: string) => {
|
|
return deleteItemAsync(key)
|
|
},
|
|
};
|
|
|
|
export const supabase = createClient(
|
|
process.env.EXPO_PUBLIC_SUPABASE_URL ?? '',
|
|
process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY ?? '',
|
|
{
|
|
auth: {
|
|
storage: ExpoSecureStoreAdapter as any,
|
|
autoRefreshToken: true,
|
|
persistSession: true,
|
|
detectSessionInUrl: false,
|
|
},
|
|
},
|
|
);
|