samples
samples copied to clipboard
TOTP secret with 26 Char length is not working with B2C
Azure AD B2C out-of-the-box TOTP Authenticator not supporting 26 Char length secret. Sample followed - https://github.com/azure-ad-b2c/samples/blob/master/policies/totp/policy/TrustFrameworkExtensions_TOTPMigration.xml
If the secret char length is 8,16,24 or 32 the OTP code entered works
-
Create a valid secret(base32) 26 Char length secret, for testing w used this link (https://totp.danhersam.com/).
-
Add the secret to google Authenticator app to get OTP code or use the above-mentioned URL to get OTP code.
-
Use the secret in Technical profile “AzureMfa-BeginVerifyOTP” from the sample, either follow the exact steps in sample or hardcode the secret in below technical profile <TechnicalProfile Id="AzureMfa-BeginVerifyOTP"> <DisplayName>Create Device</DisplayName> <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.AzureMfaProtocolProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /> <Metadata> <Item Key="Operation">BeginVerifyOTP</Item> </Metadata> <InputClaims> <InputClaim ClaimTypeReferenceId="secretKey" /> <InputClaim ClaimTypeReferenceId="objectId" /> <InputClaim ClaimTypeReferenceId="userPrincipalName" /> </InputClaims> </TechnicalProfile>
-
Run the user journey, logging in using a user ID and password, on the OTP verification screen enter the OTP code from google Authenticator or the online tool for the secret you added in step 2.
-
Observe the error "Wrong code entered" error.
-
Repeat the same step with 8,16,24 or 32 char length and observe the B2C validate the OTP code.
NOTE : AAD TOTP Authenticator works fine.
Secret tests were performed.
- 8 Char Length secret - JHDGFDHJ - - Worked(OTP code accepted by B2C)
- 16 Char Length secret :JHDGFDHJF3JHFGD -- Worked(OTP code accepted by B2C)
- 24 Char Length secret :JHDGFDHJF3JHFGDJHFGJHDJ2 - - Worked(OTP code accepted by B2C)
- 26 Char length secret : JHDGFDHJF3JHFGDJHFGJHDJ23J - Not working(Wrong code entered)
- 32 Char Length secret : JHDGFDHJF3JHFGDJHFGJHDJ23JHHGJHD - Worked(OTP code accepted by B2C)