I want to figure how to convert guest user into logged in user.
I am not registering new user. The user already exists. But she logged out and now restarted the app with guest login. Now when she logs in, all the guest data should link back to actual account.
Could not find the code in documentation for this point.
Guest user accounts created with the Anonymous Login API documented below can be “converted” to regular users using the User Registration API. The BackendlessUser object used in the registration request must contain the same value for the objectId property as the one returned in the response for the Anonymous Login API request.
Are you sure the user you are trying to convert is a guest user?
You are converting a user who has a well-defined email and password. This is not a guest user. Therefore you are getting an error.
var res = Backendless.UserService.LoginAsGuest();
BackendlessUser registeredUser = new BackendlessUser();
registeredUser.Email = "test@testt.com";
registeredUser.Password = "123234";
registeredUser.ObjectId = res.ObjectId;
registeredUser = Backendless.UserService.Register(registeredUser);
Hi
This is what I have been saying, it supports new user registration. I want to login with existing user.
Lets say user runs the app first time, and it logs in as guest. Then they register. Then sign out and closes the app,.
Next time they run the app and logs in as guest again. Now they will login (not register), so I want all the guest user data to be moved to the logged in user. How is that possible?
If I understood you correctly - you need to do this:
You need to get user(that user registered early) by objectId from database. Then put properties(that you need to update) from guest user to user that you got. Then you need to update user and login to it with login and password.