Forums

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

Downloading attachment from confluence URL

faisalg
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 18, 2016

My application uses rest calls to get the download URL of an attachment in confluence documents page. The problem is if user is logged in to confluence, downloading works fine other wise it redirects to login page.

<a href="https://example.com/download/attachments/{id}/MyFile.txt" download></a>

It downloads login.htm if user is not logged in to confluence.

1 answer

0 votes
105349
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 18, 2016

Hi Faisal!

This is expected behavior.  By default Confluence does not allow anonymous access.

If you'd like to enable anonymous access, you can, by browsing to, (as a site admin), (Cog Icon) -> Global Permissions -> Anonymous Access.

This is clearly not ideal from a security standpoint, but it should work for what you're trying to do.

Thanks!

faisalg
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 19, 2016

Hi Cody!

Thank you for your valuable response. As you mentioned its not ideal from a security standpoint, we also can't allow anonymous access as the documents are intellectual property. While user is logged in,  I've observed that confluence takes a JSESSIONID cookie in request headers when the download URL is accessed directly from browser and it works fine.

Can you suggest something which enables me to do the same in my application. I am using C# and javascript to make the calls.

Thanking in anticipation!

105349
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 19, 2016

Hey Faisal!  Sadly that is well beyond my level of expertise...  I'll ask around and see if I can get any information for ya, but I'm personally not sure.  sad

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events