generating, updating and revoking token for the user