8 stable releases

2.0.0 Mar 23, 2024
1.2.2 Oct 8, 2023
1.2.1 Jul 15, 2023
1.2.0 Jun 21, 2023
1.0.0 Feb 23, 2023

#112 in Authentication

Download history 4/week @ 2023-12-29 4/week @ 2024-01-05 2/week @ 2024-02-02 19/week @ 2024-02-09 18/week @ 2024-02-16 63/week @ 2024-02-23 118/week @ 2024-03-01 57/week @ 2024-03-08 62/week @ 2024-03-15 169/week @ 2024-03-22 84/week @ 2024-03-29 19/week @ 2024-04-05

339 downloads per month

MIT license

115KB
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, AuthenticationManager,
};

// Load your GCP SA from env, see https://crates.io/crates/gcp_auth for more details
let gcp_service_account = AuthenticationManager::new().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

~21–38MB
~730K SLoC