How would you handle authentication and sessions within CLIs?

Hey guys, so I'm currently building a CLI and for the API to work the user has to generate a personal access token. I'm currently just getting the token before each API call and passing it to the HTTP client. This needs to be done. But I want a simple way to check that the user is logged in. Would I then wrap the whole CLI in the authentication wrapper and check the session? How would you do this?