How to programmatically retrieve auth code from V2 API




  • SalsaShark42

    Once you generate access/refresh tokens, you can keep them in a token store.  When you establish a new Box client session, you'll get a new token pair that you can store for the next time.  The refresh token is good for 60 days, so as long as you're using it at least once every two months, that would be an option.


    That said, the approach doesnj't work well if you have multiple instances of the application running concurrently.  They'll step on each other and invalidate the tokens pretty quickly.


    So you may want to take a closer look at Service Accounts (formerly called Enterprise users).  There's no application-size token management required.  You authorize your application in the Box admin console and provide the public key and you're good to go.  Depending on what language/SDK you're using, there should be examples of this.  I have some Node.js setup steps I can share if that would help.

    コメントアクション Permalink