示例#1
0
 public void authorize(String url)
     throws OAuthMessageSignerException, OAuthNotAuthorizedException,
         OAuthExpectationFailedException, OAuthCommunicationException {
   String verifier = Uri.parse(url).getQueryParameter(oauth.signpost.OAuth.OAUTH_VERIFIER);
   httpOauthprovider.retrieveAccessToken(httpOauthConsumer, verifier);
   accessToken = new Token(httpOauthConsumer.getToken(), httpOauthConsumer.getTokenSecret());
   authentified = true;
 }
示例#2
0
  public void getAccessToken()
      throws OAuthMessageSignerException, OAuthNotAuthorizedException,
          OAuthExpectationFailedException, OAuthCommunicationException {

    provider.setOAuth10a(true);
    provider.retrieveAccessToken(consumer, verifier);
    this.access_token = consumer.getToken();
    this.access_token_secret = consumer.getTokenSecret();
  }
示例#3
0
 /**
  * 获得AccessToken
  *
  * @param intent
  * @return UserInfo
  */
 public User getAccessToken(Intent intent) {
   Uri uri = intent.getData();
   // 处理获取返回的oauth_verifier参数
   String verifier = uri.getQueryParameter(oauth.signpost.OAuth.OAUTH_VERIFIER);
   try {
     httpOauthprovider.setOAuth10a(true);
     httpOauthprovider.retrieveAccessToken(httpOauthConsumer, verifier);
   } catch (OAuthMessageSignerException ex) {
     ex.printStackTrace();
   } catch (OAuthNotAuthorizedException ex) {
     ex.printStackTrace();
   } catch (OAuthExpectationFailedException ex) {
     ex.printStackTrace();
   } catch (OAuthCommunicationException ex) {
     ex.printStackTrace();
   }
   SortedSet<String> user_id = httpOauthprovider.getResponseParameters().get("user_id");
   String userToken = httpOauthConsumer.getToken();
   String userSecret = httpOauthConsumer.getTokenSecret();
   User user = new User(user_id.first(), userToken, userSecret);
   return user;
 }
 /**
  * Returns the access token.
  *
  * @return the access token.
  */
 public String getToken() {
   return consumer.getToken();
 }
 // verifier parametro oauth_verifier della query
 public void retrieveAccessToken(String verifier)
     throws ThoundsOAuthParameterExcepion, ThoundsConnectionException {
   retrieveAccessToken(verifier, consumer.getToken(), consumer.getTokenSecret());
 }
示例#6
0
 public Token getAccessToken() {
   accessToken = new Token(httpOauthConsumer.getToken(), httpOauthConsumer.getTokenSecret());
   return accessToken;
 }