1
votes

I'm new to OAuth and I need help in accessing the Survey Monkey API to get the auth token. I tried using login_with_surveymonkey.php code and changed the client_id, client_secret, and api_key (https://developer.surveymonkey.com/apps/mykeys). It is giving me this error message:

'it was not possible to open the OAuth access token URL: could not resolve the host domain "api.surveymonkey.net"'

I tried running it on our dev environment and the error returned changed: '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"}'

However, when I used the io-docs (https://developer.surveymonkey.com/io-docs) using the same client_id, client_secret, and api_key, I was able to connect to retrieve a token. I have curl working on my local machine.

Am I missing something?

Thanks!

1
It sounds like where you're running the code from doesn't have access to the domain. - Luke
I'm running it on local. Does it mean that it doesn't have access to that domain? - Judith
I wonder if the Survey Monkey API needs cURL enabled, have you enabled that plugin in your PHP setup? - Luke
extension=php_curl.dll was already enabled from php.ini but it's still giving me the same error message. Are there other ways to get auth token? Thanks! - Judith

1 Answers

1
votes

The IO Docs API console does not actually perform OAuth correctly and is unfortunately not a good model on how to do OAuth - we have a replacement coming very soon.

The source code for that PHP OAuth implementation looks good, so I would check the following things:

Edit: According to our logs, it looks like you've solved this problem, correct? I think you were providing the api_key as the client_secret.