Package org.scribe.model

Examples of org.scribe.model.OAuthRequest.send()


          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){
                handleAuthenticationData(request, response, requestData, OAuthType.WINDOWS_LIVE, responseBody);
View Full Code Here


            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){
                handleAuthenticationData(request, response, requestData, OAuthType.TWITTER, responseBody);
View Full Code Here

                    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) {
                             handleAuthenticationData(request, response, requestData, OAuthType.FACEBOOK, responseBody);
View Full Code Here

          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){
                handleAuthenticationData(request, response, requestData, OAuthType.FACEBOOK, responseBody);
View Full Code Here

                request.addQuerystringParameter(OAuthConstants.CLIENT_SECRET, config.getApiSecret());
                request.addQuerystringParameter(OAuthConstants.CODE, verifier.getValue());
                request.addQuerystringParameter(OAuthConstants.REDIRECT_URI, config.getCallback());
                if(config.hasScope()) request.addQuerystringParameter(OAuthConstants.SCOPE, config.getScope());
            }
            Response response = request.send();
            return api.getAccessTokenExtractor().extract(response.getBody());
        }
    }
}
View Full Code Here

            }
            if (this.addGrantType) {
                request.addBodyParameter("grant_type", "authorization_code");
            }
        }
        final Response response = request.send();
        return this.api.getAccessTokenExtractor().extract(response.getBody());
    }
}
View Full Code Here

        request.addOAuthParameter(OAuthConstants.CALLBACK, this.config.getCallback());
        addOAuthParams(request, OAuthConstants.EMPTY_TOKEN);
        appendSignature(request);
       
        this.config.log("sending request...");
        final Response response = request.send();
        final String body = response.getBody();
       
        this.config.log("response status code: " + response.getCode());
        this.config.log("response body: " + body);
        return this.api.getRequestTokenExtractor().extract(body);
View Full Code Here

        if (LOG.isDebugEnabled()) {
            LOG.debug("Yammer request url: {}", request.getCompleteUrl());
        }
       
        Response response = request.send();
        if (response.isSuccessful()) {                   
            return response.getBody();
        } else {
            throw new Exception(String.format("Failed to poll %s. Got response code %s and body: %s", getApiUrl(), response.getCode(), response.getBody()));
        }
View Full Code Here

  public static void saveAccessToken(HttpServletRequest request, OAuthService service, Token accessToken) throws Exception {
   
        OAuthRequest _request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL);
        service.signRequest(accessToken, _request);
        Response _response = _request.send();
        if (_response.getCode() != 200)
          throw new OAuthException("Can query account information.");

        String contentType = _response.getHeader("Content-Type");
    if (contentType == null) contentType = "";
View Full Code Here

          req.addBodyParameter(OAuthConstants.CODE, verifier.getValue());
    // jetty.port.jetty
          req.addBodyParameter(OAuthConstants.REDIRECT_URI, config.getReturnURL());
          req.addBodyParameter("grant_type", "authorization_code");
         
          String responce = req.send().getBody();

          JSONTokener tokener = new JSONTokener(responce);
          try {
              JSONObject root = new JSONObject(tokener);
              String access_token = root.getString("access_token");
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.