perrybutler / WP-OAuth

A WordPress plugin that allows users to login or register by authenticating with an existing Google, Facebook, LinkedIn, Github, Reddit or Windows Live account via OAuth 2.0. Easily drops into new or existing sites, integrates with existing users.
GNU General Public License v2.0
97 stars 76 forks source link

Invalid Request when getting access_token #54

Open Xtremefaith opened 8 years ago

Xtremefaith commented 8 years ago

Currently there are instances when attempting to login, that I get this error:

Sorry, we couldn't log you in. Malformed access token result detected. Please notify the admin or try again later

From what I can tell thus far, this is simply because when attempting to get the access token both $access_token and $expires_in were empty from the response. Because this only happens after a user has authenticated themselves and is reattempting to login, I am guessing the invalid_request response has something to do with not using a refresh token since the application has already been authenticated.

Can anyone confirm this? I'm going to experiment with implementing the request token to see if this resolves the issue.

Xtremefaith commented 8 years ago

Turns out the issue was related to how the cURL request was made, setting up the URL with the parameters but also passing post parameters through CURLOPT_POSTFIELDS. More details about the issue can be found here:

http://stackoverflow.com/questions/39282160/google-oauth2-0-returns-invalid-request-when-getting-access-token-with-php-cur

This we close with the acceptance of #53