[][src]Function mojang_api::server_auth

pub async fn server_auth<'_, '_>(
    server_hash: &'_ str,
    username: &'_ str
) -> Result<ServerAuthResponse>

Performs server-side authentication using the given server hash and username.

The server hash can be retrieved using server_hash. Obtaining it requires the server's public RSA key and the secret key being used for encryption with the client.

Performing this request also requires the client's username. Servers should use the value sent in the Login Start packet.

The request is performed asynchronously, and this function is async.

See wiki.vg for more information.

Examples

// Obtain the server hash and username...
let hash = server_hash();
let username = username();

// Make the API request
let response = mojang_api::server_auth(&hash, &username).await?;