pstoppani pstoppani - 4 months ago 33
iOS Question

How to logout a user using Box V2 iOS SDK

In the V1 iOS SDK it was possible to logout the current user as follows:

[Box logoutWithCallbacks:^(id <BoxOperationCallbacks> on)
on.after(^(BoxCallbackResponse response)

How is it done using the V2 SDK?


Here's what I do:

BoxSDK *sdk = ... // a reference to the BoxSDK for the user
sdk.OAuth2Session.accessToken = @"INVALID_TOKEN";
sdk.OAuth2Session.refreshToken = @"INVALID_TOKEN";

That's it. The next time you try to do anything with the user's session you will be forced to log in again.

Update - you can see this in action in the Box sample app at Look at the BoxFolderViewController.m file.