API Reference
GoogleServiceAccountCredentialSource
Credential source that acquires Google access tokens by exchanging a signed service-account JWT assertion.
Inheritance
- Object
- GoogleServiceAccountCredentialSource
Usage
Explore 2 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 2
Constructors
public GoogleServiceAccountCredentialSource(String clientEmail, String privateKeyPem, String? tokenEndpoint = null, GoogleWorkspaceSessionOptions? sessionOptions = null) #Creates a service-account credential source from an email identity and PKCS#8 PEM private key.
Parameters
- clientEmail System.String
- Service-account email used as the JWT issuer.
- privateKeyPem System.String
- RSA private key in PEM form used to sign JWT assertions.
- tokenEndpoint System.String? = null
- OAuth token endpoint, or null for Google's default endpoint.
- sessionOptions OfficeIMO.GoogleWorkspace.GoogleWorkspaceSessionOptions? = null
- Optional delegation, HTTP-client, and timeout settings.
Methods
public async Task<GoogleWorkspaceAccessToken> AcquireAccessTokenAsync(IEnumerable<String> scopes, CancellationToken cancellationToken = default) #Task<GoogleWorkspaceAccessToken>Acquires an access token and its available scope evidence for the requested operation.
Parameters
- scopes System.Collections.Generic.IEnumerable<System.String>
- OAuth scopes required by the pending operation.
- cancellationToken System.Threading.CancellationToken = default
- Token used to cancel acquisition.
Returns
A task that produces the acquired token and its scope and identity evidence. Callers must verify that the evidence covers their required scopes.
public Void Dispose() #VoidReleases the token-cache lock and the internally created HTTP client, if any.
public static GoogleServiceAccountCredentialSource FromFile(String serviceAccountJsonPath, GoogleWorkspaceSessionOptions? sessionOptions = null) #GoogleServiceAccountCredentialSourceCreates a credential source from a Google service-account JSON file.
Parameters
- serviceAccountJsonPath System.String
- Path to the service-account JSON file.
- sessionOptions OfficeIMO.GoogleWorkspace.GoogleWorkspaceSessionOptions? = null
- Optional delegation, HTTP-client, and timeout settings.
Returns
A configured credential source.
public static GoogleServiceAccountCredentialSource FromJson(String serviceAccountJson, GoogleWorkspaceSessionOptions? sessionOptions = null) #GoogleServiceAccountCredentialSourceCreates a credential source from a Google service-account JSON document.
Parameters
- serviceAccountJson System.String
- JSON containing client_email, private_key, and optionally token_uri.
- sessionOptions OfficeIMO.GoogleWorkspace.GoogleWorkspaceSessionOptions? = null
- Optional delegation, HTTP-client, and timeout settings.
Returns
A configured credential source.
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
Properties
public String ClientEmail { get; } #Gets the service-account email used as the JWT issuer.
public String TokenEndpoint { get; } #Gets the OAuth endpoint used to exchange signed JWT assertions.
public String? SubjectUser { get; } #Gets the Workspace user to impersonate when domain-wide delegation is enabled.
public Boolean UseDomainWideDelegation { get; } #Gets whether domain-wide delegation was requested for generated JWT assertions.
public TimeSpan TokenLifetime { get; } #Gets the requested lifetime of signed JWT assertions and fallback access-token lifetime.
public TimeSpan RefreshSkew { get; } #Gets how early a cached token is refreshed before its expiry.