Jira OAuth Authentication using Jquery Ajax

Pandu Ranga August 20, 2012

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

0 votes
Pandu Ranga August 21, 2012

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 .

Siomara Jimenez August 14, 2018

Hello, this is kinda old but were you able to make it work? I'm stuck in a similar situation

0 votes
Dennis Kromhout van der Meer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2012

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?

Pandu Ranga August 20, 2012

Hi Dennis,

Jira Url: http://localhost:8080/domejira

Dennis Kromhout van der Meer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2012

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

Pandu Ranga August 21, 2012

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.

Suggest an answer

Log in or Sign up to answer