#firebase #user #sdk #admin #service-account #gcp

rs-firebase-admin-sdk

为Rust提供的Firebase管理SDK

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 身份验证

Download history 32/week @ 2024-04-20 32/week @ 2024-04-27 15/week @ 2024-05-04 24/week @ 2024-05-11 17/week @ 2024-05-18 34/week @ 2024-05-25 11/week @ 2024-06-01 11/week @ 2024-06-08 3/week @ 2024-06-15 215/week @ 2024-06-22 27/week @ 2024-06-29 36/week @ 2024-07-06 109/week @ 2024-07-13 59/week @ 2024-07-20 700/week @ 2024-07-27 3047/week @ 2024-08-03

3,917每月下载量

MIT许可协议

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