Table of Contents

Namespace BpNexT.NET.GraphQL.Client.OAuth

Classes

AuthorizationCodeTokenProvider

Provides bearer tokens from an OAuth 2.0 authorization code session. Caches the access token, refreshes it single-flight via the refresh token, and raises TokensUpdated after every acquisition so hosts can persist the (rotating) refresh token. Contains no browser interaction of its own, which makes it suitable for headless hosts such as Windows services — seed it with a stored refresh token and keep persisting rotations.

GraphQlAuthorizationCodeOptions

Options for creating a BpQlApplication that authenticates via the OAuth 2.0 authorization code flow with PKCE. At least one credential source must be set: an InitialTokens set from a completed login, a stored RefreshToken, microtech ERP user credentials (Username/Password plus RedirectUri), or a combination — the freshest source is used first and the credentials serve as self-healing fallback. Tokens are acquired lazily on first use; use the static BpQlApplication.*Async factories to authenticate eagerly (fail fast) or to log in interactively via the browser.

GraphQlAuthorizationSession

A pending OAuth 2.0 authorization code flow where the host owns the callback endpoint (e.g. an ASP.NET controller). The SDK handles everything else: PKCE, state, the authorize URL, callback validation, and the code exchange.

// 1. Start: redirect the user's browser to session.AuthorizeUrl
var session = oauthClient.BeginAuthorization("https://myapp.example/oauth/callback");

// 2. Your callback controller receives the redirect and completes the flow:
var tokens = await session.CompleteAsync(callbackUrl);

The session holds no server connection — it is plain state. For multi-instance web hosts, persist CodeVerifier and State (e.g. in the user's session store) and rebuild the session in the callback request via the public constructor.

GraphQlTokenSet

An OAuth token set issued by the microtech ERP authorization server. Immutable so token updates can be observed and persisted atomically.

InteractiveBrowserLogin

Runs the full OAuth 2.0 authorization code flow with PKCE using the system browser and a loopback HTTP listener: opens the authorization page, waits for the redirect, validates the state, and exchanges the code for tokens.

InteractiveBrowserLoginOptions

Options for LoginAsync(InteractiveBrowserLoginOptions, HttpClient?, ILoggerFactory?, CancellationToken).

OAuthAuthorizationCodeClient

Low-level client for the OAuth 2.0 authorization code flow with PKCE (RFC 6749 + RFC 7636) against the microtech ERP authorization server. Handles URL building, code exchange, and token refresh — no browser interaction and no caching. For a one-call desktop login use InteractiveBrowserLogin; for automatic caching and refresh wrap the results in an AuthorizationCodeTokenProvider.

OAuthTokenProvider

Provides OAuth 2.0 client credentials authentication. Caches tokens and refreshes them when expired.

Pkce

Helpers for the Proof Key for Code Exchange extension (RFC 7636) used by the OAuth 2.0 authorization code flow. PKCE is mandatory for both public and confidential microtech ERP GraphQL clients.

PkcePair

A PKCE code verifier and its S256 code challenge (RFC 7636).