Manual Authentication
If you would prefer to wait for a time that better suits you for Immerse authentication or would simply like to have more control or a better view of the authentication process, this can be done manually. First you will need to disable auto authenticate.
The manual authentication process is done 3 steps as details below.
First step is to get the session credentials. The GetCredentials
method will attempt to get credentials based on the app’s build target.
var credentials = await ImmerseSession.GetCredentials();
Next step is to retrieve the session data, including the user’s identity. This step will also validate that the token retrieved from the previous step is valid.
var session = await ImmerseSession.Join(credentials);
Finally initialize reporting. This will send launched
and initialized
statements for your session and validate that the app is now authenticated and able to send additional reporting statements.
var result = await ImmerseReporting.Initialize(session);
Sample scripts are included with the Platform package that perform the manual authentication process. The sample MonoBehaviour scripts also provide UnityEvents that are triggered on a success or failure to authenticate. These scripts are a great source for reference or can be used as is.
If you are creating an app that will not have any of the expected credentials sources, or you are testing using the join on device utility, you can use a PIN for authentication. A sample script is included to aid in supporting this in your app.
The ImmerseAuthenticationWithPIN
script requires a prefab with a PINInput
component, which will be instantiated when required. When creating your prefab, please refer to the PINInput
field’s tooltips for more information.