jesselang / dox

Publish markdown to Confluence as HTML
MIT License
23 stars 5 forks source link

Use with Confluence Cloud #16

Closed johns10 closed 3 years ago

johns10 commented 3 years ago

Anyone tried to use this with Confluence cloud? I tried with my username/password (didn't expect it to work) and an API token. Neither worked. I got Authentication failed with both.

johns10 commented 3 years ago

It's probably because of this:

https://github.com/jesselang/dox/blob/f598edea6703eba2c58fe4e7b1b15766f1b06ecd/internal/publish.go#L55

Cloud doesn't support BasicAuth any longer.

jesselang commented 3 years ago

:wave: Hey @johns10, thanks for your inquiry. I had previously used Confluence Cloud with dox, but haven't tried recently. I did a quick search, but wasn't able to find any indication that basic auth is no longer supported for their REST APis. I did find this page, which indicates that you should use your email address as the user and your API key as the password. I'm curious if you tried that configuration, and what the error message was. Looking forward to hearing back. Thanks!

johns10 commented 3 years ago

I'll hit it again.

Here was the notice I found:

https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-basic-auth-and-cookie-based-auth/

johns10 commented 3 years ago

Thanks for the advice! With a little fiddling with environment variables I got it to work (I'm on windows BTW). I set the DOX_PASSWORD to my API key. I was getting an authorization error. Now I'm getting:

error: Unknown response status 404 Not Found

johns10 commented 3 years ago

Maybe I had something wrong. I changed my URI to https://x.atlassian.net/wiki and now I'm back to error: Authentication failed.

johns10 commented 3 years ago

Nope, got it. More fiddling with environment variables. I had singlequotes in my username.

johns10 commented 3 years ago

It appears that it didn't include my line breaks. This markdown:


1. **Name** User defined identifier for the particular group of material components
2. **MRO Component** Use to select and add individual components to the BOM
3. **Quantity** Define amount of selected components to be used when executing tasks this BOM associated to
4. **Add Component Button** Click to add the selected component to the BOM record
5. **Existing BOM Component** Table of components added to the BOM record

![Equipment BOM Groups Form](images/equipment_bom_groups_form_reference.png)

Came in like this: image

johns10 commented 3 years ago

Any idea what's going on there?

johns10 commented 3 years ago

PS, first cut, didn't add any of the dox headers

johns10 commented 3 years ago

The script populated the dox headers, but won't update anything. I'm getting: error: Unknown response status 400 Bad Request again

johns10 commented 3 years ago

I ran this again on a personal space, and it is publishing and updating the root page.

johns10 commented 3 years ago

Question - is there a directive to set the ancestor? I thought I saw something like that in the readme, but I can't find it now.

johns10 commented 3 years ago

My two main issues are the line endings and the ancestor thing.

jesselang commented 3 years ago

I ran this again on a personal space, and it is publishing and updating the root page.

Glad to hear that it is publishing for you now.

Question - is there a directive to set the ancestor? I thought I saw something like that in the readme, but I can't find it now.

After you publish with dox, you can move pages around in Confluence as you see fit to be child pages of other pages within the same space, etc. When you run dox again, the pages will be updated while Confluence maintains the tree of relationships between pages.

jesselang commented 3 years ago

It appears that it didn't include my line breaks.

Would you be willing to create a new issue to address this? That way, if others have the same issue, they'll be able to search for it. Thanks!