- csrf-get-tokenprocedure
Retrieves or generates a CSRF token for the current session. This function first checks if a CSRF token already exists in the session. If found, it returns the existing token. If not found, it generates a new cryptographically secure token, stores it in the session, and returns it.
Returns: A base64-encoded string containing the CSRF token
;; Get token for use in forms (let ((token (csrf-get-token))) `[input (@ (type "hidden") (name ,(symbol->string (csrf-form-field))) (value ,token))]) ;; Get token for AJAX requests (get ("/api/token") (csrf-get-token))