How To Validate One Time Password Generated By Microsoft Authenticator App ?

Palacios Cordoba, Cristhian David 0 Reputation points
2023-06-21T14:57:23.39+00:00

Hi,

I want know if exist any form to validated One Time Password Generated by Microsoft Authenticator app with api or another method?

Microsoft Authenticator
Microsoft Authenticator
A Microsoft app for iOS and Android devices that enables authentication with two-factor verification, phone sign-in, and code generation.
7,217 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sedat SALMAN 14,065 Reputation points MVP
    2023-06-24T23:37:09.6266667+00:00

    https://stackoverflow.com/questions/57767763/is-there-still-a-microsoft-authenticator-dev-api-how-can-i-use-it

    you can check the above link also but as a summary

    The Microsoft Authenticator app uses the Time-based One-Time Password (TOTP) mechanism to generate OTPs. This mechanism is a common standard used in many authentication apps.

    To validate a One-Time Password generated by the Microsoft Authenticator app, you need to implement a server-side system that follows the same TOTP mechanism. Here's a general process:

    1. The Microsoft Authenticator app can scan a QR code with an embedded URL following this pattern: otpauth://totp/UserName?secret=Some-long-secret&digits=6&issuer=CompanyName. This URL contains the user's name, the shared secret key, the number of digits in the OTP (usually 6), and the issuer's name.

    Once the Microsoft Authenticator app scans the QR code, it starts generating OTPs based on the embedded details.

    On the server side, you can use a library that implements the TOTP mechanism. This library can generate the shared secret and also validate the OTPs generated by the Microsoft Authenticator app.

    A specific library recommended for this purpose, if you're using Java, is java-totp which is available on GitHub​.

    If you're using a different programming language, you should look for a TOTP library for that language. The main idea is to ensure that your server side and the Microsoft Authenticator app are using the same mechanism (TOTP) and shared secret to generate and validate the OTPs.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.