twitter4j.Twitter.getOAuthRequestToken()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中twitter4j.Twitter.getOAuthRequestToken()方法的一些代码示例,展示了Twitter.getOAuthRequestToken()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Twitter.getOAuthRequestToken()方法的具体详情如下:
包路径:twitter4j.Twitter
类名称:Twitter
方法名:getOAuthRequestToken

Twitter.getOAuthRequestToken介绍

[英]Retrieves a request token
[中]检索请求令牌

代码示例

代码示例来源:origin: org.twitter4j/twitter4j-async

@Override
public RequestToken getOAuthRequestToken() throws TwitterException {
  return twitter.getOAuthRequestToken();
}

代码示例来源:origin: org.twitter4j/twitter4j-async

@Override
public RequestToken getOAuthRequestToken(String callbackUrl) throws TwitterException {
  return twitter.getOAuthRequestToken(callbackUrl);
}

代码示例来源:origin: OpenNMS/opennms

public MicroblogAuthorization(final Twitter twitter) throws MicroblogAuthorizationException {
  m_twitter = twitter;
  try {
    m_requestToken = twitter.getOAuthRequestToken();
  } catch (final TwitterException e) {
    throw new MicroblogAuthorizationException("Unable to get OAuth request token", e);
  }
}

代码示例来源:origin: stackoverflow.com

@Override
   protected RequestToken doInBackground( Void... params ) {
     Twitter twitter = getTwitter();
     RequestToken token = null;
     try {
       token = twitter.getOAuthRequestToken();
     }
     catch (TwitterException e) {
       Log.e( TAG, e.getMessage(), e );
     }
     return token;
   }

代码示例来源:origin: jchampemont/WTFDYUM

@Override
public RequestToken signin(final String path) throws WTFDYUMException {
  RequestToken token = null;
  try {
    token = twitter().getOAuthRequestToken(new StringBuilder(baseUrl).append(path).toString());
  } catch (final TwitterException e) {
    log.debug("Error while signin", e);
    throw new WTFDYUMException(e, WTFDYUMExceptionType.TWITTER_ERROR);
  }
  return token;
}

代码示例来源:origin: HuygensING/timbuctoo

@GET
public Response login() throws TwitterException {
 RequestToken requestToken = twitter.getOAuthRequestToken();
 tokenSecrets.put(requestToken.getToken(), requestToken);
 return Response.temporaryRedirect(URI.create(requestToken.getAuthorizationURL())).build();
}

代码示例来源:origin: stackoverflow.com

ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
  .setOAuthConsumerKey("ConsumerKey")
  .setOAuthConsumerSecret("ConsumerSecret");
try {
  Twitter twitter = new TwitterFactory(cb.build()).getInstance();
  requestToken = twitter.getOAuthRequestToken("application://calback");
  WebView twitterSite = new WebView(MyActivity.this);
  twitterSite.loadUrl(requestToken.getAuthenticationURL());
  setContentView(twitterSite);                    
} catch (Exception e) {
  e.printStackTrace();
}

代码示例来源:origin: stackoverflow.com

Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer(consumerKey, consumerSecret);
RequestToken requestToken = twitter.getOAuthRequestToken(CALLBACKURL); 
...
...

代码示例来源:origin: org.twitter4j/twitter4j-async

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    RequestToken token = twitter.getOAuthRequestToken();
    for (TwitterListener listener : listeners) {
      try {
        listener.gotOAuthRequestToken(token);
      } catch (Exception e) {
        logger.warn("Exception at getOAuthRequestTokenAsync", e);
      }
    }
  }
});

代码示例来源:origin: org.twitter4j/twitter4j-async

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    RequestToken token = twitter.getOAuthRequestToken(callbackURL);
    for (TwitterListener listener : listeners) {
      try {
        listener.gotOAuthRequestToken(token);
      } catch (Exception e) {
        logger.warn("Exception at getOAuthRequestTokenAsync", e);
      }
    }
  }
});

代码示例来源:origin: org.twitter4j/twitter4j-async

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    RequestToken token = twitter.getOAuthRequestToken(callbackURL, xAuthAccessType);
    for (TwitterListener listener : listeners) {
      try {
        listener.gotOAuthRequestToken(token);
      } catch (Exception e) {
        logger.warn("Exception at getOAuthRequestTokenAsync", e);
      }
    }
  }
});

代码示例来源:origin: org.twitter4j/twitter4j-async

@Override
  public void invoke(List<TwitterListener> listeners) throws TwitterException {
    RequestToken token = twitter.getOAuthRequestToken(callbackURL, xAuthAccessType, xAuthMode);
    for (TwitterListener listener : listeners) {
      try {
        listener.gotOAuthRequestToken(token);
      } catch (Exception e) {
        logger.warn("Exception at getOAuthRequestTokenAsync", e);
      }
    }
  }
});

代码示例来源:origin: ORCID/ORCID-Source

/**
 * Get the twitter RequestToken
 * 
 * @return The twitter RequestToken
 * */
private RequestToken getTwitterRequestToken(String orcid) throws Exception {
  // If it exists, use it once and discard it
  if (requestTokenMap.containsKey(orcid)) {
    RequestToken result = requestTokenMap.get(orcid);
    requestTokenMap.remove(orcid);
    return result;
  } else {
    Twitter twitter = new TwitterFactory().getInstance();
    twitter.setOAuthConsumer(twitterKey, twitterSecret);
    RequestToken requestToken = twitter.getOAuthRequestToken();
    requestTokenMap.put(orcid, requestToken);
    return requestToken;
  }
}

代码示例来源:origin: stackoverflow.com

RequestToken requestToken = twitter.getOAuthRequestToken(callbackURL.toString());
System.out.println("request token is " + requestToken);

代码示例来源:origin: stackoverflow.com

Twitter twitter = new Twitter();
twitter.setOAuthConsumer(consumerKey,consumerSecret);
RequestToken requestToken = twitter.getOAuthRequestToken();

String token = requestToken.getToken();
String tokenSecret = requestToken.getTokenSecret();

HttpSession session = request.getSession();
session.setAttribute("token",token);
session.setAttribute("tokenSecret",tokenSecret);

代码示例来源:origin: stackoverflow.com

Twitter twitter = new TwitterFactory().getInstance();
 twitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
 RequestToken reqToken = twitter.getOAuthRequestToken();
 mWebView.loadUrl(reqToken.getAuthenticationURL());

代码示例来源:origin: org.mule.modules/mule-module-twitter

/**
 * Start the OAuth request authorization process.
 * <p/>
 * {@sample.xml ../../../doc/twitter-connector.xml.sample twitter:requestAuthorization}
 *
 * @param callbackUrl the url to be requested when the user authorizes this app
 * @return The user request token. For retrieving the authorization URL please call requestToken.getAuthorizationURL()
 * @throws TwitterException when Twitter service or network is unavailable
 */
@Processor
public RequestToken requestAuthorization(@Optional String callbackUrl) throws TwitterException {
  RequestToken token = getConnectionManagement().getTwitterClient().getOAuthRequestToken(callbackUrl);
  return token;
}

代码示例来源:origin: stackoverflow.com

Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer("yourConsumerKey","yourConsumerSecret");
RequestToken requestToken = twitter.getOAuthRequestToken();

session.setAttribute("token", requestToken.getToken());
session.setAttribute("tokenSecret", requestToken.getTokenSecret());

// REDIRECT USER TO TWITTER LOGIN PAGE

response.sendRedirect(requestToken.getAuthorizationURL());

代码示例来源:origin: stackoverflow.com

Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer(consumerKey, consumerSecret);
RequestToken requestToken = twitter.getOAuthRequestToken();

代码示例来源:origin: borax12/Searcher

private void login() {
  final ConfigurationBuilder builder = new ConfigurationBuilder();
  builder.setOAuthConsumerKey(consumerKey);
  builder.setOAuthConsumerSecret(consumerSecret);
  final Configuration configuration = builder.build();
  final TwitterFactory factory = new TwitterFactory(configuration);
  twitter = factory.getInstance();
  try {
    requestToken = twitter.getOAuthRequestToken(callbackUrl);
    /**
     *  webview for authorization
     *  Once authorized, results are received at onActivityResult
     *  */
    final Intent intent = new Intent(this, WebViewActivity.class);
    intent.putExtra(WebViewActivity.EXTRA_URL, requestToken.getAuthenticationURL());
    startActivityForResult(intent, REQUEST_CODE);
  } catch (TwitterException e) {
    e.printStackTrace();
  }
}

相关文章