How to store tokens in react native?

前端 未结 6 1295
萌比男神i
萌比男神i 2021-02-05 05:59

I used to develop in android previously and i used to used SharePreference for storing user tokens. Is there anything such available in react native for both ios and android?

6条回答
  •  星月不相逢
    2021-02-05 06:17

    Try this example from React Native Expo

    Note: This example is for unencrypted usage so if you want secure storage so visit this page for nore information https://docs.expo.io/versions/latest/sdk/securestore

    Reference: Unencrypted https://reactnavigation.org/docs/en/auth-flow.html#set-up-our-navigators Encrypted https://docs.expo.io/versions/latest/sdk/securestore

    class SignInScreen extends React.Component {
      static navigationOptions = {
        title: 'Please sign in',
      };
    
      render() {
        return (
          
            

提交回复
热议问题