Custom User class w...
 
Notifications
Clear all

Custom User class with AuthenticatePlatform

4 Posts
2 Users
0 Reactions
403 Views
(@sgeorge)
Posts: 6
Active Member
Topic starter
 

Hi all, new here.

Following the steps, I've created a custom class m80User.

I have been using the AuthenticatePlatform call to Auto create a user account and associate it with a combu user. Which works fine. Next step was to add my custom user class <m80User> in this case.

On success, I try to cast CombuManager.localUser as M80User but it remains Null. Am I missing something here? I am sure after I get more familiar with the code base, it will become more apparent but the custom User example I followed is for standard account creation flow. I need to do the same for AuthenticatePlatform flow.

CombuManager.localUser.AuthenticatePlatform<M80User>(platformName, platformID, (bool success, string error) => {
                if (success)
                {
                   
                    Debug.Log("Login success: ID " + CombuManager.localUser.id);
                    M80User user = CombuManager.localUser as M80User;
                    RequestInventoryData();
                }

                else
                {
                    Debug.Log("Login failed: " + error);
                   
                }

Β 

 
Posted : 28/04/2021 7:40 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

You're right, please edit the method AuthenticatePlatform<T> in the Unity script User.cs inside the callback after the check onΒ success (it should be lines 1021-1022) and change it to this:

_authenticated = true;
T user = new T ();
user.FromJson(result["message"].ToString());
CombuManager.instance.SetLocalUser(user);

This change will be applied to the next incoming update as well, thank you for the report.

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 30/04/2021 8:46 am
(@sgeorge)
Posts: 6
Active Member
Topic starter
 

@skaredcreations

Correct me if I am wrong but I think it should be like this, otherwise Authenticated will always be false.

T user = new T();
user._authenticated = true;
user.FromJson(result["message"].ToString());
CombuManager.instance.SetLocalUser(user);
 
Posted : 30/04/2021 5:44 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

@sgeorged yes indeed 😎 

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 30/04/2021 6:26 pm
Share: