0

I am writing a web app that will allow a user to migrate their Dropbox Datastore data to a new database file that I will store in their Dropbox account using the core API.

The user authenticates using the PHP SDK, but when I attempt to make a Datastore call via JS, the Dropbox client isn't authenticated.

Is there a way I can grant access to both the PHP core SDK and JS Datastore SDK within the same authorization flow? I'd hate for my users to have to authenticate twice (once for each SDK).

2
  • You can re-use access tokens, subject to the permission level granted by the access tokens, between SDKs as long as the SDKs use the same kind of access tokens (i.e., both OAuth 1 or both OAuth 2). Which SDKs/versions are you using specifically? Commented Feb 19, 2016 at 19:38
  • I'm using the PHP SDK 1.1.5 and the Datastore JS SDK 1.2 Commented Feb 19, 2016 at 20:08

1 Answer 1

1

Yes, both the Dropbox Datastore JavaScript SDK v1.2 and the Dropbox PHP Core SDK v1.1.5 use OAuth 2 access tokens and have constructors that taken an OAuth 2 access token directly.

To create a client in the PHP SDK using an OAuth 2 access token, use this constructor and pass in an OAuth 2 access token as $accessToken:

https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/class-Dropbox.Client.html#___construct

To create a client in the JavaScript SDK using an OAuth 2 access token, you can use this constructor and pass in an OAuth 2 access token as token:

https://www.dropbox.com/developers-v1/datastore/docs/js#Dropbox.Client

Remember that a Dropbox OAuth 2 access token is specific to a particular user-app pair, and will only have access to the extent allowed by the permission the app is registered for.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.