Updated example with csrf handling