Start a new topic

Changing User email invalidated credentials?

I am using createAutogeneratedUser when the app first launches if there is no active user or saved credentials. This user is basically a 'guest', but it is possible to update the user with email, name etc at a later date. If I quit the app without changing anything, it logs back in with the saved credentials as it should and I immediately have an activeUser. If I change the email, etc and quit the app, it still has saved credentials when it launches but it never resolves to an active user.

I read in another thread that changing the special attributes alters the auth token, but I can't find any way to refresh it. Even if I didn't use an auto-generated user at first, the user would need to be able to edit those fields.

Can anybody offer any insights as to what's happening, and if there's a solution.

What version of the library are you using? How do you update the new user with the email?
Kinvey Framework is version is 1.26.2

I'm setting the attributes that support it with dot notation and then saving the user object.

[KCSUser activeUser].email = email;

[[KCSUser activeUser] saveWithCompletionBlock:^(NSArray *objectsOrNil, NSError *errorOrNil)

It actually seems unable to use the saved credentials to log in again from any user that has been modified from the auto-generated user.

The basic auto-generated user seems to always work.

When I log in with an updated user or update the auto-generated user's data, the saved credentials no longer work when launching the app.
Could it have something to do with changing to a staging environment? I've changed back with no difference, but I could see it potentially causing trouble with the keychain. I really can't think of why a newly logged in user wouldn't be able to use saved credentials.

It's hard to troubleshoot this sort of thing since the Kinvey SDK is pretty opaque. Do you have any tips for how to proceed? Any thoughts on things that could be causing it?
Can you describe more about your use of environments? The tokens are different for each environment, even if you copy the user data between them; this means a user created in one environment cannot be used in another, at least not without log-out and re log-in.
We were initially using a development environment, which we cloned to a staging environment. I've tried both newly created and old users in both environments with the same results. Whenever the user is modified from the originally created user, the automatic login fails on launch. Whether a fresh login or modified after first login.
I think I've finally found the answer but I'm not sure I understand why it was causing the issue. After logging in or registering a new user I was clearing the data store cache like so.

[KCSLinkedAppdataStore clearCaches];

I was calling this method because old data was showing up when showing the logged-in interface and this fixed that issue. I would have preferred to clear out a specific instance of KCSLinkedAppdataStore for the data I needed to clear, but I couldn't find any way to do so. Regardless, I don't understand how the user is tied to the data store class. Can someone provide a little explanation as to why this would happen?
Clearing the caches also clears out the user cache which will mess up the active user. It is better to logout the active user, which should reset the app state.
So there is no supported method to clear data caches while logged in?

On a separate note, and I can start a new thread if necessary, but when I log out during data retrieval it crashes the app. Is there a way to suspend all data store queries before logging out?
Unfortunately, no
Login or Signup to post a comment