resolve
resolve copied to clipboard
Can't use passport-2fa-totp strategy with resolve-module-auth
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:
- Clone the
personal-data
example - Inside
auth/create-strategy.js
, usepassport-2fa-totp
instead ofpassport-local
- Start the server
- Execute the route
/api/login
or/api/register
- 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