# GitHubAppTokenSource

Mints and caches the installation token of a GitHub App: a ten-minute JWT signed with the App's key buys a token that lasts an hour, renewed five minutes…

Class 

`IntelligenceX.Telemetry.GitHub`

**Namespace**

`IntelligenceX.Telemetry.GitHub`

**Assembly**

`IntelligenceX`

**Source**

[GitHubAppCredentials.cs:85](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Telemetry/GitHub/GitHubAppCredentials.cs#L85)

**Implements**

`IDisposable`

**Modifiers**

sealed

Mints and caches the installation token of a GitHub App: a ten-minute JWT signed with the App's key buys a token that lasts an hour, renewed five minutes before it expires.

## Inheritance

- object
- GitHubAppTokenSource

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

- Property [GitHubCredentialResolution.App](/api/intelligencex-telemetry-github-githubcredentialresolution/#property-app)

### Accepted by parameters 1

- Constructor [GitHubAppAuthHandler.GitHubAppAuthHandler](/api/intelligencex-telemetry-github-githubappauthhandler/#constructor-ctor-intelligencex-telemetry-github-githubapptokensource-net-http-httpmessagehandler-string) parameter `tokens`

Filter members 

Show inherited

## Constructors

`public GitHubAppTokenSource(GitHubAppSettings settings, HttpClient? client = null, Func<DateTimeOffset>? clock = null)` [#](#constructor-ctor-intelligencex-telemetry-github-githubappsettings-net-http-httpclient-func-system-datetimeoffset)

[GitHubAppCredentials.cs:85](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Telemetry/GitHub/GitHubAppCredentials.cs#L85)

Creates a token source; client is for tests.

Parameters

**settings IntelligenceX.Telemetry.GitHub.GitHubAppSettings required**

**client System.Net.Http.HttpClient? = null optional**

**clock System.Func<System.DateTimeOffset>? = null optional**

## Methods

`public void Dispose()` [#](#method-dispose)

[GitHubAppCredentials.cs:178](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Telemetry/GitHub/GitHubAppCredentials.cs#L178)

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

`public async Task<string> GetTokenAsync(CancellationToken cancellationToken = default)` [#](#method-gettokenasync-threading-cancellationtoken)

The current installation token, minted or renewed when needed.

Parameters

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

Returns

`Task<string>`

`public static bool IsSignInFailure(Exception error, CancellationToken cancellationToken)` [#](#method-issigninfailure-exception-threading-cancellationtoken)

[GitHubAppCredentials.cs:156](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Telemetry/GitHub/GitHubAppCredentials.cs#L156)

Whether error means the App couldn't sign in (unreachable, timed out, refused, bad key or answer), as opposed to the caller cancelling.

Parameters

**error System.Exception required**

**cancellationToken System.Threading.CancellationToken required**

Returns

`bool`

## 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?`

## Properties

`public long InstallationId { get; }` [#](#property-installationid)

[GitHubAppCredentials.cs:104](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Telemetry/GitHub/GitHubAppCredentials.cs#L104)

The installation ID tokens are minted for.

## Fields

`public static readonly TimeSpan RetryAfter` [#](#field-retryafter)

[GitHubAppCredentials.cs:91](https://github.com/EvotecIT/IntelligenceX/blob/master/IntelligenceX/Telemetry/GitHub/GitHubAppCredentials.cs#L91)

How long every caller skips the App after it failed to sign in, before trying again.

<!-- PowerForge markdown artifact sha256:ACF20C4D62264EB6F744C9F75E1C0F1AE24100E42571CFC38FFCAC310EFA5317 -->
