Table of Contents

Namespace Line.OpenApi.ChannelAccessToken

Classes

JwtAssertionTokenSource

An IChannelAccessTokenSource implementation that consumes the generated client (Line.OpenApi.ChannelAccessToken.Generated.ChannelAccessTokenClient) and issues a short-lived channel access token (/oauth2/v2.1/token) via a JWT assertion.

Producing the JWT assertion itself (signing with the channel's private key) is application-specific, so the caller supplies it through assertionFactory (this library never handles signing keys).

RefreshingChannelAccessTokenProvider

An Microsoft.Kiota.Abstractions.Authentication.IAccessTokenProvider that issues and caches a short-lived channel access token (v2.1 / JWT) at runtime and re-issues it as expiry approaches.

Design section 7:

  • Placed in this package (Line.OpenApi.ChannelAccessToken) rather than Core, to avoid a reverse dependency.
  • Allowed hosts are injectable/extensible rather than hard-coded (returns an empty string on the negative path).
  • Prevents duplicate issuance under concurrent refresh (SemaphoreSlim + double-check).
StatelessJwtAssertionTokenSource

An IChannelAccessTokenSource implementation that consumes the generated client (Line.OpenApi.ChannelAccessToken.Generated.ChannelAccessTokenClient) and issues a stateless channel access token (/oauth2/v3/token) via a JWT assertion.

A stateless token has no limit on the number of concurrently active tokens, but in exchange it lives for only 15 minutes and cannot be revoked before expiry. Because it is short-lived, the intended usage is to combine it with RefreshingChannelAccessTokenProvider and issue one on demand.

R2 usability: the body of /oauth2/v3/token is a discriminator-less oneOf, which in the generated code shows up as the composed wrapper TokenRequestBuilder.TokenPostRequestBody (an IComposedTypeWrapper). That wrapper serializes the inner request model as a nested object, so sending it as-is over form-urlencoded (whose Kiota Form serializer does not support nesting) fails with "Form serialization does not support nested objects." This class avoids the composed wrapper and instead sends the flat request model Line.OpenApi.ChannelAccessToken.Generated.Models.IssueStatelessChannelTokenByJWTAssertionRequest directly as the body, hiding this pitfall and offering the same issuance seam as JwtAssertionTokenSource (/oauth2/v2.1/token).

Producing the JWT assertion itself (signing with the channel's private key) is application-specific, so the caller supplies it through assertionFactory (this library never handles signing keys).

Structs

IssuedToken

An issued token together with its lifetime. Used by RefreshingChannelAccessTokenProvider to compute the cache expiry.

Interfaces

IChannelAccessTokenSource

Seam that abstracts the channel-access-token issuance operation. In production use JwtAssertionTokenSource (short-lived tokens, /oauth2/v2.1/token) or StatelessJwtAssertionTokenSource (stateless tokens, /oauth2/v3/token); in tests it can be replaced with a fake implementation that performs no HTTP.