Router Wise CSRF Token Validation :: Express :: Node JS

0
1217

Hello Techies, I face an issue in express like i am developing Rest APIs for Mobile and Web Application both, In Web Application use of CSRF token is must to ensure about security purposes, but on the other hand for Mobile App Rest APIs we do not need CSRF token validation, so to overcome this we are going to use router wise CSRF

app.use('/webApi',csrf({ cookie: true }), webApiRouter) // in web csrf token is enabled
app.use('/mobileApi', mobileApiRouter)

LEAVE A REPLY

Please enter your comment!
Please enter your name here