0
votes

I am trying to write an html application which runs locally in my machine and store data in dropbox using its datastore api. The app will first authenticate the user with dropbox to loggin the user's account so that data can be stored. (the related tutorial about this is https://www.dropbox.com/developers/datastore/tutorial/js)

However after I click the "allow" button in dropbox page to accept the authentication, I cannot go back to my html and get this error in my chrome js console:

Not allowed to load local resource: file:///I:/my%20app/my%20app.html# access_token=uKAmBGggAAA…bTSwy&token_type=bearer&uid=192028&state=oas_hjmjzi5m_0.8ejep9nuh99hpvi authorize?client_id=wy9s1uvip6qnswr&redirect_uri=file%3A///....................

the js code of doing the authentication in my app is:

function save(){
    var client = new Dropbox.Client({key: '9s1uswrxxxxxx'});
    client.authenticate({interactive: false}, 
        function (error) {
            if (error) {
                alert('Authentication error: ' + error);
            }
    });
    if (client.isAuthenticated()) {
        alert('the client is authenticated.');
    }
    client.authenticate();
    var datastoreManager = client.getDatastoreManager();
    datastoreManager.openDefaultDatastore(function (error, datastore) {
    if (error) {
        alert('Error opening default datastore: ' + error);
    }

According to dropbox datastore api tutorial: "The linking process will redirect the user to the Dropbox website and ask them to grant your app permission to access their Dropbox. When the user approves (or denies), they will be automatically directed back to the same page".

So I would like to know why this error happens when goes back from dropbox authentication page to my HTML.

1

1 Answers

1
votes

Your redirect_uri is pointing at a local file:// URL which your browser won't redirect you to. See here for more information:

https://forums.dropbox.com/topic.php?id=103530#post-558937

In short, you should serve your app off of a server instead.