resolve icon indicating copy to clipboard operation
resolve copied to clipboard

Can't use passport-2fa-totp strategy with resolve-module-auth

Open snizzl opened this issue 4 years ago • 0 comments

Describe the bug When using resolve-module-auth with the strategy "passport-2fa-totp", the following error occurs:

TypeError: 2FA TOTP Strategy required TOTP code verification callback
    at new Strategy (/node_modules/passport-2fa-totp/lib/strategy.js:26:15)
    at getBaseStrategyAndOptions (/node_modules/resolve-module-auth/src/execute_strategy.js:22:26)
    at executeStrategy (/node_modules/resolve-module-auth/src/execute_strategy.js:40:45)
    at /node_modules/resolve-module-auth/src/api_handler_constructor.js:12:32
    at mainHandler (/dist/common/local-entry/node_modules/resolve-runtime/lib/common/handlers/main-handler.js:52:1)
    at /dist/common/local-entry/node_modules/resolve-runtime/lib/local/wrap-api-handler.js:227:1
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at /dist/common/local-entry/node_modules/resolve-runtime/lib/local/init-express.js:59:1

It may occur because the passport-2fa-totp strategy does not follow the standards of the other strategies.

To Reproduce Steps to reproduce the behavior:

  1. Clone the personal-data example
  2. Inside auth/create-strategy.js, use passport-2fa-totp instead of passport-local
  3. Start the server
  4. Execute the route /api/login or /api/register
  5. An error will appear

Expected behavior That resolve-module-auth performs two-factor-authentication

Desktop:

  • OS: Ubuntu 20.04
  • Browser: Firefox 85.0.1
  • Node.js: Version v15.9.0
  • ReSolve: Version 0.26.5

snizzl avatar Feb 19 '21 14:02 snizzl