File Uploads via Dropbox Api V2

后端 未结 2 556
野的像风
野的像风 2021-01-21 08:16

Previously I was using the Dropbox API V1 within my web app to upload files my dropbox account. Please note that the app uses only one dropbox account (mine) to

2条回答
  •  灰色年华
    2021-01-21 08:39

    My recommendation is also to use a SDK which abstracts over authentication. CloudRail for Node.js could be very useful here. It's quite easy to use and works for other providers like OneDrive as well.

    const cloudrail = require("cloudrail-si");
    
    const service = new cloudrail.services.Dropbox(
        cloudrail.RedirectReceivers.getLocalAuthenticator(8082),
        "[Dropbox Client Identifier]",
        "[Dropbox Client Secret]",
        "http://localhost:8082/auth",
        "someState"
    );
    
    service.upload(
        "/myFolder/myFile.png",
        readableStream,
        1024,
        true,
        (error) => {
            // Check for potential error
        }
    );
    

    Here is also a short article about the {“error”: “v1_retired”} issue.

提交回复
热议问题