-
Notifications
You must be signed in to change notification settings - Fork 0
Providers
Viscosity OTP works with any CLI tool that outputs a TOTP code to stdout. Below are setup guides for common providers.
-
1Password CLI (
op) installed - 1Password desktop app integration enabled (recommended — allows biometric unlock)
- Open 1Password desktop app
- Right-click the item containing your VPN OTP
- Select Copy UUID
Note: If "Copy UUID" isn't visible, go to 1Password → Settings → Advanced and enable Developer experience.
defaults write net.skycmd.viscosity-otp "<connection-name>" "/usr/local/bin/op item get <uuid> --otp"
Replace <uuid> with the UUID you copied.
When you connect, op item get fetches the TOTP code. If you have desktop app integration enabled, 1Password will authenticate via Touch ID or your system password. Approve the prompt quickly — Viscosity has a ~10 second timeout for Before Connect scripts.
-
Bitwarden CLI (
bw) installed
defaults write net.skycmd.viscosity-otp "<connection-name>" "/usr/local/bin/bw get totp <item>"
Where <item> is the item name, ID, or search term.
- KeePassXC installed
- keepassxc-cli available in your PATH
defaults write net.skycmd.viscosity-otp "<connection-name>" "keepassxc-cli show -t <database-path> <entry-name>"
keepassxc-cli will prompt for the database password on stdin. This may not work well in the non-interactive context of a Viscosity Before Connect script. Consider using KeePassXC's secret service integration or a keyfile-based unlock instead.
-
oathtoolinstalled (brew install oath-toolkit)
defaults write net.skycmd.viscosity-otp "<connection-name>" "oathtool --totp --base32 <secret>"
Caution
This stores your TOTP secret in plaintext in the macOS preferences plist. Anyone with access to your user account can read it. This approach is not recommended for sensitive credentials. Prefer a password manager like 1Password or Bitwarden instead.
You can store the secret in macOS Keychain and retrieve it at runtime:
security add-generic-password -a "my-vpn-totp" -s "my-vpn-totp" -w "<secret>"
Then configure:
defaults write net.skycmd.viscosity-otp "<connection-name>" "oathtool --totp --base32 \$(security find-generic-password -a my-vpn-totp -w)"
You can use any script or command as long as it:
- Outputs the OTP code (and only the OTP code) to stdout
- Exits with code 0 on success
- Exits with a non-zero code on failure (stderr will be shown in the error dialog)
defaults write net.skycmd.viscosity-otp "<connection-name>" "/path/to/my-otp-script.sh"
Where my-otp-script.sh might be:
#!/bin/bash
# Fetch OTP from a custom API
curl -s https://internal.example.com/api/otp?vpn=my-vpnMake sure the script is executable (chmod +x my-otp-script.sh).