You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

FawazT's avatar
FawazT
New member | Level 1
3 days ago

Requests fail if client secret isn't added when using the javascript sdk

I'm implementing the pkce flow correctly, I'm creating a dropbox object and adding the app key and refresh token, but when trying to use the check app method it will throw an exception with the error "Error in call to API function "check/app": Invalid authorization value in HTTP header/URL parameter", adding the app secret will solve this issue but I can't do that because I have to ship my app to the user, trying the same app key and refresh token in the c# sdk works and according to posts on the forum this should also work with the javascript sdk, here is my code:

const auth = new DropboxAuth();
auth.setRefreshToken("xxxxx");
auth.setClientId("xxxxx");
// auth.setClientSecret("xxxxx");
const dbx = new Dropbox({auth: auth});
try {
    const res = await dbx.checkApp({ query: "test" });
    console.log(res);
} catch (e) {
    console.log(e);
}

 

  • This is the expected behavior if attempting checkApp without an app secret; the checkApp method validates the app key and secret by calling /2/check/app which uses "App Authentication", which does require the app key and secret. So, that will fail without the app secret.

    If you want to check the validity of the access token, use checkUser instead.

  • FawazT's avatar
    FawazT
    New member | Level 1

    Manually calling checkAndRefreshAccessToken will also get the access token but it still returns the same error when calling checkApp

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    This is the expected behavior if attempting checkApp without an app secret; the checkApp method validates the app key and secret by calling /2/check/app which uses "App Authentication", which does require the app key and secret. So, that will fail without the app secret.

    If you want to check the validity of the access token, use checkUser instead.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,917 PostsLatest Activity: 12 days ago
334 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!