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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

670 views 3 11
Read article

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