user3277170
user3277170

Reputation: 11

dropbox.js auth firefox os

I'm currently developing a Firefox OS app wich should be caplable of saving files into my Dropbox account but I have some problems with the oauth2 authentication process. My app has to be "privileged", which means that all documents are not hosted on a webserver and so I need to use the "Dropbox.AuthDriver.Popup" driver for the authentication process.

My problem:

Everything works fine until Dropbox redirects me to the "oauth_receiver.html" which is hosted on my webserver. It seems that the " Dropbox.AuthDriver.Popup.oauthReceiver();" method can't send the authtoken to my app.

So is it possible to perfom a dropbox.js oauth2 authentication with the built-in auth drivers? Or do I need to do it by hand?

Upvotes: 1

Views: 212

Answers (1)

Jason Weathersby
Jason Weathersby

Reputation: 1081

I was able to login to dropbox from a Firefox OS App using: https://github.com/smarx/othw/tree/master/JavaScript

I did make a few changes. For example getting the redirect url. I changed it to the dropbox home:

 function get_redirect_uri() {
      return "https://www.dropbox.com/home"; 
 }

I then used the redirects manifest (manifest.webapp for my app) setting like:

  "redirects": [
    {"from": "https://www.dropbox.com/home",
    "to": "/redirects/auth.html"}
  ]

https://developer.mozilla.org/en-US/Apps/Build/Manifest#redirects

App had to be privileged btw. May not be the best way of doing it but it appears to work. I also moved the js from inline to an external js file which I executed when a button was clicked. The auth.html file should have access to the token after the redirect.

Upvotes: 1

Related Questions