Skip to content

plambrechtsen/postman-totp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Generating TOTP codes in Postman

I love postman for all sorts of things and have extensively used Postman for generating JWTs, and thought there must be a pure javascript implementation of TOTP for automating the signing to pages that have 2FA as part of a login journey. So I found this page: https://gist.github.com/ptrstpp950/42660823675f6bf2f2d2f1503663553a

And minified it to reduce space.

Download

To download it to global variables:

Tests:

pm.test("Status code is 200", function () {
  pm.response.to.have.status(200);
});

// Set the Global TOTP variable
pm.globals.set("TOTP", responseBody);

Main TOTP Pre-request script.

eval(pm.globals.get("TOTP"));
var totpObj = new TOTP();
var otp = totpObj.getOTP("YOUR_PASSWORD_HERE");
pm.environment.set("OTP", otp);

About

Calculating a TOTP code in Postman

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published