Integrate logout functionality into the app

This topic enables the android mobile app to add OIDC logout functionality that allows a logout from the app and OpenID provider using the SDK

Build the logout functionality in the Android mobile app using the CyberArk Identity mobile SDK. The logout functionality enables the app to log the user out of the mobile app and the OpenID provider. The logout functionality also revokes the tokens from the Android storage.

To implement the logout, call the end-session endpoint from the CyberArk Identity to clear the access token from your custom tab browser using the CyberArkAuthProvider class and the CyberArkAccountBuilder parameter.

The logout model is as follows:

CyberArkAuthProvider.endSession(cyberArkAccountBuilder).start(this)

Remove the access token and the refresh token from device storage (SharedPreference) using the CyberArkPreferenceUtil class.

CyberArkPreferenceUtil.remove(Constants.ACCESS_TOKEN)
CyberArkPreferenceUtil.remove(Constants.ACCESS_TOKEN_IV)
CyberArkPreferenceUtil.remove(Constants.REFRESH_TOKEN)
CyberArkPreferenceUtil.remove(Constants.REFRESH_TOKEN_IV)
CyberArkPreferenceUtil.remove(Constants.ID_TOKEN)
CyberArkPreferenceUtil.remove(Constants.ID_TOKEN_IV)