question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Delete sensitive info when app is reinstalled

See original GitHub issue

I currently use Sensitive Info to save the login tokens etc. I now have a problem where if a user uninstalls the app without logging out, then reinstalls the app on the same phone, the app crashes because it still thinks its logged in.

How can I make sure to delete any relevant information in keychain upon 1st Install? Can this be included in the base library?

I found a workaround on StackOverflow which suggested putting this native code in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

Basically

    //Clear keychain on first run in case of reinstallation
  if (![[NSUserDefaults standardUserDefaults] objectForKey:@"FirstRun"]) {
      // Delete values from keychain here
      [[NSUserDefaults standardUserDefaults] setValue:@"1strun" forKey:@"FirstRun"];
      [[NSUserDefaults standardUserDefaults] synchronize];
  }

I need to insert code in the //Delete values from keychain section, but am not sure how to go about doing this.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:7

github_iconTop GitHub Comments

3reactions
virdesaicommented, Dec 4, 2019

You can do this without needing to modify native code by implementing AsyncStorage as that stored value will be gone between uninstalls

import AsyncStorage from '@react-native-community/async-storage';
...
            try {
                const firstRun = await AsyncStorage.getItem('firstRun');
                if (!firstRun) {
                    await SInfo.deleteItem(key, secureStorageConfig);
                    await AsyncStorage.setItem('firstRun', 'true');
                } else {
                    const persistedState = await SInfo.getItem(
                        key,
                        secureStorageConfig,
                    );
                    if (persistedState) {
                        // do something with existing values
                    }
                }
            } catch (error) {
                console.log({ error });
            }
... 
0reactions
stale[bot]commented, Jul 10, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Do apps really delete all the info they have on you ... - Quora
Yes most of the apps delete all the data kept on your device but some just keep the data for backup purpose. Some...
Read more >
The 4 Things You Need to Do Before Deleting an App
The right way to remove an app completely​​ First, delete all your data on the app. While the instructions for erasing data are...
Read more >
What data (of or about the app) remains in the device after the ...
When an app is uninstalled, the user will be deleted. Any data left ... Nature of Application Cache: may be and may not...
Read more >
Delete an application - ServiceNow Docs
Navigate to System Applications > Applications. Click the name or icon of the application that you want to delete. In the application record, ......
Read more >
Control which third-party & internal apps access Google ...
App verification is Google's program to ensure that third-party apps accessing sensitive customer data pass security and privacy checks. Users may be blocked ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found