Skip to main content
Version: SDK-5.9.6

OnOtherDeviceLoginDetectedError

Description

This handler is called automatically when you use a currently connected account to log in with another device.
The handler is called when the following error is returned:

When the refresh_token expired because the user logged in to another device
statusCode : 401
errorCode : BadUnauthorizedException
message : bad refreshToken, Invalid refreshToken

For the handler to work, the BACKND Inspector window's Auto Refresh Token field must be enabled.

Example

    void Start() {
if(Backend.IsInitialized) {
Backend.ErrorHandler.InitializePoll(true);

Backend.ErrorHandler.OnOtherDeviceLoginDetectedError = () => {
Debug.Log("External login detected!!!");
gameObject.GetComponentInChildren<Text>().text = "Login detected from another device.";
};
}
}

void Update() {
if(Backend.ErrorHandler.UseAsyncQueuePoll) {
Backend.ErrorHandler.Poll();
}
}

External thread

void Start() {
Backend.ErrorHandler.OnOtherDeviceLoginDetectedError = () => {
Debug.Log("External login detected!!");
};
}