ProjectClientis to instantiate it. To do so we must utilize a builder class nested within the client.
EnjinHostsclass and passed to the builder.
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:
ProjectClientclass may be setup to automatically reauthenticate itself before its access token expires. To do so we must first return to our client builder and make a call to its method which enables automatic reauthentication.
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.