It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Using access oauth and oauth_token

I can't see to access my onDemand Jira with my oAuth access token.

I have authenticated and I have the application link all setup.  My understanding now is that with the oauth_token I should be able to interact with Jira, but I can't get it to work.  It works with basic authorisation.

This is what I have, but when I run it I don't seem to be authenticated and aren't able to access anything, can anyone see what I am doing wrong

Thanks

Grant

 

$oauth_token="TOKEN";
$oauth_token_secret="SECRET";

$headr = array();
$headr[] = 'Content-type: application/json';
$headr[] = 'Authorization: oauth_token '. $oauth_token;

$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $jiraurl . '/rest/api/latest/' . $resource,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $jdata,
CURLOPT_HTTPHEADER => $headr,
CURLOPT_RETURNTRANSFER => false,

//help debug
CURLOPT_HEADER => true,
CURLINFO_HEADER_OUT => true,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false
));


$result = curl_exec($ch);
$ch_error = curl_error($ch);

if ($ch_error) {
echo "<br/>cURL Error: $ch_error<br/>";
}else{
echo "<br/>No curl error we can see<br/>";
}

curl_close($ch);
var_dump($result);
echo "ALL DONE";

0 answers

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published Thursday in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

144 views 0 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