https://github.com/nhatthm/authenticator-cli
Managing and generating one-time passwords for multiple accounts
https://github.com/nhatthm/authenticator-cli
2fa authenticator authy cli go golang mfa otp totp
Last synced: 11 months ago
JSON representation
Managing and generating one-time passwords for multiple accounts
- Host: GitHub
- URL: https://github.com/nhatthm/authenticator-cli
- Owner: nhatthm
- License: mit
- Created: 2024-02-19T22:23:46.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-07-15T08:42:36.000Z (11 months ago)
- Last Synced: 2025-07-15T19:42:54.583Z (11 months ago)
- Topics: 2fa, authenticator, authy, cli, go, golang, mfa, otp, totp
- Language: Go
- Homepage:
- Size: 1.02 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Authenticator
[](https://github.com/nhatthm/authenticator-cli/releases/latest)
[](https://github.com/nhatthm/authenticator-cli/actions/workflows/release-edge.yaml)
[](https://goreportcard.com/report/github.com/nhatthm/authenticator-cli)
[](https://pkg.go.dev/github.com/nhatthm/authenticator-cli)
[](https://www.paypal.com/donate/?hosted_button_id=PJZSGJN57TDJY)
CLI tool for managing and generating one-time passwords for multiple accounts.
## Prerequisites
- `Go >= 1.24`
### 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](https://wiki.gnome.org/Projects/GnomeKeyring).
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](https://wiki.gnome.org/Apps/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](https://github.com/nhatthm/authenticator-cli/releases/latest) or
the [nightly build](https://github.com/nhatthm/authenticator-cli/releases/tag/edge) (`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:
```bash
$ /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](#scan-a-qr-code). Otherwise, [input the account and the totp secret manually](#manually-input-all-the-information).
```bash
$ authenticator account add -h
Add an account
Usage:
authenticator account add [-n ] [--qr ] [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](#add-a-new-account), you can generate an OTP by running `authenticator otp `. For example:
```bash
$ 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:
```bash
$ 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:
>
> ```bash
> 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

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
[](https://www.paypal.com/donate/?hosted_button_id=PJZSGJN57TDJY)
or scan this