#steam #login #openid #authenticate

steam-auth

允许您在网站实现“使用Steam登录”功能

4个版本 (1个稳定版)

1.0.0 2019年6月18日
0.3.0 2019年6月16日
0.2.0 2019年6月16日
0.1.0 2019年6月15日

#926 in 认证

Download history 8/week @ 2023-10-29 1/week @ 2023-11-05 9/week @ 2023-11-12 3/week @ 2023-11-19 14/week @ 2023-11-26 9/week @ 2023-12-03 4/week @ 2023-12-10 2/week @ 2023-12-17 8/week @ 2023-12-24 5/week @ 2023-12-31 4/week @ 2024-01-07 1/week @ 2024-01-14 12/week @ 2024-01-21 22/week @ 2024-01-28 3/week @ 2024-02-04 15/week @ 2024-02-11

每月下载量 53

MIT 许可证

18KB
223

Docs.rs Build Status

steam-auth

允许您在网站实现“使用Steam登录”功能。

用法

使用此Crate最简单的方法是使用reqwest-09x功能,该功能允许库代表您发起HTTP请求。否则,您需要手动进行。

使用reqwest-09x功能

// First, create a redirector
let redirector = Redirector::new("https://127.0.0.1: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),
}

有一个异步版本:Verifier::make_verify_request_async,它返回一个future。您还可以将数据反序列化为SteamLoginData结构体,并从该结构体构建一个Verifier,如果这样做更方便。

如果您不想依赖请求,则需要自己发送HTTP请求。请参阅示例服务器Verifier文档以获取更多关于如何执行此操作的信息。

MIT许可。欢迎提交pull请求和贡献。

依赖关系

~3–6.5MB
~158K SLoC