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.” )

1 Like

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

2 Likes

Okay Sounds good and looking forward to that Taha.

1 Like

@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:

2 Likes

@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);

1 Like

@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

2 Likes

@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:

2 Likes

@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?

2 Likes

@Taha

Basically looking over at the Enjin forum on this and its looking like this is important,

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

I was able to authorize the player with only their name via the graphql playground and so the question is how to implement this into the AccountManager script.

1 Like

Yes,
I have mentioned the same here :slight_smile:

I will write down the program sample and get back to you

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

Is there any way to make the name kyanisthebest and then how do i log in to the account?
@Taha
@filip

1 Like

Because i am not seeing any password thing in the code nor e-mail so i dont know how to log-in
@Taha
@filip

same here @Taha, @filip etc . Now I only have a new testUser username (no email or password set, or even settable AFAIK) created in my app on kovan enjin, successfully linked to my enjin wallet app. I can’t figure out what to change in AccountManager.cs to get my testUser logged in to the game. There is no email address or password to pass to EnginUser.Login() any more, and there is no obvious AuthPlayer() function in the SDK to pass my testUser username to instead.

Please help! thanks

1 Like

Hey @Billy, hope you are great.

I tried with:

mutation newUser{
  CreateEnjinUser(name:"test1"){
    id accessTokens
  }
}

query viewIdentities{ 
  EnjinIdentities ( pagination: { page: 1, limit: 50 } ) { 
  id app {name} 
  linking_code enj_allowance ethereum_address 
	} 
}

My result on GraphQL was valid, so i suggets you to try it the same way also. Let me know if works for you. :nerd_face:

If you have any more questions, please let us know so we can help you! :slight_smile:

Carlos Z.

1 Like

Hi @thecil yes I can create the user and link a wallet and see the new identity ok in GraphQL. What I can’t see in the AccountManager.cs code is a way to authenticate this user against the Enjin database (“log them into the game”). Can’t the Enjin SDK for Unity do this game user authentication function any more?

@KYNUX @CryptoCowboy sorry to interrupt, did either of you get an actual solution to this from @Taha or anyone else, that gets a new EnjinUser / EnjinIdentity back into the AccountManager.cs C# script for the test user? Clearly, repeating the same GraphQL instructions is not useful to us in a C# function :slight_smile: thanks!

1 Like