Jira OAuth Authentication using Jquery Ajax

Hi,

I am new to Jira Rest API and i am running Jira 5.1. Is it possible to do oAuth authentication process using Jquery ajax from another genric application?

In this link JIRA REST API Example - OAuth authentication step 1 i completed. I am getting error in step 2.

I tried like this:

jQuery.ajax({
	  //The URL to process the request
	    'url' : 'http://localhost:8080/domejira/rest/api/latest/plugins/servlet/oauth/request-token',
	   // 'data' : {'username': 'jiraadmin'},
	    'type' : 'GET',
	    'success' : function(data) {
	       alert('Request token is: ' + data);
	    }
	  });

Got error:

"NetworkError: 404 Not Found - http://localhost:8080/domejira/rest/api/latest/plugins/servlet/oauth/request-token"
 
thanks for the replies. 
 

2 answers

The 404 error indicates that it cannot find any of the REST endpoints at this address. May I ask what url you use for accessing JIRA?

Are you using any form of reverse proxy? What do you get when you access a url similar to this (be sure to edit the issue key and number):

http://localhost:8080/domejira/rest/api/latest/issue/EXAMPLE-1

When i access through browser with this url

http://localhost:8080/domejira/rest/api/latest/issue/169-59

I am getting the issue in json format.

In the above code the url is worng thats why i am getting 404 error.

Now i changed the code to:

jQuery.ajax({
	  //The URL to process the request
	    'url' : 'http://localhost:8080/domejira/plugins/servlet/oauth/request-token',
	    'type' : 'GET',
	    'success' : function(data) {
	       alert('Request token is: ' + data);
	    }
	  });

Now the url is ok but i am not getting the "Request token" and the response content size is showing zero .

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

771 views 2 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you