logout

fun logout(force: Boolean? = null, onLogoutListener: OnLogoutListener, handler: Handler = Handler(Looper.getMainLooper()))

Logout the current session by revoking the refresh token and access token. It works for both normal user and anonymous user. For both cases, you can obtain the session again via authenticate or authenticateAnonymously.

Note that for anonymous user, calling authenticateAnonymously after logout would login to the same anonymous user.

If you need multiple anonymous users, create another authgear instance instead.

Parameters

force

true to ignore any errors and always clear sessions, false otherwise.

onLogoutListener

The listener.

handler

The handler of the thread on which the listener is called.