Expand example.

This commit is contained in:
Joe Neeman
2022-11-23 14:46:36 -06:00
parent 923a149e99
commit 9e31f1912f

View File

@@ -12,6 +12,19 @@ async fn main() {
.await .await
.expect("user secret"); .expect("user secret");
let auth = ServiceAccountImpersonationAuthenticator::builder(user_secret.clone(), &svc_email)
.build()
.await
.expect("authenticator");
let scopes = &["https://www.googleapis.com/auth/youtube.readonly"];
match auth.token(scopes).await {
Err(e) => println!("error: {:?}", e),
Ok(t) => println!("token: {:?}", t),
}
// If you configure the authenticator to request id tokens, it will give back id tokens
// instead of access tokens.
let auth = ServiceAccountImpersonationAuthenticator::builder(user_secret, &svc_email) let auth = ServiceAccountImpersonationAuthenticator::builder(user_secret, &svc_email)
.request_id_token() .request_id_token()
.build() .build()