# StaticAccessTokenCredentialSource

Credential source that always returns the same already-acquired access token.

Class 

`OfficeIMO.GoogleWorkspace`

**Namespace**

`OfficeIMO.GoogleWorkspace`

**Assembly**

`OfficeIMO.GoogleWorkspace`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[GoogleWorkspaceCredentialSources.cs:16](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace/GoogleWorkspaceCredentialSources.cs#L16)

**Implements**

`IGoogleWorkspaceCredentialSource`

**Modifiers**

sealed

Credential source that always returns the same already-acquired access token.

## Inheritance

- object
- StaticAccessTokenCredentialSource

## 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.

Filter members 

Show inherited

## Constructors

StaticAccessTokenCredentialSource 2 overloads

`public StaticAccessTokenCredentialSource(string accessToken, DateTimeOffset? expiresAt = null, IReadOnlyList<string>? scopes = null)` [#](#constructor-ctor-string-nullable-system-datetimeoffset-collections-generic-ireadonlylist-system-string)

[GoogleWorkspaceCredentialSources.cs:16](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace/GoogleWorkspaceCredentialSources.cs#L16)

Creates an unverified static token source. This exact overload is retained for binary compatibility.

Parameters

**accessToken string required**

**expiresAt System.DateTimeOffset? = null optional**

**scopes System.Collections.Generic.IReadOnlyList<string>? = null optional**

`public StaticAccessTokenCredentialSource(string accessToken, DateTimeOffset? expiresAt, IReadOnlyList<string>? scopes, string? account)` [#](#constructor-ctor-string-nullable-system-datetimeoffset-collections-generic-ireadonlylist-system-string-string)

[GoogleWorkspaceCredentialSources.cs:19](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace/GoogleWorkspaceCredentialSources.cs#L19)

Creates an unverified static token source with an informational account label.

Parameters

**accessToken string required**

**expiresAt System.DateTimeOffset? required**

**scopes System.Collections.Generic.IReadOnlyList<string>? required**

**account string? required**

## Methods

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

[GoogleWorkspaceCredentialSources.cs:34](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.GoogleWorkspace/GoogleWorkspaceCredentialSources.cs#L34)

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:0B75AF30E42DCE1B91D388EF033C823EB1EF349E98652EF5D869D7B195C3CB74 -->
