AuthenticatorBuilder.subject() does not work
cc8dea2e-4a29-4394-af6d-af0ccc73647a opened this issue · 0 comments
cc8dea2e-4a29-4394-af6d-af0ccc73647a commented
Domain-wide delegation is enabled for the organisation in the Google Admin console, but a cant use AuthenticatorBuilder.subject(), i get an error - Error(GoogleApiError(MissingToken(AuthError(AuthError { error: UnauthorizedClient, error_description: Some("Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested."), error_uri: None }))))
.
let gsa = oauth2::read_service_account_key("path.json").await.?;
let auth = oauth2::ServiceAccountAuthenticator::builder(gsa)
.subject("username@domain.name")
.build()
.await?;
let hub = Sheets::new(
hyper::Client::builder().build(
hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.https_or_http()
.enable_http1()
.build(),
),
auth,
);
I'm sure there are no problems with the access settings, because similar code in Python works.
What am I doing wrong?