obabichev / react-token-auth

84 stars 22 forks source link

React-native support ? #8

Closed revskill10 closed 2 years ago

revskill10 commented 4 years ago

I see if we use AsyncStorage then this library could universally support both web and mobile ?

obabichev commented 4 years ago

Hi, yeah, it's not a problem to use any storage you want.

At the current moment, you can specify the storage as a parameter. Limitation - this storage should provide the same methods as the browser's localStorage (setItem, getItem, removeItem).

If AsyncStorage has another API you can create a wrapper around it (or I can add this wrapper into the library).

It might be a small problem if AsyncStorage has async API and its methods return promises, but it is not a big deal to fix it.

obabichev commented 4 years ago

I looked at the AsyncStorage and I think I can add support of it.

I just will need to write it a bit careful to keep synchronous approach for synchronous storages (like localStorage in Browsers) and asynchronous for asynchronous storages (like AsyncStorage)

obabichev commented 2 years ago

Quite a lot of time passed but I needed to rewrite the library in order to add support of RN, but now (in version 2) it works.