atlassian-python-api icon indicating copy to clipboard operation
atlassian-python-api copied to clipboard

Login via Personal Access Token into confluence

Open chlamprecht opened this issue 2 years ago • 6 comments

Since Version 7.9 of confluence (Server or DC) it is possible to use personal access tokens to login into the system.

Currently this works only for Jira. In the moment the token parameter isn't accepted for confluence.

It would be nice to use this feature for confluence too.

chlamprecht avatar Jan 04 '22 15:01 chlamprecht

Hi! I use personal token as password parameter: and it works well for Confluence.

could you share exact logs please?

gonchik avatar Jan 04 '22 18:01 gonchik

Hi,

sure, I use this code and I am getting the following error

    confluence = Confluence(
        url='https://confuence.xxx',
        token='token')
Traceback (most recent call last):
  File "guardian.py", line 52, in <module>
    token='xxx')
  File "confluence.py", line 38, in __init__
    super(Confluence, self).__init__(url, *args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'token'

chlamprecht avatar Jan 05 '22 07:01 chlamprecht

@chlamprecht - try changing your code to this:

confluence = Confluence(url="https://confluenceinstance.atlassian.net/",
    username='your_username / email>',
    password= '<token>',
    cloud=True)

I had been struggling with this and the above worked for me.

boomjynx avatar Jan 10 '22 10:01 boomjynx

I tried your code, but i am getting an 401 - forbidden. Are you sure to use Cloud=true? Because i try to connect against a data center edition.

chlamprecht avatar Jan 14 '22 07:01 chlamprecht

I have the same issue connecting with a personal access token to a datacenter edition of Confluence. Is this currently supported?

gthieleb avatar Sep 09 '22 12:09 gthieleb

Update: It works when using token param instead of password:

confluence = Confluence(
    url='https://confluence.example.com',
    username=os.environ["CONFLUENCE_USER"],
    token=os.environ["CONFLUENCE_PASSWORD"],
    cloud=False)

gthieleb avatar Sep 09 '22 12:09 gthieleb