Using Bearer Token Authentication with a Manual Token

  • 7 August 2023
  • 0 replies

Userlevel 1

Many API services require the use of a bearer token to authenticate with it. Most of the time, this takes the form of OAuth 2.0. However, there are some APIs that handle the generation of the bearer token differently, forcing the customer to provide the literal value to the driver’s configuration manually. 

In this scenario, the CData REST driver has two ways of setting up this form of authentication manually. These options also extend to CData drivers for other generic HTTP sources, such as OData and GraphQL. 


Option 1: 

The first option is to provide the bearer token as an OAuth access token without enabling automated OAuth operations. Do this by defining the following properties in your configuration accordingly: 

AuthScheme --> OAuth 
InitiateOAuth --> OFF 
OAuthVersion --> 2.0 


Option 2: 

The second option is to make use of the CustomHeaders property to manually add the desired header to all requests. When doing this, you should also disable other forms of authentication so that they do not interfere with your manually provided header: 

AuthScheme --> None 
CustomHeaders --> Authorization: Bearer YOUR_BEARER_TOKEN_HERE 

This topic has been closed for comments