Set the httpOnly Cookie Flag in Express to Ensure Cookies are Inaccessible from JavaScript

Share this video with your friends

Send Tweet

In this lesson, we'll learn how to set the httpOnly flag on our session id cookie to ensure it is inaccessible from javascript, thereby defeating theft of the session id from the XSS attack we crafted in the previous lesson. However, we'll still leave ourselves open to other dangers from XSS, which we'll exploit in our next lesson!