Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 7rb0YfdymWJrEYQl6WE8C4
Power Automate - Building Flows
Unanswered

Unable to send x-csrf-token in POST request

Like (2) ShareShare
ReportReport
Posted on 18 Feb 2022 18:40:25 by

Hi Experts, 

 

I am trying to send POST request using HTTP connector. The Odata API required x-csrf-token to be sent as well. I could fetch token from previous GET request and trying to pass it to subsequent POST request. Though I could see it as input, API returns with a message 403 and CSRF token validation failed. The same works with POSTMAN. Please suggest.

Input :

pipa_0-1645209331757.png

 

Raw input :

pipa_3-1645209491550.png

 

Output

pipa_2-1645209382676.png

 

Regards,

 

  • PC-28030728-0 Profile Picture
    2 on 28 Mar 2025 at 07:33:53
    Unable to send x-csrf-token in POST request
    Hi Guys, I'm new to power apps. I'm using custom connection to generate CSRF token. I managed to get 200 response but the x-csrf-token is not included in the Header respone. Appreciate if someone can help me. Big help!
  • imranimzzy Profile Picture
    24 on 21 Jan 2025 at 13:52:32
    Unable to send x-csrf-token in POST request
    Here is the screenshot of how you pass the cookie getting from the GET x-csrf-token call. Please accept this as a solution if it resolves your query.

    1. Getting the csrf token
    2. In Compose replacing the set-cookie value ',' with ';'.
    3. POST call by sending the Cookie value.

  • PowerPlatChadd Profile Picture
    13 on 07 Sep 2023 at 15:10:09
    Re: Unable to send x-csrf-token in POST request

    Running into same issue, did you ever figure this out?

  • VDI Profile Picture
    335 on 05 May 2023 at 16:43:45
    Re: Unable to send x-csrf-token in POST request

    Thanks, I have replace the commas to semicolon, but still I am getting the CSRF token validation failed error.

    I am trying to connect to on-premise SAP System via data gateway and already did all the configuration but still unable to send cookies.

  • Abdollar Profile Picture
    3 on 08 Mar 2023 at 14:18:23
    Re: Unable to send x-csrf-token in POST request

    Yes, it has been resolved.
    Modify this expression to yours "replace(outputs('Get_product')['headers']['Set-Cookie'],',',';')" to replace commas in your set-cookie.

  • VDI Profile Picture
    335 on 15 Dec 2022 at 17:22:47
    Re: Unable to send x-csrf-token in POST request

    Is it resolve? I am also getting the same error.

  • TM82 Profile Picture
    6 on 04 May 2022 at 12:36:42
    Re: Unable to send x-csrf-token in POST request

    can you plz elaborate and give the syntax for the post method

  • japel Profile Picture
    4 on 09 Mar 2022 at 14:52:59
    Re: Unable to send x-csrf-token in POST request

    Had the same issue for days and figured it out today:

     

    You need to submit the session cookie, which you will find in the "set-cookie" header of your GET request. 

    This needs to be passed to the POST request. Unfornately this can't be done using a custom connector. 

    I used a normal http request for this. You can set a Cookie Attribute there.

    For the info from "set-cookie" you need to replace "," with ";" before passing it to your POST-Request. 

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 61

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 47 Super User 2025 Season 1

#3
rzaneti Profile Picture

rzaneti 31 Super User 2025 Season 1

Overall leaderboard