當前位置: 首頁>>代碼示例>>Java>>正文


Java AccessToken.getToken方法代碼示例

本文整理匯總了Java中twitter4j.auth.AccessToken.getToken方法的典型用法代碼示例。如果您正苦於以下問題:Java AccessToken.getToken方法的具體用法?Java AccessToken.getToken怎麽用?Java AccessToken.getToken使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在twitter4j.auth.AccessToken的用法示例。


在下文中一共展示了AccessToken.getToken方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
 
開發者ID:jchampemont,項目名稱:WTFDYUM,代碼行數:19,代碼來源:MainController.java

示例2: afterSuccesfullAuthentication

import twitter4j.auth.AccessToken; //導入方法依賴的package包/類
public String afterSuccesfullAuthentication(HttpServletRequest request) {
    Twitter twitter = new TwitterFactory().getInstance();
    RequestToken token = (RequestToken) request.getSession().getAttribute("requestToken");
    String verifier = request.getParameter("oauth_verifier");
    twitter.setOAuthConsumer(client_id, client_secret);
    try {
         AccessToken accessToken = twitter.getOAuthAccessToken(token, verifier);
        User user = twitter.verifyCredentials();
        AccountJDO account = AccountManager.addAccount(""+user.getId(), AccountJDO.TWITTERCLIENT, "",
                "", "", user.getName(),
                user.getProfileImageURL(),false);
        UserLoggedInManager.submitOauthUser(account.getUniqueId(), accessToken.getToken());
        return accessToken.getToken();
    } catch (TwitterException e) {
        log.log(Level.SEVERE, e.getMessage(), e);
    }
    return null;
}
 
開發者ID:WELTEN,項目名稱:dojo-ibl,代碼行數:19,代碼來源:OauthTwitterWorker.java

示例3: 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;
}
 
開發者ID:vocefiscal,項目名稱:vocefiscal-android,代碼行數:25,代碼來源:TwitterSession.java

示例4: 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();
}
 
開發者ID:SamKnows,項目名稱:skandroid-core,代碼行數:9,代碼來源:SKAPostToTwitterActivity.java

示例5: 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);
	}
}
 
開發者ID:haku,項目名稱:Onosendai,代碼行數:14,代碼來源:TwitterOauthWizard.java

示例6: 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) {
    }
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:69,代碼來源:TwitterDialog.java


注:本文中的twitter4j.auth.AccessToken.getToken方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。