27 lines
872 B
Rust
27 lines
872 B
Rust
use rs_firebase_admin_sdk::{
|
|
auth::{FirebaseAuthService, UserIdentifiers},
|
|
client::ApiHttpClient,
|
|
App, AuthenticationManager,
|
|
};
|
|
|
|
async fn test() {
|
|
// 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);
|
|
} |