Skip to main content
Version: SDK-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
    message : bad bad,accessToken,,Invalid accessToken, Invalid bad, accessToken,, Invalid accessToken

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

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.");
}
}
}