Closed sayanb closed 7 months ago
Hi,
Can you check if your token
has the required permissions to fetch the records.
Hi, Can you check if your
token
has the required permissions to fetch the records.
Hi @anoopshrma I am the admin of that Confluence account, and when I created the token by following this step:
Create an API token on https://id.atlassian.com/manage-profile/security/api-tokens
I was logged into Confluence with that admin account.
I also manually verified that I am able to access the space (see step 4 of my steps to reproduce).
One way to check if the token is working or not is by checking with confluence library directly and verify if your token is able to fetch the records or not.
Hi, I am facing same issue. Like sayanb, I also verified access by using curl with access_token and work fine.
Set "loglevel DEBUG", and check the output. Output is like as follows:
DEBUG:atlassian.rest_client:curl --silent -X GET -H 'Content-Type: application/json' -H 'Accept: application/json' 'https://xxxx.atlassian.net/wiki/rest/api/content?spaceKey=TESTSPACE&status=current&expand=body.storage.value&type=page'
This curl returns 403.
Because this curl is NOT correct. The correct curl should have
-H 'Authorization: Basic xxxxxxxxxxxxxxxxxxxxx \
And the code after Basic should be created by
echo -n "{confluence_user_name}:{confluence_api_token}" | base64
If I append above header option, curl works fine. I think you need to create auth code and Authorization header by encoding base64.
Would you please check that?
Hi @anoopshrma @sayanb
I change the loader code like as follows to check if my solutions work fine.
rest_client.py: before>>> default_headers = { "Content-Type": "application/json", "Accept": "application/json", } after>>> default_headers = { "Content-Type": "application/json", "Accept": "application/json", "Authorization" : "Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxx" }
After I changed the code like above, loader works fine. So I confirm that you need to append "Authorization" header to use with "api_token" (NOT API_KEY BUT API_TOKEN)
Would you please update your loader code ?
Came accross the same issue.
If you put your username into CONFLUENCE_USERNAME
and your api token from here https://id.atlassian.com/manage-profile/security/api-tokens into CONFLUENCE_PASSWORD
env variable, the loader will work just fine.
Hope it helps.
Bug Description
These lines of code
Are throwing this exception
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: REDACTED/wiki/rest/api/content?spaceKey=REDACTED&status=current&expand=body.storage.value&type=page
Version
0.9.13
Steps to Reproduce
.env
asCONFLUENCE_API_TOKEN=<my-api-token>
.env
asBASE_URL=<my confluence base URL ending in /wiki>
SPACE KEY
/overview.env
, set the space key asSPACE=<space key from above step>
Relevant Logs/Tracbacks