Skip to main content
Level 2
Jul 16, 2019 10:57 AM UTC
Solved

Generating CSRF Token from Backend

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.
suchawlaAccepted solution
Adobe Employee
Jul 16, 2019 4:47 PM UTC

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

Adobe Employee
Jul 16, 2019 12:51 PM UTC

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

Translate
suchawlaAdobe EmployeeAccepted solution
Adobe Employee
Jul 16, 2019 4:47 PM UTC

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.

Translate