Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/64/steam-auth
Steam authentication library in Rust
https://github.com/64/steam-auth
authentication rust steam
Last synced: about 1 month ago
JSON representation
Steam authentication library in Rust
- Host: GitHub
- URL: https://github.com/64/steam-auth
- Owner: 64
- License: mit
- Created: 2019-06-15T01:26:15.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-18T19:13:36.000Z (over 5 years ago)
- Last Synced: 2024-10-13T16:11:35.829Z (2 months ago)
- Topics: authentication, rust, steam
- Language: Rust
- Homepage:
- Size: 19.5 KB
- Stars: 9
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[![Docs.rs](https://docs.rs/steam-auth/badge.svg)](https://docs.rs/steam-auth)
[![Build Status](https://travis-ci.org/64/steam-auth.svg?branch=master)](https://travis-ci.org/64/steam-auth)# steam-auth
Allows you to implement a 'login with steam' feature on your website.
### Usage
The easiest way to use this crate is with the `reqwest-09x` feature which allows the library to
make HTTP requests on your behalf. Otherwise, you will need to do that manually.Using the `reqwest-09x` feature:
```rust
// First, create a redirector
let redirector = Redirector::new("http://localhost:8080", "/callback").unwrap();// When a user wants to log in with steam, (e.g when they land on the `/login` route),
// redirect them to this URL:
let redirect_url = redirector.url();// Once they've finished authenticating, they will be returned to `/callback` with some data in
// the query string that needs to be parsed and then verified by sending an HTTP request to the steam
// servers.
match Verifier::make_verify_request(&reqwest::Client::new(), querystring) {
Ok(steam_id) => println!("Successfully logged in user with steam ID 64 {}", steam_id),
Err(e) => eprintln!("There was an error authenticating: {}", e),
}
```There is an asynchronous variant: `Verifier::make_verify_request_async` which returns a
future. You can also deserialize the data into a `SteamLoginData` struct and construct a
`Verifier` from that if it is more convenient.If you don't want to depend on request, you'll need to send the HTTP request yourself. See the
[example server](https://github.com/64/steam-auth/blob/master/examples/server.rs) and the
`Verifier` documentation for more details on how this can be done.MIT Licensed. Pull requests and contributions welcome.