rc_api_process_login_response - RetroAchievements/rcheevos Wiki

Parses the response for logging a user into the RetroAchievements API.

Syntax

int rc_api_process_login_response(
    rc_api_login_response_t* response,
    const char* server_response
);

Parameters

response

The rc_api_login_response_t to construct.

server_response

The body of the HTTP response received from the server.


struct rc_api_login_response_t 
{
  const char* username;
  const char* api_token;
  unsigned score;
  unsigned num_unread_messages;
  rc_api_response_t response;
};

username

The case-corrected name of the user being logged in. This should be passed to future API requests for the user.

api_token

The API token to pass to future API requests for the user.

score

The player's current score.

num_unread_messages

The number of unread messages in the player's inbox on the website.

response

Common server-provided response information. Contains a succeeded flag, and an error_message field.

Return value

If the function succeeds, the return value is RC_OK. Otherwise, the error code can be converted to a string using [[rc_error_str]].

Remarks

NOTE: It is important to capture the case-corrected username as returned by this API. Some API calls will fail if passed an incorrectly cased username.

The rc_api_login_response_t must be destroyed by [[rc_api_destroy_login_response]] when the caller is done with it.

Minimum version: 10.0.0

See also

[[rc_api_init_login_request]]

[[rc_api_destroy_login_response]]