Package com.restfb

Examples of com.restfb.FacebookClient$AccessToken


      return null;
    }
  }
 
  public List<FacebookUser> getFriends(String accessToken) throws FacebookOAuthException {
    FacebookClient fb = createFacebookClient(accessToken);
    return fb.executeFqlQuery(FRIENDS_FQL, FacebookUser.class);
  }
View Full Code Here


    FacebookClient fb = createFacebookClient(accessToken);
    return fb.executeFqlQuery(FRIENDS_FQL, FacebookUser.class);
  }
 
  public List<FacebookUser> getAppFriends(String accessToken) throws FacebookOAuthException {
    FacebookClient fb = createFacebookClient(accessToken);
    return fb.executeFqlQuery(APP_FRIENDS_FQL, FacebookUser.class);
  }
View Full Code Here

    FacebookClient fb = createFacebookClient(accessToken);
    return fb.executeFqlQuery(APP_FRIENDS_FQL, FacebookUser.class);
  }
 
  public List<String> getAppFriendsIds(String accessToken) throws FacebookOAuthException {
    FacebookClient fb = createFacebookClient(accessToken);
    List<FacebookUser> facebookUsers = fb.executeFqlQuery(APP_FRIENDS_IDS_FQL, FacebookUser.class);
    return Lists.transform(facebookUsers, new PropertyFunction<FacebookUser, String>("facebookId"));
  }
View Full Code Here

  public void publish(String accessToken, String message) {
    publish(accessToken, FB_ME, message);
  }
 
  public void publish(String accessToken, String facebookId, String message) {
    FacebookClient fb = createFacebookClient(accessToken);
    fb.publish(facebookId + FB_FEED, FacebookType.class, Parameter.with(FB_MESSAGE, message));
  }
View Full Code Here

    publishLink(accessToken, FB_ME, link, message, image, caption, description);
  }
 
  public void publishLink(String accessToken, String facebookId, String link, String message, String image,
      String caption, String description) {
    FacebookClient fb = createFacebookClient(accessToken);
    fb.publish(facebookId + FB_FEED, FacebookType.class, Parameter.with(FB_LINK, link),
      Parameter.with(FB_MESSAGE, message), Parameter.with(FB_PICTURE, image),
      Parameter.with(FB_CAPTION, caption), Parameter.with(FB_DESC, description));
  }
View Full Code Here

    @Path("/login")
    public Response facebookLogin(@QueryParam("access_token") String access_token) {
        String appId = env.get("facebook.appId");
        String appSecret = env.get("facebook.appSecret");
        try {
            FacebookClient facebookClient = new DefaultFacebookClient(access_token);
            User user = facebookClient.fetchObject("me", User.class);

            String me = "";
            try {
                me = gson.toJson(user);
            } catch (Exception e) {
View Full Code Here

    // You'll want to initialize the bridge just once at app startup.
    // In a webapp, a good place to do this is ContextLoaderListener#contextInitialized()
    SLF4JBridgeHandler.install();

    try {
      FacebookClient facebookClient = new DefaultFacebookClient();

      // You'll notice that logging statements from this call are bridged from java.util.logging to Log4j
      User user = facebookClient.fetchObject("btaylor", User.class);

      // ...and of course this goes straight to Log4j
      logger.debug(user);
    } finally {
      // Make sure to tear down when you're done using the bridge
View Full Code Here

            try {
                verifier = IN.readLine();
            } catch (final IOException ex) {
                throw new RuntimeException(ex);
            }
            final AccessToken accessToken = authFlow.finish(verifier);

            // store access token for next application execution
            PROPERTIES.setProperty(PROPERTY_TOKEN, accessToken.getToken());
            PROPERTIES.setProperty(PROPERTY_TOKEN_SECRET, accessToken.getAccessTokenSecret());

            // get the feature that will configure the client with consumer credentials and
            // received access token
            filterFeature = authFlow.getOAuth1Feature();
        } else {
            final AccessToken storedToken = new AccessToken(PROPERTIES.getProperty(PROPERTY_TOKEN),
                    PROPERTIES.getProperty(PROPERTY_TOKEN_SECRET));
            // build a new feature from the stored consumer credentials and access token
            filterFeature = OAuth1ClientSupport.builder(consumerCredentials).feature()
                    .accessToken(storedToken).build();
        }
View Full Code Here

        final Response userAuthResponse = ClientBuilder.newClient().target(authUri).request().get();
        Assert.assertEquals(200, userAuthResponse.getStatus());
        final String verifier = userAuthResponse.readEntity(String.class);
        System.out.println("Verifier: " + verifier);

        final AccessToken accessToken = authFlow.finish(verifier);
        final Client authorizedClient = authFlow.getAuthorizedClient();

        Response response = authorizedClient.target(getBaseUri()).path("resource")
                .request().get();
        Assert.assertEquals(200, response.getStatus());
View Full Code Here

     */
    @Test
    public void testRequestSigning() {
        final Feature filterFeature = OAuth1ClientSupport.builder(
                new ConsumerCredentials(CONSUMER_KEY, SECRET_CONSUMER_KEY)).feature()
                .accessToken(new AccessToken(PROMETHEUS_TOKEN, PROMETHEUS_SECRET)).build();
        final Client client = ClientBuilder.newBuilder()
                .register(filterFeature).build();
        final URI resourceUri = UriBuilder.fromUri(getBaseUri()).path("resource").build();
        final WebTarget target = client.target(resourceUri);
        Response response;
View Full Code Here

TOP

Related Classes of com.restfb.FacebookClient$AccessToken

Copyright © 2018 www.massapicom. 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.