Google调查api - INVALID_CREDENTIALS

时间:2018-02-01 15:54:14

标签: google-surveys

我尝试通过api获取调查结果,但我仍然遇到错误。 我能够获得谷歌日历活动,但当我尝试获取调查列表或结果(https://www.googleapis.com/surveys/v2/surveys/ {survey_ID} /结果)时,我得到:

"domain": "global",
"reason": "INVALID_CREDENTIALS",
"message": "User must be authenticated to make this call. Request Id: 5a73195500ff0c64532dccb0ef0001737e3430322d747269616c320001707573682d30312d33312d72313100010163",
"locationType": "header",
"location": "Authorization"
}

看起来我的访问令牌很糟糕,但是使用相同的令牌和方法,我得到了例如日历事件。 看起来我没有范围,但是当我发出此请求https://www.googleapis.com/oauth2/v1/tokeninfo?access_token={valid_token}时,我得到了正确答案:

"issued_to": "822311642112-***********.apps.googleusercontent.com",
"audience": "822311642112-***********.apps.googleusercontent.com",
"scope": "https://www.google.com/calendar/feeds/ https://www.googleapis.com/auth/surveys",
"expires_in": 2983,
"access_type": "offline"

我在我的帐户中启用了Survey api。我通过Windows对象Microsoft.XMLHTTP

从visual foxpro桌面应用程序运行此代码

知道我做错了什么吗?

编辑: 这与this question不重复,因为我的身份验证凭据对日历起作用,但不适用于调查。 看起来Maia Werbos对我有正确的答案,现在我得到的回应是请求是正确的(状态:200),但响应只包含requestId。

Maia非常感谢你。

1 个答案:

答案 0 :(得分:0)

您的请求表明您已启用以下两个OAuth范围:

Entered main
Entered main
Init
Init
[Bens-MacBook-Pro:22004] *** Process received signal ***
[Bens-MacBook-Pro:22004] Signal: Segmentation fault: 11 (11)
[Bens-MacBook-Pro:22004] Signal code: Address not mapped (1)
[Bens-MacBook-Pro:22004] Failing at address: 0x10000004c
[Bens-MacBook-Pro:22004] [ 0] 0   libsystem_platform.dylib            0x00007fffc0118b3a _sigtramp + 26
[Bens-MacBook-Pro:22004] [ 1] 0   ???                                 0x0000000113f92978 0x0 + 4630063480
[Bens-MacBook-Pro:22004] [ 2] 0   mpi_test                            0x00000001078e40d1 main + 81
[Bens-MacBook-Pro:22004] [ 3] 0   libdyld.dylib                       0x00007fffbff09235 start + 1
[Bens-MacBook-Pro:22004] *** End of error message ***
[Bens-MacBook-Pro:22005] *** Process received signal ***
[Bens-MacBook-Pro:22005] Signal: Segmentation fault: 11 (11)
[Bens-MacBook-Pro:22005] Signal code: Address not mapped (1)
[Bens-MacBook-Pro:22005] Failing at address: 0x10000004c
[Bens-MacBook-Pro:22005] [ 0] 0   libsystem_platform.dylib            0x00007fffc0118b3a _sigtramp + 26
[Bens-MacBook-Pro:22005] [ 1] 0   ???                                 0x000000004fc26c50 0x0 + 1338141776
[Bens-MacBook-Pro:22005] [ 2] 0   mpi_test                            0x000000010ffd90d1 main + 81
[Bens-MacBook-Pro:22005] [ 3] 0   libdyld.dylib                       0x00007fffbff09235 start + 1
[Bens-MacBook-Pro:22005] [ 4] 0   ???                                 0x0000000000000001 0x0 + 1
[Bens-MacBook-Pro:22005] *** End of error message ***
-------------------------------------------------------
Primary job  terminated normally, but 1 process returned
a non-zero exit code. Per user-direction, the job has been aborted.
-------------------------------------------------------
--------------------------------------------------------------------------
mpirun noticed that process rank 1 with PID 0 on node Bens-MacBook-Pro exited on signal 11 (Segmentation fault: 11).
--------------------------------------------------------------------------

但您还需要启用电子邮件范围以使用Surveys API(有关详细信息,请参阅Surveys API Getting Started Guide):

https://www.google.com/calendar/feeds/ 
https://www.googleapis.com/auth/surveys