How to use the dropbox.AuthDriver.Popup 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 developit / dropfox / src / lib / dropbox-client.js View on Github external
const shell = remoteRequire('shell');

const dropbox = new Client({
	key: API_KEY
});

const CLEANUPS = {};

const NOOP = ()=>{};

export default dropbox;

Object.assign(dropbox, new Emitter());
Object.assign(dropbox, Emitter.prototype);

dropbox.authDriver(new AuthDriver.Popup({
	receiverUrl: 'https://dropfox.firebaseapp.com/dropbox/oauth_receiver.html'
	//receiverUrl: location.href.replace(/[^/]+$/,'') + 'assets/oauth_receiver.html'
}));

export function init(callback=NOOP) {
	dropbox.authenticate({ interactive: false }, err => {
		if (err) return callback(err);

		if (dropbox.isAuthenticated()) {
			dropbox.emit('init');
			return callback();
		}

		dropbox.authenticate( err => {
			if (err) return callback(err);

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 1 year ago

Package Health Score

65 / 100
Full package analysis