Redirect to login page when fetching data from agile API

Jakub Jagoda June 29, 2023


I have an app that allows to add Jira Server as an "identity provider" via OAuth1. When the user gets through this process, they are required to add the application to the "incoming authentication" section and then set it up in "allowlist". As a result, we then get all the necessary data to call Jira Server Rest API using OAuth1. And indeed, example endpoint `http://localhost:2990/jira/rest/api/2/configuration` can be then called with proper `Authorization` header and everything's fine.

However, for some reason when we try to do the same with Agile API (e.g. `http://localhost:2990/jira/rest/agile/1.0/board?startAt=0&maxResults=50`), this is not working anymore. First we discovered that our requests get rejected with "401" and the error provided in response's`www-authenticate` header told us that there was oauth_problem="nonce_used" error, basically meaning that we've already did a request with a same nonce. We started investigating that further and it turned out that this error is caused because the original request gets responded with a 302 and the fetch immediately does a redirect using the same headers - including nonce - and hence the nonce_used error.

Now, to the root of the problem. Trying to fetch `http://localhost:2990/jira/rest/agile/1.0/board?startAt=0&maxResults=50` causes a redirect to `http://localhost:2990/jira/login.jsp?os_destination=http%3A%2F%2Flocalhost%3A2990%2Fjira%2Frest%2Fagile%2F1.0%2Fboard%3FstartAt%3D0%26maxResults%3D50` so basically the login site which is then supposed to redirect the user to the proper endpoint.

My question are then: why this happens, especially given that Rest API works fine; is there even a possibility to interact with Agile API this way and how to fix it - is it something we need to change in the app in the way we interact with the API or something that needs to be changed in Jira configuration?

Thank you in advance

1 answer

0 votes
okrasavin February 28, 2024

Have you solved the problem?

Jakub Jagoda March 12, 2024

Hi @okrasavin, we've contacted the Atlassian support and it turned out there were 2 problems we had:

- first of all, the URL incorrectly includes `/jira` part. The URL should have been http://localhost:2990/rest/agile/1.0/board

- second of all, Agile API did not work on for us anyway (even with the correct URL), because we've performed the tests on Atlassian Plugin SDK (and not on a regular Jira Server instance), which apparently doesn't include every component of regular Jira, for example Agile API. I don't know, however, whether it's missing completely or just disabled and can be turned on, I believe it's the former

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events