fix #16 and save cookie and token as pref to be reusable in multiple windows