Exemple #1
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();
  }
 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;
 }
Exemple #3
0
  public String getRequestToken()
      throws OAuthMessageSignerException, OAuthNotAuthorizedException,
          OAuthExpectationFailedException, OAuthCommunicationException {

    //		String callBackUrl="mfmd://OAuthActivity";
    String callBackUrl = "";
    String oauthURL = provider.retrieveRequestToken(consumer, callBackUrl);
    return oauthURL;
  }
 public void requestAuthorization(final Activity ctx, final DialogListener listener)
     throws OAuthMessageSignerException, OAuthNotAuthorizedException,
         OAuthExpectationFailedException, OAuthCommunicationException {
   final String authUrl = httpOauthprovider.retrieveRequestToken(httpOauthConsumer, callback);
   ctx.runOnUiThread(
       new Runnable() {
         public void run() {
           new SocialLibDialog(ctx, authUrl, listener, callback).show();
         }
       });
 }
 private void authorizeUser() {
   commonsHttpOAuthProvider =
       new CommonsHttpOAuthProvider(
           TWITTER_OAUTH_REQUEST_TOKEN_ENDPOINT,
           TWITTER_OAUTH_ACCESS_TOKEN_ENDPOINT,
           TWITTER_OAUTH_AUTHORIZE_ENDPOINT);
   commonsHttpOAuthConsumer =
       new CommonsHttpOAuthConsumer(Constants.CONSUMER_KEY, Constants.CONSUMER_SECRET);
   commonsHttpOAuthProvider.setOAuth10a(true);
   dialog =
       new TwDialog(
           this,
           commonsHttpOAuthProvider,
           commonsHttpOAuthConsumer,
           dialogListener,
           R.drawable.login);
   dialog.show();
 }