Cindy, This thread already some of my attempts: "Using Provisioning API through 3-legged auth"
http://www.mail-archive.com/[email protected]/msg00393.html If you have any clue, please contact me. We could share solutions. Thanks, Pedro Ferreira Em 10-05-2011 10:53, Cindy de Albuquerque escreveu: > I am developing an application with 3LO to retrieve the users in my domain, > among other stuff. Until yesterday, it was working fine and it retrieved all > the users. However, this morning it started giving me this error: > > Token invalid - AuthSub token has wrong scope > > I haven't changed anything in my domain nor in the code. Is this an issue? > Here is my code: > UserService service = null; > try { > HttpSession session = request.getSession(); > String tokenAcesso = (String) session.getAttribute("tokenAcesso"); > String tokenSecret = (String) session.getAttribute("tokenSecret"); > String urlEscopo = https://apps-apis.google.com/a/feeds/user/#readonly"; > String url = > "https://apps-apis.google.com/a/feeds/<mydomain>.com/user/2.0/"; > > GoogleOAuthParameters oAuthParameters = new GoogleOAuthParameters(); > oAuthParameters.setOAuthConsumerKey(CONSUMER_KEY); > oAuthParameters.setOAuthConsumerSecret(CONSUMER_SECRET); > oAuthParameters.setOAuthToken(tokenAcesso); > oAuthParameters.setOAuthTokenSecret(tokenSecret); > oAuthParameters.setScope(urlEscopo); > > service = new UserService( > "gdata-sample-AppsForYourDomain-ListUserService"); > service.setOAuthCredentials(oAuthParameters, > new OAuthHmacSha1Signer()); > > > URL retrieveUrl = new URL(url); > > UserFeed allUsers = new UserFeed(); > UserFeed currentPage = null; > Link nextLink = null; > do { > currentPage = service.getFeed(retrieveUrl, UserFeed.class); > allUsers.getEntries().addAll(currentPage.getEntries()); > nextLink = currentPage.getLink(Link.Rel.NEXT, Link.Type.ATOM); > if (nextLink != null) { > retrieveUrl = new URL(nextLink.getHref()); > } > } while (nextLink != null); > } > > Thanks in advance, > Cindy de Albuquerque. > -- You received this message because you are subscribed to the Google Groups "Google Apps Domain Information and Management APIs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-apps-mgmt-apis?hl=en.
