added support for setting user and usertoken from cookie and localstorage