Log out users
You can log out users programmatically when needed. For example, you can log out users in the following situations:
- When a user is inactive after the idle time limit
- When you use a custom login instead of the default login
Note: The SDK triggers a logout automatically, when the OAuth tokens are no longer valid. When this happens, the user will have to log in again.
This example shows how to log out a user account when an idle timer is triggered, if that is something your app requires or supports.
Objective-C
1/// This function is triggered when the idle timer expires and the user should be logged out2- (void)idleTimerTriggered {3[[iZettleSDK shared] logout];4}
Swift
1/// This function is triggered when the idle timer expires and the user should be logged out2func idleTimerTriggered() {3iZettleSDK.shared().logout()4}