replydev / cotp

Trustworthy, encrypted, command-line TOTP/HOTP authenticator app with import functionality.
GNU General Public License v3.0
240 stars 21 forks source link

How to setup github's 2FA with cotp? #440

Closed RokerHRO closed 3 months ago

RokerHRO commented 3 months ago

Github enforces 2FA now, so I'd like to use cotp for that.

Github shows a dialog: "Setup authenticator app" and there is a QR code. -> unusable for command line tool. The dialog also a "Setup key", when I click on it, a 16-char code is shown, but no URL.

But cotp wants an URL -> what shall I enter here?

I think github's 2FA enforcement would give you a lot of new users, but at the moment I am completely lost and a README-gitgub.md would be nice. :-)

I scanned the QR code from the Github dialog. It contains an URI like this: otpauth://totp/GitHub:RokerHRO?secret=★★★★★★★★&issuer=GitHub but that is not accepted by cotp add -u:

error: unexpected argument 'otpauth://totp/GitHub:RokerHRO?secret=★★★★★★★★&issuer=GitHub'

:-(

replydev commented 3 months ago

Hello @RokerHRO. In this case you would just need to execute cotp add -l Github. Without the -u flag, it will prompt for the BASE32 secret that GitHub shown to you. Copy and paste it and you are good to go.

RokerHRO commented 3 months ago

Hello @RokerHRO. In this case you would just need to execute cotp add -l Github. Without the -u flag, it will prompt for the BASE32 secret that GitHub shown to you. Copy and paste it and you are good to go.

Nice. I didn't know what this "label" is good for.

I think this could be mentioned as example in the README.md for any impatient user. :-)

replydev commented 3 months ago

Yeah I totally agree. A new revision is coming :)

RokerHRO commented 3 months ago

A question to the "label" parameter: Is it an arbitrary name, just for the user? Or are other config parameters associated with this label, e.g. if `label == "Github" then algorithm=SHA1, digits=6, period=30 etc. ?

replydev commented 2 months ago

Hello @RokerHRO, the label is just an arbitrary name that you give to the OTP Code.

Please check also: https://github.com/google/google-authenticator/wiki/Key-Uri-Format#label

RokerHRO commented 2 months ago

Okay, so where do the other configuration values (algorithm, digits, period) come from?

I'd still like to see an example how to use cotp with Github's 2FA in your README.md :-)