Reputation: 45
I've recently decided to try and make a universal app with expo supporting ios, android and web altogether. I knew that there would be many hick ups along the way.. but I found the biggest problem from the start. I can see that there are few options as where to store the access token for apps such as secure store or asyncStorage, I just simply can't find a way to work with cookies or any client side store to put in the access-token.
As my app should have the stay logged in feature essentially, this will be a critical problem for the web client.
Does anybody know a good workaround this matter, or is there a way to keep the users logged in from the server side using the device / ip detail..?
Please enlighten me guys!
Upvotes: 0
Views: 1563
Reputation: 51
For andoid and ios you should use ExpoSecure Storage. For web I currently can only rely on the normal storage, but this seems not to be secure. One option would be to safe it in a cookie but thats something i dont realy like.
Upvotes: 0
Reputation: 1119
The web support is available in asyncStorage since v1.9.0.
So you can use it in recent versions of asyncStorage.
Upvotes: 1
Reputation: 930
I've managed to do this with AsyncStorage.
import AsyncStorage from '@react-native-community/async-storage';
/// Then inside your component make an asynchronous set
await AsyncStorage.setItem(['tokenName', tokenValue]);
Upvotes: 0