Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Fetch an image from api.media.atlassian.com - Authentication

jallen May 12, 2020

My company is using Confluence Cloud.


I'm fetching a page from Confluence cloud (successfully, with a Perl app, but I'm talking any client), and the page has an attachment. When I GET the attachment, I get a 302 redirect, with a location.

Ok, but the location is at api.media.atlassian.com, and I'm using basic auth to get my pages. When I try to get my resource (an image) at the new location, I get this:

HTTP/1.1 401 Unauthorized

. . .a bunch of other stuff. . .

{"error":{"code":"ForbiddenError","title":"This resource requires authorization","href":"https://api.media.atlassian.com#AuthenticationGuide"}}

(Typing https://api.media.atlassian.com#AuthenticationGuide into a browser gives me a http 403.)

So how do I authenticate my client to api.media.atlassian? basic auth doesn't do it, my user id in a cookie doesn't do it; In the Web interface to Confluence Cloud, my browser receives a cookie called 'ajs_anonymous_id', but passing that cookie to api.media.atlassian doesn't work.

Suggestions welcome. . .

2 answers

1 accepted

0 votes
Answer accepted
jallen May 13, 2020

Yes, sorry, but perhaps someone else can benefit from my mistake. . .

 

I was using cURL to try to fetch the image.  When I put the uri from the 'location' into quotes, it worked.

 

The authentication is in the 'token' part of the uri.  The token expires after some time, not sure how long.

Nasar Ibrahim December 31, 2021

what does this mean in plain simple English imagine you are explaining it to a 7 year old

 

i got the same error just trying to understand what it could mean

 

thanks in advance  

0 votes
Nasar Ibrahim December 31, 2021

..

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events