Skip to main content
Version: 5.9.6

IsBadAccessTokenError

public bool IsBadAccessTokenError();

Description

When a Bad AccessToken error occurs because 24 hours have passed after login or an attempt is made to log in via another device, 'true' is returned.
When 24 hours have passed since login, you can call Backend.BMember.RefreshTheBackendToken to resolve the issue.

When logging in from another device, the access token must be reissued by logging in manually, which can be done through custom login or federation sign-in.

The included error cases are as follows:

  • When the user's Access Token is wrong or expired
    statusCode : 401
    errorCode : BadUnauthorizedException

  • When the user's Access Token is wrong or expired upon logging in
    statusCode : 401
    errorCode : BadUnauthorizedException

Example

BackendReturnObject bro = Backend.GameData.Get("tableName", new Where());

if(bro.IsSuccess())
{

}
else
{
if(bro.IsBadAccessTokenError())
{
Debug.Log("When the access token is expired");

var bro2 = Backend.BMember.RefreshTheBackendToken();
if(bro2.GetMessage() == "bad refreshToken")
{
Debug.Log("Logged in from another device.");
}
}
}