I noticed another problem: get_token_and_login() works, and it stores credentials in the keyring, but it doesn't _read_ credentials from the keyring the second time you run the code, because the code to look in the keyring was in login_with(). I moved that code to _authorize_token_and_login, which is called by all code paths, and now get_token_and_login() works just as well as login_with().
I noticed another problem: get_token_ and_login( ) works, and it stores credentials in the keyring, but it doesn't _read_ credentials from the keyring the second time you run the code, because the code to look in the keyring was in login_with(). I moved that code to _authorize_ token_and_ login, which is called by all code paths, and now get_token_ and_login( ) works just as well as login_with().