152

I am using Google Authenticator for 2-step authentication. I like how I can use a code and verify my account using my phone:

enter image description here

I realize that the app was designed to run on a device other than a computer to increase security for the computer (in case that it is lost or stolen), but I would like to know if there is a way I can run Google Authenticator on my Macbook.

Now, per the Google Authenticator Page it will not run on a desktop:

What devices does Google Authenticator work on?

  • Android version 2.1 or later
  • BlackBerry OS 4.5 - 6.0
  • iPhone iOS 3.1.3 or later

However there are several emulators for developers and so I wonder if it is possible to run one of these emulators and then run Google Authenticator with that. I do realize this is not a best practice - but I'm less worried about my laptop getting stolen and more worried about someone just hacking the account.

So my question is this: Is it possible to run it on the desktop, even though it is not meant to be / not recommended?

4
  • nah, kind of defeats the purpose, if you think about it. but if you really want to defeat that purpose, this article explains how albertech.blogspot.com/2016/10/… – jar Oct 18 '16 at 22:45
  • however, as an alternative to GAuth under emulation you could just use oathplus - soundly.me/oathplus - it's essentially Google Authenticator for the command-line (I'm the dev). – jar Nov 11 '16 at 4:18
  • By that same logic shouldn’t you avoid accessing all those websites that have enabled 2fa on your mobile (which is generally more likely to get stolen anyway)...? – user1073075 Jan 6 '19 at 16:15
  • This Firefox addon can also be explored. addons.mozilla.org/en-US/firefox/addon/auth-helper does this well. – Animesh Jan 11 '20 at 6:35

22 Answers 22

118

Install oath-toolkit via brew, generate your keys with:

oathtool --totp -b <your_secret>

To get your secret, use the 'change phone' option in Google. You can get your key by clicking the 'manually enter the key' link.

7
  • 1
    Awesome! Only problem now - can't log in when I don't have my laptop. – Jason R. Coombs Sep 1 '16 at 16:08
  • 15
    Copy the secret to a fairly secure file: (umask 0077;pbpaste > ~/.totp_google). Write a shell function to put the TOTP in your clipboard: totp() { oathtool --totp -b $(<~/".totp_${1:-google}") | pbcopy; }. Add other secrets for other services: (umask 0077;pbpaste > ~/.totp_github). Select which token you want from the function: totp github. Profit!!! – kojiro Oct 13 '16 at 0:11
  • 3
    FWIW I wrote a shell wrapper that does @kojiro 's suggestion: github.com/poolpog/bash-otp – JDS Nov 2 '16 at 17:24
  • Here's a short shell script that reads the Google Authenticator app's database file and generates a live code for each key, providing you have enough access to your device to copy the file over to your PC. – Malvineous Oct 1 '17 at 9:15
  • 1
    @JasonR.Coombs you should be able to login to both the laptop and your phone with the same secret key. Just did it right now and both generate the same 6 digit passcode. – John Lee Jun 11 '19 at 18:20
29

There is a Self Hostable Web App at https://github.com/gbraad/html5-google-authenticator This is not secure on an internet facing machine, but you can load this on a completely offline Machine and you'd be safe.

4
  • 1
    It looks really good - just makes me nervous b/c I don't easily understand everything that makes it work :) – cwd May 25 '13 at 0:30
  • 4
    basically, it's using local storage inside your browser to store a secret key, local storage is only accessible from the domain it was written from (someone correct me if i'm wrong), it then uses the current time and the secret key from the local storage, to compute what the key should be. It's all just Javascript goodness – Jharwood May 28 '13 at 13:11
  • 1
    This one is awesome bro. Now I don't need to run a VirtualBox or Bluestacks for this. – manish_s Mar 24 '14 at 16:41
  • 1
    That's fantastic. You can use rawgit to run the app now or use a version pinned to a commit if you have concerns about the code mutating. – Jason R. Coombs Sep 1 '16 at 16:24
21

Yes. You can use WinAuth. Works fine for me.

2
  • Open source + very simple to use, and works even on Vista (which Authy does not do). – Casper Jun 29 '18 at 16:35
  • Worked fine for me. Used it because it runs in my machine, is open source, GNU licensed and there's a binary to download. It has a nice option "copy on new code" that automatically copies a new code to the clipboard. – neves Jun 16 '20 at 19:39
18

JAuth is a good alternative - Java based (has Windows, Linux, and OS X installers), small and portable. I keep a copy on a USB drive.

5
  • For my money, this ought to be the accepted answer. JAuth is works great, and has its own installer. It really couldn't be any easier. – evadeflow Apr 11 '14 at 13:37
  • If JAuth_KS file is leaked can somebody else generate One Time Passwords for my accounts? – Saqib Ali Nov 3 '16 at 15:07
  • 1
    I found the UI confusing. For me, on Linux Mint (Ubuntu based), the buttons were 3x3 px wide and hard to click, and what do they mean? The > button for example. + hard to see what's a button and what is some kind of title. — I wish they hadn't built any GUI at all, instead everything via the command line in Bash / Win CMD. I guess that would have saved them fairly much time too – KajMagnus Nov 16 '16 at 12:47
  • Can JAuth be configured for more than one account? – d-b Jul 7 '18 at 7:10
  • The installers don't work any more for OS X. And it's confusing how to even use it! – rogerdpack Jun 13 '20 at 14:18
18

Try Authy: https://www.authy.com/.

It works for many 2fa accounts, including Google. Authy supports multiple platforms, including PC.

Note: Google seems to only provide a QR code for adding accounts. This means it's easiest to add your Google account via the Authy Android app. However, once you do that, you can also access it from the PC Authy app.

5
  • 1
    By far the best solution. It has a Chrome Extension too :) – Jacob Relkin Dec 3 '15 at 10:26
  • 7
    Requires an online account. – pgampe Mar 30 '16 at 20:19
  • 2
    Just to be clear, this is a web app? And you have to upload your secrets to a third party? – jiggunjer Oct 18 '17 at 3:50
  • @jiggunjer good question. From their website "Data Security Encrypt your 2FA data and backup to our cloud, without storing passwords with us." So yes and no. You can choose to let them hold your secrets but theoretically they can't access them. If I recall, you can skip the cloud backup feature if you wish. – dss539 Oct 18 '17 at 3:55
  • 1
    This requires a phone number. – SuperSandro2000 Oct 6 '19 at 13:31
13

Forget the others if you have to deal with more than one key, pass or any other kind of information. It is always a question how do you use it. The easiest method is to use an password management tool (please do not use online services for such things, LastPass has been hacked too).

Here is my suggestion (works on Linux, Mac, Android), this one is for Windows users:

  1. Download latest KeePass (currently 2.32) and set your DB up (please secure it with more than just an pass, an certificate makes it all more secure as example)
  2. Download TrayTOTP Plugin for KeePass and copy it into plugins folder located in KeePass installation folder.
  3. For an entry in KeePass, create two custom strings for your keepass entry:

    First string: TOTP Seed
    Second string: TOTP Settings

    Under TOTP Seed, you should place your seed key. For settings, many are confused, especially newbies. By default (and most use defaults) new key is always created every 30 seconds and has length of 6 characters. That means, if not explicitly set, then TOTP Settings should have:

    30;6
    

    30: Stands for seconds
    6: Stands for length of a key

    I know only couple services where you can choose or set it manually, Kraken Exchange is one of them, when you secure your account, you can choose length up to 8 characters and totp settings would be 30;8

  4. Change Autotype :) , there are two types of pages and how they verify.

    First: You can enter username, password and 2FA key.
    Second: You need to enter username and password, after pressing enter/submitting, second page/frame shows asking for 2FA.

    For first case, edit your KeePass entry by changing autotype options. Click on "Override default sequence" which is:

    {USERNAME}{TAB}{PASSWORD}{ENTER}
    

    and add pressing additional TAB, then placing TOTP key and then pressing ENTER:

    {USERNAME}{TAB}{PASSWORD}{TAB}{TOTP}{ENTER}
    

    For second case, we need to send user and pass, then wait 1-3 seconds (I will set here 5 seconds) and then 2FA key:

    {USERNAME}{TAB}{PASSWORD}{ENTER}{DELAY 5000}{TOTP}
    

That's it. Press CTRL+V or right click and perform autotype, that's it.

1
  • 1
    KeePassXC is another version of KeePass that is cross platform and supports 2fa/OTP. Works well. – jeffmcneill Sep 19 '18 at 2:50
11

You could use Oracle's VirtualBox, Android x86 OS, and then install the Authenticator. This would essentially give you the Google Authenticator on a desktop.

VirtualBox: https://www.virtualbox.org/

Android x86: http://www.android-x86.org/

1
  • 1
    When I see I pigeon I always have bazooka ready hanging on my back. Bazooka is loaded with proximity missiles, I love certainty. – Aubergine Nov 22 '20 at 17:36
8

Disclaimer: I'm the Author :-)

https://qoomon.github.io/otp-authenticator-webapp/

Its a google authenticator web app.

This is a static website hosted on github pages. You could just use my version or fork the gh-pages branch and hosted on your own github page.

No External Services are used, local JavaScript execution only

Features

  • generate totp codes
  • show remaining valid seconds for totp code
  • parse otpauth URLs in 'secret' input field
  • generate otpauth URL QR code

Here is an Example

7

There's also a Firefox OS app version. It doesn't need Firefox to run first, and you can actually install Firefox portable so it doesn't impact your system.

https://marketplace.firefox.com/app/gauth/

2
6

I hacked together an oath-toolkit integration with a CLI that works in Quicksilver too. The CLI Bash Script and .otpkeys Configuration File example can be found in the Quicksilver and OTP: Together At Last blog post.

You'll need your secret keys so you can put them into the config.

Bash Script:

#!/bin/bash
scriptname=`basename $0`
if [ -z $1 ]
then
    echo "$scriptname: Service Name Req'd"
    echo ""
    echo "Usage:"
    echo "   otp google"
    echo ""
    echo "Configuration: $HOME/.otpkeys"
    echo "Format: name=key"
    exit
fi
otpkey=` grep ^$1 $HOME/.otpkeys | cut -d"=" -f 2 | sed "s/ //g" `
if [ -z $otpkey ]
then
    echo "$scriptname: Bad Service Name"
    exit
fi
/usr/local/bin/oathtool --totp -b $otpkey

Configuration File example for .otpkeys -- spaces are stripped.

google=a743 mike k3b4 rm5k z8a9 q6f5 id1k bxk1
facebook=OWBV Q9LF POQ2 MKYU
evernote=UKPPIDEALLKPYTT9
dropbox=iop4 xbox asia b0ss ninj a9

Usage -- specify the full or partial service name from the config, anchored to the beginning of the service name. E.g. 'goo' will work for google, but 'oogl' will not.

iso : ~ --> otp google
196379
iso : ~ --> otp goo
612384
5

On MAC (OSX) you can use Alfred* and the GAuth-Workflow to get the Google Authenticator on your Desktop.

  • Workflows are only supported with the (paid) Powerpack version.
1
  • Sascha, Have you been able to find a more native app for Mac OS to generate the Google Tokens? – Saqib Ali Nov 3 '16 at 18:49
4

I'm surprised that no one mentions the following 2 apps.

Authenticator - Happy Two-Factor Verifying! / $2.99

OTP Manager / Free

1
  • Authenticator price is $3.49 for me. And author's GitHub page is not there anymore. – Denis The Menace Dec 2 '18 at 11:04
2

YubiKey offers a hardware solution (an USB dongle) that's capable of doing OATH-TOTP.

There's also a Windows helper program:

http://www.yubico.com/applications/internet-services/gmail/

1

There's a Chrome app that's compatible: https://chrome.google.com/webstore/detail/gauth-authenticator/ilgcnhelpchnceeipipijaljkblbcobl?hl=en

1
0

You can use my script: otp.py

The downside of it is that:

  1. you'll see a proper countdown only when the first code expires :)
  2. this zenity popup doesn't allow copy & paste (this is a big limitation IMO)
  3. it was working on Mac, but Cocoa Dialog was retired and it doesn't work anymore.
  4. perhaps it can be adapted to work on Windows, by installing Zenity on Windows (which is possible).
0

I'm just getting up to speed with this myself, but it appears that there is now a google-authenticator command-line interface that's distributed with the PAM module at https://github.com/google/google-authenticator-libpam.

Some further information on setup (aimed at use with ssh on CentOS) can be found in an article at https://www.digitalocean.com/community/tutorials/how-to-set-up-multi-factor-authentication-for-ssh-on-centos-7.

0

There is an open-source authenticator implementation: https://github.com/Authenticator-Extension/Authenticator.

0

Open-sourced keeweb has OTP option built-in, on top of the password manager + autogen pass. Works on MacOSX and as a WebApp

https://github.com/keeweb/keeweb

0

For Python user, there is a little tool called mfa available through PyPI. Just install it using pip install mfa.

https://github.com/limeburst/mfa

1
  • Be aware: This software is no longer maintained nor recommended. – Valeriy Solovyov Nov 15 '20 at 17:08
-1

If you wrote down the seed for your sites and have Python (easy to install on Mac/Windows/linux), you can use this command line script, which also tries to hide the seed from inadvertent bad use: twisted2sv.

-1

Use this Python simple script to get authentication code all you have to do is add your secret when prompt.

https://github.com/abhishek-bharadwaj/Authenticator/blob/master/Authenticator.py

-1

Install and run Google Authenticator on BlueStacks Android emulator - very easy and it gives you a single click Google Authenticator shortcut on the desktop that will load bluestacks with authenticator already open. Almost as good as a Google Authenticator desktop app.

Not the answer you're looking for? Browse other questions tagged or ask your own question.