Adds auntication cookie, there is still some bugs.