* docs(react-native): create the basic expo project * docs(react-native): cross-platform Apple social sign-in * docs(react-native): cross-platform Google social sign-in * docs(react-native): fix typos * docs(react-native): remove wrong entry in the `Connection` component * Correct typos * Prettier * Draft * Draft * docs(react-native): use kebab-case file naming convention in Expo guide - use kebab-case file naming convention in Expo guide - add trailing semicolon to align with the standard Expo template conventions * docs(react-native): use kebab-case file naming convention in Expo social auth example * docs(react-native): update the packages of the Expo social auth example * Fix * Draft * Changes * Correct log message --------- Co-authored-by: Chris Chinchilla <chris.ward@supabase.io> Co-authored-by: Chris Chinchilla <chris@chrischinchilla.com>
32 lines
960 B
TypeScript
32 lines
960 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,
|
|
},
|
|
},
|
|
);
|