List of usage examples for twitter4j.auth AccessToken toString
@Override
public String toString()
From source file:com.gmail.altakey.joanne.service.TwitterAuthService.java
License:Apache License
private void authenticate(final Twitter tw) { final AccessToken accessToken = getAccessToken(); if (accessToken == null) { try {/*from ww w . j av a 2 s.co m*/ final RequestToken req = tw.getOAuthRequestToken(); final Intent intent = new Intent(this, AuthorizeActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse(req.getAuthorizationURL())); startActivity(intent); } catch (TwitterException e) { Log.e(TAG, "authentication failure", e); } } else { Log.d(TAG, String.format("got access token: %s", accessToken.toString())); updateRelations(this, accessToken); final Intent intent = new Intent(ACTION_AUTH_SUCCESS); intent.putExtra(EXTRA_TOKEN, accessToken); LocalBroadcastManager.getInstance(this).sendBroadcast(intent); } }
From source file:com.gmail.altakey.joanne.service.TwitterAuthService.java
License:Apache License
private void authenticateDone(final Twitter tw, final String verifier) { try {//from w w w.j a v a2 s . c om final AccessToken accessToken = tw.getOAuthAccessToken(verifier); Log.d(TAG, String.format("got access token: %s", accessToken.toString())); setAccessToken(accessToken); updateRelations(this, accessToken); final Intent intent = new Intent(ACTION_AUTH_SUCCESS); intent.putExtra(EXTRA_TOKEN, accessToken); LocalBroadcastManager.getInstance(this).sendBroadcast(intent); } catch (TwitterException e) { Log.e(TAG, "authentication failure", e); final Intent intent = new Intent(ACTION_AUTH_FAIL); LocalBroadcastManager.getInstance(this).sendBroadcast(intent); } }
From source file:org.structr.web.auth.TwitterAuthClient.java
License:Open Source License
@Override public String getAccessToken(final HttpServletRequest request) { String verifier = request.getParameter("oauth_verifier"); RequestToken requestToken = (RequestToken) request.getSession().getAttribute("requestToken"); AccessToken accessToken; try {//w w w . j ava 2s. c o m accessToken = twitter.getOAuthAccessToken(requestToken, verifier); return accessToken.toString(); } catch (TwitterException ex) { logger.log(Level.SEVERE, null, ex); } return null; }