Jira REST API get attachments redirect to a login page

I have an electron app where users login in to their JIRA accounts using OAuth 2.0

I create a get request to /rest/api/2/search with Bearer authorization to get the issue list.
From the issue metadata I get the attachment content url and make a get request to /secure/attachment/{id}/{filename} (without Bearer authorization)

Sometimes instead of the redirection to the attachment file I get an redirection to a login page.
I think it could be because of expiration of cloud.session.token cookie (the expiry date is setting to now + 1 month)
If I delete cloud.session.token manually and try to make a request to attachment file I get the same result (redirection to a login page)
How can I prevent such behavior?


@DinaAbezgauz did you ever figure this out? This is unbelievable to me that attachments cannot be downloaded via oauth, and there are probably 10 posts on their community websites asking questions about this sitting unanswered.

I switched my request to https://api.atlassian.com/ex/jira/<cloud-id>/secure/attachment/<attachment-id>/<attachment-name> with Bearer authorization

1 Like