authentication - Error 401 in JavaScript Dropbox SDK -


I'm trying to use Dropbox SDK for JavaScript, so I tried a Hello World! To get to know myself, but I'm getting a 401 error for failed authentication.

 I think the

When I turn off the pop-up, I click the button and redirect it to the authorization page, but click on "Allow" After this, it will show a "contaminated content error" page.

Here is my code, which I actually have a The Torial is found to be obtained from the page:

  & lt ;; doctype html> gt; & gt; & lt; html & gt; & lt; top & gt; & gt; script src = " Https://www.dropbox.com/static/api/dropbox-datastores-1.0-latest.js "> gt; & lt; / script & gt; link rel =" stylesheet "href =" style.css Click & lt; code & gt; to create & gt; & gt; & gt; & gt; & gt; & lt; body & gt; & lt; center & gt; & gt; button id = "writeButton" & gt; Hello.txt & lt; / code & gt; Dropbox. & Lt; / button & gt; & lt; / center & gt; `& lt; script & gt; Var client = new dropbox. Client ({key: key / / / APP key secret: "& lt; REDACTED>" "//" & lt; REDACTED & gt; // APP SECRET}); Function doHelloWorld () {client.writeFile ('hello.txt', 'hello, world!', Function (error) {if (error) {warning ('error:' + error);} and {alert ('file written) Successfully! ');}}); } // Try completing OAuth flow Client.authenticate ({interactive: false}, function (error) {if (error) {warning ('error:' + error);} and {doHelloWorld ();}} ); Document.getElementById ('writeButton'). Onclick = function () {client.authenticate (function (error, client) {if (error) {warning ('error:' + error);} and {doHelloWorld ();}}); } & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

edit

It seems as if I did not work on the Dropbox dev blog post (now?). Callback from client.authenticate does not matter because you have to manually check whether the client is authenticated or not.

I will update the blog post. The code should look like this:

  // Try to complete the OAuth flow Client.authenticate ({interactive: false}, function (error) {if (error) Error: '+ error);} and if (client.isAuthenticated ()) {// <- this row changed DoHelloWorld ();}});   

Original (wrong) answer

At first glance, the only difference is my code and mine () (When you should not be).

If you delete that line, does your app work?

(BTW, the secrets you have posted, but they are still visible in the editing history. I recommend deleting those apps and making them new.)


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -