【发布时间】:2012-06-28 22:23:51
【问题描述】:
我需要做的是在谷歌驱动器上加载文件。
我正在使用 GoogleAccountManager 通过 oauth2 进行授权并获得 AUTHTOKEN,现在不知道下一步该做什么。
要创建 Drive 对象,我需要 GoogleCredential 在哪里可以获得它们?
Drive service = new Drive(TRANSPORT, JSON_FACTORY, credential);
也许我应该做与Connect to the Online Service 教程类似的事情?
URL url = new URL("https://www.googleapis.com/tasks/v1/users/@me/lists?key=" + your_api_key);
URLConnection conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("client_id", your client id);
conn.addRequestProperty("client_secret", your client secret);
conn.setRequestProperty("Authorization", "OAuth " + token);
那么这个 url 来自哪里"https://www.googleapis.com/tasks/v1/users/@me/lists?key="
请给我建议或示例代码如何在谷歌驱动器上加载文件。谢谢。
【问题讨论】: