posting to blogger with Google-api-java-client

十年热恋 提交于 2019-12-11 06:14:22

问题


I am quite a beginner and learn at the moment "how to use apis properly": I imported the .jar files from code.google.com/p/google-api-java-client and added them via "external jar files" to the build path in eclipse.

The code snippet from https://developers.google.com/blogger/docs/3.0/reference/posts/insert can't work standalone since OAuth2Native and BloggerScopes aren't recognized because one has to authenticate onself first. can someone help me with this, giving advice about how to authenticate oneself in the simplest possible way?

i already found this: https://code.google.com/p/google-api-java-client/wiki/OAuth2Draft10


回答1:


You can find Google's sample OAuth2Native implementation here.

For the missing scope constant, just construct an array with the Blogger scope manually:

final static String[] Blogger = { "https://www.googleapis.com/auth/blogger" };



回答2:


As of September 2015, There is no way to preauthorize someone for Blogger so I believe the only way to access Blogger Api is to generate access token through Auth 2 Playground ( https://developers.google.com/oauthplayground/ ) and then using the token for API call.



来源:https://stackoverflow.com/questions/12286783/posting-to-blogger-with-google-api-java-client

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!