Package org.scribe.oauth

Examples of org.scribe.oauth.OAuthService.signRequest()


        // TODO: Store this token if authorization succeeds
        Token accessToken = service.getAccessToken(storedToken, verifier);

        OAuthRequest authRequest = new OAuthRequest(Verb.GET, "https://api.twitter.com/1.1/account/verify_credentials.json");
        service.signRequest(accessToken, authRequest);
        Response authResponse = authRequest.send();

        if (!authResponse.isSuccessful()) {
            LOGGER.warn("OAuth handshake completed, but Twitter credential verification failed: " + authResponse.getMessage());
            httpResponse.sendError(HttpServletResponse.SC_FORBIDDEN);
View Full Code Here


       
       
        String url = getProtectedResourceUrlFromSession();
        OAuthRequest request = new OAuthRequest(Verb.GET,url);
        // sign the request
        service.signRequest(accessToken,request);
        Response response = request.send();
        String json = response.getBody();
        SocialUser socialUser = getSocialUserFromJson(json,authProvider);
        return socialUser;
    }
View Full Code Here

            logger.info("Getting protected resource");
            logger.info("Protected resource url: " + protectedResourceUrl);
            try
            {
                OAuthRequest request = new OAuthRequest(Verb.GET,protectedResourceUrl);
                service.signRequest(accessToken,request);
               
                Response response = request.send();
                logger.info("Status code: " + response.getCode());
                logger.info("Body: " + response.getBody());
               
View Full Code Here

          final String code = request.getParameter("code");
          if(StringUtils.isNotEmpty(code)){
            Verifier verifier = new Verifier(code);
            Token accessToken = service.getAccessToken(EMPTY_TOKEN, verifier);
            OAuthRequest oauthRequest = new OAuthRequest(Verb.GET, LIVE_ME_URL);
              service.signRequest(accessToken, oauthRequest);
              Response oauthResponse = oauthRequest.send();
              int responseCode = oauthResponse.getCode();
              String responseBody = oauthResponse.getBody();
             
              if(responseCode == 200){
View Full Code Here

            Verifier verifier = new Verifier(code);
            Token requestToken = (Token) request.getSession().getAttribute(TWITTER_OAUTH_REQUEST_TOKEN);
           
            Token accessToken = service.getAccessToken(requestToken, verifier);
            OAuthRequest oauthRequest = new OAuthRequest(Verb.GET, TWITTER_URL);
              service.signRequest(accessToken, oauthRequest);
              Response oauthResponse = oauthRequest.send();
              int responseCode = oauthResponse.getCode();
              String responseBody = oauthResponse.getBody();
             
              if(responseCode == 200){
View Full Code Here

                    final String code = request.getParameter("code");
                    if (StringUtils.isNotEmpty(code)) {
                        Verifier verifier = new Verifier(code);
                        Token accessToken = service.getAccessToken(EMPTY_TOKEN, verifier);
                        OAuthRequest oauthRequest = new OAuthRequest(Verb.GET, GOOGLE_ME_URL);
                        service.signRequest(accessToken, oauthRequest);
                        Response oauthResponse = oauthRequest.send();
                        int responseCode = oauthResponse.getCode();
                        String responseBody = oauthResponse.getBody();

                        if (responseCode == 200) {
View Full Code Here

          final String code = request.getParameter("code");
          if(StringUtils.isNotEmpty(code)){
            Verifier verifier = new Verifier(code);
            Token accessToken = service.getAccessToken(EMPTY_TOKEN, verifier);
            OAuthRequest oauthRequest = new OAuthRequest(Verb.GET, FACEBOOK_ME_URL);
              service.signRequest(accessToken, oauthRequest);
              Response oauthResponse = oauthRequest.send();
              int responseCode = oauthResponse.getCode();
              String responseBody = oauthResponse.getBody();
             
              if(responseCode == 200){
View Full Code Here

        final Token token = new Token(accessToken, guestService.getApiKeyAttribute(updateInfo.apiKey, "runkeeperConsumerSecret"));
        final String userEndpoint = url + accessToken;
        OAuthRequest request = new OAuthRequest(Verb.GET, userEndpoint);
        request.addHeader("Accept", "application/vnd.com.runkeeper.User+json");
        final OAuthService service = runKeeperController.getOAuthService();
        service.signRequest(token, request);
        Response response = request.send();
        final int httpResponseCode = response.getCode();
        long then = System.currentTimeMillis();
        String body = response.getBody();
View Full Code Here

                                                parameters.get(parameterName));
            }
            OAuthService service = getOAuthService(updateInfo.apiKey);
            final String accessToken = guestService.getApiKeyAttribute(updateInfo.apiKey, "accessToken");
            final Token token = new Token(accessToken, guestService.getApiKeyAttribute(updateInfo.apiKey, "tokenSecret"));
            service.signRequest(token, request);
            Response response = request.send();
            httpResponseCode = response.getCode();
            if (httpResponseCode!=200)
                throw new UpdateFailedException("Unexpected response code: " + httpResponseCode);
            String json = response.getBody();
View Full Code Here

        System.out.println("********A basic user profile call********");
        //The ~ means yourself - so this should return the basic default information for your profile in XML format
        //https://developer.linkedin.com/documents/profile-api
        String url = "http://api.linkedin.com/v1/people/~";
        OAuthRequest request = new OAuthRequest(Verb.GET, url);
        service.signRequest(accessToken, request);
        Response response = request.send();
        System.out.println(response.getBody());
        System.out.println();System.out.println();

        System.out.println("********Get the profile in JSON********");
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.