ProjectClientis to instantiate it. During this we must specify which network we are using. Our choices are Mainnet, JumpNet, and Goerli. URLs for these networks can be programmatically acquired from the
EnjinHostsclass and passed to the clients. The chosen network must match the one we created our project on.
AuthProjectrequest, we must first gather our project's UUID and secret key. To do so, we may navigate to our project page on the Enjin platform and find these items under
AuthProjectrequest we have created.
AuthProjectrequest is shown below:
AccessTokenclass representing the platform's
Authtype. Before retrieving the data however, we may want to consider checking if the response was successful. To do so, we can use the method shown below and get its result:
AccessTokenmodel from the response. This may be done with the code shown below:
AccessTokenwe can now pass the string token contained within to the client's authentication method.
AccessTokenas shown below:
CreatePlayerrequest, which is for new players that do not yet exist for our project. The other way to acquire a player's access token is via the
AuthPlayerrequest, which is used for existing players.
CreatePlayerrequest, we provide the ID of the new player we wish to add to our project as shown below:
CreatePlayerrequest to the platform and if successful we will get the player's access token in the response as shown below:
AuthPlayerrequest, we must specify the ID of the player whom we wish to authenticate for as shown below:
AuthPlayerrequest to the platform and get the player's access token.
ProjectClientand its related classes we will be using the
AuthPlayerrequests. To do so, we call the respective authentication method and provide the string token contained within.