google-api-php中的authen错误

时间:2016-03-04 16:39:55

标签: php

我试图运行这个脚本:

infinite.destroy()

但是,它给了我这个错误:

  

PHP致命错误:未捕获的异常' Google_Service_Exception'同   信息   ' {"错误" {"错误":[{"结构域":"全球""理由&# 34;:"需""消息":"登录   必需""的locationType":"头""位置":"授权"}],"代码&#34 ;:401,"消息":"登录   必需"}}'在   /root/google-api/google-api-php-client-2.0.0-RC5/src/Google/Http/REST.php:129   堆栈跟踪:
  #0 /root/google-api/google-api-php-client-2.0.0-RC5/src/Google/Http/REST.php(88):   Google_Http_REST :: decodeHttpResponse(对象(GuzzleHttp \ PSR7 \响应),   对象(GuzzleHttp \ Psr7 \ Request),' Google_Service _...')   #1 [内部函数]:Google_Http_REST :: doExecute(Object(GuzzleHttp \ Client),   对象(GuzzleHttp \ Psr7 \ Request),' Google_Service _...')   #2 /root/google-api/google-api-php-client-2.0.0-RC5/src/Google/Task/Runner.php(181):   call_user_func_array(Array,Array)   #3 /root/google-api/google-api-php-client-2.0.0-RC5/src/Google/Http/REST.php(57):   Google_Task_Runner->运行()   #4 /root/google-api/google-api-php-client-2.0.0-RC5/src/Google/Client.php(758):   Google_Http_REST :: execute(Object(GuzzleH in。)   /root/google-api/google-api-php-client-2.0.0-RC5/src/Google/Http/REST.php   第129行

为什么?

1 个答案:

答案 0 :(得分:0)

You need a valid redirectUri instead of null.

https://developers.google.com/api-client-library/php/auth/web-app