Are there any plans to add support for backup codes to the 2FA system?
AI-generated summary
The discussion revolves around implementing backup codes for 2FA in the system. bartv asks about plans for this feature, and tgxworld confirms itās planned for the 2.1 release. maja shares a basic flow for enabling backup codes, which requires TOTP to be active and allows users to copy or download codes, with the ability to reset them if lost. dax suggests adding a download option, which maja considers. gerhard emphasizes security, requiring password and 2FA authentication to create codes. featheredtoast proposes a dedicated 2FA page and suggests a one-time download with regeneration, avoiding displaying code counts on the login page. sam recommends naming the action ācreate new backup codesā and following Googleās approach for re-downloading. The feature is confirmed as shipped by sam.
Yup this is planned for and would probably be done in the 2.1 release.
Iām looking into adding support for 2FA backup codes, this is what I came up so far and Iād really appreciate some feedback. This is very basic flow so far, but hopefully enough to raise some questions/points to consider.
In order to enable backup codes, primary method (TOTP) has to be enabled.
After enabling backup codes, user gets to copy and store the codes. If user loses backup codes, they have to reset them and get the new set of codes.
Backup code can be used everywhere authentication code is required if device providing TOTP code is not available.
This will be build upon the feature @featheredtoast initially built - using user_second_factors, and since you gave this some thought already Iād appreciate if you have any suggestions.
Would it be possible (or will it be possible in the next future) to download a text file instead of copying the codes?
Was thinking about it too and will consider it when I get the basic functionality going.
I agree, there should be an option to download backup codes. I really like how Google does it ā they even show me which backup codes were already used. But, looking at the screenshots, I think enabling backup codes is planned to be a one-time action with no ability to show them again. Thatās fine too.
Anyway, the most important thing is, that it shouldnāt be possible to create backup codes unless I authenticate with my password and a second factor or recently logged in with both. Otherwise someone could steal my backup codes.
The more 2fa items weāve got, the more desire for a dedicated 2fa page, kinda how google accounts do this - Iām leaning towards a page that requires a password confirm and optional 2factor credentials to access, that allows a user to configure 2factor details. This would open the UX gates to allow for multiple 2factor devices.
re: backup codes specifically, Iād lean more towards having a one time download for codes, which would have to be re-generated to show another batch of codes. Iām not sure I like showing how many backup codes a user has left on the login page. Iād prefer to keep that count in the user profile instead.
Overall, Iād say the mockup looks quite good, and I agree with what you have here, where we invalidate all codes + regenerate, rather than reveal older codes.
Some minor changes
I would call this ācreate new backup codesā, if you click it I would always require a token prior showing them. (If you have codes I would say they exist) I would follow whatever google do regarding allowing re-download vs always regenerate.
I would also add something to the initial screen after you confirm the token for directly downloading codes after you scan the barcode
Closing this @maja has shipped backup code!!! ![]()


