Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save actionjack/210d560427486654eda05d218491411b to your computer and use it in GitHub Desktop.
Save actionjack/210d560427486654eda05d218491411b to your computer and use it in GitHub Desktop.
macosx: oathtool totp google 2 factor authentication
#-----------------------------------------------#
# oathtool totp google 2 factor
#-----------------------------------------------#
# if you have already set up 2 factor authentication with your phone
# you need to remove it from your phone and google authenticator app
# this wont invalidate your backup codes or application codes
# login to your google account go to 2 factor authentication,
# select your phone and click remove
# then switch to the google authenticator app on your iphone
# click edit and then swipe left on the gmail generator,
# it should now show a button that says delete,
# click delete to remove the generator
# switch back to your google account and click add phone
# select your iphone
# IMPORTANT
# when you get to the screen where it shows you a qr code,
# select the link underneath that says cant use qr code
# this will show you a secret key to use instead of a qr code
# write the secret key down
# switch to the google authenticator app on your iphone
# click the plus button to add a new generator
# select time based
# add in your gmail email address and the secret key
# the generator will now create a time based code for you
# now log in to gmail with your username and password
# youll be promted for your code, add it and you should log in
#-----------------------------------------------#
get you google secret key from the previous and use it with oathtool
# install oathtool
# ./configure
# make
# sudo make install
# example key
1 # google 2 factor secret key ( example )
b kuq 7ty asd buj lda
2 # remove spaces and convert to uppercase
BKUQ7TYASDBUJLDA
3 # create the 2 factor code
oathtool -b --totp BKUQ7TYASDBUJLDA
# -b = use base32 encoding
# --totp = time based
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment