return object when getting a token for a code