Amar
Amar

Reputation: 363

How to get access token from Dropbox using JavaScript?

I am trying to list the files and folders that are in the Dropbox by using JavaScript. Can anyone suggest me how to get access token programmatically. I can generate access token manually but I need to get from code.

Upvotes: 0

Views: 2098

Answers (1)

Greg
Greg

Reputation: 16930

To programmatically get an access token for a user, your app needs to send them through the OAuth app authorization flow. When directly using JavaScript, ideally you'd use an SDK or library, e.g.,:

https://www.dropbox.com/developers/datastore/sdks/js

(Note that the Datastore API functionality is deprecated, but the rest isn't.)

The tutorial will guide you through linking an account:

https://www.dropbox.com/developers/datastore/tutorial/js

There's also more documentation and resources here:

https://www.dropbox.com/developers/datastore/docs/js
https://github.com/dropbox/dropbox-js

There's also an OAuth guide here that should serve as a good reference about the OAuth flow:

https://www.dropbox.com/developers/reference/oauthguide

Otherwise, if you want or need to implement this manually, the following blog posts may be helpful:

for OAuth 1: https://blogs.dropbox.com/developers/2012/07/using-oauth-1-0-with-the-plaintext-signature-method/
for OAuth 2: https://blogs.dropbox.com/developers/2013/07/using-oauth-2-0-with-the-core-api/

Upvotes: 1

Related Questions