Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Update with-expo.mdx

Akosde0082e8006a
diff --git a/apps/docs/pages/guides/getting-started/tutorials/with-expo.mdx b/apps/docs/pages/guides/getting-started/tutorials/with-expo.mdx
index b60db313a51..e5e150532f8 100644
--- a/apps/docs/pages/guides/getting-started/tutorials/with-expo.mdx
+++ b/apps/docs/pages/guides/getting-started/tutorials/with-expo.mdx
@@ -38,6 +38,7 @@ Then let's install the additional dependencies: [supabase-js](https://github.com
```bash
npm install @supabase/supabase-js
npm install react-native-elements @react-native-async-storage/async-storage react-native-url-polyfill
+npx expo install expo-secure-store
```
Now let's create a helper file to initialize the Supabase client.
@@ -46,15 +47,27 @@ These variables will be exposed on the browser, and that's completely fine since
[Row Level Security](/docs/guides/auth#row-level-security) enabled on our Database.
```ts title=lib/supabase.ts
-import AsyncStorage from '@react-native-async-storage/async-storage'
+import * as SecureStore from "expo-secure-store";
import { createClient } from '@supabase/supabase-js'
+const ExpoSecureStoreAdapter = {
+ getItem: async (key: string) => {
+ return await SecureStore.getItemAsync(key);
+ },
+ setItem: async (key: string, value: string) => {
+ SecureStore.setItemAsync(key, JSON.stringify(value));
+ },
+ removeItem: async (key: string) => {
+ await SecureStore.deleteItemAsync(key);
+ },
+};
+
const supabaseUrl = YOUR_REACT_NATIVE_SUPABASE_URL
const supabaseAnonKey = YOUR_REACT_NATIVE_SUPABASE_ANON_KEY
export const supabase = createClient(supabaseUrl, supabaseAnonKey, {
auth: {
- storage: AsyncStorage as any,
+ storage: ExpoSecureStoreAdapter as any,
autoRefreshToken: true,
persistSession: true,
detectSessionInUrl: false,