Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

CSRF token validation failed from SAP endpoint

Hi,

I am using service callout policy and getting the csrf token from SAP . Using assign message policy, I am assigning the token to the POST call in header. From there I am getting "CSRF token validation failed."

Help me to resolve this issue.

note:checked the cookies before and after 

Solved Solved
0 6 10.3K
1 ACCEPTED SOLUTION

Hi,

Extracting cookies along with CSRF-token helped me. Here, tokenResponse is response fron SC,

<AssignMessage continueOnError="false" enabled="true" name="AM-AssignHeader">
  <DisplayName>AM-AssignHeader</DisplayName>
  <Set>
   <Headers>
    <Header name="x-csrf-token">{tokenResponse.header.x-csrf-token}</Header>
    <Header name="Cookie">{tokenResponse.header.Set-Cookie.1};{tokenResponse.header.Set-Cookie.2};{tokenResponse.header.Set-Cookie.3}</Header>
   </Headers>
   <Verb>POST</Verb>
  </Set>
  <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</AssignMessage>

View solution in original post

6 REPLIES 6