appwrite / sdk-for-web

[READ-ONLY] Official Appwrite Web SDK ๐Ÿงก
https://appwrite.io
BSD 3-Clause "New" or "Revised" License
273 stars 59 forks source link

React Native / Expo support #20

Closed brunoprietog closed 1 year ago

brunoprietog commented 2 years ago

๐Ÿ”– Feature description

Hello! Can this sdk be used with React Native? I was thinking that things like authentication with oauth providers would not work. Thanks!

๐ŸŽค Pitch

Perhaps some alternative methods could be implemented for executions in these environments.

๐Ÿ‘€ Have you spent some time to check if this issue has been raised before?

๐Ÿข Have you read the Code of Conduct?

rohankm commented 1 year ago

As react native does not have window.localstorage, implementing the same with AsyncStorage from '@react-native-async-storage/async-storage'; would be more sense.

i was checking the docs of supabase. This is how they did it

import AsyncStorage from '@react-native-async-storage/async-storage';
import { createClient } from '@supabase/supabase-js'

const supabaseUrl = YOUR_REACT_NATIVE_SUPABASE_URL
const supabaseAnonKey = YOUR_REACT_NATIVE_SUPABASE_ANON_KEY

export const supabase = createClient(supabaseUrl, supabaseAnonKey, {
  localStorage: AsyncStorage as any,
  autoRefreshToken: true,
  persistSession: true,
  detectSessionInUrl: false,
});

implementing something like this would be helpful

stnguyen90 commented 1 year ago

@brunoprietog, cookies should work automatically in react native. Would you be able to verify if oauth doesn't work in react native?

stnguyen90 commented 1 year ago

Closing in favor of some of the other React Native issues