Generating CSRF Token from Backend | Community
Skip to main content
New Participant
July 16, 2019
Solved

Generating CSRF Token from Backend

  • July 16, 2019
  • 2 replies
  • 2794 views

Hi Is there any way to generate csrf token from Java code through any API or by accessing /libs/granite/csrf/token.json

Thanks in advance

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by suchawla

Any component  that relies on the granite.jquery dependency will benefit from the CSRF Protection automatically otherwise as mentioned by Wasil you can use /libs/granite/csrf/token.json which will generate the token as {“token”:”ey….″}

Cheers.

2 replies

suchawlaAccepted solution
Employee
July 16, 2019

Any component  that relies on the granite.jquery dependency will benefit from the CSRF Protection automatically otherwise as mentioned by Wasil you can use /libs/granite/csrf/token.json which will generate the token as {“token”:”ey….″}

Cheers.

Employee
July 16, 2019

It's generated/injected via filter, part of platform code, no direct API exposed(wait for other replies) but making a HTTP GET on '/libs/granite/csrf/token.json' should return JSON response having the token.

Thanks,

Wasil