fire-auth-token

Crates.iofire-auth-token
lib.rsfire-auth-token
version0.1.3
created_at2025-02-12 18:46:43.586808+00
updated_at2025-02-16 08:29:41.413335+00
descriptionFirebase Auth Token Verification Crate
homepagehttps://github.com/ajkumar1205/fire-auth-token
repositoryhttps://github.com/ajkumar1205/fire-auth-token
max_upload_size
id1553274
size58,525
Ajay Kumar (ajkumar1205)

documentation

https://docs.rs/fire-auth-tokenate

README

Fire Auth Token

A Rust library for verifying Firebase ID tokens. It handles token validation, public key caching, and automatic background public key refresh using async operations.

Features

  • Verifies Firebase ID token claims
  • Caches and refreshes public keys automatically
  • Handles various error scenarios during token validation

Installation

Add the package with Cargo:

[dependencies]
fire-auth-token = "0.1.2"

Or run

cargo add fire-auth-token

use fire_auth_token::FirebaseAuth;

#[tokio::main]
async fn main() {
    let project_id = "your-project-id".to_string();
    let auth = FirebaseAuth::new(project_id).await;
    let token = "your-firebase-id-token";
    
    // For regular Firebase tokens
    let user = auth.verify_token::<FirebaseAuthUser>(token).await?;

    // For Google Firebase tokens
    let user = auth.verify_token::<FirebaseAuthGoogleUser>(token).await?;
}
Commit count: 8

cargo fmt