1

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

Jav_Rock
  • 22,059
  • 20
  • 123
  • 164
Mr Jones
  • 11
  • 2
  • i found that http://stackoverflow.com/questions/5343277/google-clientlogin-authentication, but i have diffiulties to put those two together – Mr Jones Sep 05 '12 at 17:46
  • Are you developing a web or a native application? – Jan Gerlinger Sep 05 '12 at 18:05
  • Applets are considered native applications, as they run on client side. OAuth2Native is only a sample implementation by Google for opening a browser and getting the redirected info back, that can be found [here](https://code.google.com/p/google-api-java-client/source/browse/shared/shared-sample-cmdline/src/main/java/com/google/api/services/samples/shared/cmdline/oauth2/OAuth2Native.java?repo=samples&name=based-on-1.7&r=7063e615dbfcc8365c317bd19a338028dc507abe). – Jan Gerlinger Sep 06 '12 at 10:58
  • very good. oauth2native is clear now. i am still missing the BloggerScopes class, I googled for it without results – Mr Jones Sep 06 '12 at 15:00
  • Have a look at this answer: https://stackoverflow.com/questions/37217708/blogger-api-sample-code – brettv Dec 04 '17 at 00:55

2 Answers2

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" };
Jan Gerlinger
  • 7,361
  • 1
  • 44
  • 52
0

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.

Vivek Vermani
  • 1,934
  • 18
  • 45