5

I have seen some web applications making use of Google Authenticator(i.e. 6 digit numeric code generator) as a 2nd level security measure(examples: Binance, Kraken etc). I am making an app on google cloud platform, and need that to use Authenticator.

How do I do this?

N/A

This has to be implemented on a nodeJS server

asked Jun 25, 2019 at 7:30
1
  • 1
    There are a couple questions on google authenticator, but they are not what I am looking for. Please dont mark duplicate. Commented Jun 25, 2019 at 7:31

1 Answer 1

4

Update: Even tho this example might still work, it's using library speakeasy which is no longer maintained.

good Example google-authenticator-node-js-web-app

> mkdir back-end
> cd back-end
> npm init -y
> npm install --save express body-parser cors qrcode speakeasy

Now, we have created a directory ‘back-end’ and initialized it as a Node.js project by installing the following dependencies:

express — This is a minimal and flexible web framework for creating API services. body-parser — In order to parse the HTTP method’s body data, this package is being used.

cors — This package is used in order to enable the client side web application to communicate with the API services and to avoid the cross-origin issue.

qrcode — In this application we would be generating the QR-code as a base64 image data, and thus we require qrcode package.

speakeasy — This is the package that enables our application to provide with the secret key and the T-OTP algorithm that the Google Authenticator uses and is also useful for the verification of the Auth code being provided.

We will now create a few API services, with app.js as the main file of execution. For the simplicity of learning process, separation of concerns is followed for the scaffolding of the application.

Jurosh
7,8759 gold badges43 silver badges52 bronze badges
answered Jun 25, 2019 at 7:55
Sign up to request clarification or add additional context in comments.

1 Comment

speakeasy seems to be no longer maintained, is there alternative ?

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.