This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub type SharedTokenManager = Arc<Mutex<TokenManager>>; | |
#[tokio::main] | |
async fn main() -> anyhow::Result<()> { | |
... | |
let shared_token_manager = { | |
let manager = TokenManager::new(&config.google_application_credentials) | |
.context("Failed to create token manager")?; | |
SharedTokenManager::new(Mutex::new(manager)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DISCLAIMER: This code is provided as is without any warranties. It's primarily for learning and informational purposes. | |
// The author does not guarantee that the code is fit for any particular purpose and will not be responsible for any damage or loss resulting from the use of this code. | |
// The author does not assume liability for the code. | |
use crate::error::ResponseError; | |
use anyhow::anyhow; | |
use serde_json::json; | |
use crate::config::Config; | |
use reqwest::Client; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DISCLAIMER: This code is provided as is without any warranties. It's primarily for learning and informational purposes. | |
// The author does not guarantee that the code is fit for any particular purpose and will not be responsible for any damage or loss resulting from the use of this code. | |
// The author does not assume liability for the code. | |
use anyhow::Result; | |
use std::time::{Duration, SystemTime}; | |
use jsonwebtoken::{encode, EncodingKey, Header}; | |
use reqwest::Client; | |
use serde_json::json; |