southbridgeio / redmine_2fa

Two-factor (sms/telegram) authentication for Redmine
https://southbridge.io
MIT License
42 stars 17 forks source link

Google Authenticator #79

Closed oliu321 closed 4 years ago

oliu321 commented 4 years ago

Hi, I was trying to set up google authenticator for my redmine installation. I have had the plugin installed, but where can I configure the google authenticator? It seems there is no place for a user to scan the QR code? Thanks.

vladislav-yashin commented 4 years ago

Hi! It supposed to be configured after authentication (user will be suggested to choose 2fa method after signing in)

ghost commented 4 years ago

I am also trying to get it to work with google auth, but no screen shows QR code. We are using 4.0.4 version of redmine. I can only select and assign 2FA as an admin cannot select is as a user.

oliu321 commented 4 years ago

I tried but got below, any idea? I pretty much know no ruby at all.

NameError (uninitialized constant RQRCode::QRCodeRunTimeError): plugins/redmine_2fa/lib/redmine_2fa/patches/account_controller_patch/second_authentication_init.rb:17:inrescue in password_authentication' plugins/redmine_2fa/lib/redmine_2fa/patches/account_controller_patch/second_authentication_init.rb:12:in password_authentication' plugins/redmine_2fa/lib/redmine_2fa/patches/account_controller_patch/second_authentication_prepare.rb:16:inpassword_authentication' app/controllers/account_controller.rb:205:in authenticate_user' app/controllers/account_controller.rb:38:inlogin' lib/redmine/sudo_mode.rb:63:in sudo_mode'

oliu321 commented 4 years ago

@funk-yourself , sorry can you help?

vladislav-yashin commented 4 years ago

You can try to replace

gem 'rqrcode'

with

gem 'rqrcode', '~> 0.10.1'

in Gemfile

77

rqrcode 1.0 will be supported eventually.

bornrobot commented 4 years ago

The latest rqrcode now include some backwards compatibility with 0.10.1 so this plugin should work again without specifically requiring the rqrcode version in the gem file.

oliu321 commented 4 years ago

Thanks, by chaging the rqrcode to 0.10.1 , now the error is gone, and I can see the QR code generated, however when I am trying to use the Google Authenticator on iOS to scan the QR code I got "The bard code 'https://xxx.xxxxxx.com/pm/OuFin2' is not a valid authentication token barcode." error on the Google Authenticator . My QR code as below:

QRCode

, can you help again? Thanks. @funk-yourself

bornrobot commented 4 years ago

This issue may be relevant https://github.com/google/google-authenticator/issues/267 ...I'll see if I can find an ios device to test.

oliu321 commented 4 years ago

I tried Anrdroid but failed too, the error now is "Can not interpret QR code". Maybe I didn't set something correctly somewhere?

vladislav-yashin commented 4 years ago

I'm not sure about the reason yet, but generated qr-code seems wrong.

Correct code should be decoded to something like otpauth://totp/redmine.domain:redmine_login?secret=secret_string&issuer=redmine.domain

oliu321 commented 4 years ago

Totally working now. The weird part http://xxx is actually from me when I was trying to circumvent the rqrcode (when I had that ErrorName error) and put some test code there which I forgot to remove. I apologize. (But once you mentioned that the QR code is wrong I immediately realized it, thanks!)

ghost commented 4 years ago

I am also trying to get it to work with google auth, but no screen shows QR code. We are using 4.0.4 version of redmine. I can only select and assign 2FA as an admin cannot select is as a user.

It Works for me also with changing of the gem file. No problems with QR code here.