mirror of
https://github.com/OMGeeky/yup-oauth2.git
synced 2026-02-23 15:50:00 +01:00
Expand example.
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user