Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Confluence Cloud 401 Unauthorized API

VL December 19, 2021

Hello using python-lib "https://github.com/atlassian-api/atlassian-python-api" I am trying to execute the script but I get this response

HTTPError: Request rejected because issuer is either not authorized or not authorized to impersonate

what is the problem?


from atlassian import Confluence

token = {
'access_token': '<token>',
'token_type': 'bearer'
}

oauth2_dict = {
'client_id': '<id>',
'token': token
}

confluence = Confluence(
url='https://<url>.atlassian.net/wiki',
oauth2=oauth2_dict,
cloud=True)

status = confluence.create_page(
space='DEMO',
title='This is the title',
body='This is the body. You can use <strong>HTML tags</strong>!')

print(status)

1 answer

0 votes
Pramodh M
Community Champion
December 19, 2021

Hi @VL 

Please try the below code and let me know if this works

confluence = Confluence(
url='https://your-domain.atlassian.net',
username=jira_username,
password=jira_api_token,
cloud=True)

status = confluence.create_page(
space='DEMO',
title='This is the title',
body='This is the body. You can use <strong>HTML tags</strong>!')

print(status)

For more reference, follow the link below

https://atlassian-python-api.readthedocs.io

Thanks,
Pramodh

Pramodh M
Community Champion
December 19, 2021

FYI, use email in place of username

VL December 22, 2021

@Pramodh M Everything worked out! Another question, if I add a script to the server, how can I not use personal mail in the script?

Pramodh M
Community Champion
December 22, 2021

@VL Use the Syntax from Documentation

Use the Username and Password/Token

confluence = Confluence(
    url='http://localhost:8090',
    username='admin',
    password='admin')

Thanks,
Pramodh

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events