mirror of
https://github.com/OMGeeky/yup-oauth2.git
synced 2026-01-23 18:35:08 +01:00
Tie ServiceAccount's into Authenticator.
Prior to this change DeviceFlow and InstalledFlow were used within Authenticator, while ServiceAccountAccess was used on it's own. AFAICT this was the case because ServiceAccountAccess never used refresh tokens and Authenticator assumed all tokens contained refresh tokens. Authenticator was recently modified to handle the case where a token does not contain a refresh token so I don't see any reason to keep the service account access separate anymore. Folding it into the authenticator provides a nice consistent interface, and the service account implementation no longer needs to provide it's own caching since it is now handled by Authenticator.
This commit is contained in:
@@ -4,7 +4,7 @@ use yup_oauth2::ServiceAccountAuthenticator;
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let creds = yup_oauth2::service_account_key_from_file("serviceaccount.json").unwrap();
|
||||
let sa = ServiceAccountAuthenticator::builder(creds).build().unwrap();
|
||||
let sa = ServiceAccountAuthenticator::builder(creds).build().await.unwrap();
|
||||
let scopes = &["https://www.googleapis.com/auth/pubsub"];
|
||||
|
||||
let tok = sa.token(scopes).await.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user