Authenticating to SAP Concur
SAP Concur uses the OAuth authentication standard. To authenticate using OAuth, you will need to create an app to obtain the OAuthClientId, OAuthClientSecret, and CallbackURL connection properties. See Using OAuth Authentication for an authentication guide.
Using OAuth Authentication
OAuth requires the authenticating user to interact with SAP Concur using the browser. The provider facilitates this in various ways as described below.
Custom Credentials
You will need to register an app to obtain the OAuthClientId and OAuthClientSecret.
Web Applications
You need to create an OAuth app to use in the web flow.
Desktop Applications
You need to create an OAuth app.
Headless Machines
In the headless OAuth flow, users need to authenticate via a browser on another machine. You will need to create a custom OAuth app.
Creating a Custom OAuth App
See Creating a Custom OAuth App for a procedure.
Custom Credentials
Desktop Authentication with your OAuth App
Follow the steps below to authenticate with the credentials for a custom OAuth app. See Creating a Custom OAuth App.Get an OAuth Access Token
After setting the following, you are ready to connect:
- OAuthClientId: Set this to the Client Id in your app settings.
- OAuthClientSecret: Set this to the Client Secret in your app settings.
- CallbackURL: Set this to the Redirect URL in your app settings.
- InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken. .
- OAuthGrantType: This is by default CODE. If you wish to authenticate with PASSWORD grant type flow see Authentication with Password grant type
- UseSandbox: Set this to true if you are authenticating using an implementation server.
- Extracts the access token from the callback URL and authenticates requests.
- Obtains a new access token when the old one expires.
- Saves OAuth values in OAuthSettingsLocation to be persisted across connections.
Web Authentication with your OAuth App
When connecting via a Web application, you need to register a custom OAuth app with SAP Concur. See Creating a Custom OAuth App. You can then use the provider to get and manage the OAuth token values.
Get an OAuth Access Token
Set the following connection properties to obtain the OAuthAccessToken:
- OAuthClientId: Set this to the Client Id in your app settings.
- OAuthClientSecret: Set this to the Client Secret in your app settings.
You can then call stored procedures to complete the OAuth exchange:
-
Call the GetOAuthAuthorizationURL stored procedure. Set the AuthMode input to WEB and set the CallbackURL input to the Redirect URI you specified in your app settings. If necessary, set the Permissions parameter to request custom permissions.
The stored procedure returns the URL to the OAuth endpoint.
- Open the URL, log in, and authorize the application. You are redirected back to the callback URL.
- Call the GetOAuthAccessToken stored procedure. Set the AuthMode input to WEB. Set the Verifier input to the "code" parameter in the query string of the callback URL. If necessary, set the Permissions parameter to request custom permissions.
To connect to data, set the OAuthAccessToken connection property to the access token returned by the stored procedure. When the access token expires after ExpiresIn seconds, call GetOAuthAccessToken again to obtain a new access token.
Headless Machines
Using OAuth on a Headless Machine
To create SAP Concur data sources on headless servers or other machines on which the provider cannot open a browser, you need to authenticate from another machine. Authentication is a two-step process.
- Instead of installing the provider on another machine, you can follow the steps below to obtain the OAuthVerifier value. Or, you can install the provider on another machine and transfer the OAuth authentication values, after you authenticate through the usual browser-based flow.
- You can then configure the provider to automatically refresh the access token from the headless machine.
Using the Credentials for a Custom OAuth App
Create a Custom OAuth App
See Creating a Custom OAuth App for a procedure. You can then follow the procedures below to authenticate and connect to data.
Obtain a Verifier Code
Set the following properties on the headless machine:
- InitiateOAuth: Set this to OFF.
- OAuthClientId: Set this to the App Id in your app settings.
- OAuthClientSecret: Set this to the App Secret in your app settings.
You can then follow the steps below to authenticate from another machine and obtain the OAuthVerifier connection property.
- Call the GetOAuthAuthorizationURL stored procedure with the CallbackURL input parameter set to the exact Redirect URI you specified in your app settings.
- Open the returned URL in a browser. Log in and grant permissions to the provider. You are then redirected to the callback URL, which contains the verifier code.
- Save the value of the verifier code. You will set this in the OAuthVerifier connection property.
On the headless machine, set the following connection properties to obtain the OAuth authentication values:
- OAuthVerifier: Set this to the verifier code.
- OAuthSettingsLocation: Set this to persist the encrypted OAuth authentication values to the specified file.
- InitiateOAuth: Set this to REFRESH.
Connect to Data
After the OAuth settings file is generated, set the following properties to connect to data:
- OAuthSettingsLocation: Set this to the file containing the encrypted OAuth authentication values. Make sure this file gives read and write permissions to the provider to enable the automatic refreshing of the access token.
- InitiateOAuth: Set this to REFRESH.
Transfer OAuth Settings
Follow the steps below to install the provider on another machine, authenticate, and then transfer the resulting OAuth values.
On a second machine, install the provider and connect with the following properties set:
- OAuthSettingsLocation: Set this to a writable text file.
- InitiateOAuth: Set this to GETANDREFRESH.
- OAuthClientId: Set this to the Client Id in your app settings.
- OAuthClientSecret: Set this to the Client Secret in your app settings.
- CallbackURL: Set this to the Callback URL in your app settings.
Test the connection to authenticate. The resulting authentication values are written, encrypted, to the path specified by OAuthSettingsLocation. Once you have successfully tested the connection, copy the OAuth settings file to your headless machine. On the headless machine, set the following connection properties to connect to data:
- InitiateOAuth: Set this to REFRESH.
- OAuthSettingsLocation: Set this to the path to your OAuth settings file. Make sure this file gives read and write permissions to the provider to enable the automatic refreshing of the access token.
Creating a Custom OAuth App
SAP Concur uses the OAuth authentication standard, which requires the authenticating user to interact with SAP Concur via the browser. The provider facilitates the OAuth exchange in various ways as described below.
Register an OAuth Application
You can follow the procedure below to obtain the OAuth client credentials, the OAuthClientId and OAuthClientSecret.
- In order to obtain an access token, you need to register an application with SAP Concur. You can do this by contacting your Partner Enablement Manager or Partner Account Manager. Once you have registered an application, you will receive a clientId which will be your OAuthClientId, clientSecret which will be your OAuthClientSecret and geolocation.
- Select the APIs that your app will request permission to access. For full driver functionality, you must select : Notifications - View and manage notifications, Supplier Service - Get Supplier Data, Digital Tax Invoice - Get or Validate Digital Tax Invoices, Attendee List - Add, Update, or Inactivate Attendees, Expense Configuration - Update Expense Feature Configuration, E-Receipts Provider - Post receipts and invoices, get matching facts, Expense Report - Add, Approve, or Update Expense Reports, Extract - Request Extract of Available Data, Imaging - Add or Retrieve Report and Line Item Images, Insights - Additional services marketable to users, Itinerary - Add or Update Itineraries or Bookings, List Items - Add, Update, or Delete List Items, Meeting - Attendee Travel Booking, Payment Batch - Close Batches and Request Batch Export Files, Travel Profile - Access and update user travel profile information, Travel Request - Add, Update or Delete Travel Requests, Travel Approval - Approve or Reject Travel Itineraries, Users- Add or Update User Accounts
Authenticate to SAP Concur from a Desktop Application
In order to obtain a token, the client application needs to call the Oauth2 endpoint using various grants depending on the authentication scenarios required. The supported scenarios from our driver are CODE and PASSWORD grant type. The default OAuthGrantType is CODE, which requires you to follow the steps below. After setting the following connection properties, you are ready to connect:
- OAuthClientId: Set this to your clientId.
- OAuthClientSecret: Set this to your clientSecret.
- InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken connection property.
- OAuthGrantType: This is by default
- CODE. If you wish to authenticate with
- PASSWORD grant type flow see Authentication with Password grant type
- UseSandbox: Set this to true if you are authenticating using an implementation server.
- Region: Set this to the region of geolocation received along with the other credentials. Possible values are EU for Europe, CN for China and US. Its default value is US.
- Extracts the access token from the CallbackURL.
- Obtains a new access token when the old one expires.
- Saves OAuth values along with geolocation in OAuthSettingsLocation to be persisted across connections.
Authenticate to SAP Concur from a Web Application
In the Web OAuth flow, set the following connection properties and follow the steps below to call stored procedures to obtain the access token.
- OAuthClientId: Set this to the Key in your app settings.
- OAuthClientSecret: Set this to the Secret in your app settings.
When connecting via a Web application, or if the provider is not authorized to open a browser window, you need to exchange a verifier code for the OAuthAccessToken.
- Call GetOAuthAuthorizationURL. The stored procedure returns the URL to the OAuth endpoint.
-
Go to that URL and log in to authorize the application. Afterwards, you are redirected back to the callback URL.
When you are redirected, the callback URL contains the code query string parameter.
- Set the following parameters and call GetOAuthAccessToken:
Name Value AuthMode WEB Verifier Set this to the verifier code.
To make requests to SAP Concur, set OAuthAccessToken to the values returned in step 3.
To automatically refresh the token when it expires, set InitiateOAuth to REFRESH.
Authentication with Password grant type
The Password grant can be used when there is a trust relationship between the user and the application.
Authenticate to SAP Concur from a Desktop Application
When authenticating through PASSWORD grant type you need to set the following connection properties:
- OAuthClientId: Set this to your clientId.
- OAuthClientSecret: Set this to your clientSecret.
- InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken connection property.
- OAuthGrantType: Set this to PASSWORD;
- UseSandbox: Set this to true if you are authenticating using an implementation server.
- Username: Set this to the username or userId.
- Password: Set this to the user's password.
- CredType: The credtype specifies which credential set is being submitted in the request (user or app credentials). There are two supported values: AuthToken and Password. For connections from the App Center, use authtoken. If not specified, SAP Concur will assume the type is password.
- Extracts the access token from the CallbackURL.
- Obtains a new access token when the old one expires.
- Saves OAuth values along with geolocation in OAuthSettingsLocation to be persisted across connections.
Connecting Through a Firewall or Proxy
HTTP Proxies
To connect through the Windows system proxy, you do not need to set any additional connection properties. To connect to other proxies, set ProxyAutoDetect to false.
In addition, to authenticate to an HTTP proxy, set ProxyAuthScheme, ProxyUser, and ProxyPassword, in addition to ProxyServer and ProxyPort.
Other Proxies
Set the following properties:
- To use a proxy-based firewall, set FirewallType, FirewallServer, and FirewallPort.
- To tunnel the connection, set FirewallType to TUNNEL.
- To authenticate, specify FirewallUser and FirewallPassword.
- To authenticate to a SOCKS proxy, additionally set FirewallType to SOCKS5.
Troubleshooting the Connection
To show provider activity from query execution to network traffic, use Logfile and Verbosity. The examples of common connection errors below show how to use these properties to get more context. Contact the support team for help tracing the source of an error or circumventing a performance issue.
- Authentication errors: Typically, recording a Logfile at Verbosity 4 is necessary to get full details on an authentication error.
- Queries time out: A server that takes too long to respond will exceed the provider's client-side timeout. Often, setting the Timeout property to a higher value will avoid a connection error. Another option is to disable the timeout by setting the property to 0. Setting Verbosity to 2 will show where the time is being spent.