csrf_token
host callCapy
function csrf_token(session_name : string = "bearer-session", token_name : string = "csrf_token") string
Description
csrf_token() returns a stable token for one session and token namespace.
Use the result in a hidden form field. Call csrf_valid() before you apply a browser-submitted change.
Parameters
session_name : the session and cookie name
token_name : the token namespace in the session
Return Values
The active CSRF token.
Example
Capy
var token := csrf_token("capy-doc-session")
print(length(token) > 0, "\n")