gauth_code is a simple script that generates verification codes for Google 2-Step verification. gauth_code has support for storing configuration for multiple accounts. Configuration saves at ~/.gauthrc.
Just copy gauth_code somewhere on your path.
To generate a verification code account run gauth_code without parameters. Before that the account must be configured. See "Add / update an account" how to configure the account.
Example:
$ gauth_code [email protected]
Account: [email protected]
-----------------------------
***....... 291337
.......... 133775
-----------------------------
To add an account run gauth_code with -s parameter.
Example:
$ gauth_code -s 3a2xv44tgvxqajn4rvw7hceuwi6rl337 [email protected]
Adding account '[email protected]' with the new secret.
Account: [email protected]
-----------------------------
***....... 291337
.......... 133775
-----------------------------
To remove an account run gauth_code with -r parameter.
Example:
$ gauth_code -r [email protected]
Trying to remove account '[email protected]'.
Account '[email protected]' is removed.
To list all configured accounts run gauth_code with -l parameter.
Example:
$ gauth_code -l
Available accounts:
[email protected]
[email protected]
To show tokens for all configured accounts run gauth_code with -a parameter.
Example:
$ gauth_code -a
***....... 291337 [email protected]
***....... 133775 [email protected]
To see help run gauth_code with -h parameter.
Example:
$ gauth_code -h
Usage: gauth_code [-h] [-l] [-r | -s <secret>] <account>
Description:
-a Show tokens for all accounts.
-l List the accounts.
-r Remove an account.
-s <secret>
Add a new account or update secret for an existing account.
Secret is a base32 encoded string.
-h Help.
gauth_code requires Python 3. It uses only Python Standard Library. No additional installation of third party modules is required.
- Is it possible to use gauth_code to generate a code for Dropbox two-step verification? gauth_code always throws "Invalid secret." message during account configuration.
Answer: Yes, it is but you need to pad the secret key properly. Just add six '=' characters ("======") at the end of the secret key and everything will work fine.