Victorio Berra
Victorio Berra

Reputation: 3125

Azure Logic App Http Connector is there a built-in way you get a token for accessing an API protected via OIDC/OAuth2?

We have a Logic App with an Http Connector which needs to hit our API which is protected with OAuth2 via IdentityServer4 3.x

As far as I know, there is no option or connector which can get a token via Client Credentials

I realize you can actually write an Http Connector to make a call to the /token endpoint, but with a function its easier to store the client credentials in keyvault, or AAS appsettings, or Azure DevOps and transform, and also you can use memory cache.

The idea is to create a function which uses client creds to get the token and then consume that with the LA http connector, and use the token to make the Http call. Unless this is a bad idea.

Upvotes: 0

Views: 2381

Answers (1)

Joey Cai
Joey Cai

Reputation: 20127

As far as I know, there is no option or connector which can get a token via Client Credentials

You could refer to the following steps to pass a “Bearer” token using Logic Apps.

1.You could use Http Connector to send post request to get access token via Client Credential.

2.Once you have your HTTP response with a valid token value, you will need to parse the JSON data to capture the value. You can copy the output from the HTTP and paste the output into the corresponding schema input of the Parse JSON trigger. This will allow Logic Apps to parse the JSON into dynamic content values that you can reference going forward.

enter image description here

3.Create a new HTTP request with the desired API endpoint you wish to call. At this point you will need to add some additional information to the HTTP header in order to validate your API request. Add Authorization into http header.

enter image description here

For more details, you could refer to this article.

Upvotes: 2

Related Questions