mirror of
https://github.com/tribufu/sdk-rust
synced 2025-06-15 18:54:19 +00:00
Add dotenv to example
This commit is contained in:
@ -25,4 +25,5 @@ serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = { version = "1.0", features = ["raw_value"] }
|
||||
|
||||
[dev-dependencies]
|
||||
dotenv = "0.15.0"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
|
18
examples/token.rs
Normal file
18
examples/token.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved
|
||||
|
||||
use dotenv::dotenv;
|
||||
use std::env;
|
||||
use tribufu::*;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
dotenv().ok();
|
||||
|
||||
let client_id = env::var("CLIENT_ID").unwrap().parse::<u64>().unwrap();
|
||||
let client_secret = env::var("CLIENT_SECRET").unwrap();
|
||||
|
||||
let client = TribufuClient::new(client_id, client_secret).unwrap();
|
||||
let token = client.get_token().await.unwrap();
|
||||
|
||||
println!("{:?}", token)
|
||||
}
|
Reference in New Issue
Block a user