Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Generating CSRF Token from Backend

rohits65152179
Level 2
Level 2

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

1 Accepted Solution
mr_chawla
Correct answer by
Level 2
Level 2

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.

View solution in original post

2 Replies
WASIL
Employee
Employee

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

mr_chawla
Correct answer by
Level 2
Level 2

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.

View solution in original post