Creating Test User Account - Discussion

Welcome to the discussion thread about this lecture section. Here you can feel free to discuss the topic at hand and ask questions.

I have some issues trying to create test users for the game.
The CreateEnjinUser mutation now seems only to take a parameter for username, not one for email and password. So with an username I get this response “This mutation can only be executed by an application.”. Any help?

Any updates on this? @filip

https://kovan.cloud.enjin.io/api-docs/enjinuser.doc.html
emailVerified: Boolean @deprecated( reason: “You cannot view the email verification status of users anymore.” )

email: String @deprecated( reason: “You cannot view the email address of users anymore.” )

@CryptoCowboy
Thanks for reaching out!
I am the new mentor for this forum :slight_smile:
Will get back to you ASAP with the solution.

1 Like

Okay Sounds good and looking forward to that Taha.

@CryptoCowboy
Currently, Enjin doesnt require email to use wallet, if you want to track email can do it locally i.e. store in your own database for verification purpose.

Thanks for waiting :slight_smile:

1 Like

@Taha

Okay thank you Taha, I am now handling the players password and email on my own server and now I need to log them into Enjin using only the players “name”. The account manager script uses “email” and “password”. How do I change the account manager script to use “name” instead of “email” and “password”.

EnjinUser user = await EnjinUser.Login(email, password);

@CryptoCowboy
Are you asking about Account manager or user?
Because for account manager we are still using email and password for login and authentication.
But for user only name

source: https://docs.enjin.io/creating-account/#logginginandauthenticatingyourrequests

1 Like

@Taha

I am talking about the AccountManager script. The script works fine for logging in the Admin account that is connected to the wallet daemon. The problem is when I go to create a “test user” the only way I can do that is with “name”. I still get the linking code and everything and connect the “testuser” to the Enjin Wallet. This “testuser” does not have a email or password associated with the Enjin Platform because email and password have been depreciated when creating a new user. I have moved the email and password handling to my own server. What needs to happen now is for the AccountManager script to check if the testuser’s name exist in the Enjin Platform and if so then continue on and if not then create the testuser.

Bellow is the only mutation that works for creating a new player, since email and password have been depreciated.
mutation createNewUser{ CreateEnjinUser ( name: “testuser” ) { id name accessTokens } }

@CryptoCowboy

Yes, I am aware of the depreciation and also testing the create user mutation

Since, email and password is no longer needed, you only have to use name param.

Check below:

 query AuthPlayer($name: String!) {
  AuthPlayer(id: $name) {
    accessToken
    expiresIn
  }
}

source: https://docs.enjin.io/creating-your-integration/#step5logginyouruserin

Let me know for further queries :slight_smile:

1 Like

@Taha

 async public void AuthPlayer()
    {
        string name = emailInput.GetComponent<InputField>().text;
        EnjinUsers user = await EnjinUsers.AuthPlayer(name);
        EnjinIdentities userIdendityOption = await user.GetIdentityForAppId(_appID);

        EnjinIdentities userIdentity = userIdendityOption.Reduce(() => {
            throw new System.Exception("User Identity not Found");

        });

        GoToGame();
    }

This is my attempt at converting the “Login” to “AuthPlayer” using the new SDK. This script is non - functional. If you have a better way please let me know and thank you.

@CryptoCowboy

I am seeing emailInput and not name

Step 1: you can try the query in GraphQL playground.

Step 2: Are you getting any error message? Try debugging in js.

Orelse it will be best to share your code base on GitHub?