dotnet-authentication

Configure authentication credentials for APIMatic-generated .NET SDK clients in C#.

Updated Jun 9, 2026
One-click install
npx skills add https://github.com/apimatic/plugin-marketplace --skill dotnet-authentication-apimatic
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-authentication
Source: https://github.com/apimatic/plugin-marketplace/tree/main/plugins/maxio-sdk/skills/dotnet-authentication
Command: npx skills add https://github.com/apimatic/plugin-marketplace --skill dotnet-authentication-apimatic

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers integrating an APIMatic-generated .NET SDK often guess at how to supply credentials, since auth scheme property names are generated per-API and the shared Core.Authentication folder ships every scheme class regardless of what the API actually accepts. This Skill provides the correct patterns for wiring credentials into the client options class and handling token lifecycle behavior. ## Core Features & Use Cases - Scheme-specific credential setup: Covers Basic auth, Bearer tokens, API keys (header, query, or cookie), and all three OAuth 2.0 grants (client credentials, authorization code with PKCE, and resource owner password). - Token caching and refresh guidance: Explains in-memory token caching, automatic refresh, and 401-triggered token invalidation and re-acquisition. - Combined schemes and secret hygiene: Documents AND/OR composition of multiple auth schemes and loading secrets from IConfiguration sources instead of hardcoding. - Use Case: A developer receives a 401 from their APIMatic .NET SDK client and uses this Skill to identify the correct credentials property on the options class and configure OAuth2 client credentials with automatic token refresh. ## Quick Start Ask the agent to configure authentication for your APIMatic .NET SDK client using the credentials properties on its options class before constructing the client.

Frequently Asked Questions about dotnet-authentication

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I authenticate an APIMatic .NET SDK client in C#?▼

Set the credentials property matching your API's security scheme on the client options class, then construct the client. The options class exposes one nullable property per scheme the API uses, such as BasicAuthCredentials or an OAuth2 credentials type.

How do I set up OAuth 2.0 client credentials in a .NET SDK?▼

Assign an OAuth2ClientCredentials instance with ClientId, ClientSecret, and optional Scope to the OAuth property on the options class. The SDK fetches and caches the token, acquiring a fresh one when it expires or after a 401.

Why does my APIMatic SDK call return 401 or 403?▼

A 401 or 403 usually means credentials are missing, expired, or set on the wrong options property. Verify the credentials properties on your SDK's options class, since only the schemes the API actually uses are exposed there.

Does the .NET SDK refresh OAuth tokens automatically?▼

Yes. Tokens are cached in memory and reused until about 30 seconds before expiry. Refreshable grants refresh automatically, and on a 401 the cached token is invalidated and re-acquired on the next call.

How do I keep API secrets out of source code in .NET?▼

Load credentials from configuration sources such as environment variables or a secret store instead of hardcoding them. Use the Add{Api}Client options callback for hosted apps or a ConfigurationBuilder chain for console apps.