# GoogleApisCredentialSource

Adapts credentials from Google.Apis.Auth to the dependency-light OfficeIMO credential contract.

Class 

`OfficeIMO.GoogleWorkspace.Auth.GoogleApis`

**Namespace**

`OfficeIMO.GoogleWorkspace.Auth.GoogleApis`

**Assembly**

`OfficeIMO.GoogleWorkspace.Auth.GoogleApis`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[GoogleApisCredentialSource.cs:20](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace.Auth.GoogleApis/GoogleApisCredentialSource.cs#L20)

**Implements**

`IGoogleWorkspaceCredentialSource`

**Modifiers**

sealed

Adapts credentials from Google.Apis.Auth to the dependency-light OfficeIMO credential contract.

## Inheritance

- object
- GoogleApisCredentialSource

## Guides & Samples

Authored walkthroughs and practical samples linked to this API.

- [Authenticate to Google Workspace](/docs/google-workspace/authentication/) Guide
  
  Create a GoogleWorkspaceSession in .NET from a service account, a short-lived access token, or existing Google APIs credentials.

## Usage

Explore 1 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 1

- Method [GoogleInstalledApplicationAuthorization.AuthorizeAsync](/api/google-workspace-auth/officeimo-googleworkspace-auth-googleapis-googleinstalledapplicationauthorization/#method-authorizeasync-officeimo-googleworkspace-auth-googleapis-googleinstalledapplicationauthorizationoptions-threading-cancellationtoken)

Filter members 

Show inherited

## Constructors

GoogleApisCredentialSource 6 overloads

`public GoogleApisCredentialSource(GoogleCredential credential, TimeSpan? fallbackTokenLifetime = null)` [#](#constructor-ctor-google-apis-auth-oauth2-googlecredential-nullable-system-timespan)

[GoogleApisCredentialSource.cs:20](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace.Auth.GoogleApis/GoogleApisCredentialSource.cs#L20)

Creates an adapter around a Google credential, applying requested scopes when the credential requires scoping.

Parameters

**credential Google.Apis.Auth.OAuth2.GoogleCredential required**

**fallbackTokenLifetime System.TimeSpan? = null optional**

`public GoogleApisCredentialSource(GoogleCredential credential, TimeSpan? fallbackTokenLifetime, string? account)` [#](#constructor-ctor-google-apis-auth-oauth2-googlecredential-nullable-system-timespan-string)

[GoogleApisCredentialSource.cs:27](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace.Auth.GoogleApis/GoogleApisCredentialSource.cs#L27)

Creates an adapter with an informational account label that is not credential evidence.

Parameters

**credential Google.Apis.Auth.OAuth2.GoogleCredential required**

**fallbackTokenLifetime System.TimeSpan? required**

**account string? required**

`public GoogleApisCredentialSource(GoogleCredential credential, TimeSpan? fallbackTokenLifetime, string? account, GoogleWorkspaceCredentialBindingResolver? credentialBindingResolver)` [#](#constructor-ctor-google-apis-auth-oauth2-googlecredential-nullable-system-timespan-string-officeimo-googleworkspace-googleworkspacecredentialbindingresolver)

[GoogleApisCredentialSource.cs:30](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace.Auth.GoogleApis/GoogleApisCredentialSource.cs#L30)

Creates an adapter that verifies account and grants through a provider-evidence resolver.

Parameters

**credential Google.Apis.Auth.OAuth2.GoogleCredential required**

**fallbackTokenLifetime System.TimeSpan? required**

**account string? required**

**credentialBindingResolver OfficeIMO.GoogleWorkspace.GoogleWorkspaceCredentialBindingResolver? required**

`public GoogleApisCredentialSource(ITokenAccess credential, TimeSpan? fallbackTokenLifetime = null)` [#](#constructor-ctor-google-apis-auth-oauth2-itokenaccess-nullable-system-timespan)

[GoogleApisCredentialSource.cs:51](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace.Auth.GoogleApis/GoogleApisCredentialSource.cs#L51)

Creates an adapter around any Google token source, including UserCredential.

Parameters

**credential Google.Apis.Auth.OAuth2.ITokenAccess required**

**fallbackTokenLifetime System.TimeSpan? = null optional**

`public GoogleApisCredentialSource(ITokenAccess credential, TimeSpan? fallbackTokenLifetime, string? account)` [#](#constructor-ctor-google-apis-auth-oauth2-itokenaccess-nullable-system-timespan-string)

[GoogleApisCredentialSource.cs:58](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace.Auth.GoogleApis/GoogleApisCredentialSource.cs#L58)

Creates an adapter with an informational account label that is not credential evidence.

Parameters

**credential Google.Apis.Auth.OAuth2.ITokenAccess required**

**fallbackTokenLifetime System.TimeSpan? required**

**account string? required**

`public GoogleApisCredentialSource(ITokenAccess credential, TimeSpan? fallbackTokenLifetime, string? account, GoogleWorkspaceCredentialBindingResolver? credentialBindingResolver)` [#](#constructor-ctor-google-apis-auth-oauth2-itokenaccess-nullable-system-timespan-string-officeimo-googleworkspace-googleworkspacecredentialbindingresolver)

[GoogleApisCredentialSource.cs:61](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace.Auth.GoogleApis/GoogleApisCredentialSource.cs#L61)

Creates an adapter that verifies account and grants through a provider-evidence resolver.

Parameters

**credential Google.Apis.Auth.OAuth2.ITokenAccess required**

**fallbackTokenLifetime System.TimeSpan? required**

**account string? required**

**credentialBindingResolver OfficeIMO.GoogleWorkspace.GoogleWorkspaceCredentialBindingResolver? required**

## Methods

`public async Task<GoogleWorkspaceAccessToken> AcquireAccessTokenAsync(IEnumerable<string> scopes, CancellationToken cancellationToken = default)` [#](#method-acquireaccesstokenasync-collections-generic-ienumerable-system-string-threading-cancellationtoken)

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

Parameters

**scopes System.Collections.Generic.IEnumerable<string> required**

OAuth scopes required by the pending operation.

**cancellationToken System.Threading.CancellationToken = default optional**

Token used to cancel acquisition.

Returns

`Task<GoogleWorkspaceAccessToken>` A task that produces the acquired token and its scope and identity evidence. Callers must verify that the evidence covers their required scopes.

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

<!-- PowerForge markdown artifact sha256:6CFF419EF569B5ED58C359D20BF30B9F0F2A7EF83C8CB9530D1B799069BD4BB3 -->
