Start a new topic

Saved Credentials after deleting the app

I recently updated the iOS SDK from 1.22.0 to 1.26.6;



I use the following logic to check whether a user is logged in already or not:



if ([KCSUser hasSavedCredentials] == NO) {

// show login screen

} else {

// proceed into the app

}



While the user is logged in, if I delete the app and reinstall the app, the hasSavedCredentials method returns a YES, so the logic proceeds to let the user into the app, but all the server calls fail with a 'No Authorization Found' error:



The documentation says the credentials are saved in the Keychain and persist even after an app install and that we can use the hasSavedCredentials to check if the user is available and the user will be loaded on the first call to Kinvey (http://devcenter.kinvey.com/ios/guides/users#login).



Please let me know if there is anything else we need to do to get this functionality to work the way it did.

I encountered the same problem. Using [KCSUser activeUser] solved it. 

On the other hand, this means [KCSUser hasSavedCredentials] leads to errors after deleting and reinstalling the app. 

Correct. Keeping a user logged in between installs is not supported.
Hi Mike,

We are not logging out of the app. Here's the basic flow we are expecting:

1. User logs in

2. The app is deleted while user is still logged in

3. User reinstalls the app



The expected result is that the user is still logged in. But it sounds like the credentials are saved in the keychain, but they won't be valid. Does the SDK no longer support the idea of keeping the user logged in if the app is deleted and reinstalled?
Arun,



Are you logging the user out of the app before deleting it? The keychain is preserved even when the app is deleted, so restored credentials are likely to be invalid.



I agree that the documention is a little confusing here, so I'll clean it up. Try using `[KCSUser activeUser] != nil` as your check instead.
Hey Arun, Apologies for the delay, our lead iOS dev is on holiday for a few days. We've got this question on our radar.
Login or Signup to post a comment