Improve error message for org-blocked PAT tokens#8973
Open
costajohnt wants to merge 4 commits intorefined-github:mainfrom
Open
Improve error message for org-blocked PAT tokens#8973costajohnt wants to merge 4 commits intorefined-github:mainfrom
costajohnt wants to merge 4 commits intorefined-github:mainfrom
Conversation
Member
|
The "T" in "PAT" stands for "token", so "PAT token" is "PersonalAccessToken token" 🤓 |
fregante
reviewed
Feb 13, 2026
Member
fregante
left a comment
There was a problem hiding this comment.
Please include real screenshots and not AI-generated descriptions
source/github-helpers/api.ts
Outdated
| if ((apiResponse.message as string)?.includes('Resource not accessible by personal access token')) { | ||
| return new RefinedGitHubAPIError( | ||
| 'The organization requires a specific type of token.', | ||
| 'Read more: https://github.com/refined-github/refined-github/wiki/Security#token', |
Member
There was a problem hiding this comment.
"Read more" should be clickable instead
50b9e1e to
1aaf10f
Compare
Contributor
Author
|
Updated — the "Read more" text is now rendered as a clickable link in the toast. The toast system auto-linkifies markdown-style I'll paste a real screenshot into the PR description shortly. |
fregante
reviewed
Feb 14, 2026
source/github-helpers/toast.tsx
Outdated
| </div> | ||
| ); | ||
| let lastRawMessage = message; | ||
| const updateToast = (message: string): void => { |
Member
There was a problem hiding this comment.
Instead of accepting a string and then linkifying it at runtime, it should accept string | JSX.Element. This way you can pass <>fragment with <a href="link">read more</a></>
Contributor
Author
|
Addressed the feedback:
|
Add a specific error case in getError() for the "Resource not accessible by personal access token" API response, showing a user-friendly toast that directs to the Security wiki page. Fixes refined-github#8942
Auto-linkify URLs and markdown-style [text](url) links in toast messages using safe DOM methods. Store raw message for fallback re-rendering to preserve link data.
- Add ToastMessage type (string | JSX.Element) to showToast - Add richMessage property to RefinedGitHubAPIError for JSX content - Rename api.ts to api.tsx for JSX support - Change "The organization" to "Your organization" - Change "Read more" link to "Fix…" - Remove runtime markdown link parsing in favor of direct JSX
1fb34d1 to
373f94b
Compare
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 #8942
When an organization blocks classic PATs, the GitHub API returns "Resource not accessible by personal access token". Previously this fell through to the generic "Unable to fetch. Ensure that your token has access to this repo." message, which doesn't explain the actual problem.
This adds a specific case in
getError()that shows a clear message directing users to the Security wiki page about token types. The "Read more" link is rendered as a clickable link in the toast notification.Additionally, the toast system now auto-linkifies both markdown-style
[text](url)links and bare URLs, so any error message containing a URL will show it as a clickable link.Test URLs
Any org repo page where the org has blocked classic PATs (e.g. a feature like
quick-reviewthat makes API calls).Screenshot