我已经从这里下载了 Google plus java starter 项目, 我设置了 maven,创建了我的 client_id 和 client_secret 以及我的 api_key 并将这些密钥放入 config.properties。
现在我开始运行该项目。这
setupTransport()
方法似乎有效。
但如果
getProfile()
方法被调用,抛出异常。
这是输出:
Attempting to open a web browser to start the OAuth2 flow
Once you authorize please enter the code here: [entered my Code here]
============== Get my Google+ profile ==============
Okt 16, 2012 1:25:10 PM Sample getProfile
Schwerwiegend: {
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceededUnreg",
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
"extendedHelp": "https://code.google.com/apis/console"
}
],
"code": 403,
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
}
}
Exception in thread "main" java.io.IOException: Stream closed
at java.util.zip.GZIPInputStream.ensureOpen(Unknown Source)
at java.util.zip.GZIPInputStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at com.google.api.client.http.HttpResponse.parseAsString(HttpResponse.java:464)
at Sample.main(Sample.java:45)
编辑:
我不知道发生了什么,但现在可以了。我只是再次复制粘贴了 ID,刷新了我的项目并让 eclipse 再次构建它......