fix: improve 401 error messages and document required scopes for scoped API tokens#77
Merged
fix: improve 401 error messages and document required scopes for scoped API tokens#77
Conversation
…ed API tokens When using scoped API tokens with api.atlassian.com, users receive unhelpful 401 errors with no guidance on what went wrong. This adds an axios response interceptor that detects 401 errors and provides context-specific hints (scoped token vs basic auth vs bearer), and documents the required classic scopes in README and SKILL.md. Closes #76
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the developer/user experience around Atlassian authentication failures by adding more actionable 401 (Unauthorized) error messages and documenting the required Confluence classic scopes for scoped API tokens, with accompanying unit tests and skill/docs updates.
Changes:
- Add an Axios response interceptor to rewrite 401 errors with context-specific guidance (scoped token vs basic vs bearer/PAT).
- Document required classic scopes for scoped API tokens in
README.mdand.claude/skills/.../SKILL.md. - Update markdown-to-storage conversion behavior for code blocks and Cloud link rendering, and extend unit tests accordingly.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
lib/confluence-client.js |
Adds 401 interceptor + updates markdown-to-storage conversions (code block decoding and Cloud vs Server link output). |
tests/confluence-client.test.js |
Adds 401 error handling tests and updates/extends markdown conversion assertions. |
README.md |
Documents required classic scopes for scoped Confluence API tokens. |
.claude/skills/confluence/SKILL.md |
Adds scoped-token scope guidance for agent reference. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .replace(/&/g, '&') | ||
| .replace(/</g, '<') | ||
| .replace(/>/g, '>'); | ||
| return `<ac:structured-macro ac:name="code"><ac:parameter ac:name="language">${language}</ac:parameter><ac:plain-text-body><![CDATA[${decodedCode}]]></ac:plain-text-body></ac:structured-macro>`; |
… rename misleading test - isCloud() now returns true for scoped tokens so Cloud-specific behavior (e.g. smart link rendering) applies correctly - Rename test to accurately reflect bearer/PAT auth scenario
Server/DC uses username/password for basic auth, not email/API token. Gate the Cloud-specific hint behind isCloud() and add a separate message for on-premise users.
|
🎉 This PR is included in version 1.27.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Summary
Closes #76
Test plan
api.atlassian.com)