DarkGhostHunter / Laraguard

"On-premises 2FA Authentication for all your users out-of-the-box
MIT License
266 stars 24 forks source link

RangeException Base32::doDecode() only expects characters in the correct base32 alphabet #63

Closed JohnMerrick closed 3 years ago

JohnMerrick commented 3 years ago

I have started to get the error:

RangeException Base32::doDecode() only expects characters in the correct base32 alphabet

after entering the 2FA code and clicking the confirm code button.

Has been working fine, so no idea why its suddenly stopped working

DarkGhostHunter commented 3 years ago

How I can reproduce this?

ehoutsma commented 3 years ago

It's the introduction of the Base32 encoded storage that made the service break. You have to delete the 2FA records and recreate the secrets to be able to use the 2FA again.

Best thing would be to store the secrets in Base32 if they aren't in that format.

DarkGhostHunter commented 3 years ago

If I find the bug, I will re-open this again.

ehoutsma commented 3 years ago

In a new installation it works, but if you have codes from before the change the service breaks.

In the old version the shared_secret was something like: "PyˑN䀀", where it now expects: "DFIHSEGLSFHKJ"

For my installation, where there was only 1 account using 2fa it wasn't a real issue, but if you have a lot of accounts it could me more annoying.

At least for others who might encounter this issue, they now know what's the cause.

DarkGhostHunter commented 3 years ago

That was because version 3.0 changed the column table definition from binary to string, thus breaking change. It was something I didn't document, but was evident from the migration.

I'll have more care when dealing with migrations between versions, like the upcoming 4.0 this Thursday.