Creating Test User Account - Discussion

Hey @Billy

Could you please show me where are you downloading the script? Might be an deprecated library, but i want to be sure anyway.

Carlos Z

Sure @thecil it was from https://ivanontech-academy.s3.eu-north-1.amazonaws.com/Enjin-course/EnjinRefactoredSDK-academy.unitypackage
Thanks

Did you manage to figure this one out? I have the same problem, thereā€™s no documentation for Unity SDK API. I have no idea which functions there are outside of the ones @filip used in the course and so thereā€™s no way in me being able to know how to authenticate to a specific User in C# Unity after logging in via email and password. :slightly_frowning_face:

1 Like

sort of. As per Improvement Suggestions - Discussion, I ended up downloading and using the more current SDK from the Asset Store. Then I figured out they seem to have done away with ā€œin-Enjinā€ authentication in the SDK so you have to implement it yourself in your own code or some other server you run somewhere with some kind of user/email/password database. For the purposes of this course, you can just fake it and assume any old password is acceptable and then just grab the userā€™s details from Enjin without ā€œlogging them inā€. My ā€˜loginā€™ code for the newer SDK:

public static AccountManager instance;

    // Start is called before the first frame update
    void Start()
    {
        if (AccountManager.instance == null) {
            AccountManager.instance = this;
        }

      StartPlatform(PLATFORM_URL, APP_ID, APP_SECRET); // New SDK init method
      LoginAdmin();
    }

    // Update is called once per frame
    void Update()
    {

    }

async public void LoginAdmin() {
  adminIdentity = GetIdentity(9535);  // My game Admin id
  Debug.Log(adminIdentity.id);
}

  async public void Login() {
    string email = emailInput.GetComponent<InputField>().text;
    string password = passwordInput.GetComponent<InputField>().text;
    User user =  GetUser(email); //Assume password ok and just get user details from Enjin SDK
    Debug.Log(user.identities[0]);

    userIdentity = user.identities[0];
    Debug.Log(userIdentity.id);

    SceneManager.LoadScene("MainScene");

  }

HTH, cheers!

2 Likes

Awesome, Iā€™ll get the new version of the SDK and authenticate this way. Thanks for the response! :slight_smile:

2 Likes

I am having this error, and couldnā€™t find why

error

Did you log into the web site first before using the graphiql playground?

Yes of course i did sir :disappointed_relieved:

Hmm the error suggested otherwise. Did you do it in the same browser session, not incognito or anything like that? Same behaviour in another browser?

1 Like

I could do it via the playground, but i think my problems are not over yet. I will follow your solution for my upcoming problems, hope theyā€™ll still work :v: @Billy

2 Likes