Reputation: 10715
I'm trying to figure out a way to switch current user programmatically with backendless sdk (Android and iOS) but stuck with it so maybe someone already faced the same issue and was able to solve it.
The issue in more details.
I have an app which supports multiplayer flow - several users can login simultaneously using the same device and play in turn - the app switches current user accordingly.
I'm actually migrating from Parse.com
where I was able to solve this task using user's token which was saved during login. Then Parse just had a function like loginWithToken and as long as token is valid the sdk switched current user so I can perform further calls to parse using the corresponding user identity.
I'm trying to find similar functionality with backendless
but with no luck. BackendlessUser
also has a token but I can't find a way to use it further to switch current user. I've asked backendless support but all they responded is like "here is the sdk sources, find yourself" and "this question is not covered by free support"
Please if anyone faced the same scenario advice on a way to proceed with backendless current user switching.
Upvotes: 0
Views: 67
Reputation: 119031
It's currently private API in iOS. The token is stored in a dictionary in the main interface class, you could replace that (using the private key) and then call getPersistentUser
on the UserService
. You'd also need to be sure to set setStayLoggedIn:
.
For Android you could perhaps use Backendless.UserService.setCurrentUser(user);
, though I haven't tried keeping multiple users all logged in at the same time.
Upvotes: 1