There is a solution for Google accounts configured to use 2-Step Verification.
At the moment, you are probably seeing a “BadAuthentication InvalidSecondFactor" error thrown, as you are not able to properly login from the shell.
In order to solve this, you will need an App Password that authorizes the app to access your account resources. Follow the tutorial and use the generated password and the username of an admin of the target App Engine app as the credentials for Remote API.
UPDATE:
Additionally, you can take a look at the remote_api_stub.py file from the AppEngine SDK. You'll find a family of methods called _ConfigureRemoteApiWith* (note the leading underscore), such as:
- _ConfigureRemoteApiWithKeyFile
- _ConfigureRemoteApiWithComputeEngineCredential
- _ConfigureRemoteApiWithOAuthCredentials
Methods themselves are well documented, please take a look at their docstrings. They'll let you authenticate with safer methods than usual ASP provided by remote_api_stub.ConfigureRemoteApi().
rtokis only for app_id lookups. (from theConfigureRemoteApidocstring) > rtok: The validation token to sent with app_id lookups. If None, a random token is used. and in the code below, you can see: ` if not app_id: app_id = GetRemoteAppIdFromServer(server, path, rtok) ` It appears to only be useful for checking if the given app_id exists on App Engine, not for actual authentication for remote_api_shell - Bodhi