szn/confluence.md

Unable to authenticate (works only with PAT and Cloud)

Closed this issue · 3 comments

Basically ConfluenceMD passes token as password..

...
    def init(self):
        super().__init__(url=self.url, username=self.username, password=self.token)

nothing to add - obviously that is not how Atlassian API meant to init:

...
        if username and password:
            self._create_basic_session(username, password)
        elif token is not None:
            self._create_token_session(token)
szn commented

Hi @imunhatep

I understand it looked misleading but this is the way how Cloud Auth works. See this:

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

To authenticate to the Atlassian Cloud APIs Jira, Confluence, ServiceDesk:

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

I have to admit this tool is cloud-oriented. And to be honest there is no reason other than myself being familiar only with cloud instances of Confluence.

I will try to offer more, better-described auth methods.

This can easily be fixed with simple IF:

    def init(self):
       if username == "":
          super().__init__(url=self.url, token=self.token)
       else:
          super().__init__(url=self.url, username=self.username, password=self.token)
szn commented

Closed with !6 thanks to @lingrlongr.