Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

OAuth + JIRA + PHP

aram.dermenjian
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.
June 16, 2013

So I tried following the examples at: https://bitbucket.org/atlassian_tutorial/atlassian-oauth-examples/src/475271a77dce5dd2be887df8a2bfc57dd970aa7a/php?at=default

And I got everything setup, but whenever I hit 'authenticate', I get the following error in my error logs:

Using $this when not in object context in /srv/oauth/src/Atlassian/OAuthWrapper.php on line 76

I looked at the code to see what was causing the issue, but I don't see anything blatant. Has anyone else hit this issue? What did you guys do to get around/solve it?

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Amy Farrell July 1, 2013

I ran into the same issue, and made a similar change. I added this near the beginning of getClient:

$privateKey = $this->privateKey;

and added a "use" clause to the signature_callback definition:

'signature_callback' => function($stringToSign, $key) use ($privateKey) {

And then I use $privateKey throughout instead of $this->privateKey. I don't know whether there's been a change in the very latest version of PHP, but my guess is that this slipped in as part of an untested refactor.

0 votes
aram.dermenjian
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.
June 16, 2013

As a temporary solution I did the following (although technically that should be updated =P)

I went into the function getClient inside of OAuthWrapper.php and I replaced all '$this->privateKey' to '$pk' and at the beginning of the function I created a new variable '$pk' with the same contents as my other file.

Still running into issues using this example, but that's for another ticket =)

TAGS
AUG Leaders

Atlassian Community Events