Authentication
Requests are authenticated with a token, which is either a session token from a login or a long-lived access token generated for your account. Both are set the same way and the library sends either as a bearer token, so your code does not need to know which kind it holds.
Using an access token
An access token needs no login. Hand it to the API instances directly.
Logging in with credentials
A login returns a session, whose ID is the token to use for subsequent requests.
When your user or account enforces multi-factor authentication, supply the code alongside the credentials.
The username can be your user ID, username, or email address. Omitting it entirely means the password is treated as an access token, which is another way to turn a token into a session.
Ending a session
Logging out invalidates the session attached to the instance. An access token is unaffected, since it is not a session.