What currently happens is that right after deleting the anonymous player from unity cloud dashboard, pressing play in unity editor first shows,
[Authentication]: Request failed: 401, {“detail”:“The session token is not valid.”,“details”:[ ],“status”:401,“title”:“INVALID_SESSION_TOKEN”}
Then,
[Authentication]: The session token is invalid and has been cleared. The associated account is no longer accessible through this login method.
After that a warning,
WebRequestException: {“detail”:“The session token is not valid.”,“details”:[ ],“status”:401,“title”:“INVALID_SESSION_TOKEN”}.
This has never happened before when I deleted an anonymous player from unity cloud, usually it just signs in with a new anonymous player. I also have not changed the script in any way that should affect this, and I have tried rolling back to previous versions when it worked perfectly fine but I suppose deleting the account messed everything up.
When I now press a button that triggers the cloud code script, on the first try it says: CloudCodeException: AccessTokenMissing Access token is missing - ensure you are signed in through the Authentication SDK and try again.
This doesn’t go away until I press play again to stop the game, then upon pressing the second time, there are no errors relating to access tokens or session tokens but two other errors, and I am almost certain the previous errors although gone are what is causing my next errors: a script error and a 422 HttpException unprocessable entity error. Before, there was never this process of warnings after deleting an anonymous player, which leads me to believe these script errors are actually caused by the deleted account.
The two errors that now appear when I try to click a button that executes some cloud code function is this:
ScriptRunner.Exceptions.CloudCodeRuntimeException: Error executing Cloud Code function. Exception type: AggregateException. Message: One or more errors occurred. (Unauthorized)
After this, no matter what I reverted the cloud code files to, the HTTP 422 error would pop up. It specifies these two specific lines:
List plantList = await GetPlants(_executionContext, _gameApiClient);
And the corresponding line in GetPlants():
var result = gameApiClient.RemoteConfigSettings.AssignSettingsGetAsync(ctx, ctx.ServiceToken, ctx.ProjectId,
ctx.EnvironmentId, null, new List { “PlantList” });
The only thing that could possibly have changed was, after deleting the anonymous player and getting the session token errors (and then these script errors), I thought it best to change the ctx.AccessToken to ctx.ServiceToken for the moment thinking unity might have been confused because the previous player was deleted.
I’ve tried changing it back and forth from AccessToken back to ServiceToken to no avail. I’ve tried clearing the session tokens, to no avail. I am not even sure anymore it’s these two lines specifically (as they occur early on. Perhaps if it gets past this point there will be more errors). Again, they all worked perfectly fine before. I am completely lost as to what could be happening here. Any help would be appreciated-