Exemplo n.º 1
0
  virtual void getIdentity(const OAuthAccessToken& token)
  {
    Http::Client *client = new Http::Client(this);
    client->setTimeout(15);
    client->setMaximumResponseSize(10*1024);

    client->done().connect
      (boost::bind(&FacebookProcess::handleMe, this, _1, _2));
    client->get("https://graph.facebook.com/me?fields=name,id,email&access_token=" + token.value());

#ifndef WT_TARGET_JAVA
    WApplication::instance()->deferRendering();
#endif
  }
Exemplo n.º 2
0
    // This call retrieves information about LinkedIn user: basic profile info and email address (as defined by the scope member variable):
    virtual void getIdentity(const OAuthAccessToken& token)
    {
      // Create Http REST client object:
      Http::Client *client = new Http::Client(this);
      client->setTimeout(15);
      client->setMaximumResponseSize(10*1024);

      // Tell how to handle the response:
      client->done().connect(boost::bind(&LinkedInProcess::handleMe, this, _1, _2));

      // Initialize request headers:
      std::vector<Http::Message::Header> headers;
      headers.push_back(Http::Message::Header("Authorization",
        "Bearer " + token.value()));

      const char *UserInfoUrl = "https://api.linkedin.com/v1/people/~:(id,num-connections,first-name,last-name,headline,location,email-address,positions,public-profile-url)?format=json";
      client->get(UserInfoUrl, headers);

#ifndef WT_TARGET_JAVA
      WApplication::instance()->deferRendering();
#endif
    }