question

WouterVermeulen-3615 avatar image
0 Votes"
WouterVermeulen-3615 asked RiaanIngram-0232 edited

Custom connector - pass Bearer token at runtime

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
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@WouterVermeulen-3615 Yes, using the standard HTTP connector and invoking directly in your LA is the workaround for now. I see that you have created a UserVoice submission for this scenario: https://feedback.azure.com/forums/287593-logic-apps/suggestions/43111944-custom-connector-pass-bearer-token-at-runtime

I'll inquire the Logic Apps team for any further updates on this scenario and report back here if any news ;)

0 Votes 0 ·
SebastianKnoche-8997 avatar image
0 Votes"
SebastianKnoche-8997 answered 88577919 commented

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.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Facing same problem/challenge.

0 Votes 0 ·
RiaanIngram-0232 avatar image
0 Votes"
RiaanIngram-0232 answered RiaanIngram-0232 edited

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.