Using the DOM to store the csrf token makes me a sad panda. As janky as it sounds, could you create a module that is basically a singleton to get/set the csrf token?