Authenticator
CLI tool for managing and generating one-time passwords for multiple accounts.
Prerequisites
Keyring
Support OS X, Linux/BSD (dbus) and Windows.
OS X
The OS X implementation depends on the /usr/bin/security
binary for
interfacing with the OS X keychain. It should be available by default.
Linux and *BSD
The Linux and *BSD implementation depends on the [Secret Service][SecretService] dbus
interface, which is provided by GNOME Keyring.
It's expected that the default collection login
exists in the keyring, because
it's the default in most distros. If it doesn't exist, you can create it through the
keyring frontend program Seahorse:
- Open
seahorse
- Go to File > New > Password Keyring
- Click Continue
- When asked for a name, use: login
Install
You can download the latest stable version or
the nightly build (edge
version).
Once downloaded, the binary can be run from anywhere. Ideally, though, you should move it into your $PATH
for easy use. /usr/local/bin
is a popular location
for this.
To update the tool to the newest version, run authenticator self-update
.
Install from source
If you have go
installed, you can run the following command to install the latest version:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/nhatthm/authenticator-cli/HEAD/install.sh)"
The binary will be installed to $GOBIN
or $GOPATH/bin
(when $GOBIN
is empty) directory. If you don't know where it is, you can run go env
to find out.
In order run the binary from anywhere, the $GOBIN
or $GOPATH/bin
directory should be added to your $PATH
.
Usage
Add a new account
Run authenticator account add
to add a new account. If you don't specify the namespace, the tool will ask you to input it.
If you have a QR code, you can use --qr
flag to tell the tool to scan the QR code. Otherwise, input the account and the totp secret manually.
$ authenticator account add -h
Add an account
Usage:
authenticator account add [-n <namespace>] [--qr </path/to/qr-code-image>] [flags]
Flags:
-h, --help help for add
-n, --namespace string namespace
--qr string qr code
Global Flags:
-d, --debug debug output
-v, --verbose verbose output
Generate an OTP
After adding an account, you can generate an OTP by running authenticator otp <namespace> <account>
. For example:
$ authenticator otp -n demo john.doe@example.com
103281
If you want to generate and copy the OTP to the clipboard, use the --copy
flag, for example:
$ authenticator otp -n demo john.doe@example.com --copy
[!TIP]
You can add an alias to your shell startup file, such as .bashrc
or .zshrc
, to make it easier to use. For example:
alias cotp='authenticator otp demo john.doe@example.com --copy'
Later, you can just run cotp
to generate and copy the OTP to the clipboard.
If your terminal allows you to customize the shortcuts, you can also create a shortcut for the alias
Examples
Manually input all the information
Scan a QR code
Example QR code:
totpauth://otp/john.doe%40example.com?secret=NBSWY3DP&issuer=example.com
Donation
If this project help you reduce time to develop, you can give me a cup of coffee :)
Paypal donation
or scan this