"401: Unauthorized • Invalid one time password" in a loop

Hello. I’m having a perpetual loop problem. I changed the sudo nano /usr/share/nginx/invoiceninja/.env file to reflect the new mail server.

Then I did: sudo php artisan optimize:clear

Then I did the password recovery. I got the email and clicked on the link. I input the new password. Then, when I try to log in, I get:

401: Unauthorized • Invalid one time password

This goes on forever. I can never seem to reset the password then login.
What do I do now? I have a few urgent invoices to send out.

1 Like

Hi,

@david do you have any suggestions?

Hello. Does anyone have any ideas? I’m effectively locked out. I was able to change the mail server so that I can get a Password Reset email but the link always results in me entering the new password, then the login screen terminating in “Invalid One Time Password”. Isn’t there some way to rectify this from the local command line?

This may help:

To be clear, running the bcrypt command doesn’t modify the DB, it just tells me what to put into the corresponding username entry? The output of the command looks like a hash.

Yes, that is correct

Thanks. How do I edit the database? I tried installing PHPMyAdmin using sudo apt install phpmyadmin. I saw no errors during the installation. When I tried the local address 192.168.1.99/phpmyadmin, I get a not found message with interface dressing from InvoiceNinja.

You may want to ask your webhost for advice

I was able to get phpmyAdmin running by creating a symbolic link from the phpMyAdmin install directory to the InvoiceNinja document root directory. I was able to get into the DB. I ran

  • php artisan tinker
  • bcrypt(‘new_password’)

It gave an output string.
I saved the output string into the database (‘users’ table → ‘password’ field).
Still I got the same errors… invalid one time password, wrong password.

I noticed these fields were also populated so I cleared them:

  • clear → google_2fa_secret
  • clear → remember_token

Now I can log in again! Thanks!

1 Like

Glad to hear it, thanks for sharing the solution!

and it died again… will make another thread with the new issue…