User Guide Cancel

CSRFVerifyToken

 

Description

Validates the given token against the same stored in the session for a specific key.

Returns

a Boolean value. true is successful.

Category

Display and formatting functions

Syntax

CSRFVerifyToken(token [,key])

See also

CSRFGenerateToken

History

ColdFusion 10: Added this function.

Parameters

Parameter

Required\Optional

Description

token

required

Token that to be validated against the token stored in the session.

key

Optional

The key against which the token be searched.

Usage

Use this function to validate the given token against the same stored in the session for a specific key.

Example

<cfset token=form.token>
<cfset validate = CSRFverifyToken(token)>
<cfoutput >#validate#</cfoutput>
<cfset token=form.token> <cfset validate = CSRFverifyToken(token)> <cfoutput >#validate#</cfoutput>
<cfset token=form.token> 
<cfset validate = CSRFverifyToken(token)> 
<cfoutput >#validate#</cfoutput>

Get help faster and easier

New user?