Google Authenticator on Apple devices, certain secrets are not valid

后端 未结 4 1716
闹比i
闹比i 2021-01-18 02:26

We\'ve incorporated two factor authentication into one of our applications using Google Authenticator. In QA, something really weird turned up. While I managed to fix it,

4条回答
  •  无人共我
    2021-01-18 02:41

    I was having the same issue as above. It turns out that Google Authenticator doesn't like = signs in the IPhone App, but doesn't complain in Android.

    In my case I increased the length of the string before encoding to base32 from 8 chars to 10 chars. This removed the three === at the end of the string. I found this online as to why = signs appear in base32 encoded strings:

    The pad character (=) does not have a binary representation in BASE32; it is inserted into the BASE32 text as a placeholder to maintain 40-bit alignment

    In your case above the same happened when you added the salt. The second secret you pasted doesn't have ='s at the end.

    Hope this help.

提交回复
热议问题