Skip to content

Commit

Permalink
Update document
Browse files Browse the repository at this point in the history
  • Loading branch information
mochi-neko committed Jan 6, 2024
1 parent 9f3aab5 commit 15b35b2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,15 +371,20 @@ Provides ID token verification of the Firebase Auth.
A sample code to [verify ID token](https://firebase.google.com/docs/auth/admin/verify-id-tokens#verify_id_tokens_using_a_third-party_jwt_library) with [tokio](https://github.com/tokio-rs/tokio) and [anyhow](https://github.com/dtolnay/anyhow) is as follows:
```rust
use fars::verification;
use fars::VerificationConfig;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = reqwest::Client::new();
// Create a cofig for verification.
let cofing = let config = VerificationConfig::new(
"firebase-project-id".to_string(),
);
// Get an ID token of the Firebase Auth.
let id_token = "id-token".to_string();
let project_id = "firebase-project-id".to_string();
match verification::verify_id_token(&client, &id_token, &project_id).await {
// Verrify the ID token.
match config.verify_id_token(&id_token).await {
Ok(claims) => {
// Verification succeeded.
},
Expand Down
2 changes: 1 addition & 1 deletion src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
//! ```
//!
//! ### Get user data
//! An example of getting user data with [tokio](https://github.com/tokio-rs/tokio) and [anyhow](https://github.com/dtolnay/anyhow) is as follows;
//! An example of getting user data with [tokio](https://github.com/tokio-rs/tokio) and [anyhow](https://github.com/dtolnay/anyhow) is as follows:
//!
//! ```rust
//! use fars::api;
Expand Down
2 changes: 1 addition & 1 deletion src/verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//!
//! // Verify the ID token.
//! match config.verify_id_token(
//! "id-token".to_string(),
//! "id-token".to_string(),
//! ).await {
//! Ok(claims) => {
//! // Verification succeeded.
Expand Down

0 comments on commit 15b35b2

Please sign in to comment.