Welcome to the new Box Support website. Check out all the details here on what’s changed.

Box App: Unable to find client_secret for requesting an access token

New post

Comments

3 comments

  • Kourtney

    Hello , 

     

    Thanks so much for using our platform and development forum and welcome to Box! 

     

    This is because you have created what we call a Box view application--- specifically, the one highlighted here:
    https://cloud.box.com/s/gvaq2b61nr1qtixt2xlbdh2tvon9wroj. Therefore, you're using server authentication (auth 2 with JWT) and not standard auth. If you create a new application and select standard oauth2, you'll see the client secret in the configuration tab for your application in the developer console. 

     

    Best, 

    Kourtney 

     

    Best, 

    0
    Comment actions Permalink
  • deepalig

    Thank you for the suggestion!

    But, what is the way to use the APP Token method in NodeJS? as there isn't a client secret in the box view application, I would like to just preview the files on the folders

    0
    Comment actions Permalink
  • anoland

    Hey  

     

    The NodeJS SDK doesn't explicitly support the app token authentication method, but it is possible to use the app token method with NodeJS. 

     

    Code example

     

    const axios = require('axios');
    
    // Set metadata add / update URL
    const urlToken = `https://api.box.com/oauth2/token`;
    
    const string = 'subject_token=REPLACE_THIS_WITH_YOUR_TOKEN&subject_token_type=urn:ietf:params:oauth:token-type:access_token&scope=item_preview item_upload&grant_type=urn:ietf:params:oauth:grant-type:token-exchange';
    
    // Make request to add metadata to file
    axios.post(urlToken, string).then(function (response) {
      console.log(response.data);
    })
    .catch(function (error) {
      console.error(error.response.data);
    });
    

     The endpoint is a little weird in that it wants the data/body payload to be a string. Keep that in mind if you need to make modifications!

    0
    Comment actions Permalink

Please sign in to leave a comment.