Added a token object. Implemented the authorization logic.