简体   繁体   English

谷歌日历 API OAUTH

[英]Google calendar API OAUTH

I'm trying to make a Java app (stand alone not web based) that connects to Google calendar but im having issues getting past the OAuth stage.我正在尝试制作一个连接到 Google 日历的 Java 应用程序(独立而不是基于 web),但我在通过 OAuth 阶段时遇到问题。 I have looked over every part of the Google API i can see.我查看了我能看到的 Google API 的每个部分。

The newest version i can find is at https://developers.google.com/google-apps/calendar/instantiate我能找到的最新版本位于https://developers.google.com/google-apps/calendar/instantiate

I have downloaded the 2 sets of JAR files they say to (google-api-services-calendar-v3-rev3-1.5.0-beta and gdata-samples.java-1.46.0) and imported the required libraries and dependencies.我已经下载了他们所说的 2 组 JAR 文件(google-api-services-calendar-v3-rev3-1.5.0-beta 和 gdata-samples.java-1.46.0)并导入了所需的库和依赖项。 This gives me deprication errors for about half the classes and some methods (mainly new Calendar(httpTransport, accessProtectedResource, jsonFactory); ) dont work at all.这给了我大约一半的类和一些方法(主要是new Calendar(httpTransport, accessProtectedResource, jsonFactory); )的 deprication 错误)根本不起作用。

Has anyone got a basic example of getting an OAuth token and accessing the Google Calendar API?有没有人有一个获取 OAuth 令牌并访问 Google 日历 API 的基本示例? Am i looking at this the wrong way or am i using an out of date copy of the api?我是不是看错了,还是我使用的是 api 的过时副本?

Is gdata still in use or has it been replaced? gdata 是否仍在使用或已被替换? Thanks Adrian谢谢阿德里安

You need to first get oauth working then use oauth to call some google api for example calendar.您需要先让 oauth 工作,然后使用 oauth 调用一些谷歌 api,例如日历。

Start from google oauth 1 for installed app or google oauth 2 for installed app or search for "google oauth installed app".谷歌 oauth 1 开始安装应用程序谷歌 oauth 2 安装应用程序或搜索“谷歌 oauth 安装应用程序”。 Scrib is a good oauth lib for Java. Scrib是一个很好的 oauth 库,适用于 Java。

I have no idea why the code is listed wrong in the documentation.我不知道为什么文档中列出的代码有误。 The line below worked for me.下面的行对我有用。

Calendar(httpTransport, jsonFactory, accessProtectedResource);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM