Skip to content

Firebase Auth Token Validation library Via their REST API for Public Keys, Caches it and updates the keys in it the background.

Notifications You must be signed in to change notification settings

ajkumar1205/fire-auth-token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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?;
}

About

Firebase Auth Token Validation library Via their REST API for Public Keys, Caches it and updates the keys in it the background.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages