diff --git a/src/config/auth.js b/src/config/auth.js index 1bc236d..8050e8c 100644 --- a/src/config/auth.js +++ b/src/config/auth.js @@ -317,10 +317,19 @@ export async function validateRestApiAccess(httpClient, authManager) { { path: '/feeds', name: 'Feeds' } ]; + // Get baseURL from httpClient for OAuth signature generation + const baseURL = httpClient?.defaults?.baseURL; + + if (!baseURL) { + throw new Error('httpClient baseURL is not configured'); + } + const results = []; for (const endpoint of endpoints) { try { - const headers = authManager.getAuthHeaders(); + // Generate proper OAuth headers with full URL for signature + const fullUrl = `${baseURL}${endpoint.path}`; + const headers = authManager.getAuthHeaders('GET', fullUrl, { per_page: 1 }); await httpClient.get(endpoint.path, { headers, params: { per_page: 1 } diff --git a/src/tests/helpers.js b/src/tests/helpers.js index 5465874..609fba2 100644 --- a/src/tests/helpers.js +++ b/src/tests/helpers.js @@ -179,6 +179,7 @@ export class MockHttpClient { this.requests = []; this.responses = new Map(); this.defaultResponse = new MockResponse(); + this.defaults = { baseURL: 'https://test.example.com' }; } /**