How do I set up 2FA in Lemmy?

Kalcifer@lemmy.world to No Stupid Questions@lemmy.world – 16 points –

When I click the set up 2FA thing in the account settings I then see the following

That button contains a link with a secret key, and some other things. What am I supposed to do with it? I want to set the 2FA up to use my authenticator on my phone.

14

Current 2FA implementation in Lemmy is a bit janky with the risk of being locked out.

First things first: DO NOT UNDER ANY CIRCUMSTANCES LOG OUT UNTIL YOU’RE 100% SURE YOUR AUTHENTICATOR WORKS AND THAT YOU CAN LOGIN USING ITS GENERATED 2FA CODE

Now that that’s out of the way, here are some steps to follow:

  1. Ideally clicking on that button will open your authenticator which will then prompt you to select login credentials to attach it to; if it doesn’t and you instead are lead to a URL with a secret key or if you right click and you can copy that URL, then you need to manually copy the URL and paste it in the 2FA section of your authenticator or password manager
  2. Once you’ve figured this out don’t log out, instead open a private browser window and test to see if you can login with your credentials + 2FA

If you can’t get it to work then you can disable it in the window you’re still logged into.

If you share which authenticator you use, people might be able to give you more specific instructions to get you through step 1.

Whatever you do, don’t log out. You will be locked out!
Unlike most common implementations, there is no built in step to verify if you can successfully generate a TOTP before 2FA is fully enabled.

I use Memmy and used wefwef to confirm the 2FA after I setup the code in the web client. Very janky. But I guess it works?

That's also a good way of verifying! As long as you go through the login process somewhere different than your current browser window you should be able to make sure it works properly.

If you do lock your self out, reset your password and after that it will log you back in. You can disable 2fa in the settings.

That sounds like a gaping security hole, but with how likely it is that you lock yourself out with the current 2FA implementation, I can't be mad about it.

If all else fails you could also reach out to the admin of your instance I suppose and see if they can disable 2FA on your account, but I figured it's best to avoid the headache altogether and just not log out until you're 100% the 2FA works properly.

the way 2fa works is that there is a "seed", the secret key that you mentioned. this is what will be creating the timed codes. in most applications this will be converted to a qr code for ease but you can still import it to your app of choice or use an extension to convert it to a qr code like @wigglingwalrus@lemm.ee said

if you are interested here is a good video about it

If the link provides a key, you should go into your 2FA app of choice and import the key. That should be about it...

I'm using bitwarden, so I'll just copy the 2fa installation link, then pasted it into the authenticator key field in bitwarden and done. You're going to need to have paid bitwarden subscription or self-hosted vaultwarden server in order to use bitwarden as 2FA client though.

Note that your 2FA installation link contains your 2FA secret key, so don't save it anywhere else but your password manager.

If you click that link on your phone, it should open your 2FA app and add it. Alternatively, you can get browser extensions to convert it to a QR code and scan it like normal on your phone.