Table of Contents

Interface IKeycloakAccessTokenProvider

Namespace
Keycloak.AuthServices.Authorization.AuthorizationServer
Assembly
Keycloak.AuthServices.Authorization.dll

Provides access tokens for Keycloak authorization server requests.

public interface IKeycloakAccessTokenProvider

Remarks

The default implementation uses IHttpContextAccessor to extract the token from the current HTTP context. For SignalR or other long-lived connection scenarios, implement this interface to provide fresh tokens from an alternative source.

Methods

GetAccessTokenAsync(CancellationToken)

Gets the current access token.

Task<string?> GetAccessTokenAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token.

Returns

Task<string>

The access token, or null if no token is available.