How to keep client JSON web token secure in a React Native app?

前端 未结 3 1901
谎友^
谎友^ 2021-02-05 17:25

We are building a React Native app for iOS and we are using an internal API built on node + express + jsonwebtoken.

When the user logs in with username/password, the ser

3条回答
  •  说谎
    说谎 (楼主)
    2021-02-05 18:17

    For iOS, you'd store that in the keychain... https://auth0.com/docs/libraries/lock-ios/save-and-refresh-jwt-tokens

    Here's a couple ways of doing that in react native that I found. There may be others. There may be better options. This is just what I found quickly.

    https://github.com/search?utf8=%E2%9C%93&q=react-native+keychain

    For Android, you'd store that in either the SharedPreferences or maybe even better the KeyStore since it's encrypted there.

提交回复
热议问题