Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "mwoauth-oauth-exception" #3

Open
franbueno opened this issue Sep 30, 2015 · 7 comments
Open

Error: "mwoauth-oauth-exception" #3

franbueno opened this issue Sep 30, 2015 · 7 comments

Comments

@franbueno
Copy link

Hi Chris,

Im always getting this issue:
error: "mwoauth-oauth-exception"

This is my consumer and secret keys:

$consumerKey = 'b02833d71fe5700c891c531fe041c36c';
$consumerSecret = 'f2b6f6ccc47e9f6b298eaa74789897b98dc6a594';

$config = new MWOAuthClientConfig(
'https://www.mediawiki.org/w/index.php?title=Special:OAuth', // url to use
true, // do we use SSL? (we should probably detect that from the url)
false // do we validate the SSL certificate? Always use 'true' in production.
);
$config->canonicalServerUrl = 'https://www.mediawiki.org';
$config->redirURL = 'https://www.mediawiki.org/view/Special:OAuth?';

Can you help me? :)

@Stype
Copy link
Owner

Stype commented Oct 8, 2015

Hi franbueno, can you tell me where you're getting that error? Backtrace or debug log would be great.

@franbueno
Copy link
Author

Sure :)

array(1) { [0]=> array(7) { ["file"]=> string(53) "/Applications/MAMP/htdocs/mwoauth-php-master/demo.php" ["line"]=> int(28) ["function"]=> string(8) "initiate" ["class"]=> string(13) "MWOAuthClient" ["object"]=> object(MWOAuthClient)#3 (5) { ["config":"MWOAuthClient":private]=> object(MWOAuthClientConfig)#1 (5) { ["endpointURL"]=> string(57) "https://www.mediawiki.org/w/index.php?title=Special:OAuth" ["canonicalServerUrl"]=> string(25) "https://www.mediawiki.org" ["redirURL"]=> string(45) "https://www.mediawiki.org/view/Special:OAuth?" ["useSSL"]=> bool(true) ["verifySSL"]=> bool(false) } ["consumerToken":"MWOAuthClient":private]=> object(OAuthToken)#2 (2) { ["key"]=> string(32) "b02833d71fe5700c891c531fe041c36c" ["secret"]=> string(40) "f2b6f6ccc47e9f6b298eaa74789897b98dc6a594" } ["extraParams":"MWOAuthClient":private]=> array(0) { } ["callbackUrl":"MWOAuthClient":private]=> string(3) "oob" ["lastNonce":"MWOAuthClient":private]=> string(32) "6ee6e80b91a0e4f58159446292b0c731" } ["type"]=> string(2) "->" ["args"]=> array(0) { } } }
Fatal error: Uncaught exception 'Exception' with message 'Callback wasn't confirmed' in /Applications/MAMP/htdocs/mwoauth-php-master/MWOAuthClient.php:94 Stack trace: #0 /Applications/MAMP/htdocs/mwoauth-php-master/demo.php(28): MWOAuthClient->initiate() #1 {main} thrown in /Applications/MAMP/htdocs/mwoauth-php-master/MWOAuthClient.php on line 94

@Stype
Copy link
Owner

Stype commented Oct 10, 2015

Hi franbueno, so the first thing that's odd is that it looks like you're running this against mediawiki.org, but that consumer key (b02833d71fe5700c891c531fe041c36c) isn't registered there. Did you import that key/secret from somewhere else?

@franbueno
Copy link
Author

You were right. I created a new one:

$consumerKey = '8c8acd2db5456006532759bd44777a5d';
$consumerSecret = 'cc9a08d3aed8b39dc57474700590bddca630b466';

Now i get "'Invalid JWT signature from /identify.'".

Backtrace:

array(1) { [0]=> array(7) { ["file"]=> string(53) "/Applications/MAMP/htdocs/mwoauth-php-master/demo.php" ["line"]=> int(28) ["function"]=> string(8) "initiate" ["class"]=> string(13) "MWOAuthClient" ["object"]=> object(MWOAuthClient)#3 (5) { ["config":"MWOAuthClient":private]=> object(MWOAuthClientConfig)#1 (5) { ["endpointURL"]=> string(57) "https://www.mediawiki.org/w/index.php?title=Special:OAuth" ["canonicalServerUrl"]=> string(25) "https://www.mediawiki.org" ["redirURL"]=> string(45) "https://www.mediawiki.org/view/Special:OAuth?" ["useSSL"]=> bool(true) ["verifySSL"]=> bool(false) } ["consumerToken":"MWOAuthClient":private]=> object(OAuthToken)#2 (2) { ["key"]=> string(32) "8c8acd2db5456006532759bd44777a5d" ["secret"]=> string(40) "cc9a08d3aed8b39dc57474700590bddca630b466" } ["extraParams":"MWOAuthClient":private]=> array(0) { } ["callbackUrl":"MWOAuthClient":private]=> string(3) "oob" ["lastNonce":"MWOAuthClient":private]=> string(32) "23df5b8987f1273e6669dff729ae4561" } ["type"]=> string(2) "->" ["args"]=> array(0) { } } } Point your browser to: https://www.mediawiki.org/view/Special:OAuth?oauth_token=3bb5d95fd78cf2f5f150e2377313f0a4&oauth_consumer_key=8c8acd2db5456006532759bd44777a5d Enter the verification code:
Fatal error: Uncaught exception 'Exception' with message 'Invalid JWT signature from /identify.' in /Applications/MAMP/htdocs/mwoauth-php-master/MWOAuthClient.php:252 Stack trace: #0 /Applications/MAMP/htdocs/mwoauth-php-master/MWOAuthClient.php(139): MWOAuthClient->decodeJWT('{"error":"mwoau...', 'cc9a08d3aed8b39...') #1 /Applications/MAMP/htdocs/mwoauth-php-master/demo.php(45): MWOAuthClient->identify(Object(OAuthToken)) #2 {main} thrown in /Applications/MAMP/htdocs/mwoauth-php-master/MWOAuthClient.php on line 252

@franbueno
Copy link
Author

Could you check it? :)

@Stype
Copy link
Owner

Stype commented Oct 16, 2015

Hi franbueno,

To clarify, when you're testing this using demo.php, you're visiting the mediawiki.org url, logging in as Jamonderata (<- this is the only user who can use that consumer before it's approved), approving the application, then cutting-and-pasting the authorization code back into the demo.php client, correct? In the output you have here, you didn't put the code in, so I wanted to make sure you did that.

From the backtrace, it's passing '{"error":"mwoau...', 'cc9a08d3aed8b39...' to decodeJWT, so you're getting an error message back from the call to /identify instead of an actual JWT (demo.php should probably be updated to detect that).

@franbueno
Copy link
Author

Hey Stype,

i really dont understand how it works. Did you mind if we talk in Skype (username: jamonderata). I only need some minutes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants