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

Error in getting Access Token through command line

New post

Comments

3 comments

  • BobFlynn-IU

    Hey ,

     

    You'll have better luck on this post over at the Box Developer Forum. This forum is mostly end users and admins.

     

    Best of luck,

     

    Bob

    0
    Comment actions Permalink
  • ppamidi

    Created an app in developer console. Using that access token from that app to upload/download files from box. But, the access token expires every 60 mins and I want to generate the access token every 59 mins and use it for my command to upload/download files. I'm trying to use the below command to generate the access token:

    curl https://api.box.com/oauth2/token \
    -d 'grant_type=authorization_code&code={your_code}&client_id={your_client_id}&client_secret={your_client_secret}' \
    -X POST
    The output of the command says that "{"error":"invalid_client","error_description":"The client credentials are invalid"}". I am using the client_id and client_secret from the app that I created. your_code in the above command is my old Access token I hope. I'm not sure what I'm missing here. Do I need to use the refresh token to generate Access token? if so, how should I get refresh token in command line?

    0
    Comment actions Permalink
  • AnzT

    He's not alone, we are in the very same situation.

    We installed this so called API.

    We can call box configure environments add then get enviro-conf and successfully delete the enviro-conf, which proves we succeed in establishing part of the connection.

    But when we try box tokens get... "The API returned an error [BadRequest].

     

    We tried using curl, which we shouldn't have to if this "API" did the job.

     

    All tutorials we found use web interface, but this is NOT an option here.

     

    So, let's put it simply.

    At the point we stand, we have:

    - the client_id

    - the client_secret

    - a public key ID

    - an enterprise ID

    We have no:

    - code

    - bearer

    - token

    After adding the enviro-conf from a simple command window, what other box-only command lines will be required in order to:
    - actually be logged onto our ...box.com/folder/0

    - recurse in our box tree

    - check for folder/file existence

    - create/remove folder

    - upload/replace file

    ?

    Some command-line only tutorials, step-by-step for dummies, would be welcome!

    0
    Comment actions Permalink

Please sign in to leave a comment.