I’m working with the Jira API and successfully implemented Basic Authentication. However, I’m running into issues when trying to set up OAuth authentication and can’t seem to get the access token working.
What I’ve done so far:
- Set up an Application Link in Jira
- Using base URL: “mycompany.atlassian.net”
- Left the Callback URL field empty
- Downloaded the required JAR files and placed them in a directory
- Executed this command from terminal:
java -jar oauth-rest-client-1.0.one-jar.jar getToken https://mycompany.atlassian.net
The process seems to start but I’m not getting back a valid access token. Has anyone successfully implemented OAuth with Jira API? What steps might I be missing in this authentication flow?
The oauth-rest-client JAR you’re using is quite outdated and may not be compatible with current Atlassian Cloud instances. I faced this exact problem two years ago when migrating our integration from Server to Cloud. The issue was that Atlassian deprecated OAuth 1.0a for Cloud instances and now requires OAuth 2.0 with proper app registration through the Developer Console. You’ll need to create an OAuth 2.0 app at developer.atlassian.com instead of using Application Links, which are primarily for Server/Data Center instances. The authentication flow is completely different - you’ll get a client ID and secret, then use standard OAuth 2.0 authorization code flow. If you’re still on Jira Server, make sure the Application Link shows as ‘Trusted’ status and verify the consumer key matches exactly what you’re passing to the JAR file.
I encountered similar OAuth issues with Jira API about six months ago and found the empty Callback URL was actually causing my token retrieval to fail. Even though some documentation suggests leaving it blank, I had to specify a valid callback URL like http://localhost:8080/callback for the authentication flow to complete properly. Another thing that caught me was the consumer key configuration - make sure you’re using the exact consumer key from your Application Link setup when running the oauth command. Also worth checking if your Jira instance has the OAuth provider enabled in the administration settings, as this can be disabled by default in some enterprise configurations. The JAR file you’re using should work fine, but double-check that you’re pointing to the correct Jira base URL format in your command.
check your jira logs first - they usually show whats going wrong with oauth tokens. i had this exact issue and it was becuase the timestamp was off on my server. also make sure you’re generating the oauth signature correctly, thats where most ppl mess up