ワンクリックで
msal-client-credentials
Client Credentials Flow for service-to-service (daemon) authentication in MSAL.NET without user involvement
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Client Credentials Flow for service-to-service (daemon) authentication in MSAL.NET without user involvement
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Authorization Code Flow for web applications using MSAL.NET confidential client to sign in users and access APIs on their behalf
On-Behalf-Of (OBO) Flow for web APIs to call downstream APIs while preserving user identity in MSAL.NET
| name | msal-client-credentials |
| description | Client Credentials Flow for service-to-service (daemon) authentication in MSAL.NET without user involvement |
| tags | ["msal","client-credentials","daemon","service-to-service","confidential-client","background-service","machine-to-machine"] |
Client Credentials Flow is used for service-to-service authentication without user involvement. Ideal for daemon applications and background services.
Agent can show code for each credential type:
Reference appropriate credential setup:
// Acquire token for service-to-service authentication
public class TokenAcquisitionService
{
private readonly IConfidentialClientApplication _app;
public TokenAcquisitionService(string clientId, X509Certificate2 cert)
{
// For complete example with static token caching, see: with-certificate.cs
_app = ConfidentialClientApplicationBuilder
.Create(clientId)
.WithCertificate(cert)
.WithAuthority($"https://login.microsoftonline.com/{tenantId}/v2.0")
.WithCacheOptions(CacheOptions.EnableSharedCacheOptions) // Enable static token caching
.Build();
}
public async Task<string> GetAccessTokenAsync()
{
var result = await _app.AcquireTokenForClient(
new[] { "resource-uri" })
.ExecuteAsync();
return result.AccessToken;
}
}
Refer to Troubleshooting Guide
.WithCacheOptions(CacheOptions.EnableSharedCacheOptions) for optimal performanceAuthenticationResultMetadata for cache hit ratiosChoose Client Credentials if:
Avoid if: