

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1# Authentication Service Usage Guide23## Overview45`IAuthenticationService` manages GitHub and Copilot authentication. It provides GitHub sessions (OAuth tokens) and Copilot tokens (CAPI tokens).67## Choosing a Session Kind89`getGitHubSession` requires a `kind` parameter. Choose thoughtfully:1011- **`'any'`** — Accepts whatever GitHub session is available, even one with minimal scopes (e.g., just `user:email`). Use this when you only need basic access and don't require repo or write permissions.12- **`'permissive'`** — Requires a session with broader scopes (`read:user`, `user:email`, `repo`, `workflow`). Use when you need private repo access or write permissions.1314## The Three Overloads of `getGitHubSession`1516### 1. Interactive — prompt user to sign in1718Returns `AuthenticationSession` (never `undefined`). Throws if the user cancels.1920Requires `createIfNone` with a `StrictAuthenticationPresentationOptions` containing a **localized `detail` string** explaining why auth is needed:2122```ts23const session = await authService.getGitHubSession('any', {24 createIfNone: { detail: l10n.t('Sign in to GitHub to use feature X.') }25});26```2728### 2. Interactive — force a new session2930Same as above but forces re-authentication even if a session exists. Use when the current token has lost authorization:3132```ts33const session = await authService.getGitHubSession('any', {34 forceNewSession: { detail: l10n.t('Sign in again to restore access.') }35});36```3738### 3. Silent — no user prompt3940Returns `AuthenticationSession | undefined`. Never shows UI. Use when auth is optional:4142```ts43const session = await authService.getGitHubSession('any', { silent: true });44if (!session) {45 // No session available, handle gracefully46}47```4849## Important Constraints5051- **`createIfNone` and `forceNewSession` do NOT accept `boolean`**. You must pass a `StrictAuthenticationPresentationOptions` with a required `detail` string. Passing `true`, `false`, or `{}` will not compile.52- **The `detail` string must be localized** using `l10n.t('...')`.53- The silent overload's options type is `Omit<AuthenticationGetSessionOptions, 'createIfNone' | 'forceNewSession'>` — you cannot sneak a boolean `createIfNone` through it.5455## Synchronous Cache Properties5657For non-blocking checks (no network, no UI), use the cached properties:5859- `authService.anyGitHubSession` — cached `'any'` session or `undefined`60- `authService.permissiveGitHubSession` — cached `'permissive'` session or `undefined`61- `authService.copilotToken` — cached Copilot token (without the raw token string) or `undefined`6263React to `onDidAuthenticationChange` for identity changes (sign in/out, account switch).64React to `onDidCopilotTokenChange` for token-level updates (quota, feature flags, routine ~20-minute refreshes).6566## Copilot Tokens6768Most callers just need a valid CAPI token. `getCopilotToken()` handles refresh automatically:6970```ts71const token = await authService.getCopilotToken();72```7374## Minimal Mode7576When `authService.isMinimalMode` is `true`, the service will not fetch permissive tokens:77- Interactive `'permissive'` calls throw `MinimalModeError`78- Silent `'permissive'` calls return `undefined`7980## Auth State Flows8182There are three states a user can be in:83841. **Not signed in** — No `'any'` session exists. The user has no GitHub session at all. An interactive `createIfNone` call will show VS Code's built-in sign-in dialog.85862. **Signed in from VS Code** — The user explicitly signed in through VS Code (e.g., via Accounts menu or a `createIfNone` prompt). In this case, VS Code automatically acquires the permissive token since it requests the broader scopes upfront. Both `'any'` and `'permissive'` sessions are available.87883. **Signed in passively** (e.g., via Settings Sync) — The user is signed into GitHub through a passive mechanism that only grants minimal scopes. Copilot Chat works with the `'any'` token, but no `'permissive'` token is available. A `'permissive'` call with `createIfNone` will prompt the user to grant additional permissions.89
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| microsoft/vscode.github/instructions/oss.instructions.md · 189k | Copilot instructions | git | 44/100 | 14 days ago | |
| microsoft/vscode.github/copilot-instructions.md · 189k | Copilot instructions | stylearchtypesui+2 | 74/100 | 13 days ago | |
| microsoft/vscode.github/instructions/accessibility.instructions.md · 189k | Copilot instructions | styledo-not | 61/100 | 14 days ago | |
| microsoft/vscode.github/instructions/agentHostTesting.instructions.md · 189k | Copilot instructions | teststyletesting-strategyagent-behaviour | 55/100 | 7 days ago | |
| microsoft/vscode.github/instructions/best-practices.instructions.md · 189k | Copilot instructions | styleui | 60/100 | today | |
| microsoft/vscode.github/instructions/chat.instructions.md · 189k | Copilot instructions | agent-behaviour | 39/100 | today | |
| microsoft/vscode.github/instructions/coding-guidelines.instructions.md · 189k | Copilot instructions | styletypesuidocs | 60/100 | 14 days ago | |
| microsoft/vscode.github/instructions/committing.instructions.md · 189k | Copilot instructions | do-not | 23/100 | 14 days ago | |
| microsoft/vscode.github/instructions/css-best-practices.instructions.md · 189k | Copilot instructions | styleui | 29/100 | 14 days ago | |
| microsoft/vscode.github/instructions/design-philosophy.instructions.md · 189k | Copilot instructions | style | 34/100 | 14 days ago | |
| microsoft/vscode.github/instructions/design-tokens.instructions.md · 189k | Copilot instructions | styledo-not | 65/100 | 14 days ago | |
| microsoft/vscode.github/instructions/interactive.instructions.md · 189k | Copilot instructions | ui | 43/100 | 14 days ago | |
| microsoft/vscode.github/instructions/notebook.instructions.md · 189k | Copilot instructions | no sections | 48/100 | 14 days ago | |
| microsoft/vscode.github/instructions/observables.instructions.md · 189k | Copilot instructions | no sections | 40/100 | 14 days ago | |
| microsoft/vscode.github/instructions/oss-third-party-notices.instructions.md · 189k | Copilot instructions | buildgitdependenciesdeployment+1 | 65/100 | 14 days ago | |
| microsoft/vscode.github/instructions/sessions.instructions.md · 189k | Copilot instructions | no sections | 24/100 | today | |
| microsoft/vscode.github/instructions/source-code-organization.instructions.md · 189k | Copilot instructions | do-not | 73/100 | 14 days ago | |
| microsoft/vscode.github/instructions/telemetry.instructions.md · 189k | Copilot instructions | styletypesdo-not | 65/100 | 14 days ago | |
| microsoft/vscode.github/instructions/tree-widgets.instructions.md · 189k | Copilot instructions | stylearchperformance | 62/100 | 14 days ago | |
| microsoft/vscode.github/instructions/writing-tests.instructions.md · 189k | Copilot instructions | teststyletypes | 58/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 201k | AGENTS.md | buildteststylearch+3 | 100/100 | 14 days ago | |
| aaif-goose/gooseAGENTS.md · 53k | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 8 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 14 days ago | |
| deepseek-ai/deepseek-harnessnative/landlock-run/AGENTS.md · 104k | AGENTS.md | setupteststylearch+3 | 100/100 | today | |
| code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 68k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 13 days ago | |
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | today | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 14 days ago | |
| elastic/elasticsearchx-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/AGENTS.md · 78k | AGENTS.md | buildtestlint-formatstyle+2 | 100/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/microsoft-vscode-extensions-copilot-src-platform-authentication-common-agents)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.