授权谷歌日历API作品在个人帐户,但不在谷歌域帐户 [英] authorize google calendar api works on personal account but not on google domain account

查看:141
本文介绍了授权谷歌日历API作品在个人帐户,但不在谷歌域帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要制作一个Java应用程序,将日历事件存储在Google Domain中的员工中。
我根据我在 http://code.google.com/p/google-api-java-client/wiki/APIs#Calendar_API

I need to make a Java application that stores calendar events in employees within a Google Domain. I created the application based on a sample I found on http://code.google.com/p/google-api-java-client/wiki/APIs#Calendar_API

现在我想使其在谷歌域的帐户工作,突然间我卡住了。
我更换了一个新的client_secrets.json文件。在code.google.com/apis/console上为已安装的应用程序生成,现在我收到了无效的客户端错误消息:

Now I wanted to make it work on an account from the google domain and suddenly I'm stuck. I changed the client_secrets.json file with a new one. generated on code.google.com/apis/console for an installed application and now I get a invalid client error:

ex =(com.google.api.client。 auth.oauth2.TokenResponseException)com.google.api.client.auth.oauth2.TokenResponseException:400 Bad Request
{
error:unauthorized_client
}

ex = (com.google.api.client.auth.oauth2.TokenResponseException) com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request { "error" : "unauthorized_client" }

我需要为此采取其他措施吗?此外,它需要在域中的所有帐户上工作,而不是单个帐户。也许其他控制台?我希望没有其他图书馆。

Do I need to do other steps for this? Also it needs to work on all accounts by default within the domain not the single account. Maybe other console? I hope not an other library.

推荐答案

要访问域中的所有帐户,您需要使用服务帐户:

To have access to all accounts in the domain, you need to use a service account:

https://developers.google。 com / accounts / docs / OAuth2ServiceAccount

此链接特定于Drive API,它应该为您提供一些易于适应Calendar API v3的代码示例:

while this link is specific to Drive API, it should give you some code samples that are easily adaptable to Calendar API v3:

https://developers.google.com /驱动器/委托

这篇关于授权谷歌日历API作品在个人帐户,但不在谷歌域帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆