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

This widget could not be displayed.

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.

This widget could not be displayed.

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 .

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 2 hours ago in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

11 views 0 1
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