szn / confluence.md

Markdown to Confluence - upload any .md files to your Confluence cloud page
23 stars 10 forks source link

Unable to authenticate (works only with PAT and Cloud) #5

Closed imunhatep closed 1 year ago

imunhatep commented 1 year ago

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 1 year ago

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.

imunhatep commented 1 year ago

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 1 year ago

Closed with !6 thanks to @lingrlongr.