🔑 Code for my blog post on using .NET anti-forgery tokens in @Sitecore JavaScript Services.
This is a sample repository to demonstrate how to use .NET anti-forgery tokens
in Sitecore JavaScript Services with both MVC and Web API controllers using
out-of-the-box anti-forgery token validators. The demo API is also completely
mocked in disconnected mode to show how this functionality can work in both
disconnected and connected modes.
Clone this repository. The rest of the setup assumes you cloned toC:\Projects\Sitecore\jss-anti-forgery-tokens
.
npm install
injss start
.C:\inetpub\wwwroot\jssaftokens.sitecore
.jssaftokens.sitecore
..config
folder:CoreySmith.Project.Common.Dev.config
sourceFolder
to your repository directory.CoreySmith.Project.JssRocks.Dev.config
hostName
to the URL you used for your instance.PublishSettings.targets
publishUrl
to the path of your Sitecore instance.scjssconfig.json
instancePath
to the path of your Sitecore instance.deployUrl
host name to the host name of your Sitecore instance.layoutServiceHost
to the URL of your Sitecore instance.jss deploy files
.npm install
in the directory if you haven’t already./unicorn.aspx?verb=sync
.