CodexBloom - Programming Q&A Platform

Azure Logic App HTTP Trigger scenarios with 401 Unauthorized scenarios After Configuration Change

๐Ÿ‘€ Views: 60 ๐Ÿ’ฌ Answers: 1 ๐Ÿ“… Created: 2025-07-24
Azure LogicApps OAuth json

I can't seem to get I'm trying to implement I'm working with an scenario with my Azure Logic App that uses an HTTP trigger to call an external API. After modifying the API's authentication method from Basic Auth to OAuth 2.0, I'm now receiving a 401 Unauthorized behavior when the Logic App attempts to connect. The API requires a bearer token in the Authorization header, but Iโ€™m not sure how to properly configure the Logic App to handle this. Previously, I was using the following action to make the HTTP request: ```json { "method": "GET", "uri": "https://api.example.com/data", "headers": { "Authorization": "Basic YWxhZGRpbjpvcGVuIHN0cmlwZQ==" } } ``` I updated it to include the bearer token, but Iโ€™m unsure how to dynamically fetch and include it. I tried setting up an Azure Key Vault to store the client ID and secret for the OAuth 2.0 token, but now Iโ€™m hitting a snag. Hereโ€™s what I currently have: ```json { "method": "GET", "uri": "https://api.example.com/data", "headers": { "Authorization": "Bearer @{body('Get_OAuth_Token')['access_token']}" } } ``` The Logic App does include an action to fetch the OAuth token, but it seems like itโ€™s not being retrieved correctly or is not valid. Iโ€™ve confirmed that the Logic App has permissions to access the Key Vault and to get the secret. However, I still see the behavior and the following logs indicate that the token is either missing or expired: `"behavior": { "code": "401", "message": "Unauthorized" }` Iโ€™m using the Azure Logic Apps Standard version and have ensured that all necessary connections are set up. What steps should I take to resolve this scenario and successfully authenticate with the API using OAuth 2.0? Any guidance or code examples would be appreciated! For reference, this is a production mobile app. I'm open to any suggestions.