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:

1 Like