# Handle login errors

> Reference the handle login errors.

When your game client receives an event from the Vivox SDK, evaluate if it was successful. For login, this is stored in the `status_code` field and should be 0. If it is non-zero your application should follow the below steps to attempt to reconnect.

Check for success:

```cpp
void HandleLoginResponse(vx_resp_account_anonymous_login *resp)
{
    if (resp->base.return_code == 1)
    {
        printf(U, resp->base.status_code, vx_get_error_string(resp->base.status_code));
        return;
    }
    vx_req_account_anonymous_login *req = reinterpret_cast<vx_req_account_anonymous_login *>(req->base.request);  
	printf("login succeeded for account %s\n", req->acct_name);
}
```

For a more detailed login process flow, refer to [Sign in to a game](../developer-guide/client-sdk-basics/sign-in-to-game).

If login is unsuccessful, follow these steps:

1. Print an error to the debug log or the client event capture location.

2. Attempt to retry the login:

   1. Craft and submit a new Login Token on each retry.
   2. Wait for 10 seconds between retries.
   3. After 5 failed retries, inform the user that voice chat services are not available.
   4. Retry on the next match or party invite or in 15 minutes, whichever comes first.
   5. Write the failure to a client log or a server log. Include the `status_code`.

## Verify your login implementation

1. Verify the username transmitted to Vivox does not contain any Personally Identifiable Information (PII). For example, any actual Names, XBox/PSN User ID’s, etc.
2. Account name format is unique and properly formatted for individual player.
3. Account name is set up to be reused every time the player logs in.
4. `vx_resp_account_anonymous_login` `status_code` is zero.
5. `vx_evt_account_login_state_change` state is `login_state_logged_in`.
6. The handler for `vx_evt_account_login_state_change` detects when the state field is `login_state_logged_out` and initiates a re-login if the client did not initiate the logout.
7. The client submits a `vx_req_account_logout` request before the client application exits.

Once you confirm that you are logging users in successfully you can continue on to [joining and leaving channels](./core-joining-leaving-channels).
