2013-10-09 90 views
1

我在Survey Monkey API上獲取Access令牌時遇到問題。 我使用http://www.phpclasses.org/package/7700-PHP-Authorize-and-access-APIs-using-OAuth.html提供的login_with_surveymonkey.php,我已經更改了我從https://developer.surveymonkey.com/apps/mykeys獲得的client_id,client_secret,redirect_url和api_key。Survey Monkey:無效的客戶端錯誤

下面是詳細信息:

  • CLIENT_ID:用戶名我在記錄以前用於 developer.surveymonkey.com
  • client_secret,API_KEY:從細節複製在developer.surveymonkey.com/apps提供/ mykeys
  • REDIRECT_URL:從developer.surveymonkey.com/apps/myapps

提供的信息中提供的細節複製,我STI LL收到此錯誤信息:

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"}

我目前我的本地機器上運行這一點,我的捲曲已啓用。 我是否需要配置其他任何東西才能解決此問題?

+0

你應該從https服務器訪問code = – user2092317

+0

我試着在https服務器上運行它,但我仍然遇到同樣的問題。我被重定向到授權頁面(https://api.surveymonkey.net/oauth/authorize?client_id=[CLIENT_ID]&redirect_uri=https%3A%2F%2Flocalhost%2Foauth%2Flogin_with_surveymonkey.php&response_type=code&state=xxxxxxxxx-xxxxxx&api_key=xxxxxxxxxxxxxxxxxxxx ),然後點擊授權按鈕後,它將我重定向到redirect_url並給我提供了同樣的錯誤消息 – Judith

回答

1

看起來您創建了兩個Mashery賬戶,並且正在使用一個賬戶中的API密鑰和另一個賬戶的用戶名 - 確保這個匹配並重試,它應該可以工作。如果您需要更多幫助,請隨時通過電子郵件發送至[email protected]

0

SurveyMonkey API用於要求傳遞API密鑰而不是客戶端密鑰。在這種情況下,OAuth類使用了一種解決方法來使其工作。

對於較新的帳戶,它需要使用客戶端密鑰而不是API密鑰,因此該解決方法不再有效。

OAuth類已更新,以使其與客戶端密鑰一起正常工作。請使用PHP Classes網站的較新版本。

如果在SurveyMonkey需要客戶端密碼之前獲得令牌,則可能需要獲取新的令牌。只需調用類ResetAccessToken()函數即可放棄舊的令牌並強制獲得新的令牌。