12 stable releases

2.3.1 Oct 10, 2024
2.2.0 Jul 18, 2024
2.0.0 Mar 23, 2024
1.2.2 Oct 8, 2023
1.0.0 Feb 23, 2023

#70 in Authentication

Download history 3407/week @ 2024-08-21 4451/week @ 2024-08-28 5115/week @ 2024-09-04 3016/week @ 2024-09-11 2567/week @ 2024-09-18 4464/week @ 2024-09-25 2346/week @ 2024-10-02 2824/week @ 2024-10-09 3083/week @ 2024-10-16 2315/week @ 2024-10-23 3806/week @ 2024-10-30 2791/week @ 2024-11-06 3126/week @ 2024-11-13 3909/week @ 2024-11-20 2729/week @ 2024-11-27 2083/week @ 2024-12-04

12,164 downloads per month

MIT license

120KB
3K SLoC

Firebase Admin SDK for Rust

The Firebase Admin Rust SDK enables access to Firebase services from privileged environments. Designed to be scalable and reliable with zero-overhead for performance in mind.

Currently supports

  • GCP service accounts
  • User and custom authentication management
  • Firebase emulator integration and management
  • Firebase OIDC token and session cookie verification using asynchronous public certificate cache

Example for interacting with Firebase on GCP

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("me@email.com".into())
        .build()
)
.await
.expect("Error while fetching user")
.expect("User does not exist");

println!("User id: {}", user.uid);

For more examples please see https://github.com/expl/rs-firebase-admin-sdk/tree/main/examples

Dependencies

~20–35MB
~657K SLoC