本文整理汇总了Java中twitter4j.auth.AccessToken.getTokenSecret方法的典型用法代码示例。如果您正苦于以下问题:Java AccessToken.getTokenSecret方法的具体用法?Java AccessToken.getTokenSecret怎么用?Java AccessToken.getTokenSecret使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twitter4j.auth.AccessToken
的用法示例。
在下文中一共展示了AccessToken.getTokenSecret方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: signinCallback
import twitter4j.auth.AccessToken; //导入方法依赖的package包/类
@RequestMapping(value = "/signin/callback", method = RequestMethod.GET)
public RedirectView signinCallback(@RequestParam("oauth_verifier") final String verifier,
final HttpServletRequest request) throws WTFDYUMException {
final RequestToken requestToken = (RequestToken) request.getSession().getAttribute(SESSION_REQUEST_TOKEN);
request.getSession().removeAttribute(SESSION_REQUEST_TOKEN);
final AccessToken accessToken = twitterService.completeSignin(requestToken, verifier);
if (principalService.get(accessToken.getUserId()) == null) {
userService.addEvent(accessToken.getUserId(), new Event(EventType.REGISTRATION, null));
}
final Principal user = new Principal(accessToken.getUserId(), accessToken.getToken(), accessToken.getTokenSecret());
principalService.saveUpdate(user);
authenticationService.authenticate(user);
return new RedirectView("/user", true);
}
示例2: save
import twitter4j.auth.AccessToken; //导入方法依赖的package包/类
/**
* Stores the session data on disk.
*
* @param context
* @return
*/
public boolean save(Context context, AccessToken accessToken)
{
Editor editor = context.getSharedPreferences(KEY, Context.MODE_PRIVATE).edit();
this.token = accessToken.getToken();
this.tokensecret = accessToken.getTokenSecret();
editor.putString(TOKEN, token);
editor.putString(TOKENSECRET, tokensecret);
if (editor.commit())
{
singleton = this;
return true;
}
return false;
}
示例3: saveAccessToken
import twitter4j.auth.AccessToken; //导入方法依赖的package包/类
private void saveAccessToken(AccessToken at) {
String token = at.getToken();
String secret = at.getTokenSecret();
Editor editor = mPrefs.edit();
editor.putString(PREF_ACCESS_TOKEN, token);
editor.putString(PREF_ACCESS_TOKEN_SECRET, secret);
editor.commit();
}
示例4: onGotTwitterAccessToken
import twitter4j.auth.AccessToken; //导入方法依赖的package包/类
protected void onGotTwitterAccessToken (final AccessToken accessToken, final TwitterOauthComplete completeCallback) {
try {
LOG.i("Account authorised %s.", accessToken.getScreenName());
final Account account = new Account(completeCallback.getAccountId(), accessToken.getScreenName(), AccountProvider.TWITTER,
getTwitterConfiguration().getOAuthConsumerKey(), getTwitterConfiguration().getOAuthConsumerSecret(),
accessToken.getToken(), accessToken.getTokenSecret());
completeCallback.onAccount(account, accessToken.getScreenName());
}
catch (final Exception e) { // NOSONAR want to show any errors to the user.
LOG.e("Failed to write new Twitter account.", e);
DialogHelper.alert(getContext(), e);
}
}
示例5: showHTML
import twitter4j.auth.AccessToken; //导入方法依赖的package包/类
@SuppressWarnings("unused")
@JavascriptInterface
public void showHTML(String html) throws TwitterException {
// System.out.println("html web page " + html);
String startImageUrl = "<img src=\"";
String endImageUrl = "\" alt=\"";
String extractedImage;
int imageStartPosition = html.indexOf(startImageUrl)
+ startImageUrl.length();
int imageEndPosition = html.indexOf(endImageUrl);
if (imageEndPosition != -1 && html.indexOf(startImageUrl) != -1) {
extractedImage = html.substring(imageStartPosition,
imageEndPosition);
// System.out.println("IAMGE EXTRACTEDDDD "+extractedImage);
TwitterAuthorization.FETCHED_IMAGE_URL = extractedImage
.replace("mini", "normal");
}
String pinCode = null;
String name = null;
String endSearchList = "</code></kbd>";
String startSearchList = "<kbd aria-labelledby=\"code-desc\"><code>";
String nameTagStart = "<span class=\"name\">";
String nameTagEnd = "</span>";
int endPosition = html.indexOf(endSearchList);
int startPosition = html.indexOf(startSearchList)
+ startSearchList.length();
int nameStartPostion = html.indexOf(nameTagStart)
+ nameTagStart.length();
int nameEndPosition = html.indexOf(nameTagEnd);
// System.out.println("name tag start "+nameStartPostion);
// System.out.println("name tag end "+nameEndPosition);
if (nameEndPosition != -1 && html.indexOf(nameTagStart) != -1) {
name = html.substring(nameStartPostion, nameEndPosition);
TwitterAuthorization.TWITTER_USER_NAME = name;
// System.out.println("name view "+name);
}
if (endPosition != -1 && html.indexOf(startSearchList) != -1) {
pinCode = html.substring(startPosition, endPosition);
// System.out.println("pin code "+pinCode);
AccessToken accessToken = twitter.getOAuthAccessToken(
requestToken, pinCode);
String token = accessToken.getToken(), secret = accessToken
.getTokenSecret();
TwitterAuthorization.FETCHED_ACCESS_TOKEN = accessToken
.getToken();
TwitterAuthorization.FETCHED_SECRET_TOKEN = accessToken
.getTokenSecret();
// System.out.println("token "+token+" SECRET "+secret);
mListener.onComplete();
Log.d("check twitter", "here 2");
TwitterDialog.this.dismiss();
} else if (currentURl
.equals("https://api.twitter.com/oauth/authenticate")
&& pinCode == null) {
}
}