Skip to content

Dropbox plugin broken? #63

Closed
tfechner opened this Issue Mar 21, 2013 · 13 comments

4 participants

@tfechner

Hey,

nice work on dillinger! Sadly I've run into a few issues.

I've spend quite some time investigating dillinger and it's inner workings and wanted to use it's Dropbox save functionality.
The online version dillinger.io does not seem to work with Dropbox, although it tells me that it saves files, but nothing shows up in my Dropbox.

I debugged a local installation using node 0.8.17 running perfectly fine on a Raspberry Pi and it seems that the getRemoteAccessToken method in plugins/dropbox/dropbox.js is not working as it should.

If I log the data when dillinger tries to get the account information I apparently have no valid access token.

Got account info!
{ error: 'Access token not found.' }
User undefined is now authenticated.

I looked deeper into the issue and changed the method a tiny bit to get the entire response of the getRemoteAccessToken method like this:

   getRemoteAccessToken: function(access_token, request_token_secret, cb){
      console.log("Get remote Access Token");
      var url = dropbox_config.access_token_url
        , oauth = { 
                    consumer_key: dropbox_config.app_key
                  , consumer_secret: dropbox_config.app_secret
                  , token: access_token
                  , token_secret: request_token_secret
                  }
        console.log("Access Token:" + access_token);
        console.log("token_secret:" + request_token_secret);
        console.log("url:" + url);
      // Create your auth_url for the view   
      request.get({url:url, oauth:oauth}, function (e, r, d) {

        if(e) return cb(e,null)
        console.log(r);
        return cb(null,qs.parse(d))

      }) // end request.get()

    }, // end getRemoteAccessToken()

The log in the console reveals this interesting bit:

authorizationError: 'Hostname/IP doesn\'t match certificate\'s altnames' },
     parser:
      { _headers: [],
        _url: '',
        onHeaders: [Function: parserOnHeaders],
        onHeadersComplete: [Function: parserOnHeadersComplete],
        onBody: [Function: parserOnBody],
        onMessageComplete: [Function: parserOnMessageComplete],
        socket: [Object],
        incoming: [Circular],
        maxHeaderPairs: 2000,
        onIncoming: [Function: parserOnIncomingClient] },
     res: [Circular] },
  body: '{"error": "OAuthError in API v1+. Request mis-signed: Invalid or missing signature"}' }

I googled around and found this issue with node 4592 which might be related. Most curiously I got the dropbox sync working two times and everything went smoothly but I was not able to reproduce it consistently.

I'll test node 0.10 soon, if anybody has any further clues I would be glad to get help - I'm quite new to node.js. Also it might be a good idea to fix dillinger if it turns out to be a version related issue it should be quick.

@tfechner

Just tested everything on node 0.10.1 and I still get the same error:

{ '{"error": "OAuthError in API v1 . Request mis-signed: Invalid or missing signature"}': '' }

Anybody any insight on this?

@joemccann
Owner

Labeled as a bug and will investigate as soon as I have a chance. Is it a Node version issue or the request module? cc: @mikeal

@joemccann
Owner

Actually just checked that bug in node core and it appears fixed. Hmm...

@DandyDev

I'm seeing the exact same bug. Any word on this? I'm not that familiar with Node, but I'll try to check it out myself this week to see if I can find out what's wrong.

@joemccann
Owner

@DandyDev I believe it is an issue in node core

@tfechner

@joemccann @DandyDev A fairly strange issue indeed. Perhaps it might be good to investigate if one of the node dropbox oauth apis here on github suffer from the same bug and if not integrate one of those or find out what the heck they are doing differently?

@joemccann
Owner
@DandyDev

This is the NodeJS lib that is recommended by Dropbox: https://github.com/sintaxi/node-dbox
I'll try and see if I can get it to work with that and report back. "Request mis-signed" -> seems we're dropping some important bit of data along the way. Maybe not everything gets stored in the session properly.

@sintaxi
sintaxi commented Apr 24, 2013

Sweet. I think dillinger would benefit from switching to dbox. I'd be happy to code review and help with the port.

@DandyDev

@sintaxi You're lib doesn't work at the moment due to a bug that someone already provided a pull request for. Are you gonna merge that? sintaxi/dbox#64

@sintaxi
sintaxi commented Apr 25, 2013

Thanks @DandyDev. Merged and published as v0.6.3.

@DandyDev

Have a look at my PR please :) And be gentle, I've never worked with Node.js before :)

@joemccann
Owner

close #73

@joemccann joemccann closed this Apr 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.