Open SampleCode/Tutorial_2/RefreshTokenManagement.js in your IDE or text editor.
Step 3
Type node RefreshTokenManagement.js in terminal to run the app to generate your credentials.json file. This generates messages in the terminal that show the credentials object.
Fill in the empty fields in this file with the information in the credential object. You can use all of the information from your credentials.json file in the previous concur-get-refresh-token tutorial except for the company request token.
How do we manage refresh token expiration?
Step 4
Run the app again. Since the app does not have a stored valid refresh token, the app will not find a valid refresh token in refreshTokenObjectFile.json.
The app will call the Oauth2 /token endpoint using your credentials and regenerate your refresh token.
If the API call is successful, the refresh token data is converted from JSON format into a refresh token object and stored in the file refreshTokenObjectFile.json.
Step 5
Run the app again. Since the app now has a valid refresh token, the app will successfully load and check the validity of the file refreshTokenObjectFile.json.
Check for a successful validity check on the refresh token object loaded from refreshTokenObjectFile.json. If the refresh token object validity check is successful, the refresh token object will be stored in the app for use with future API calls.