我们想让我们的 GAE for java 应用程序从谷歌驱动器中读取文档以满足应用程序的特定要求。
同样,我试图参考https://developers.google.com/drive/auth/web-server
但是,我无法理解代码流。没有提及从哪里获得授权代码,如下面的代码中所述:
public static Credential getCredentials(String authorizationCode, String state)
throws CodeExchangeException, NoRefreshTokenException, IOException {
String emailAddress = "";
try {
Credential credentials = exchangeCode(authorizationCode);
Userinfo userInfo = getUserInfo(credentials);
String userId = userInfo.getId();
emailAddress = userInfo.getEmail();
if (credentials.getRefreshToken() != null) {
storeCredentials(userId, credentials);
return credentials;
} else {
credentials = getStoredCredentials(userId);
if (credentials != null && credentials.getRefreshToken() != null) {
return credentials;
}
}
} catch (CodeExchangeException e) {
gae for java和google drive之间集成的任何工作示例?