IntelligenceX
Class

GitHubAppTokenSource

IntelligenceX.Telemetry.GitHub

Namespace
IntelligenceX.Telemetry.GitHub
Assembly
IntelligenceX
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

Accepted by parameters 1

Constructors

public GitHubAppTokenSource(GitHubAppSettings settings, HttpClient? client = null, Func<DateTimeOffset>? clock = null) #

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() #

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

public async Task<string> GetTokenAsync(CancellationToken cancellationToken = default) #

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

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

Properties

public long InstallationId { get; } #

The installation ID tokens are minted for.

Fields

public static readonly TimeSpan RetryAfter #

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