web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / HTTP request with Bear...
Power Automate
Answered

HTTP request with Bearer Token

(1) ShareShare
ReportReport
Posted on by 21

I'm trying to use Power Automate to capture a webhook that is being generated by an outside/closed system.

In Power automate I just have simple trigger that is: "When a HTTP request is received" followed by a parser and 200 response.

I can simulate receiving the data using Postman with no issues when using no additional authentication in the header.

When the actual system generates the webhook call, it includes a Bearer token in the header. 

As a result I get the following error: error 401

 

{
"error": {
"code": "DirectApiRequestHasMoreThanOneAuthorization",
"message": "The request has both SAS authentication scheme and 'Bearer' authorization scheme. Only one scheme should be used."
}
}

 

Unfortunately, I can't modify anything in the system that generates the webhook.

I can only subscribe to it as is.

Is there a way to set the Flow HTTP API trigger to ignore the Bearer token and not fail since it now has both (Bearer token and SAS auth)?

 

Thank you

 

Oren

Categories:
I have the same question (0)
  • divdivsays Profile Picture
    3 on at

    Hi @OrenLevy - really keen on hearing how you solved for this? 

     

    Facing the same exact issue - on capturing a webhook and not able to modify anything on their side to get around the SAS + Bearer Auth schemes error.

  • Verified answer
    OrenLevy Profile Picture
    21 on at

    Hi @divdivsays 

    I created an Azure function that consumes the webhook and then redirects it to Power Automate (flow).

    The Azure function is more forgiving and I just redirect the payload to flow.

     

    I created an Azure function (with no authentication/security).

    I added a parameter to the Azure function endpoint url called "disp" to identify the source of the webhook.

    Below is the code for the Azure function (they are free up to a certain SLA/consumption).

    In a nutshell:

    •  I consume the webhook payload (json).
    • Convert it to a string.
    • Add a json wrapper around it to include the source of the webhook ("disp" parameter)
    • Create an HTTP post response and sends that to Power Automate.

    Let me know if that worked for you.

     

    Regards

     

    Oren Levy

     

    #r "Newtonsoft.Json"
    
    using System.Net;
    using Microsoft.AspNetCore.Mvc;
    using Microsoft.Extensions.Primitives;
    using Newtonsoft.Json;
    using System.Text;
    using System.Net.Http;
    
    
    private static HttpClient httpClient = new HttpClient();
    
    public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
    {
    
     string disp = "";
     string flowUrl = "";
    
     log.LogInformation("C# HTTP trigger function processed a request.");
    
     // used this additional parameter in the webhook url to identify the source
     string name = req.Query["disp"];
     
     disp = name;
     flowUrl = "ENTER YOUR FLOW HTTP POST URL";
    
     string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
     dynamic data = JsonConvert.DeserializeObject(requestBody);
     
     
     //convert original request to string
     string dataJson = Convert.ToString(data);
    
     //added a json wrapper on top of the original payload to be able to include the source
     dataJson = "{"+ ((char)34).ToString() + "disp"+ ((char)34).ToString() + ": "+ ((char)34).ToString() + disp + ((char)34).ToString() + ","+ ((char)34).ToString() + "wrapper_data"+ ((char)34).ToString() + ": " + dataJson + "}";
    
     string responseMessage = string.IsNullOrEmpty(name)
     ? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response."
     : $"Hello, {name}, {name}. This HTTP triggered function executed successfully.";
    
    
     //create the httpcontent to be sent as a post.
     var httpContent = new StringContent(dataJson, System.Text.Encoding.UTF8, "application/json");
     //send the Post
     var response = await httpClient.PostAsync(flowUrl,httpContent);
    
     return new OkObjectResult(dataJson);
     
     }

     

     

  • DanielGAJohnson Profile Picture
    93 on at

    @OrenLevy , can you pass along any resources for how to duplicate that setup? I've never used the Azure Function App or any Azure services before, and creating a new Function App asks you loads of questions that I don't know how to answer. Any pointers in the right direction would be greatly appreciated.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 873

#2
Valantis Profile Picture

Valantis 813

#3
Haque Profile Picture

Haque 526

Last 30 days Overall leaderboard