Auth
Activate when code touches token management, credential resolution, git auth flows...
Install
npx skills add microsoft/apm --skill auth -g -a claude-code -y- Repository
- microsoft/apm4.2k
- Category
- Git and review
- Updated
- 6d ago
- License
- MIT
- Context cost
- Lightabout 860 tokens
- Runs scripts
- No, instructions only
What it does
Activate when code touches token management, credential resolution, git auth flows, GITHUB_APM_PAT, ADO_APM_PAT, AuthResolver, HostInfo, AuthContext, or any remote host authentication -- even if 'auth' isn't mentioned explicitly.
Auth Skill
When to activate
- Any change to
src/apm_cli/core/auth.pyorsrc/apm_cli/core/token_manager.py - Code that reads
GITHUB_APM_PAT,GITHUB_TOKEN,GH_TOKEN,ADO_APM_PAT - Code using
git ls-remote,git clone, or GitHub/ADO API calls - Error messages mentioning tokens, authentication, or credentials
- Changes to
github_downloader.pyauth paths - Per-host or per-org token resolution logic
Key rule
All auth flows MUST go through AuthResolver. No direct os.getenv() for token variables in application code.
Canonical reference
The full per-org -> global -> credential-fill -> fallback resolution flow is in docs/src/content/docs/getting-started/authentication.md (mermaid flowchart). Treat it as the single source of truth; if behavior diverges, fix the diagram in the same PR.
Bearer-token authentication for ADO
Azure DevOps Services (dev.azure.com, *.visualstudio.com) use this chain:
ADO_APM_PATenv var if set- AAD bearer via
az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798ifazis installed andaz account showsucceeds - Operation-time path-scoped
git credential fillafter HTTP 401/403 or a recognized Git authentication failure (is_ado_auth_failure_signal) - Otherwise:
AdoAuthChainExhaustedErrorfromtry_with_fallback, orbuild_error_contexton resolve-time failures
Azure DevOps Server hosts (ADO_HOST / APM_ADO_HOSTS) skip az bearer: PAT, then fill.
ADO_APM_PAT is the env var name used by the auth flow. The AAD bearer source constant lives in src/apm_cli/core/token_manager.py as GitHubTokenManager.ADO_BEARER_SOURCE = "AAD_BEARER_AZ_CLI".
Stale-PAT fallback: on HTTP 401/403 or a recognized Git authentication failure, APM tries an available az bearer. A successful bearer retry emits:

