Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)