I’m having trouble connecting to our company’s JIRA instance through the REST API. Every time I try to get an authentication token, I keep getting a 401 Unauthorized error message.
Here’s what I’m doing:
- Making a request to the session endpoint:
https://company-jira.ourorg.com/jira/rest/auth/1/session
- Using Basic Authentication in the Authorization header
- Setting the Content-Type header to
application/json
- Testing this with POSTMAN
I’ve double-checked my username and password, and they work fine when I log into JIRA through the web interface. But the API call keeps failing with the unauthorized error. Has anyone encountered this issue before? What could be causing the authentication to fail even though my credentials are correct?
Check if your Jira admin disabled basic auth for security reasons. Most companies are switching to personal access tokens or OAuth now. Also make sure you’re encoding the credentials properly in base64 - I’ve seen that trip up lots of people. Try hitting the endpoint from a different IP to rule out firewall blocks too.
Sounds like a CAPTCHA issue kicking in after failed login attempts. JIRA blocks auth temporarily when it sees repeated failures, even with correct credentials. Clear your browser cache/cookies for the JIRA domain and wait 15-20 minutes before trying again. Also check if your company uses SSO or SAML - that’d need a completely different approach. The session endpoint can be finicky, so try a simpler one like /rest/api/2/myself first to test your auth. Double-check your URL structure too - some JIRA instances have different context paths.
Had this exact problem with JIRA Cloud recently. JIRA doesn’t support basic auth with username/password anymore for API calls. You need to create an API token instead - go to your JIRA profile security settings. Then use your email as username and that token as the password in your auth header. Fixed my 401 error right away. Also check that 2FA isn’t messing things up.