question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use sdk only in backend

See original GitHub issue

How to generate a new Dropbox instance to call upload method? without login ?

clientId is my api key, and clientSecret my api secret I try something like that : but throws accestoken error

let dbx = new Dropbox({ clientId: "xxx", clientSecret: "xxxx" });
  await dbx.filesUpload({
    path,
    contents: fs.readFileSync("documents/temp.pdf")
  }).catch((err) => {
    throw err;
  });

Thanks

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
greg-dbcommented, May 23, 2022

You can’t upload using only an app key and secret. (The app key and secret only identify the app itself; they do not enable access to an account.) You’ll need an access token, and optionally a refresh token for long-term unattended operation, to upload to an account

It is not possible to fully automate the OAuth process where the user chooses to authorize the app and the app then receives the resulting access token and optional refresh token. This needs to be done manually by the user at least once. If your app needs to maintain long-term access without the user manually re-authorizing it repeatedly, the app should request “offline” access so that it gets a refresh token. The refresh token doesn’t expire and can be stored and used repeatedly to get new short-lived access tokens whenever needed, without the user manually reauthorizing the app.

You can find an example here.

0reactions
greg-dbcommented, May 30, 2022

@maheshkasindi There are non-Node JavaScript examples, such as this example for uploading, and this example for the authorization flow. The JavaScript examples may not do exactly the same things as the Node examples, but most of the actual code is interchangeable. For example, you can still request “offline” access the same way as the Node example, that is, by using the getAuthenticationUrl options accordingly. If something doesn’t seem to be working as expected, please feel free to open a new issue with the details of the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SDK vs. API: What's the Difference? - IBM
SDK use cases​​ SDKs are part and parcel of mobile app development. They have many use cases: Programming language-specific SDKs like the JSON ......
Read more >
Why an SDK is Critical to your API Offering - BlogGeek.me
Offer your SDK as a closed binary, but also give access to the backend API. Those who wish to use the SDK to...
Read more >
Using the Web3 SDK: Frontend or Backend? - thirdweb blog
This guide shows how to use our SDK effectively and where your code should live depending on your use case.
Read more >
What's the Difference Between an SDK and an API? - Square
SDKs enable developers to create applications and act as the building blocks for your software solution.
Read more >
Making SDK calls from a backend service - Amazon Chime SDK
Nearly all Amazon Chime SDK messaging APIs take chime-bearer as a parameter, except APIs meant to be called only by developers, such as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found