Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dropbox-client-oauth2

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dropbox-client-oauth2

Extension functions to Dropbox SDK to enabling OAuth2 with responsetype code.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
297
increased by22.22%
Maintainers
1
Weekly downloads
 
Created
Source

dropbox-client-oauth2

Extension functions to Dropbox SDK to enabling OAuth2 with responsetype code.

An example how to use this library:

'use strict';

const app = require('express')();
const hostname = 'localhost';
const port = 3000;
const https = require('https');
const config = {
  clientId: '[yourClientId]',
  secret: '[yourSecret]'
};

const dropbox = new (require('dropbox'))(config);
require('dropbox-client-oauth2');

const redirectUri = `http://${hostname}:${port}/auth`;
const url = dropbox.getAuthenticationUrl(redirectUri, null, 'code');

app.get('/', (req, res) => {
  res.writeHead(302, { 'Location': url });
  res.end();
});

app.get('/auth', (req, res) => {
  let code = req.query.code;
  var options = Object.assign({
    code,
    redirectUri
  }, config);

  dropbox.fetchAccessTokenFromCode(options, (err, token) => {
      if (err) {
        console.log(err);
      } else {
        dropbox.setAccessToken(token);
      }
    });
});

app.listen(port);

FAQs

Package last updated on 11 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc