• Resolved buruss

    (@buruss)


    Hello.
    I’m having following error when I request a token from ‘/oauth/token/’ endpoint right after successfully getting authorization code.

    error: “invalid_grant”
    error_description: “Authorization code doesn’t exist or is invalid for the client”

    And below is the request header and data.
    url: http://mydomain/oauth/token/

    header (base64 encoded ClientId:ClientSecret):
    Authorization: “Bearer dm9QcUNUdmRsQlhXVG45Y1l4ejVQV2FkYVZxRWRraTBGd2htTGtqajplNVJYZ0RWVEFsV2RxM1V2djVoUjFpMFRJMUFGTjdaTlpWRW12aHpZ”

    body:
    code: “swsf21lutlcebtlule3jdisgnsriurb9kxi589wn”
    client_id: “voPqCTvdlBXWTn9cYxz5PWadaVqEdki0FwhmLkjj”
    client_secret: “e5RXgDVTAlWdq3Uvv5hR1i0TI1AFN7ZNZVEmvhzY”
    redirect_uri: “https://www.myappserver.com/postaccount/authCallback?sns=7”
    state: “3e1de11921200559323365b17a609f4b”
    grant_type: “authorization_code”

    My callback server(https://www.myappserver.com) is running on a windows local testing environment.
    I set my system clock exactly to current date-time. and I requested token immediately after I acquired authorization code.

    And I’m using free version so I only enabled “Authorization Code” grant type in wordpress’s oAuth server setting.

    How can I fix this error?
    Thanks a lot.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Try to renew authentification code at each try

    Plugin Author Justin Greer

    (@justingreerbbi)

    Hi and sorry for the issues. I know this might sound a bit crazy because you are seeing data being returned. Check you DB to ensure that the DB tables are installed. There should be tables prefixed with *oauth_*.

    Thread Starter buruss

    (@buruss)

    Thank you for your support.

    @mrdev023
    I requested new authorization code before token request every time.

    @justingreerbbi
    Yes there is a table named ‘wp_oauth_scopes’.
    but there is no record. Is it normal?

    Thanks a lot.

    Plugin Author Justin Greer

    (@justingreerbbi)

    You should see a tables for codes and tokens as well. If not, ensure you have the latest version then deactivate and re-activeate the plugin. If this does not work let me know. There is a known bug for some DBs where the tables are not being created.

    Thread Starter buruss

    (@buruss)

    @justingreerbbi

    As you said, there is no table related to codes and tokens, even after I uninstall and reinstall and activate the plugin.

    Any suggestion would be appreciated.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘invalid_grant’ is closed to new replies.