Custom connector - pass Bearer token at runtime

Wouter 6 Reputation points
2021-04-09T07:54:54.363+00:00

When creating a custom connector for a group of API calls using a bearer token to authorize (not through OAuth2), it is not allowed to use the "Authorization" header in the Request section, this shows an error and won't allow you to save the connector. It seems it has to go via the Security section -> API Key. Though, this API Key is set when the connector is created within the logic app, while a bearer token only has a short lifespan (hours). Hence, it would be useful to be able to pass the bearer token as part of the request (header) during each run. This way, the bearer token can be fetched in a first step and then passed on to the custom connector, having a fresh bearer token every time.
Is it possible to achieve this in some way currently, using custom connectors of course and not the standard Web Request connector?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,113 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Sebastian Knoche 16 Reputation points
    2021-07-22T13:35:29.003+00:00

    Unfortunately you can't route the standard HTTP connector through the on-prem-data-gateway.
    The UserVoice submission came from somebody else a while ago, but I am facing the same issue.

    At the moment, I am setting up a LAB environment to test, if can utilize the "HTTP with Azure AD" connector, since it supports on-prem routing, but since the documentation states, that the action will encode the request body with base64, I will most likely hit a wall.


  2. Riaan Ingram 1 Reputation point
    2022-01-13T00:37:30.377+00:00

    If the back end endpoint used true OAuth you would be able to send the (dynamic) OAuth token through an 'access_token' query parameter instead of through the 'Authorization' header (without the 'Bearer ' prefix though). This worked for me as my custom connector back end accepted the OAuth token this way as well, and the custom connector didn't reject when I added this 'access_token' query param to the definition. Seems to be fairly standard that OAuth protected endpoints accept the token this way as well.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.