Tuesday, February 27, 2024

400, 403, 405, 415 or XSRF check failed when sending POST to custom rest endpoint + Power automate Desktop

I need to get list of projects issues from Jira using custom rest endpoint in power automate desktop (that it (API) works fine when I call it from postman), but when I submit this dialog, it appears "XSRF check failed".



I am using the basic AUTH to get issue using the API in postman and it created successfully but when I do the same using the invoke webservice action - it gives me 403 XSRF check failed
https://domain/rest/api/latest/search

  • Adding headers: { 'X-Atlassian-Token': 'nocheck' }

  • JQL query as per the requirement in request body - Screenshot captured below

  • Click advanced setting.

    Uncheck this option if it is checked - Screenshot captured below

  • Change User Agents Header - Power Automate Desktop Screenshot captured below 
  • Whitelist/Allowlist the origin domain in Jira. When you send a request to the Jira API your browser automatically populates the "origin" header. You need to add that value to the whitelist/allowlist in Jira. -> See here: https://confluence.atlassian.com/adminjiraserver073/configuring-the-allowlist-1014667631.html Type "Domain" should work.

Resolution

To call protected APIs from external systems you can add the X-Atlassian-Token header to each request, setting the value to no-check. Adding this header to a request bypasses the server-side XSRF check and allows the request to be fulfilled and set the User Agent : "PostmanRuntime/7.30.0"

Regarding getting issues from JIRA using the action "Invoke Web Service". You can solve the issue "XSRF Check Failed" by adding following headers:

X-Atlassian-Token: nocheck
Authorization: Basic <base64>
User-Agent: PowerAutomateDesktop/1.0.0 OR User-Agent: PostmanRuntime/7.30.0



Hope this helps!

No comments:

Post a Comment

Building Secure Azure AI Foundry Agents with Managed Identity

  The credential problem nobody wants to own Every team that connects an Azure AI Foundry agent to Microsoft Graph, SharePoint, Outlook, or...