Tutorial 1: Create Tokens Required for SAP Concur API Access
Create an app with a company request token to create a refresh token for API access.
Prerequisites
- SAP Concur instance credentials
- Node.js
- GitHub account
- IDE or text editor
You Will Learn
- How to create a new app.
- How to generate your company request token from the app.
- How to create your
credentials.json
file using information from the app and the company request token. - How to create a refresh token from an API call using the
credentials.json
file.
Login to Your Admin Panel
- Login to your Concur admin panel.
- Enter your user ID and click Next.
- Enter your password and click Sign In.
Create a New App
- Go to the OAuth 2.0 Application Management screen.
- Click Create new app.
- Fill in all of the required fields and add all of the grants and scopes you have access to.
- Click Submit when the form is completed.
- Copy and paste your Client ID and Client Secret to a text file.
- Click OK when completed.
Generate Your Company Request Token
- Go to the Company Request Token screen.
- Enter your App ID in the required field and click Submit to generate your company request token.
- Copy/paste the Company UUID and company request token fields to a text file.
- Click OK after you have saved this information to a text file.
Setup the Node.js App
- Get the Node.js sample code.
- Open
SampleCode/Tutorial_1/GetRefreshToken.js
in your IDE or text editor.
Generate Your Credentials File
- Type
node GetRefreshToken.js
in terminal to run the app to generate yourcredentials.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.
Generate Your Refresh Token
- Run the app again. The app will call the Oauth2 /token endpoint using your credentials and generate your refresh token.
- Check if your credentials were transferred from the JSON file to the credentials object.
- Check for a successful validity check on the credentials object.
- Check for a successful API call. The status code will be 2xx and the refresh token will be one of the refresh token object properties.