Additional Functions - disconnect user sessions or close the picker using the Filestack v2 library

The following functions are also available in the Javascript API. You can programmatically close the picker or disconnect your user's connected cloud sources.

Disconnect your user's cloud drives from Filestack

If your users work with sensitve information or share a computer with other users, you can now use the filepicker.logout() method to disconnect their cloud drive sessions after a successful upload or after an error.

Syntax and Usage:

    { console.log('Logout Success!'); },
  onError(msg, status)
    { console.log('Logout Error: ', msg); },

See how it works with the live code examples below:

Step 1. Authenticate to a Cloud Drive

Log into a service like Facebook
filepicker.pick( function(Blob){ console.log(JSON.stringify(Blob)); } );

Step 2. Deauthenticate Connected Sessions

Disconnect the cloud source session
filepicker.logout({ onSuccess() { console.log('Logout Success!'); }, });

Close the Filestack Dialog Programmatically

If your users have performed all of the actions you wanted them to perform, you can close the modal automatically. All methods which open the dialog modal now return an API object. The API object currently has only one method: .close

Sample Close Modal Code

Close Picker Dialog after 5 Seconds
// All methods which open the dialog modal now return an API object. var dialog = filepicker.pick(); // This will close the modal automatically after 5 seconds. setTimeout(function() { dialog.close(); // This API object has only one method: dialog.close }, 5000);