How to use the dropbox.Util function in dropbox

To help you get started, we’ve selected a few dropbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ifrost / afterwriting-labs / js / utils / dropbox.js View on Github external
var client_authenticate = function(callback) {
        client = new Dropbox.Client({
            key: key,
            token: $.cookie('dbt'),
            uid: $.cookie('dbu'),
            sandbox: false
        });
        if (client.isAuthenticated()) {
            callback();
        } else {
            var state = Dropbox.Util.Oauth.randomAuthStateParam();
            var popup = window.open('https://www.dropbox.com/1/oauth2/authorize?response_type=token&redirect_uri=' + redirect_uri + '&client_id=' + key + '&state=' + state, '_blank', 'width=500, height=500');
            $(window).on('message.dropboxclient', function(e) {
                e = e.originalEvent;
                e.target.removeEventListener(e.type, arguments.callee);
                if (e.origin !== 'https://ifrost.github.io' && e.origin !== 'https://afterwriting.com' && e.origin !== 'http://localhost:8000') {
                    return;
                }

                if (/error=/.test(e.data)) {
                    return;
                }

                if (
                    (e.data.indexOf('access_token') === -1) ||
                    (e.data.indexOf('uid') === -1) ||
                    (e.data.indexOf('state') === -1)

dropbox

The Dropbox JavaScript SDK is a lightweight, promise based interface to the Dropbox v2 API that works in both nodejs and browser environments.

MIT
Latest version published 2 years ago

Package Health Score

62 / 100
Full package analysis