Generating CSRF Token from Backend

Avatar

Avatar

rohits65152179

Avatar

rohits65152179

rohits65152179

16-07-2019

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

mr_chawla

Avatar

mr_chawla

mr_chawla

16-07-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.

Answers (1)

Answers (1)

Avatar

Avatar

WASIL

Employee

Avatar

WASIL

Employee

WASIL
Employee

16-07-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