Concur Authenticate an Element Instance

You can authenticate with Concur to create your own instance of the Concur element through the UI or through APIs. Once authenticated, you can use the element instance to access the different functionality offered by the Concur platform.

Authenticate Through the UI

Use the UI to authenticate with Concur and create an element instance. Because you authenticate with Concur via OAuth 2.0, all you need to do is add a name for the instance and enter the API Key and Secret you identified in Concur API Provider Setup. After you create the instance, you'll log in to Concur to authorize Cloud Elements access to your account. For more information about authenticating an element instance, see Authenticate an Element Instance (UI)

After successfully authenticating, we give you several options for next steps. Make requests using the API docs associated with the instance, map the instance to a virtual data resource, or use it in a formula template.

Authenticate Through API

Authenticating through API is a multi-step process that involves:

Getting a Redirect URL

Use the following API call to request a redirect URL where the user can authenticate with the vendor. Replace {keyOrId} with the element key, concur.

GET /elements/{keyOrId}/oauth/url?apiKey=<api_key>&apiSecret=<api_secret>&callbackUrl=<url>&siteAddress=<url>

Query Parameters

Query ParameterDescription
apiKeyThe key obtained from registering your app with the provider. This is the Client ID that you recorded in API Provider Setup section.
apiSecretThe client secret obtained from registering your app with the provider. This is the Client Secret that you recorded in API Provider Setup section.
callbackUrlThe URL that will receive the code from the vendor to be used to create an element instance. This is the Callback URL that you recorded in API Provider Setup section.

Example cURL

curl -X GET
-H 'Content-Type: application/json'
'https://api.cloud-elements.com/elements/api-v2/elements/concur/oauth/url?apiKey=fake_api_key&apiSecret=fake_api_secret&callbackUrl=https://www.mycoolapp.com'

Example Response

Use the oauthUrl in the response to allow users to authenticate with the vendor.

{
"element": "concur",
"oauthUrl": "https://www.concursolutions.com/net2/oauth2/Login.aspx?scope=LIST%2CCONFIG%2CATTEND%2CERECPT%2CEXPRPT%2CTRVPRF%2CTRVREQ%2CUSER%2CTWS&response_type=code&redirect_uri=https%3A%2F%2Fhttpbin.org%2Fget&state=concur&client_id=UPjRvqOyYz9hDdWLLLLuQV"
}

Authenticating Users and Receiving the Authorization Grant Code

Provide the response from the previous step to the users. After they authenticate, Concur Beta provides the following information in the response:

  • code
  • state
Response ParameterDescription
codeThe Authorization Grant Code required by Cloud Elements to retrieve the OAuth access and refresh tokens from the endpoint.
stateA customizable identifier, typically the element key (concur) .
Note: If the user denies authentication and/or authorization, there will be a query string parameter called error instead of the code parameter. In this case, your application can handle the error gracefully.

Authenticating the Element Instance

Use the /instances endpoint to authenticate with Concur Beta and create an element instance. If you are configuring events, see the Events section.

Note: The endpoint returns an Element token upon successful completion. Retain the token for all subsequent requests involving this element instance.

To create an element instance:

  1. Construct a JSON body as shown below (see Parameters):

            {
              "element": {
                "key": "concur"
              },
              "providerData": {
                "code": "<AUTHORIZATION_GRANT_CODE>"
              },
              "configuration": {
                "oauth.api.key": "<CONCUR_KEY>",
                "oauth.api.secret": "<CONCUR_SECRET>",
                "oauth.callback.url": "<CALLBACK_URL>"
              },
              "tags": [
                "<Add_Your_Tag>"
              ],
              "name": "<INSTANCE_NAME>"
            }
    
  2. Call the following, including the JSON body you constructed in the previous step:

    POST /instances
    
    Note: Make sure that you include the User and Organization keys in the header. For more information, see Authorization Headers, Organization Secret, and User Secret.
  3. Locate the token in the response and save it for all future requests using the element instance.

Example cURL

curl -X POST \
  https://api.cloud-elements.com/elements/api-v2/instances \
  -H 'authorization: User <USER_SECRET>, Organization <ORGANIZATION_SECRET>' \
  -H 'content-type: application/json' \
  -d '{
    "element": {
      "key": "concur"
    },
    "providerData": {
      "code": "0_mG9HpbmXfGi3gIQHlWNUbnHP0aOlN"
    },
    "configuration": {
         "oauth.api.key":"UPjRvqOyYz9hDdWLLLLuQV",
          "oauth.api.secret":"GNnU6D7uvWMjOyOEsU7uL1Xc4iaEdEOa",
          "oauth.callback.url":"https://mycoolapp.com"    },
    "tags": [
      "Test"
    ],
    "name": "ConcurInstance"
  }'

Parameters

API parameters are in code formatting.

HeadingHeadingData Type
'key'The element key.
concur
string
Name
name
The name for the element instance created during authentication.Body
OAuth API Key
oauth.api.key
The Key from Concur.string
OAuth API Secret
oauth.api.secret
The Secret from Concur.string
Filter null values from the response
filter.response.nulls
Optional. Determines if null values in the response JSON should be filtered from the response. Yes or true indicates that Cloud Elements will filter null values.
Default: true.
boolean
Events Enabled
event.notification.enabled
Optional. Identifies that events are enabled for the element instance.
Default: false.
boolean
Event Type
event.vendor.type
Optional. identifies the type of events enabled for the instance. The Concur Beta element supports only polling.string
Event Notification Callback URL
event.notification.callback.url
Where do you want CE to send the events that we generate?.string
Callback Notification Signature Key
event.notification.signature.key
Optional. A user-defined key for added security to show that events have not been tampered with.string
Event poller refresh interval (mins)
event.poller.refresh_interval
A number in minutes to identify how often the poller should check for changes.number
Configure Polling
"event.poller.configuration"


reports
"event.poller.configuration": "{"reports"...}" (see Events)
Optional
The Concur reports. resource available for polling.
JSON object
tagsOptional. User-defined tags to further identify the instance.string