Skip to main content
Question

Salesforce Box API access token

  • May 22, 2025
  • 1 reply
  • 99 views

Forum|alt.badge.img

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).

Manual Authentication

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');

 

 

1 reply

Forum|alt.badge.img

hi Raju

This connection method refers to an OAuth2.0 app where you would get the users explicit authorization to access Box on their behalf and exchange a auth code for a token/refresh token pair.

If you use case is more backend automation you could look at using a server side option which will work without user interaction. 

See https://github.com/box/box-salesforce-sdk/blob/master/doc/platform.md for more details/

Best regards

Peter Christensen, Platform Solutions Engineer, Box