In order to complete the prerequisites, you need to generate the access token and the refresh token. Box connector uses OAuth 2.0, the standard used by most APIs for authenticating and authorizing users. You can also find the procedure in Box developer site (The First Leg - (https://developers.box.com/oauth - The First Leg)

 

Generate access and refresh tokens

Execute this url in a browser : https://app.box.com/api/oauth2/authorize?response_type=code&client_id=<CLIENT_ID>&state=security_token%3DKnhMJatFipTAnM0nHlZA

Replace the <CLIENT_ID> tag with the client id value from the previous prerequisites.

Enter the credentials (crawler account) 


Click on Grant access (Box will redirect to the URI you specified earlier (on the Box application) with a code parameter and a state parameter, if you included one. 
For example if the redirect uri was http://0.0.0.0, Box would redirect to: http://0.0.0.0/?state=security_token%3DKnhMJatFipTAnM0nHlZA&code=YoQS1icBnv5CWxldtp3UPz86NpAXYLnf 


Please copy the code from the redirect url of the browser. Please notice that the Authorization Code will be valid only for 30 seconds. (Ex. YoQS1icBnv5CWxldtp3UPz86NpAXYLnf) 


 


Now to get the tokens, you will need to make a POST request to https://app.box.com/api/oauth2/token.

 

For example, you can use POSTMAN chrome extension.

 

 

grant_type: authorization_code
client_id: Value from the previous prerequisite.
client_secret: Value from the previous prerequisite.
code: YoQS1icBnv5CWxldtp3UPz86NpAXYLnf --Value from the previous step.

 

If everything goes right, there will be a successful response

"access_token": "T9cE5asGnuyYCCqIZFoWjFHvNbvVqHjl",
"expires_in": 3600,
"restricted_to": [],
"token_type": "bearer",
"refresh_token": "J7rxTiWOHMoSC1isKZKBZWizoRXjkQzig5C6jFgCVJ9bUnsUfGMinKBDLZWP9BgR"


Then, copy the access_token and the refresh_token values to the corresponding files Box.accesstoken and Box.refreshtoken files. 

 

  • No labels