Provisioning api using java

Posted by user268515 on Stack Overflow See other posts from Stack Overflow or by user268515
Published on 2010-05-21T10:19:30Z Indexed on 2010/05/21 10:30 UTC
Read the original article Hit count: 323

Filed under:
|
|

Hi i tried to retrieve all users from the domain using provisioning api & 2-legged OAuth in java program but it returns unknown authorization header........... when i started to search about it i got the scope as https://apps-apis.google.com/a/feeds/user/#readonly. i dont what what #readonly refers please explain it ....

Regards Sharun

© Stack Overflow or respective owner

Provisioning Api using java

Posted by user268515 on Stack Overflow See other posts from Stack Overflow or by user268515
Published on 2010-05-21T07:16:24Z Indexed on 2010/05/21 7:20 UTC
Read the original article Hit count: 323

Filed under:
|
|
|

Hi i'm working in java and tried to retrieve all the user in the domain for that i used Provisionin api............ Its working good But my idea is to Use 2-legged OAuth to retrieve the users from the domain Is it Possible? I dont how to specify the URL please Help me And i triede the following the program

    final String CONSUMER_KEY = "xxxxxxxxxx.com";
    final String CONSUMER_SECRET = "12345678122154154df9";
    final String DOMAIN = "xxxxxxxxxx.com";
    GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
    oauthParameters.setOAuthConsumerKey(CONSUMER_KEY);
    oauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET);
    oauthParameters.setOAuthType(OAuthType.TWO_LEGGED_OAUTH);
    OAuthHmacSha1Signer signer = new OAuthHmacSha1Signer();
    URL feedUrl = new URL("https://apps-apis.google.com/a/feeds/" + DOMAIN + 
      "/user/2.0/[email protected]");
userService = new UserService("Myapplication");
    userService.setOAuthCredentials(oauthParameters, signer);
    userService.useSsl();
    UserFeed allUsers = new UserFeed();
       UserFeed allpage;
      Link nextLink;


do {
  allpage = userService.getFeed(feedUrl, UserFeed.class);

  allUsers.getEntries().addAll(allpage.getEntries());

  nextLink = allpage.getLink(Link.Rel.NEXT, Link.Type.ATOM);
  if (nextLink != null) {
    feedUrl = new URL(nextLink.getHref());
   }

}while (nextLink != null);
return allUsers;
 }

Its returing the error as com.google.gdata.util.AuthenticationException: Unknown authorization header

© Stack Overflow or respective owner

Related posts about provisioning

Related posts about api