sintaxi / dbox

NodeJS SDK for Dropbox API (THIS LIBRARY IS OBSOLETE!!)
513 stars 91 forks source link

Use existing access tokens #48

Closed benbuckman closed 12 years ago

benbuckman commented 12 years ago

Hi, I've got an app that connects to several 3rd-party services, including Dropbox, so I'm using everyauth for the authorization. So for a given authenticated user I already have the appToken, appSecret, accessToken, and accessTokenSecret ... now I want to pass those (the last 2 I guess) into a dbox client to use the API.

So far I've got,

var dbox = require('dbox').app({
  app_key: conf.dropbox.appKey,
  app_secret: conf.dropbox.appSecret
});

...

var client = dbox.client(req.session.auth.dropbox.accessToken);

client.readdir('/', callback);

but it's giving me a 401. What am I missing? Thanks!

benbuckman commented 12 years ago

Ah, looks like I have to pass,

dbox.client({
  oauth_token_secret: "...",
  oauth_token: "..."
});

and then it works!