public synchronized void logout ( final BoxSession session ) { BoxUser user = session . getUser ( ) ; if ( user == null ) { return ; } session . clearCache ( ) ; Context context = session . getApplicationContext ( ) ; String userId = user . getId ( ) ; getAuthInfoMap ( session . getApplicationContext ( ) ) ; BoxAuthenticationInfo info = mCurrentAccessInfo . get ( userId ) ; Exception ex = null ; try { BoxApiAuthentication api = new BoxApiAuthentication ( session ) ; BoxApiAuthentication . BoxRevokeAuthRequest request = api . revokeOAuth ( info . refreshToken ( ) , session . getClientId ( ) , session . getClientSecret ( ) ) ; request . send ( ) ; } catch ( Exception e ) { ex = e ; BoxLogUtils . e ( TAG , "logout" , e ) ; // Do nothing as we want to continue wiping auth info } mCurrentAccessInfo . remove ( userId ) ; String lastUserId = authStorage . getLastAuthentictedUserId ( context ) ; if ( lastUserId != null ) { authStorage . storeLastAuthenticatedUserId ( null , context ) ; } authStorage . storeAuthInfoMap ( mCurrentAccessInfo , context ) ; onLoggedOut ( info , ex ) ; info . wipeOutAuth ( ) ; }
Log out current BoxSession . After logging out the authentication information related to the Box user in this session will be gone .