[GH-ISSUE #3090] Confluenct Data Connector auth problem #1983

Closed
opened 2026-02-22 18:27:33 -05:00 by yindo · 5 comments
Owner

Originally created by @kilasuelika on GitHub (Feb 3, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/3090

I correctly set the access token and still can't connect to the self-hosted confluence space. The debug message shows:

[collector] info: -- Working Confluence http://192.168.16.110:8090 --
[collector] error: Error: Error: Failed to fetch http://192.168.16.110:8090/rest/api/content?spaceKey=CTF&limit=25&start=0&expand=body.storage,version from Confluence: Error: Failed to fetch http://192.168.16.110:8090/rest/api/content?spaceKey=CTF&limit=25&start=0&expand=body.storage,version from Confluence: 401
    at ve.fetchConfluenceData (C:\Users\admin\AppData\Local\Programs\anythingllm-desktop\resources\backend\collector.js:36:6340)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ve.fetchAllPagesInSpace (C:\Users\admin\AppData\Local\Programs\anythingllm-desktop\resources\backend\collector.js:36:6579)
    at async ve.load (C:\Users\admin\AppData\Local\Programs\anythingllm-desktop\resources\backend\collector.js:36:5904)
    at async Cs (C:\Users\admin\AppData\Local\Programs\anythingllm-desktop\resources\backend\collector.js:42:1102)
    at async C:\Users\admin\AppData\Local\Programs\anythingllm-desktop\resources\backend\collector.js:42:9628
[backend] info: [TELEMETRY SENT] {"event":"extension_invoked","distinctId":"938e9785-1b1a-47fc-b48a-0156131de4ae","properties":{"type":"confluence","runtime":"desktop"}}

I check the settings in confluence and shows the token is never used:

Image

I tried to use follow command line and succeed:

 curl -H "Authorization: Bearer <my token>" "http://192.168.16.110:8090/rest/api/content?spaceKey=CTF&limit=25&start=0&expand=body.storage,version"

So it seems the problem is due to the auth way used in anythingllm. My confluence version is 8.3.2.

Originally created by @kilasuelika on GitHub (Feb 3, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/3090 I correctly set the access token and still can't connect to the self-hosted confluence space. The debug message shows: ``` [collector] info: -- Working Confluence http://192.168.16.110:8090 -- [collector] error: Error: Error: Failed to fetch http://192.168.16.110:8090/rest/api/content?spaceKey=CTF&limit=25&start=0&expand=body.storage,version from Confluence: Error: Failed to fetch http://192.168.16.110:8090/rest/api/content?spaceKey=CTF&limit=25&start=0&expand=body.storage,version from Confluence: 401 at ve.fetchConfluenceData (C:\Users\admin\AppData\Local\Programs\anythingllm-desktop\resources\backend\collector.js:36:6340) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ve.fetchAllPagesInSpace (C:\Users\admin\AppData\Local\Programs\anythingllm-desktop\resources\backend\collector.js:36:6579) at async ve.load (C:\Users\admin\AppData\Local\Programs\anythingllm-desktop\resources\backend\collector.js:36:5904) at async Cs (C:\Users\admin\AppData\Local\Programs\anythingllm-desktop\resources\backend\collector.js:42:1102) at async C:\Users\admin\AppData\Local\Programs\anythingllm-desktop\resources\backend\collector.js:42:9628 [backend] info: [TELEMETRY SENT] {"event":"extension_invoked","distinctId":"938e9785-1b1a-47fc-b48a-0156131de4ae","properties":{"type":"confluence","runtime":"desktop"}} ``` I check the settings in confluence and shows the token is never used: ![Image](https://github.com/user-attachments/assets/54c6ad49-197f-47a5-b5fa-e9322c90ac99) I tried to use follow command line and succeed: ``` curl -H "Authorization: Bearer <my token>" "http://192.168.16.110:8090/rest/api/content?spaceKey=CTF&limit=25&start=0&expand=body.storage,version" ``` So it seems the problem is due to the auth way used in anythingllm. My confluence version is 8.3.2.
yindo closed this issue 2026-02-22 18:27:33 -05:00
Author
Owner

@timothycarambat commented on GitHub (Feb 3, 2025):

https://github.com/Mintplex-Labs/anything-llm/blob/121fbea2848707e870613e2edbbdb3c94df64ecf/collector/utils/extensions/Confluence/ConfluenceLoader/index.js#L78C2-L83C40

Calls to
https://github.com/Mintplex-Labs/anything-llm/blob/121fbea2848707e870613e2edbbdb3c94df64ecf/collector/utils/extensions/Confluence/ConfluenceLoader/index.js#L53-L75

from Confluence: 401 would be a generic Unauthorized so given the space Key and Authorization header is applied this would only imply that the Personal Access Token is invalid and/or not set in the request.
https://github.com/Mintplex-Labs/anything-llm/blob/121fbea2848707e870613e2edbbdb3c94df64ecf/collector/utils/extensions/Confluence/ConfluenceLoader/index.js#L29-L30

In order to get the correct endpoint the base URL should be http://192.168.16.110:8090
Cloud toggle: off
Access Token => set to your token.

This should then be the correct flow to reach your locally running confluence endpoint just as you can with cURL.

Since a 401 is returned, logs from the Confluence server would help since it would show what endpoint is being hit.

@timothycarambat commented on GitHub (Feb 3, 2025): https://github.com/Mintplex-Labs/anything-llm/blob/121fbea2848707e870613e2edbbdb3c94df64ecf/collector/utils/extensions/Confluence/ConfluenceLoader/index.js#L78C2-L83C40 Calls to https://github.com/Mintplex-Labs/anything-llm/blob/121fbea2848707e870613e2edbbdb3c94df64ecf/collector/utils/extensions/Confluence/ConfluenceLoader/index.js#L53-L75 `from Confluence: 401` would be a generic `Unauthorized` so given the space Key and `Authorization` header is applied this would only imply that the Personal Access Token is invalid and/or not set in the request. https://github.com/Mintplex-Labs/anything-llm/blob/121fbea2848707e870613e2edbbdb3c94df64ecf/collector/utils/extensions/Confluence/ConfluenceLoader/index.js#L29-L30 In order to get the correct endpoint the base URL should be `http://192.168.16.110:8090` Cloud toggle: `off` Access Token => set to your token. This should then be the correct flow to reach your locally running confluence endpoint just as you can with cURL. Since a 401 is returned, logs from the Confluence server would help since it would show what endpoint is being hit.
Author
Owner

@kilasuelika commented on GitHub (Feb 4, 2025):

https://github.com/Mintplex-Labs/anything-llm/blob/121fbea2848707e870613e2edbbdb3c94df64ecf/collector/utils/extensions/Confluence/ConfluenceLoader/index.js#L78C2-L83C40

Calls to

anything-llm/collector/utils/extensions/Confluence/ConfluenceLoader/index.js

Lines 53 to 75 in 121fbea

async fetchConfluenceData(url) {
try {
const initialHeaders = {
"Content-Type": "application/json",
Accept: "application/json",
};
const authHeader = this.authorizationHeader;
if (authHeader) {
initialHeaders.Authorization = authHeader;
}
const response = await fetch(url, {
headers: initialHeaders,
});
if (!response.ok) {
throw new Error(
Failed to fetch ${url} from Confluence: ${response.status}
);
}
return await response.json();
} catch (error) {
throw new Error(Failed to fetch ${url} from Confluence: ${error});
}
}
from Confluence: 401 would be a generic Unauthorized so given the space Key and Authorization header is applied this would only imply that the Personal Access Token is invalid and/or not set in the request.

anything-llm/collector/utils/extensions/Confluence/ConfluenceLoader/index.js

Lines 29 to 30 in 121fbea

if (this.personalAccessToken) {
return Bearer ${this.personalAccessToken};
In order to get the correct endpoint the base URL should be http://192.168.16.110:8090 Cloud toggle: off Access Token => set to your token.

This should then be the correct flow to reach your locally running confluence endpoint just as you can with cURL.

Since a 401 is returned, logs from the Confluence server would help since it would show what endpoint is being hit.

I find there is an accesstoken and personalaccesstoken:

constructor({
    baseUrl,
    spaceKey,
    username,
    accessToken,
    limit = 25,
    expand = "body.storage,version",
    personalAccessToken,
    cloud = true,
  }) {

In authorizationHeader, the two tokens are processed differently:

if (this.personalAccessToken) {
      return `Bearer ${this.personalAccessToken}`;
    } else if (this.username && this.accessToken) {
      const authToken = Buffer.from(
        `${this.username}:${this.accessToken}`
      ).toString("base64");
      return `Basic ${authToken}`;
    }
    return undefined;

in my case it should use the personalAccessToken. But in the interface, there is only an Access Token:

Image

So i'm wondering the access token is misused.

@kilasuelika commented on GitHub (Feb 4, 2025): > https://github.com/Mintplex-Labs/anything-llm/blob/121fbea2848707e870613e2edbbdb3c94df64ecf/collector/utils/extensions/Confluence/ConfluenceLoader/index.js#L78C2-L83C40 > > Calls to > > [anything-llm/collector/utils/extensions/Confluence/ConfluenceLoader/index.js](https://github.com/Mintplex-Labs/anything-llm/blob/121fbea2848707e870613e2edbbdb3c94df64ecf/collector/utils/extensions/Confluence/ConfluenceLoader/index.js#L53-L75) > > Lines 53 to 75 in [121fbea](/Mintplex-Labs/anything-llm/commit/121fbea2848707e870613e2edbbdb3c94df64ecf) > > async fetchConfluenceData(url) { > try { > const initialHeaders = { > "Content-Type": "application/json", > Accept: "application/json", > }; > const authHeader = this.authorizationHeader; > if (authHeader) { > initialHeaders.Authorization = authHeader; > } > const response = await fetch(url, { > headers: initialHeaders, > }); > if (!response.ok) { > throw new Error( > `Failed to fetch ${url} from Confluence: ${response.status}` > ); > } > return await response.json(); > } catch (error) { > throw new Error(`Failed to fetch ${url} from Confluence: ${error}`); > } > } > `from Confluence: 401` would be a generic `Unauthorized` so given the space Key and `Authorization` header is applied this would only imply that the Personal Access Token is invalid and/or not set in the request. > > [anything-llm/collector/utils/extensions/Confluence/ConfluenceLoader/index.js](https://github.com/Mintplex-Labs/anything-llm/blob/121fbea2848707e870613e2edbbdb3c94df64ecf/collector/utils/extensions/Confluence/ConfluenceLoader/index.js#L29-L30) > > Lines 29 to 30 in [121fbea](/Mintplex-Labs/anything-llm/commit/121fbea2848707e870613e2edbbdb3c94df64ecf) > > if (this.personalAccessToken) { > return `Bearer ${this.personalAccessToken}`; > In order to get the correct endpoint the base URL should be `http://192.168.16.110:8090` Cloud toggle: `off` Access Token => set to your token. > > This should then be the correct flow to reach your locally running confluence endpoint just as you can with cURL. > > Since a 401 is returned, logs from the Confluence server would help since it would show what endpoint is being hit. I find there is an `accesstoken` and `personalaccesstoken`: ``` constructor({ baseUrl, spaceKey, username, accessToken, limit = 25, expand = "body.storage,version", personalAccessToken, cloud = true, }) { ``` In `authorizationHeader`, the two tokens are processed differently: ``` if (this.personalAccessToken) { return `Bearer ${this.personalAccessToken}`; } else if (this.username && this.accessToken) { const authToken = Buffer.from( `${this.username}:${this.accessToken}` ).toString("base64"); return `Basic ${authToken}`; } return undefined; ``` in my case it should use the `personalAccessToken`. But in the interface, there is only an Access Token: ![Image](https://github.com/user-attachments/assets/cc6dfd4d-dd38-4b96-b083-f8451807be1f) So i'm wondering the access token is misused.
Author
Owner

@kilasuelika commented on GitHub (Feb 5, 2025):

@timothycarambat
Checking this file: index.js

I think the personalAccessToken wasn't set at all.

@kilasuelika commented on GitHub (Feb 5, 2025): @timothycarambat Checking this file: [index.js](https://github.com/Mintplex-Labs/anything-llm/blob/121fbea2848707e870613e2edbbdb3c94df64ecf/collector/utils/extensions/Confluence/index.js) I think the `personalAccessToken` wasn't set at all.
Author
Owner

@lacey000 commented on GitHub (Feb 14, 2025):

Is there a solution?

@lacey000 commented on GitHub (Feb 14, 2025): Is there a solution?
Author
Owner

@xumenghe1989 commented on GitHub (Feb 24, 2025):

Is there a solution?

@xumenghe1989 commented on GitHub (Feb 24, 2025): Is there a solution?
yindo changed title from Confluenct Data Connector auth problem to [GH-ISSUE #3090] Confluenct Data Connector auth problem 2026-06-05 14:43:49 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#1983