passport-oauth icon indicating copy to clipboard operation
passport-oauth copied to clipboard

Failed to obtain access token

Open suederade opened this issue 9 years ago • 4 comments

We are using WP Oauth Server and Passport-Oauth2-Complete-for-Wordpress and we are constantly running into this issue no matter what settings are chosen on WP Oauth Server. It is returned as code?=token, but never finds it.

InternalOAuthError: failed to obtain access token at /app/node_modules/passport-oauth2-complete-for-wordpress/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js:125:38 at /app/node_modules/passport-oauth2-complete-for-wordpress/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js:176:18 at passBackControl (/app/node_modules/passport-oauth2-complete-for-wordpress/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js:123:9) at IncomingMessage. (/app/node_modules/passport-oauth2-complete-for-wordpress/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js:142:7) at IncomingMessage.emit (events.js:129:20) at _stream_readable.js:908:16 at process._tickCallback (node.js:355:11)

suederade avatar Jul 07 '15 18:07 suederade

Hi, we have a similar issue, trying to authenticate using the wordpress credentials, but always getting a error back: failed to obtain access token (status: 400 data: {"error":"invalid_request","error_description":"Unknown request"}) This is the kind of query string that is returned: ?code=xhgcfxpf5cmphkc8uoequhvvqhjjg0ybmtbaky&state=_

Could you get yours to work? And what was for you the solution? Thanks for help regards

Jemy09 avatar Mar 10 '16 06:03 Jemy09

Change $response = $client->getAccessToken(TOKEN_ENDPOINT, 'authorization_code', $params); to $response = $client->getAccessToken(TOKEN_ENDPOINT, 'AuthorizationCode', $params);

tonyvibrant avatar Apr 15 '16 18:04 tonyvibrant

Hi,

I'm getting the same error using WP Oauth Server and Passport-Oauth2-Complete-for-Wordpress

failed to obtain access token (status: 400 data: {"error":"invalid_request","error_description":"Unknown request"}) at node_modules/passport-oauth2-complete-for-wordpress/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js:125:38 at node_modules/passport-oauth2-complete-for-wordpress/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js:177:18 at passBackControl (node_modules/passport-oauth2-complete-for-wordpress/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js:123:9) at IncomingMessage. (node_modules/passport-oauth2-complete-for-wordpress/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js:143:7) at IncomingMessage.emit (events.js:117:20) at _stream_readable.js:944:16 at process._tickCallback (node.js:448:13)

Where do I have to change the code in the Wordpress plugin or at the node passport-wordpress code?

Change $response = $client->getAccessToken(TOKEN_ENDPOINT, 'authorization_code', $params); to $response = $client->getAccessToken(TOKEN_ENDPOINT, 'AuthorizationCode', $params);

Thanks!

hibernator11 avatar May 24 '16 09:05 hibernator11

I finally made it!

Using this module https://github.com/ido-ran/passport-wordpress-oauth-server

I think that complete-wordpress plugin uses an old version of oauth and that is why is not working...

Thanks!

hibernator11 avatar May 25 '16 11:05 hibernator11