I have a web app that is Angular2 on the front-end and NodeJS on the back-end. I want to allow clients to use Google Authenticator to make their accounts more secure.
How can I implement/use Google Authenticator in my website? I cannot find an API to use or and tutorials to follow or any libraries to use. Where can I find some resources to do this?
You enable 2-step authentication at the website, and then. Indicate you want to use your Google Authenticator app to generate codes. Next, you use the Google Authenticator app on your phone to scan a code displayed by the website on your computer screen, and then. The Authenticator app adds the account.
To log into a site or service that uses two-factor authentication and supports Authenticator, the user provides a username and password to the site. The site then computes (but does not display) the required six-digit one-time password and asks the user to enter it.
Basically, Google Authenticator receives a scanned code from the app that is setting up 2FA, and then it produces a 2FA code to access the app or online account. However, since it only works on Android and iOS devices, it cannot work on desktop PCs directly.
SMS Token. Perhaps the most common method of implementing 2FA. This method sends the user a unique token via SMS text message, normally a 5-10 digit code, after they have successfully entered their username and password. The user then needs to provide this unique token before they are granted access.
The key phrase that you're looking for is "TOTP" (Time-Based One-time Password) - and it is a specification, rather than an API maintained by Google.
At a very high level, your backend will generate a secret that it will share with your users' Google Authenticator app. At login, both the Authenticator app and your backend with use the stored secret and current time to generate a single-use key. If the keys match, it means that the secrets match, and the user may be logged in.
The SpeakEasy node implementation seems to be pretty popular on github.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With