【发布时间】:2019-01-23 19:43:49
【问题描述】:
这是我的命令
curl https://accounts.google.com/o/oauth2/token -d "client_id=111111111111%2D8pc07m34pj5eb5nid0u5n9fgs5vrndpm%2Eapps%2Egoogleusercontent%2Ecom&grant_type=password&username=123456%2E123%40gmail%2Ecom&password=123456&scope=https%3A%2F%2Fwww%2Egoogleapis%2Ecom%2Fauth%2Fcalendar&redirect_url=https%3A%2F%2Fwww%2Egoogle%2Ecom"
但我不断得到:
{
"error" : "invalid_request"
}
我正在尝试编写一个可以读取命令行中指定的任何 gmail 帐户的日历数据的应用程序:
./foo gmailID@gmail.com password
但我不知道我的 foo 如何使用 gmailID 和密码来获取没有用户交互的令牌(即,打开 url 并单击“接受”),因此我可以使用该令牌调用 Google Calendar APIs读取该 gmail 帐户的日历数据。我是新来的。我至少在正确的轨道上吗?
【问题讨论】:
-
为了帮助您开始您的开发,我认为深入挖掘谷歌的标准文档是理想的。 Using OAuth 2.0 to Access Google APIs、Gmail API 和 Calendar API。
-
不,你没有走上正轨。请参阅鲁本的回答。
-
2021 年对此有任何答案,否则是否相同?我正在寻找是否有类似于 OKTA 在developer.okta.com/blog/2018/06/29/… 中提供的 API。
标签: oauth-2.0 google-api google-oauth google-calendar-api