How to use the dropbox.Dropbox 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 bradyhouse / house / fiddles / node / fiddle-0041-SvgWriter / lib / client / dropbox-client.js View on Github external
downloadImages() {
    console.log('download\t', 'connecting to dropbox');
    new Dropbox({
        fetch: fetch,
        accessToken: this.dropBoxAccessToken
      })
      .filesListFolder({
        path: this.dropBoxPath,
      })
      .then((response) => {
        this._pending = response.entries.length;
        if (this.pending) {
          this.explode(response.entries);
        } else {
          this.emit('complete', {
            status: 'complete'
          });
        }
      })
github jichu4n / asciidoclive / v2 / src / storage / dropbox-storage-provider.ts View on Github external
this.log(`Validating access token ${accessToken}`);
      try {
        await this.dbx.filesListFolder({
          path: '',
          limit: 1,
        });
        this.log(`Access token is valid: ${accessToken}`);
        return;
      } catch (e) {
        this.log(`Access token is invalid, clearing: ${accessToken}`);
        this.accessToken = null;
      }
    }

    this.log('Constructing unauthenticated Dropbox SDK client');
    this.dbx = new DropboxSdk({
      clientId: environment.dropboxApiKey,
      fetch,
    });
  }
github jichu4n / asciidoclive / v2 / src / storage / dropbox-storage-provider.ts View on Github external
private async initSdk() {
    let {accessToken} = this;
    if (accessToken) {
      this.log('Constructing authenticated Dropbox SDK client');
      this.dbx = new DropboxSdk({
        clientId: environment.dropboxApiKey,
        accessToken,
        fetch,
      });
      this.log(`Validating access token ${accessToken}`);
      try {
        await this.dbx.filesListFolder({
          path: '',
          limit: 1,
        });
        this.log(`Access token is valid: ${accessToken}`);
        return;
      } catch (e) {
        this.log(`Access token is invalid, clearing: ${accessToken}`);
        this.accessToken = null;
      }
github jitsi / jitsi-meet / react / features / dropbox / functions.web.js View on Github external
export function _authorizeDropbox(
        appKey: string,
        redirectURI: string
): Promise {
    const dropboxAPI = new Dropbox({ clientId: appKey });
    const url = dropboxAPI.getAuthenticationUrl(redirectURI);

    return authorize(url).then(returnUrl => {
        const params
            = parseURLParams(parseStandardURIString(returnUrl), true) || {};

        return params.access_token;
    });
}
github danactive / history / ui / app / containers / HomePage / saga.js View on Github external
export function* getDropboxGalleries() {
  const accessToken = process.env.HISTORY_DROPBOX_ACCESS_TOKEN;
  const dbx = new Dropbox({ accessToken });

  try {
    const galleries = yield call([dbx, dbx.filesListFolder], { path: '/public' });
    yield put(galleriesLoaded(galleries));
  } catch (error) {
    yield put(galleriesLoadingError(error));
  }
}
github goqoo-on-kintone / goqoo / defaultFiles / .goqoo / def.dropbox.js View on Github external
constructor ({ accessToken, localRootDir }) {
    this.dbx = new Dropbox({ accessToken })
    this.localRootDir = localRootDir
  }
github jitsi / jitsi-meet / react / features / dropbox / functions.web.js View on Github external
export function getDisplayName(token: string, appKey: string) {
    const dropboxAPI = new Dropbox({
        accessToken: token,
        clientId: appKey
    });

    return (
        dropboxAPI.usersGetCurrentAccount()
            .then(account => account.name.display_name));
}
github davidmerfield / Blot / app / clients / dropbox / authenticate / index.js View on Github external
authenticate.route("/redirect").get(function(req, res) {
  var callback, key, secret, authentication_url;

  callback = req.protocol + "://" + req.get("host") + req.baseUrl;

  if (req.query.full_access) {
    key = config.dropbox.full.key;
    secret = config.dropbox.full.secret;
    callback += "?full_access=true";
  } else {
    key = config.dropbox.app.key;
    secret = config.dropbox.app.secret;
  }

  var client = new Dropbox({
    clientId: key,
    secret: secret
  });

  authentication_url = client.getAuthenticationUrl(callback, null, "code");
  authentication_url = authentication_url.replace(
    "response_type=token",
    "response_type=code"
  );

  debug("Redirecting", req.blog.id, "authentication_url");

  res.redirect(authentication_url);
});

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