Ejemplo n.º 1
0
  private static void getAccessToken() {
    System.out.println("Getting an OAuth access token\n");

    WebResource resource = client.resource(TOKEN_SERVICE + "get_access_token");

    resource.addFilter(filter);

    MultivaluedMap<String, String> response = POST(resource, new MultivaluedMapImpl());
    params.token(required(response.getFirst("oauth_token")));

    secrets.tokenSecret(required(response.getFirst("oauth_token_secret")));

    System.out.println(response + "\n");
  }
Ejemplo n.º 2
0
  private static void getRequestToken() {
    System.out.println("Getting an OAuth request token\n");

    params.consumerKey(CONSUMER_KEY).signatureMethod(SIGNATURE_METHOD);
    secrets.consumerSecret(CONSUMER_SECRET);

    WebResource resource = client.resource(TOKEN_SERVICE + "get_request_token");

    resource.addFilter(filter);

    MultivaluedMap<String, String> response = POST(resource, new MultivaluedMapImpl());

    params.token(required(response.getFirst("oauth_token")));

    secrets.tokenSecret(required(response.getFirst("oauth_token_secret")));

    System.out.println(response + "\n");
  }