-
Notifications
You must be signed in to change notification settings - Fork 3
Fix OAuth signature generation in validateRestApiAccess #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The validateRestApiAccess function was calling getAuthHeaders() without the required URL parameter for OAuth 1.0a signature generation. This caused authentication failures when using HTTP connections (which fall back to OAuth instead of Basic Auth). Changes: - Get baseURL from httpClient.defaults.baseURL - Construct full URL for each endpoint - Pass proper parameters (method, url, params) to getAuthHeaders() This fixes the "REST API validation failed: undefined" error when connecting via HTTP/OAuth.
Walkthrough
Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/config/auth.js
🧰 Additional context used
🧬 Code graph analysis (1)
src/config/auth.js (2)
scripts/check-env.js (1)
httpClient(109-112)src/tests/authentication.test.js (2)
headers(46-46)headers(113-113)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/config/auth.js
🧰 Additional context used
🧬 Code graph analysis (1)
src/config/auth.js (2)
scripts/check-env.js (2)
httpClient(109-112)authManager(106-106)src/tests/authentication.test.js (2)
headers(46-46)headers(113-113)
🔇 Additional comments (1)
src/config/auth.js (1)
330-332: LGTM! OAuth signature generation fix is correct.The fix properly constructs the full URL and passes it to
getAuthHeadersalong with the HTTP method and query parameters. This ensures OAuth1Handler can generate valid signatures for API requests.The implementation is consistent with
OAuth1Handler.testConnection(lines 159-160) and correctly addresses the authentication failures described in the PR objectives.
Summary
validateRestApiAccessfunctionProblem
The
validateRestApiAccessfunction was callinggetAuthHeaders()without the required URL parameter for OAuth 1.0a signature generation. This caused authentication failures when using HTTP connections (which fall back to OAuth instead of Basic Auth).Steps to Reproduce
Clone and configure GravityMCP with HTTP base URL:
Add to Claude Code:
Check MCP server status:
Expected: gravitymcp shows "✓ Connected"
Actual: gravitymcp shows "✗ Failed to connect" with error "REST API validation failed: undefined"
Solution
baseURLfromhttpClient.defaults.baseURLmethod,url,params) togetAuthHeaders()Test plan
npm run check-envon HTTP localhost connectionclaude mcp listshows gravitymcp as connected after fixSummary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.