How to use the dropbox.Client 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 davidmerfield / Blot / app / clients / dropbox / routes / change_dropbox / index.js View on Github external
info(req, function(err, info, new_client){

        if (err) return next(err);

        var old_client = new Dropbox.Client(config.dropbox);

        old_client.setCredentials(req.session.old_credentials);

        // Remove the old credentials
        // This must happen before res.render
        // or the session will not be saved...
        req.session.old_credentials = null;

        res.addLocals({dropbox_email: info.email});

        res.title('Copy your files');
        res.renderDashboard('folder/copy-files');

        old_client.authenticate(function(err, old_client){

          if (err) console.log(err);
github ng-four / budgie / server / routes.js View on Github external
var router = require('express').Router();
var request = require('request');
var parser = require('body-parser');
var bcrypt = require('bcrypt-nodejs');
var moment = require('moment');
var Dropbox = require('dropbox');
var Twitter = require('twitter');

// Dropbox Setup for server-based Authentication
var dropboxOptions = process.env.dropbox || require('./config.js').dropbox;
var client = new Dropbox.Client({ key: "yhintvoqspu0w44", secret: dropboxOptions });

// Twitter Setup
var twitterOptions;
if(process.env.dropbox === undefined){
  twitterOptions = require('./config.js').twitter;
} else {
  twitterOptions = {
    consumer_key: process.env.twitter_consumer_key,
    consumer_secret: process.env.twitter_consumer_secret,
    access_token_key: process.env.twitter_access_token_key,
    access_token_secret: process.env.twitter_access_token_secret
  };
}
var twitterClient = new Twitter(twitterOptions);

// Database Requirements
github jsbin / jsbin / lib / dropbox / child.js View on Github external
function saveToDropBox (file, name, user) {
  log('actually saving it now');
  var client = new Dropbox.Client({
    key: options.id,
    secret: options.secret,
    token: user.dropbox_token // jshint ignore:line
  });

  client.writeFile(name, file, function (err) {
    if (err) {
      process.send({
        error: err,
        user: user
      });
    }
    log('saved!');
  });

}
github ifrost / afterwriting-labs / js / utils / dropbox.js View on Github external
) {
                    return;
                }

                var token = /access_token=([^\&]*)/.exec(e.data)[1],
                    uid = /uid=([^\&]*)/.exec(e.data)[1],
                    state_r = /state=([^\&]*)/.exec(e.data)[1];

                if (state !== state_r) {
                    return;
                }

                $.cookie('dbt', token);
                $.cookie('dbu', uid);

                client = new Dropbox.Client({
                    key: key,
                    sandbox: false,
                    token: token,
                    uid: uid
                });

                popup.close();
                callback();
            });
        }
github keystonejs / storage / lib / provider / dropbox.js View on Github external
var DropboxClient = function DropboxClient(config) {

	var client;

	config = _.defaults(config, {
		folder: ''
	});

	this._ensureValid(['token', 'folder'], config);

	client = new Dropbox.Client({
		token: config.token
	});

	DropboxClient.super_.call(this, config, client);
};
github keeweb / keeweb / app / scripts / comp / dropbox-link.js View on Github external
_getClient: function(complete, overrideAppKey) {
        if (this._dropboxClient && this._dropboxClient.isAuthenticated()) {
            complete(null, this._dropboxClient);
            return;
        }
        if (!overrideAppKey && !this.isValidKey()) {
            return complete(DropboxCustomErrors.BadKey);
        }
        const client = new Dropbox.Client({key: overrideAppKey || getKey()});
        if (Launcher) {
            client.authDriver(new Dropbox.AuthDriver.Electron({ receiverUrl: location.href }));
        } else {
            client.authDriver(new Dropbox.AuthDriver.Popup({ receiverUrl: location.href }));
        }
        client.authenticate((error, client) => {
            if (!error) {
                this._dropboxClient = client;
            }
            complete(error, client);
        });
    },
github enyojs / ares-project / hermes / fsDropbox.js View on Github external
function _authorize(authStr) {
		try {
			auth = JSON.parse(authStr);
			this.log("FsDropbox.authorize(): auth:" + util.inspect(auth));
		} catch(e) {
			return next(e);
		}
		req.dropbox = new dropbox.Client({
			key: auth.appKey,
			secret: auth.appSecret,
			sandbox: true
		});
		req.dropbox.authDriver(new AuthDriver(auth));
		req.dropbox.authenticate((function(err, client) {
			if (err) {
				return next(err);
			}
			this.log("dropbox:" + util.inspect(client));
			next();
		}).bind(this));
	}
github trestletech / todotxtpp / lib / endpoints / dropbox.js View on Github external
.then(function(text){
          var client = new DropboxJS.Client({token: req.user.accessToken});  
          return self.writeFile_p(req.user.path, text, 
            req.body.revision, client)
          .then(function(revs){
            res.json(revs);          
          });
        })
        .fail(function(err){
github filefog / filefog / old / dropbox / dropbox_client.js View on Github external
function getClient() {
        if (_dropboxClientPromise) return _dropboxClientPromise
        var deferred = Q.defer();
        var client = new Dropbox.Client({
            key: provider_options.client_key,
            secret: provider_options.client_secret,
            token: _oauth_data.access_token
        })
        client.authenticate(function (err, client) {
            if (err) return deferred.reject(err);
            return deferred.resolve(client);
        })
        _dropboxClientPromise = deferred.promise
        return _dropboxClientPromise;
    }
github vsiao / dropboxdb-js / lib / index.js View on Github external
DropboxDB.prototype.connect = function(options) {
  this._client = new Dropbox.Client(options);
  this._client.authDriver(new Dropbox.Drivers.NodeServer({port: 8192}));
};

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