/** * Using the specifiedSession member variable (which may be nil), find the real session to log to * (with an access token). Precedence: 1) specified session, 2) activeSession, 3) app * authenticated session via Client Token. */ private Session sessionToLogTo() { synchronized (this) { Session session = specifiedSession; // Require an open session. if (session == null || !session.isOpened()) { session = Session.getActiveSession(); } if (session == null || !session.isOpened() || session.getAccessToken() == null) { if (appAuthSession == null) { // Build and stash a client-token based session. // Form the clientToken based access token from appID and client token. String tokenString = String.format("%s|%s", applicationId, clientToken); AccessToken token = AccessToken.createFromString(tokenString, null, AccessTokenSource.CLIENT_TOKEN); appAuthSession = new Session(null, applicationId, new NonCachingTokenCachingStrategy(), false); appAuthSession.open(token, null); } session = appAuthSession; } return session; } }
private void finishAuthWithTestAccount(TestAccount testAccount) { testAccountId = testAccount.getId(); AccessToken accessToken = AccessToken.createFromString( testAccount.getAccessToken(), requestedPermissions, AccessTokenSource.TEST_USER); finishAuthOrReauth(accessToken, null); }
private void finishAuthWithTestAccount(TestSession.TestAccount paramTestAccount) { testAccountId = paramTestAccount.getId(); testAccountUserName = paramTestAccount.getName(); finishAuthOrReauth(AccessToken.createFromString(paramTestAccount.getAccessToken(), requestedPermissions, AccessTokenSource.TEST_USER), null); }