Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/

API Reference

Class

GoogleServiceAccountCredentialSource

Namespace OfficeIMO.GoogleWorkspace
Assembly OfficeIMO.GoogleWorkspace
Source revision 33d062b583cb with working tree changes
Implements
Modifiers sealed

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.

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 requiredposition: 0
Service-account email used as the JWT issuer.
privateKeyPem System.String requiredposition: 1
RSA private key in PEM form used to sign JWT assertions.
tokenEndpoint System.String? = null optionalposition: 2
OAuth token endpoint, or null for Google's default endpoint.
sessionOptions OfficeIMO.GoogleWorkspace.GoogleWorkspaceSessionOptions? = null optionalposition: 3
Optional delegation, HTTP-client, and timeout settings.

Methods

public async Task<GoogleWorkspaceAccessToken> AcquireAccessTokenAsync(IEnumerable<String> scopes, CancellationToken cancellationToken = default) #
Returns: Task<GoogleWorkspaceAccessToken>

Acquires an access token and its available scope evidence for the requested operation.

Parameters

scopes System.Collections.Generic.IEnumerable<System.String> requiredposition: 0
OAuth scopes required by the pending operation.
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
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() #
Returns: Void

Releases the token-cache lock and the internally created HTTP client, if any.

public static GoogleServiceAccountCredentialSource FromFile(String serviceAccountJsonPath, GoogleWorkspaceSessionOptions? sessionOptions = null) #
Returns: GoogleServiceAccountCredentialSource

Creates a credential source from a Google service-account JSON file.

Parameters

serviceAccountJsonPath System.String requiredposition: 0
Path to the service-account JSON file.
sessionOptions OfficeIMO.GoogleWorkspace.GoogleWorkspaceSessionOptions? = null optionalposition: 1
Optional delegation, HTTP-client, and timeout settings.

Returns

A configured credential source.

public static GoogleServiceAccountCredentialSource FromJson(String serviceAccountJson, GoogleWorkspaceSessionOptions? sessionOptions = null) #
Returns: GoogleServiceAccountCredentialSource

Creates a credential source from a Google service-account JSON document.

Parameters

serviceAccountJson System.String requiredposition: 0
JSON containing client_email, private_key, and optionally token_uri.
sessionOptions OfficeIMO.GoogleWorkspace.GoogleWorkspaceSessionOptions? = null optionalposition: 1
Optional delegation, HTTP-client, and timeout settings.

Returns

A configured credential source.

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.