【发布时间】:2013-10-01 15:08:43
【问题描述】:
我正在尝试实现这个例子,
https://google-developers.appspot.com/drive/auth/web-server
但是没有找到以下类! Oauth2, Userinfo
static User getUserInfo(Credential credentials)
throws NoUserIdException {
Oauth2 userInfoService =
new Oauth2.Builder(new NetHttpTransport(), new JacksonFactory(), credentials).build();
Userinfo userInfo = null;
try {
userInfo = userInfoService.userinfo().get().execute();
} catch (IOException e) {
System.err.println("An error occurred: " + e);
}
if (userInfo != null && userInfo.getId() != null) {
return userInfo;
} else {
throw new NoUserIdException();
}
}
找到所有其他类。我的构建路径 (Eclipse) 中有最新的 Drive 库。
这个例子很混乱。我以前实现过 OAuth,这太冗长和过于复杂了。用户被发送到 Google 进行身份验证的位置甚至都不明显。
【问题讨论】:
标签: java gwt google-drive-api google-oauth