-
Suggestion
-
Resolution: Unresolved
-
None
-
None
-
1
-
We are receiving 401 unauthorized response from Jira in case of wrong credentials, but the response is in html format.
Jira Server: 8.20.18
Steps tried:
- Using X-Atlassian-Token: no-check
- Using Accept: application/json'
- Updated the jira.webapi.enableJsonErrorResponse property to true in the jira-config.properties file and restarted Jira
Same question is also asked in community please refer : https://community.atlassian.com/t5/Jira-Software-questions/How-to-prevent-getting-error-messages-in-html-format-for-jira/qaq-p/2350039
Observations:
1. For Jira server, for other errors like 404, we receive json error format
{ "errorMessages": [ "Issue does not exist or you do not have permission to see it." ], "errors": {} }
2. Jira cloud doesn’t give 401 unauthorized error above, even if credentials are wrong. Either it gives 200 response or sometime 404 (for example a get status call with wrong credentials is giving:
{ "errorMessages": [ "No project could be found with key 'XXXX'." ], "errors": {} }
Comparing HTML 401 unauthorized messages,
Can we replicate this behaviour in Jira server if possible?
The concern behind getting html error messages for 401 based errors is that we offer Jira integration to our customers. In the event of wrong credentials of Jira, we have to relay the response from Jira to our UI / APIs. And it’s not easily possible to parse the html error message as well, hence this weird long html error message relays to our UI.