.github/skills/msal-auth-code-flow/SKILL.md
Authorization Code Flow for web applications using MSAL.NET confidential client to sign in users and access APIs on their behalf
npx skillsauth add azuread/microsoft-authentication-library-for-dotnet msal-auth-code-flowInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Authorization Code Flow is used by web applications to authenticate users and obtain access tokens on their behalf.
Agent can show code snippets for each credential type:
Reference appropriate credential setup:
// In controller's callback method
[HttpGet("auth/callback")]
public async Task HandleCallback(string code, string state)
{
// See: with-certificate.cs for credential setup
var app = ConfidentialClientApplicationBuilder
.Create(clientId)
.WithCertificate(cert)
.WithAuthority($"https://login.microsoftonline.com/{tenantId}/v2.0")
.WithRedirectUri("https://myapp.com/auth/callback")
.Build();
var result = await app.AcquireTokenByAuthorizationCode(
new[] { "scope-uri" },
code)
.ExecuteAsync();
// Result contains AccessToken, RefreshToken, ExpiresOn
}
Refer to Troubleshooting Guide
https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?client_id=...&redirect_uri=...Choose Auth Code Flow if:
Avoid if:
tools
Client Credentials Flow for service-to-service (daemon) authentication in MSAL.NET without user involvement
tools
Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layers like Lobster, ACPX, plugins, or plain code. Keep conditional logic in the caller; use TaskFlow for flow identity, child-task linkage, waiting state, revision-checked mutations, and user-facing emergence.
tools
# Lobster Lobster executes multi-step workflows with approval checkpoints. Use it when: - User wants a repeatable automation (triage, monitor, sync) - Actions need human approval before executing (send, post, delete) - Multiple tool calls should run as one deterministic operation ## When to use Lobster | User intent | Use Lobster? | | ------------------------------------------------------ | --------------------------
tools
# Lobster Lobster executes multi-step workflows with approval checkpoints. Use it when: - User wants a repeatable automation (triage, monitor, sync) - Actions need human approval before executing (send, post, delete) - Multiple tool calls should run as one deterministic operation ## When to use Lobster | User intent | Use Lobster? | | ------------------------------------------------------ | --------------------------