Response-native-sensitive-info gives undefined when trying to get stored data from keychain

Thanks for this great library. I use this library in one of my react project, but whenever I try to get the value stored in keychain it returns undefined on iOS.

Here is what is my use case
1-We have an existing "Native iOS App", which is already present in AppStore to download.
2-Now my client is redeveloping the same app in React-Native, and want to provide this new app as an update to existing users.
3-So we are keeping "Bundle ID" of our new (react-native app) same as that of older app (iOS native app), with higher version number ,so that our new will be downloaded as an updated.
4-Let suppose, an existing user is already logged in the older app, so we want to maintain this logged status , whenever user update app with newer one.
5-In older app (iOS native app), we are saving "Access Token" in keychain, so based on whether "Access Token" is present in keychain, we decide the logged in status of user
6-Now, in newer app (react-native), we have to get that same "Access Token" from keychain, so that we can decide the logged in status of user and can navigate the user to appropriate screen.

I hope that makes sense!

Now when I am using this library, and try to get "Access Token" from keychain, its returning "undefined" in iOS.

Here may be I am doing something wrong, which only you guys can figure out.
This is how I am trying to get saved "Access Token".


    SInfo.getItem("AccessToken", {}).then(value => {
     alert(value);
    console.log("access token is", value); // value1
   });

      

+3


source to share





All Articles