Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new command is missing from the clim365 skill’s command index, preventing its discovery through index searches.
1 open issue
What changed in this PR
Adds m365 cli accesstoken refresh to refresh cached Microsoft 365 access tokens without signing out, addressing #6681.
Changes:
- Refreshes all cached resources or a selected resource, with
sharepointandgraphshorthand support. - Adds command registration, validation, logging, error handling, and unit tests.
- Documents usage and consent requirements, and links the command from app reconsent guidance.
Build, tests, and lint were not run during this review.
| File | Description |
|---|---|
src/m365/cli/commands/accesstoken/accesstoken-refresh.ts |
Implements forced token refresh and resource selection. |
src/m365/cli/commands/accesstoken/accesstoken-refresh.spec.ts |
Tests validation, resource selection, empty caches, and errors. |
src/m365/cli/commands.ts |
Registers the new command name. |
eslint.config.mjs |
Adds refresh to the command-name dictionary. |
docs/src/config/sidebars.ts |
Adds the command to documentation navigation. |
docs/docs/cmd/cli/app/app-reconsent.mdx |
Links token refresh guidance after consent updates. |
docs/docs/cmd/cli/accesstoken/accesstoken-refresh.mdx |
Documents options, examples, and consent requirements. |
Review effort: Balanced
| const prefix: string = 'cli'; | ||
|
|
||
| export default { | ||
| ACCESSTOKEN_REFRESH: `${prefix} accesstoken refresh`, |
Contributor
|
@joseimsss can you please let the issue be assigned to you first before working on it? |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #6681
Summary
Adds the new
m365 cli accesstoken refreshcommand to explicitly refresh cached access tokens (all cached tokens by default, or a specific token when-r, --resource [resource]is provided, including thesharepointandgraphshorthand identifiers).Changes
src/m365/cli/commands.ts: registeredACCESSTOKEN_REFRESHin alphabetical order.src/m365/cli/commands/accesstoken/accesstoken-refresh.ts: implementedCliAccessTokenRefreshCommandwith optional-r, --resourceoption,sharepoint/graphshorthand resolution, and forced token acquisition viaauth.ensureAccessToken(resource, logger, this.debug, true).src/m365/cli/commands/accesstoken/accesstoken-refresh.spec.ts: added unit tests with 100% statement, branch, function, and line coverage.eslint.config.mjs: added'refresh'to the command-name word-breaking dictionary.docs/docs/cmd/cli/accesstoken/accesstoken-refresh.mdx&docs/src/config/sidebars.ts: added command documentation (including a clear note that only scopes already consented on the service principal are reflected) and registered it in the sidebar.docs/docs/cmd/cli/app/app-reconsent.mdx: referencedm365 cli accesstoken refreshin the remarks section.Validation
npm run build: passed.npm run lint: passed with 0 errors.c8ondist/m365/cli/commands/accesstoken/accesstoken-refresh.js): 13 passing, 100% Statements (78/78), 100% Branches (20/20), 100% Functions (5/5), 100% Lines (78/78).npm run test:test: 17208 passing (run on Node v23.11.0;npm testversion check requires Node 26).