Reputation: 23
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:
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?
Upvotes: 1
Views: 675
Reputation: 1134
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.
Upvotes: 1
Reputation: 1245
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.
Upvotes: 0