Hello,
I'm trying to call CombuDemoUser user = (CombuDemoUser)CombuManager.localUser; after a CallWebservice callback, but it's turning up empty. Do you have any tips for what I could do?
After a callback if CombuManager.instance.isAuthenticated is false. Is there a way I can make sure this scope appears after the callback?
Thanks for your help.
Josh
Did you use the overload Authenticate<CombuDemoUser>? Else the authentication will instantiate the user object with the standard User class.
FRANCESCO CROCETTI @ SKARED CREATIONS
This is an example call that's causing the problem. Is there a way i can have isAuthenticated equal true?
CombuDemoUser user = (CombuDemoUser)CombuManager.localUser;
user.emailInput = "mike@example.com";
user.ResetPassword(user.emailInput, (bool success, string error) => {
if (CombuManager.instance.isAuthenticated) {
Debug.Log("true");
} else {
Debug.Log("false");
}
});
I don't understand what you're doing, there isn't any non-static overload of ResetPassword that accepts a string and a callback. Also setting the email at runtime without calling Update will have no effect because the reset password email is sent to the email registered on database.
About the casting localUser to CombuDemoUser class will work, as already said, only if you used the overload Authenticate<CombuDemoUser> (take a look at the code here).
Also "isAuthenticated" had an issue that was fixed in version 2.1 that has been just released on this website and sent to Asset Store yesterday (but will take some days to be available there).
FRANCESCO CROCETTI @ SKARED CREATIONS
Apologies. I had modified that method and didn't realize it until I read your reply. Really the issue is every callback loses authentication (I had the new isAuthenticated installed). After a callback like the below, a second call to something isn't possible. Do you know a way I can do this? It would help a lot if I could make a second call. Here is an example from the sample application. Thanks much for any help!
textCustom.text = "Loading...";
CombuDemoUser user = (CombuDemoUser)CombuManager.localUser;
user.customData[customKey.text] = customValue.text;
user.Update((bool success, string error) => {
if (CombuManager.instance.isAuthenticated) {
Debug.Log("true");
} else {
Debug.Log("false");
}
});
Wait...there may have been a problem in one of my scripts that was messing things up. I'm doing some testing now.
I tried the following and it works, so there should be something else in your other code/scripts that is invalidating the local user:
CombuManager.platform.Authenticate( "aa", "aa", (bool success, string error) => {
Debug.Log("First: " + CombuManager.instance.isAuthenticated);
CombuManager.localUser.customData["test"] = "ok";
CombuManager.localUser.Update((bool success2, string error2) => {
Debug.Log("Second: " + CombuManager.instance.isAuthenticated);
});
});
FRANCESCO CROCETTI @ SKARED CREATIONS
Yes, I agree. Thanks for sticking with me. Investigating now why this is happening.