Symptoms:
- When trying to access Gaming Services such as Cloud Code or Cloud Save on a VR application an error is being thrown such as; Access token is missing
unable to validate token
Cause:
The tokens only last for one hour and the Authentication SDK will automatically renew this as the application is running. When a user takes of a VR headset it will go into standby which can cause this one hour window to be missed so when they resume play the token will no longer be valid.
Resolution:
You can set up a retry mechanism in your code to sign the user back in every 5 minutes to counter this or you can sign the user back in when you receive the error and re-attempt the call the Cloud Services.
try
{ (do cloud services call)
}
catch (CloudSaveException e)
{
if (e.Message.Contains("Access token is missing") || e.Message.Contains("token expired"))
{
// Attempt to sign in again
await AuthenticationService.Instance.SignInWithSteamAsync
// Retry your request (do cloud services call)
}
else
{
throw; // some other error
}
}