Skip to content

Commit

Permalink
refactor: save origin code
Browse files Browse the repository at this point in the history
  • Loading branch information
youmts committed Mar 10, 2023
1 parent 182191f commit 19abf31
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ impl ServiceAccountAuthenticator {
}

pub(crate) async fn service_account_authenticator(
scopes: &[&str],
scopes: Vec<&str>,
sa_key_file: &str,
) -> Result<Arc<dyn Authenticator>, BQError> {
let sa_key = yup_oauth2::read_service_account_key(sa_key_file).await?;
ServiceAccountAuthenticator::from_service_account_key(sa_key, scopes).await
ServiceAccountAuthenticator::from_service_account_key(sa_key, &scopes).await
}

#[derive(Deserialize)]
Expand Down Expand Up @@ -256,5 +256,5 @@ pub(crate) async fn authorized_user_authenticator<S: AsRef<Path>>(
scopes: &[&str],
) -> Result<Arc<dyn Authenticator>, BQError> {
let authorized_user_secret = yup_oauth2::read_authorized_user_secret(secret).await?;
AuthorizedUserAuthenticator::from_authorized_user_secret(authorized_user_secret, &scopes).await
AuthorizedUserAuthenticator::from_authorized_user_secret(authorized_user_secret, scopes).await
}
3 changes: 2 additions & 1 deletion src/client_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ impl ClientBuilder {
}

pub async fn build_from_service_account_key_file(&self, sa_key_file: &str) -> Result<Client, BQError> {
let sa_auth = service_account_authenticator(&self.auth_base_as_str_urls(), sa_key_file).await?;
let scopes = &self.auth_base_as_str_urls();
let sa_auth = service_account_authenticator(scopes, sa_key_file).await?;

let mut client = Client::from_authenticator(sa_auth);
client.v2_base_url(self.v2_base_url.clone());
Expand Down

0 comments on commit 19abf31

Please sign in to comment.