10个稳定版本
2.2.0 | 2024年7月18日 |
---|---|
2.1.0 | 2024年6月22日 |
2.0.0 | 2024年3月23日 |
1.2.2 | 2023年10月8日 |
1.0.0 | 2023年2月23日 |
#68 in 身份验证
3,917每月下载量
115KB
3K SLoC
为Rust提供的Firebase管理SDK
Firebase管理Rust SDK允许从受信任环境中访问Firebase服务。它旨在可扩展且可靠,并考虑到性能的零开销。
当前支持
- GCP服务账户
- 用户和自定义身份验证管理
- Firebase模拟器集成和管理
- 使用异步公开证书缓存验证Firebase OIDC令牌和会话cookie
与GCP上的Firebase交互的示例
use rs_firebase_admin_sdk::{
auth::{FirebaseAuthService, UserIdentifiers},
client::ApiHttpClient,
App, credentials_provider,
};
// Load your GCP SA from env, see https://crates.io/crates/gcp_auth for more details
let gcp_service_account = credentials_provider().await.unwrap();
// Create live (not emulated) context for Firebase app
let live_app = App::live(gcp_service_account.into()).await.unwrap();
// Create Firebase authentication admin client
let auth_admin = live_app.auth();
let user = auth_admin.get_user(
// Build a filter for finding the user
UserIdentifiers::builder()
.with_email("[email protected]".into())
.build()
)
.await
.expect("Error while fetching user")
.expect("User does not exist");
println!("User id: {}", user.uid);
更多示例请参阅 https://github.com/expl/rs-firebase-admin-sdk/tree/main/examples
依赖项
~21–35MB
~685K SLoC