Easily obtain OAuth credentials for the Dropbox API.
Simple authentication helper for Dropbox.
$ npm install dropbox-authentixator
The authenticator is a tiny object that exposes two single functions.
initiate function asks Dropbox for a request token and generates a URL
that you should send your user to. You are then responsible for providing
a calback URL that Dropbox can send the user to.
Once the user comes back to you, you complete the authorization by calling
complete function takes the response stream from an HTTP server and a
call back function. Once authorization is complete this function is called
with the OAuth credentials. It's up to you to store these.
Quick 'n dirty example showing how to use this thing:
var Authenticator = require'dropbox-authenticator';var http = require'http';var auth = AuthenticatorYOUR_APP_ID YOUR_APP_SECRET;// Handle authorizationshttpcreateServerif requrl === '/'authinitiate''reswrite'<a href="' + url + '">Authorize!</a>';resend;;elseauthcompleteres// Save credentials or something hereconsole.logcredentials;;;