1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

E2Eで2段階認証を突破する

Posted at

結構大変なんだろうなと思いつつやってみたらすごく簡単だった。

totp-generator

2段階認証の設定をした際の秘密鍵を控えておく
totp-generator
こちらのライブラリを使用させていただくだけ。

import getToken from "totp-generator";

function main() {
  if (!process.env.MFA_SECRET_KEY) {
    throw new Error("required set MFA_SECRET_KEY");
  }
  const token = getToken(process.env.MFA_SECRET_KEY);
  console.log(token);
}

これだけで2段階認証用の6桁コードが取れる。
オプションで桁数やアルゴリズムなども変更可能。素晴らしい。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?