1
votes

I am having a problem with getting an Access Token on the Survey Monkey API. I am using login_with_surveymonkey.php provided in http://www.phpclasses.org/package/7700-PHP-Authorize-and-access-APIs-using-OAuth.html and I already changed the client_id, client_secret, redirect_url, and api_key which I got from https://developer.surveymonkey.com/apps/mykeys.

Here are the details:

  • client_id: username I used in logging in to developer.surveymonkey.com
  • client_secret, api_key: copied from the details provided at developer.surveymonkey.com/apps/mykeys
  • redirect_url: copied from the details provided in developer.surveymonkey.com/apps/myapps

Provided those information, I am still getting this error message:

Error: it was not possible to access the OAuth access token: it was returned an unexpected response status 401 Response: {"error_description": "Invalid client_id/client_secret/api_key", "error": "invalid_client"}

I am currently running this on my local machine and my curl is already enabled. Do I need to configure anything else in order to resolve this issue?

2
you should access the code= from https server - user2092317
I tried running it on https server but I still encountered the same issue. I was redirected to the authorization page (api.surveymonkey.net/oauth/…), then after I clicked the Authorize button, it redirects me to the redirect_url and gives me the same error message - Judith

2 Answers

1
votes

It looks like you created two Mashery accounts, and are using the API key from one account with the username from the other account - make sure this matches up and try again, it should work. Feel free to email us at [email protected] if you want some more help with this.

0
votes

SurveyMonkey API used to require passing the API key instead of the client secret. The OAuth class used a workaround to make it work in that case.

For newer accounts it requires the use of the client secret instead of the API key, so the workaround no longer works.

The OAuth class was updated to make it work correctly with the client secret. Please use the newer version from the PHP Classes site.

If you have obtained a token before SurveyMonkey required the client secret, you may need to obtain a new token. Just call the class ResetAccessToken() function to discard the old token and force obtaining a new token.