[][src]Crate steam_auth

Allows you to implement a 'login with steam' feature on your website.

Usage

First, obtain the URL to which users should be redirected to start the login process:

let redirect_url = steam_auth::get_login_url("http://localhost:8080", "/callback").unwrap();

After redirecting the user to this URL, they will be returned to /callback with some data in the query string that needs to be deserialized into a SteamAuthResponse. Then, verify the data (this makes an HTTP request to the steam servers):

// deserialize query string into auth_response: SteamAuthResponse
match steam_auth::verify_response(&reqwest::Client::new(), auth_response) {
    Ok(id) => println!("Successfully logged in user with STEAMID64: {}", id),
    Err(e) => println!("Login unsuccessful: {}", e),
}

There's also an asynchronous variant on steam_auth::verify_response_async.

See the example server for more details.

Structs

SteamAuthResponse

Represents the data that is returned by Steam to the callback URL.

Enums

Error

Functions

get_login_url

Obtains the URL to which users should be redirected to start the login process

verify_response

Verifies callback data (synchronous)

verify_response_async

Verifies callback data (asynchronous)