# Integrating NPM package "Authenticator" with postman for MFA

**URL:** <https://community.postman.com/t/integrating-npm-package-authenticator-with-postman-for-mfa/54558>\
**Category:** Help Hub\
**Tags:** authentication\
**Created:** [November 13, 2023, 9:37am UTC](https://community.postman.com/t/integrating-npm-package-authenticator-with-postman-for-mfa/54558 "2023-11-13T09:37:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anil1905](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@anil1905](https://community.postman.com/u/anil1905)\
**Post date:** [November 13, 2023, 9:37am UTC](https://community.postman.com/t/integrating-npm-package-authenticator-with-postman-for-mfa/54558/1 "2023-11-13T09:37:20Z")

</div>

Hi Folks,  
I need to integrate an external npm package “[authenticator - npm](https://www.npmjs.com/package/authenticator)” into Postman for cracking MFA.

Can anyone help me to solve this issue?

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [November 13, 2023, 10:16am UTC](https://community.postman.com/t/integrating-npm-package-authenticator-with-postman-for-mfa/54558/2 "2023-11-13T10:16:37Z")

</div>

You can’t utilise node libraries in Postman web or the desktop client.

You are limited to the libraries\modules built into the sandbox.

You can however use Newman as an node.JS module.

[newman - npm (npmjs.com)](https://www.npmjs.com/package/newman)

Or just turn off MFA on the account you use for testing, which is an common approach for this problem in automation as you aren’t usually testing the MFA element, but the application you hit after this.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [June 11, 2025, 3:10pm UTC](https://community.postman.com/t/integrating-npm-package-authenticator-with-postman-for-mfa/54558/4 "2025-06-11T15:10:50Z")

</div>

Opened on June 11, 2025, 3:10pm UTC



---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [June 11, 2025, 3:13pm UTC](https://community.postman.com/t/integrating-npm-package-authenticator-with-postman-for-mfa/54558/5 "2025-06-11T15:13:17Z")

</div>

Hey @anil1905 👋

I know it’s been a while but I wanted to add this here for anyone else finding this thread.

That package can now be used in the Postman scripts:

```auto
const authenticator = pm.require('npm:authenticator@1.1.5');

var formattedKey = authenticator.generateKey();
// "acqo ua72 d3yf a4e5 uorx ztkh j2xl 3wiz"
 
var formattedToken = authenticator.generateToken(formattedKey);
// "957 124"
 
authenticator.verifyToken(formattedKey, formattedToken);
// { delta: 0 }
 
authenticator.verifyToken(formattedKey, '000 000');
// null
 
authenticator.generateTotpUri(formattedKey, "john.doe@email.com", "ACME Co", 'SHA1', 6, 30);

```

 ![Screenshot 2025-06-11 at 16.10.16](https://us1.discourse-cdn.com/getpostman/original/3X/5/f/5fd6b44de30c36e512598d00e6ecc6f66e6027e5.png)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [June 11, 2025, 3:20pm UTC](https://community.postman.com/t/integrating-npm-package-authenticator-with-postman-for-mfa/54558/6 "2025-06-11T15:20:59Z")

</div>

Closed on June 11, 2025, 3:20pm UTC


