[Bug Report]: MFA error after artisan key:generate #2627

Closed
opened 2026-02-05 04:39:29 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @christianhz01 on GitHub (Feb 2, 2022).

Describe the Bug

If you have activated TOPT MFA and then renew the application key with "artisan key:generate", the MFA login fails. In this case, MFA must be reset for the user.

Steps to Reproduce

  1. Enable MFA for an User
  2. change something in the .env File
  3. execute artisan key:generate
  4. Now you get an error if you try to login with the mfa user

Expected Behaviour

no Error?

Screenshots or Additional Context

No response

Exact BookStack Version

21.12.3

PHP Version

7.3

Hosting Environment

Ubuntu20, Apache2, php7.3

Originally created by @christianhz01 on GitHub (Feb 2, 2022). ### Describe the Bug If you have activated TOPT MFA and then renew the application key with "artisan key:generate", the MFA login fails. In this case, MFA must be reset for the user. ### Steps to Reproduce 1. Enable MFA for an User 2. change something in the .env File 3. execute artisan key:generate 4. Now you get an error if you try to login with the mfa user ### Expected Behaviour no Error? ### Screenshots or Additional Context _No response_ ### Exact BookStack Version 21.12.3 ### PHP Version 7.3 ### Hosting Environment Ubuntu20, Apache2, php7.3
OVERLORD added the 🐛 Bug label 2026-02-05 04:39:29 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Feb 2, 2022):

Hi @christianhz01,
This is known. You should not be re-running the artisan key:generate. This should only ever be ran during initial install.
This command generates the key used for encryption, and encryption is used to secure MFA details. Changing the key will cause any encrypted details, encrypted with the previous/different key, to be inaccessible.

@ssddanbrown commented on GitHub (Feb 2, 2022): Hi @christianhz01, This is known. You should not be re-running the `artisan key:generate`. This should only ever be ran during initial install. This command generates the key used for encryption, and encryption is used to secure MFA details. Changing the key will cause any encrypted details, encrypted with the previous/different key, to be inaccessible.
Author
Owner

@christianhz01 commented on GitHub (Feb 2, 2022):

Hi @ssddanbrown
Thanks for the answer. I understood that the command is needed to apply settings from the .env. Is that wrong then? How do I transfer the settings?

@christianhz01 commented on GitHub (Feb 2, 2022): Hi @ssddanbrown Thanks for the answer. I understood that the command is needed to apply settings from the .env. Is that wrong then? How do I transfer the settings?
Author
Owner

@ssddanbrown commented on GitHub (Feb 2, 2022):

I understood that the command is needed to apply settings from the .env. Is that wrong then

Yeah, that's wrong.

How do I transfer the settings?

Settings from the .env file are ready automatically and dynamically. No commands are needed unless you've ran php artisan config:cache at some point (Not something we document though) in which case you may need to run php artisan config:clear once.

@ssddanbrown commented on GitHub (Feb 2, 2022): > I understood that the command is needed to apply settings from the .env. Is that wrong then Yeah, that's wrong. > How do I transfer the settings? Settings from the `.env` file are ready automatically and dynamically. No commands are needed unless you've ran `php artisan config:cache` at some point (Not something we document though) in which case you may need to run `php artisan config:clear` once.
Author
Owner

@christianhz01 commented on GitHub (Feb 2, 2022):

Thanks :)

@christianhz01 commented on GitHub (Feb 2, 2022): Thanks :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2627