Sha*_*mad 6 ruby-on-rails google-calendar-api google-api http-status-code-403 google-api-client
我一直在尝试使用服务帐户访问Calendar v3 API.我已经从管理控制台添加了范围 https://www.googleapis.com/auth/calendar,并将该日历与该服务帐户的电子邮件地址共享.
我也使用相同的服务帐户访问https://www.googleapis.com/auth/coordinate范围,并且工作正常.
此外,尝试撤销访问权限如下所述:为什么Google Calendar API(oauth2)以"权限不足"进行响应?
所有这一切,我仍然得到;
{"error"=>
{"errors"=>
[{"domain"=>"global",
"reason"=>"insufficientPermissions",
"message"=>"Insufficient Permission"}],
"code"=>403,
"message"=>"Insufficient Permission"}}
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?
你对此感到高兴吗?我也碰到过同样的砖墙。
更新:
$key = file_get_contents($key_file_location);
$scopes = array('https://www.googleapis.com/auth/calendar');
$cred = new Google_Auth_AssertionCredentials(
$service_account_name,
$scopes,
$key
);
Run Code Online (Sandbox Code Playgroud)
在与服务电子邮件帐户共享日历后,这对我的授权有效。
| 归档时间: |
|
| 查看次数: |
2665 次 |
| 最近记录: |