mirror of
https://github.com/tribufu/tribufu-rust
synced 2026-05-06 06:47:28 +00:00
Add dotenv to example
This commit is contained in:
parent
f309fd834c
commit
67fcf7ce3b
2 changed files with 19 additions and 0 deletions
|
|
@ -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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue