Hi: I am connecting from Salesforce to Box to download files via APEX. I see the following documentation for Manual Authentication. My question- I have the Client ID and Secret from the App that I defined, but how do I get the Access Token and Refresh Token (parameters for the following API).
For scenarios where you only want to grant authorization once and store access and refresh tokens yourself, you can create an API connection with the tokens directly. It's up to you how to store these tokens but it's important to store them securely. Hierarchical custom settings are a good place to start. Encrypting the fields you store tokens in is important since having these tokens and your client information grants full access to the Box account they're associated with.
BoxApiConnection api = new BoxApiConnection('YOUR-CLIENT-ID', 'YOUR-CLIENT-SECRET', 'YOUR-ACCESS-TOKEN', 'YOUR-REFRESH-TOKEN');
Please sign in to leave a comment.