Package weibo4j.http

Examples of weibo4j.http.RequestToken


         
         
            Weibo weibo = new Weibo();
            // set callback url, desktop app please set to null
            // http://callback_url?oauth_token=xxx&oauth_verifier=xxx
            RequestToken requestToken = weibo.getOAuthRequestToken();
           
            System.out.println("Got request token.");
            System.out.println("Request token: "+ requestToken.getToken());
            System.out.println("Request token secret: "+ requestToken.getTokenSecret());
            AccessToken accessToken = null;

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            while (null == accessToken) {
                System.out.println("Open the following URL and grant access to your account:");
                System.out.println(requestToken.getAuthorizationURL());
                BareBonesBrowserLaunch.openURL(requestToken.getAuthorizationURL());
                System.out.print("Hit enter when it's done.[Enter]:");
               
                String pin = br.readLine();
                System.out.println("pin: " + br.toString());
                try{
                    accessToken = requestToken.getAccessToken(pin);
                } catch (WeiboException te) {
                    if(401 == te.getStatusCode()){
                        System.out.println("Unable to get the access token.");
                    }else{
                        te.printStackTrace();
View Full Code Here


          Weibo.CONSUMER_SECRET);

      Weibo weibo = new Weibo();
      // set callback url, desktop app please set to null
      // http://callback_url?oauth_token=xxx&oauth_verifier=xxx
      RequestToken requestToken = weibo.getOAuthRequestToken(backUrl);

      System.out.println("Got request token.");
      System.out.println("Request token: " + requestToken.getToken());
      System.out.println("Request token secret: "
          + requestToken.getTokenSecret());
      return requestToken;
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
View Full Code Here

  this.weibo = new Weibo();
  }

  public AuthToken requestToken() throws Exception {

  RequestToken requestToken;
  requestToken = weibo.getOAuthRequestToken(this.authCallbackUrl);

  log.info("Token:" + requestToken.getToken());
  log.info("TokenSecret:" + requestToken.getTokenSecret());
  log.info(requestToken.getAuthenticationURL());

  AuthToken authToken = new AuthToken(WeiboSource.Sina, requestToken.getToken(), requestToken.getTokenSecret());

  return authToken;
  }
View Full Code Here

TOP

Related Classes of weibo4j.http.RequestToken

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.