Added token encoding to login controller