{"_id":"@dheerajshrivastva-dev/d-auth","_rev":"11-bede88518525494e8411e3ad3f0d5b30","name":"@dheerajshrivastva-dev/d-auth","dist-tags":{"latest":"3.0.0"},"versions":{"0.0.1":{"name":"@dheerajshrivastva-dev/d-auth","version":"0.0.1","keywords":["auth"],"author":{"name":"Dheeraj Kumar Shrivastva"},"license":"ISC","_id":"@dheerajshrivastva-dev/d-auth@0.0.1","maintainers":[{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"}],"homepage":"https://github.com/dheerajshrivastva-dev/d-auth#readme","bugs":{"url":"https://github.com/dheerajshrivastva-dev/d-auth/issues"},"dist":{"shasum":"c5248baf46c872b2e4ec6c97c12b43b1205d20af","tarball":"https://registry.npmjs.org/@dheerajshrivastva-dev/d-auth/-/d-auth-0.0.1.tgz","fileCount":20,"integrity":"sha512-CYYod07yA9Uu2hYo3D0R3Q+2kbntVIeoaLwDGL4VUkX1guJK6Qk7E8iE0ZPkmlm52Uft61ipUUr38qCvP+z7rQ==","signatures":[{"sig":"MEYCIQCuI58zUKYhi2MY7x15MXQnTpi8ifRXydHGaIy5v9ni7QIhALMTdZGaEmk4Lyzh+ChdrWNcVWr8djsx06pLAtp+85/8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":40145},"main":"src/index.cjs.js","types":"src/index.d.ts","gitHead":"c5e00f28d63414759c5a770b4c1886e89d195412","scripts":{"dev":"nodemon ./src/index.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc --project tsconfig.build.json","start":"node ./dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"},"repository":{"url":"git+https://github.com/dheerajshrivastva-dev/d-auth.git","type":"git"},"_npmVersion":"10.8.2","description":"express js middleware for authentication using passportjs","directories":{},"_nodeVersion":"20.17.0","dependencies":{"uuid":"^10.0.0","dotenv":"^16.4.5"},"_hasShrinkwrap":false,"devDependencies":{"rollup":"^2.79.1","nodemon":"^3.1.7","ts-node":"^10.9.2","typescript":"^5.6.2","@types/node":"^22.5.5","@types/uuid":"^10.0.0","@types/express":"^4.17.21","@types/bcryptjs":"^2.4.6","@types/passport":"^1.0.16","@types/nodemailer":"^6.4.16","@rollup/plugin-json":"^6.1.0","@types/jsonwebtoken":"^9.0.7","@types/ua-parser-js":"^0.7.39","@types/cookie-parser":"^1.4.7","rollup-plugin-terser":"^7.0.2","@types/passport-apple":"^2.0.3","@types/passport-local":"^1.0.38","@types/express-session":"^1.18.0","@rollup/plugin-commonjs":"^28.0.0","@types/passport-facebook":"^3.0.3","rollup-plugin-typescript2":"^0.36.0","@rollup/plugin-node-resolve":"^15.3.0","@types/passport-google-oauth20":"^2.0.16","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"express":"^4.21.0","bcryptjs":"^2.4.3","mongoose":"^8.6.3","passport":"^0.7.0","nodemailer":"^6.9.15","jsonwebtoken":"^9.0.2","ua-parser-js":"^1.0.39","cookie-parser":"^1.4.6","passport-apple":"^2.0.2","passport-local":"^1.0.0","express-session":"^1.18.0","passport-facebook":"^3.0.0","express-rate-limit":"^7.4.0","passport-google-oauth20":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/d-auth_0.0.1_1727930750619_0.5032126073033745","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@dheerajshrivastva-dev/d-auth","version":"0.0.2","keywords":["express","authentication","jwt","OAuth","middleware","Google login","email login","refresh tokens","session management"],"author":{"name":"Dheeraj Kumar Shrivastva"},"license":"MIT","_id":"@dheerajshrivastva-dev/d-auth@0.0.2","maintainers":[{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"}],"homepage":"https://github.com/dheerajshrivastva-dev/d-auth#readme","bugs":{"url":"https://github.com/dheerajshrivastva-dev/d-auth/issues"},"dist":{"shasum":"6ab25feb52c193cb71ce15789899bb4739485c38","tarball":"https://registry.npmjs.org/@dheerajshrivastva-dev/d-auth/-/d-auth-0.0.2.tgz","fileCount":22,"integrity":"sha512-b2GwtsdQqJwNKv3D3Aa8esZ5pLTDMTm0nvWD7/vgkVIlEHe+2nmr918ag1YvU+ckiwiBH8uMb4HPlhuL5AcvXQ==","signatures":[{"sig":"MEQCIGj60FdT4cX3NObGJDPd3yIDf+7S1HIy8VxzEIE4smt2AiBGhDvSNJbevzT9+RTJ8FJBCPXNEMRJ5x6osLTPco/uNw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":47875},"main":"src/index.cjs.js","types":"src/index.d.ts","gitHead":"fa50ded9a7817a0721c6b9fbf86917597e7a4f46","scripts":{"dev":"nodemon ./src/app.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc --project tsconfig.build.json","start":"node ./dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"},"repository":{"url":"git+https://github.com/dheerajshrivastva-dev/d-auth.git","type":"git"},"_npmVersion":"10.8.2","description":"express js middleware for authentication using passportjs","directories":{},"_nodeVersion":"20.17.0","dependencies":{"uuid":"^10.0.0","dotenv":"^16.4.5"},"_hasShrinkwrap":false,"devDependencies":{"rollup":"^2.79.1","nodemon":"^3.1.7","ts-node":"^10.9.2","typescript":"^5.6.2","@types/node":"^22.5.5","@types/uuid":"^10.0.0","@types/express":"^4.17.21","@types/bcryptjs":"^2.4.6","@types/passport":"^1.0.16","@types/nodemailer":"^6.4.16","@rollup/plugin-json":"^6.1.0","@types/jsonwebtoken":"^9.0.7","@types/ua-parser-js":"^0.7.39","@types/cookie-parser":"^1.4.7","rollup-plugin-terser":"^7.0.2","@types/passport-apple":"^2.0.3","@types/passport-local":"^1.0.38","@types/express-session":"^1.18.0","@rollup/plugin-commonjs":"^28.0.0","@types/passport-facebook":"^3.0.3","rollup-plugin-typescript2":"^0.36.0","@rollup/plugin-node-resolve":"^15.3.0","@types/passport-google-oauth20":"^2.0.16","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"express":"^4.21.0","bcryptjs":"^2.4.3","mongoose":"^8.6.3","passport":"^0.7.0","nodemailer":"^6.9.15","jsonwebtoken":"^9.0.2","ua-parser-js":"^1.0.39","cookie-parser":"^1.4.6","passport-apple":"^2.0.2","passport-local":"^1.0.0","express-session":"^1.18.0","passport-facebook":"^3.0.0","express-rate-limit":"^7.4.0","passport-google-oauth20":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/d-auth_0.0.2_1727934794340_0.6600593064098752","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"@dheerajshrivastva-dev/d-auth","version":"1.0.0","keywords":["express","authentication","jwt","OAuth","middleware","Google login","email login","refresh tokens","session management"],"author":{"name":"Dheeraj Kumar Shrivastva"},"license":"MIT","_id":"@dheerajshrivastva-dev/d-auth@1.0.0","maintainers":[{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"}],"homepage":"https://github.com/dheerajshrivastva-dev/d-auth#readme","bugs":{"url":"https://github.com/dheerajshrivastva-dev/d-auth/issues"},"dist":{"shasum":"dea9ee861a31caaadbaa892be085ffc220119687","tarball":"https://registry.npmjs.org/@dheerajshrivastva-dev/d-auth/-/d-auth-1.0.0.tgz","fileCount":22,"integrity":"sha512-Z75WDrcpa25+A6t1niT7+GqmYBRkhXu1x//oYKg817PzL1y3WZcpcYCO2KgqWy6ixBv3WFPwhOboVBw162S8CA==","signatures":[{"sig":"MEYCIQDME1w1/QioSTgn2txgNESgmKwyuQZ9oU7F2IPwM+ae2gIhAJlDN3Xpdb7/XRDUWltObfRSVlpGislDbpmNVbKL781u","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":47803},"main":"src/index.cjs.js","types":"src/index.d.ts","gitHead":"a90d05934ac5343e87e0d10aad3bbb6dda071a49","scripts":{"dev":"nodemon ./src/app.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc --project tsconfig.build.json","start":"node ./dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"},"repository":{"url":"git+https://github.com/dheerajshrivastva-dev/d-auth.git","type":"git"},"_npmVersion":"10.8.2","description":"express js middleware for authentication using passportjs","directories":{},"_nodeVersion":"20.17.0","dependencies":{"uuid":"^10.0.0","dotenv":"^16.4.5"},"_hasShrinkwrap":false,"devDependencies":{"rollup":"^2.79.1","nodemon":"^3.1.7","ts-node":"^10.9.2","typescript":"^5.6.2","@types/node":"^22.5.5","@types/uuid":"^10.0.0","@types/express":"^4.17.21","@types/bcryptjs":"^2.4.6","@types/passport":"^1.0.16","@types/nodemailer":"^6.4.16","@rollup/plugin-json":"^6.1.0","@types/jsonwebtoken":"^9.0.7","@types/ua-parser-js":"^0.7.39","@types/cookie-parser":"^1.4.7","rollup-plugin-terser":"^7.0.2","@types/passport-apple":"^2.0.3","@types/passport-local":"^1.0.38","@types/express-session":"^1.18.0","@rollup/plugin-commonjs":"^28.0.0","@types/passport-facebook":"^3.0.3","rollup-plugin-typescript2":"^0.36.0","@rollup/plugin-node-resolve":"^15.3.0","@types/passport-google-oauth20":"^2.0.16","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"express":"^4.21.0","bcryptjs":"^2.4.3","mongoose":"^8.6.3","passport":"^0.7.0","nodemailer":"^6.9.15","jsonwebtoken":"^9.0.2","ua-parser-js":"^1.0.39","cookie-parser":"^1.4.6","passport-apple":"^2.0.2","passport-local":"^1.0.0","express-session":"^1.18.0","passport-facebook":"^3.0.0","express-rate-limit":"^7.4.0","passport-google-oauth20":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/d-auth_1.0.0_1727935035731_0.30942644606712943","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@dheerajshrivastva-dev/d-auth","version":"1.0.1","keywords":["express","authentication","jwt","OAuth","middleware","Google login","email login","refresh tokens","session management"],"author":{"name":"Dheeraj Kumar Shrivastva"},"license":"MIT","_id":"@dheerajshrivastva-dev/d-auth@1.0.1","maintainers":[{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"}],"homepage":"https://github.com/dheerajshrivastva-dev/d-auth#readme","bugs":{"url":"https://github.com/dheerajshrivastva-dev/d-auth/issues"},"dist":{"shasum":"7b3cf04ed6cf636254b45db8009fd6f4ee9c1f98","tarball":"https://registry.npmjs.org/@dheerajshrivastva-dev/d-auth/-/d-auth-1.0.1.tgz","fileCount":21,"integrity":"sha512-Pgz4sM+lpdGRBZbl+1zdg9JGmhUWoYxzfnaUpNdFAoBukCFmPnlUKUDONfR/6jpZNGng9Ti9zTXhAB13/yXMiw==","signatures":[{"sig":"MEQCIHCO6wkjEn1nQ4XJBeSaxNLrzcRXK5uIAp62kaAG/KqdAiAVg4G5eLV8rldJMYenfgfVkZX24aBapJ5DKINUZRY3Ng==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":47007},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.js","gitHead":"a90d05934ac5343e87e0d10aad3bbb6dda071a49","scripts":{"dev":"nodemon ./src/app.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc --project tsconfig.build.json","start":"node ./dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"},"repository":{"url":"git+https://github.com/dheerajshrivastva-dev/d-auth.git","type":"git"},"_npmVersion":"10.8.2","description":"express js middleware for authentication using passportjs","directories":{},"_nodeVersion":"20.17.0","dependencies":{"uuid":"^10.0.0","dotenv":"^16.4.5"},"_hasShrinkwrap":false,"devDependencies":{"rollup":"^2.79.1","nodemon":"^3.1.7","ts-node":"^10.9.2","typescript":"^5.6.2","@types/node":"^22.5.5","@types/uuid":"^10.0.0","@types/express":"^4.17.21","@types/bcryptjs":"^2.4.6","@types/passport":"^1.0.16","@types/nodemailer":"^6.4.16","@rollup/plugin-json":"^6.1.0","@types/jsonwebtoken":"^9.0.7","@types/ua-parser-js":"^0.7.39","@types/cookie-parser":"^1.4.7","rollup-plugin-terser":"^7.0.2","@types/passport-apple":"^2.0.3","@types/passport-local":"^1.0.38","@types/express-session":"^1.18.0","@rollup/plugin-commonjs":"^28.0.0","@types/passport-facebook":"^3.0.3","rollup-plugin-typescript2":"^0.36.0","@rollup/plugin-node-resolve":"^15.3.0","@types/passport-google-oauth20":"^2.0.16","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"express":"^4.21.0","bcryptjs":"^2.4.3","mongoose":"^8.6.3","passport":"^0.7.0","nodemailer":"^6.9.15","jsonwebtoken":"^9.0.2","ua-parser-js":"^1.0.39","cookie-parser":"^1.4.6","passport-apple":"^2.0.2","passport-local":"^1.0.0","express-session":"^1.18.0","passport-facebook":"^3.0.0","express-rate-limit":"^7.4.0","passport-google-oauth20":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/d-auth_1.0.1_1727957181453_0.4453603086440736","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@dheerajshrivastva-dev/d-auth","version":"1.0.2","keywords":["express","authentication","jwt","OAuth","middleware","Google login","email login","refresh tokens","session management"],"author":{"name":"Dheeraj Kumar Shrivastva"},"license":"MIT","_id":"@dheerajshrivastva-dev/d-auth@1.0.2","maintainers":[{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"}],"homepage":"https://github.com/dheerajshrivastva-dev/d-auth#readme","bugs":{"url":"https://github.com/dheerajshrivastva-dev/d-auth/issues"},"dist":{"shasum":"585156ae36d17b1a8f8ef4627d6d5ad652357698","tarball":"https://registry.npmjs.org/@dheerajshrivastva-dev/d-auth/-/d-auth-1.0.2.tgz","fileCount":21,"integrity":"sha512-NA6CQadxOK/8wqj6S6KLJnjYmMTHnjpUAbkUVdX2dkwappkTvdeXlFmDrYZ7r36QS1vNMMjbqH/qQVWlpZnDEQ==","signatures":[{"sig":"MEYCIQD8jkMuXjI9W6DsUdLfsbTHmWqW+0GBwhGEoCTTHkm9+wIhAKoEZT25otzfuU9BUrD/SRBSWsgcuydBaptczkC6DtQo","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":47543},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.js","gitHead":"03cb15bf6d1b94d72177802d2446751937262b51","scripts":{"dev":"nodemon ./src/app.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc --project tsconfig.build.json","start":"node ./dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"},"repository":{"url":"git+https://github.com/dheerajshrivastva-dev/d-auth.git","type":"git"},"_npmVersion":"10.8.2","description":"express js middleware for authentication using passportjs","directories":{},"_nodeVersion":"20.17.0","dependencies":{"uuid":"^10.0.0","dotenv":"^16.4.5"},"_hasShrinkwrap":false,"devDependencies":{"rollup":"^2.79.1","nodemon":"^3.1.7","ts-node":"^10.9.2","typescript":"^5.6.2","@types/node":"^22.5.5","@types/uuid":"^10.0.0","@types/express":"^4.17.21","@types/bcryptjs":"^2.4.6","@types/passport":"^1.0.16","@types/nodemailer":"^6.4.16","@rollup/plugin-json":"^6.1.0","@types/jsonwebtoken":"^9.0.7","@types/ua-parser-js":"^0.7.39","@types/cookie-parser":"^1.4.7","rollup-plugin-terser":"^7.0.2","@types/passport-apple":"^2.0.3","@types/passport-local":"^1.0.38","@types/express-session":"^1.18.0","@rollup/plugin-commonjs":"^28.0.0","@types/passport-facebook":"^3.0.3","rollup-plugin-typescript2":"^0.36.0","@rollup/plugin-node-resolve":"^15.3.0","@types/passport-google-oauth20":"^2.0.16","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"express":"^4.21.0","bcryptjs":"^2.4.3","mongoose":"^8.6.3","passport":"^0.7.0","nodemailer":"^6.9.15","jsonwebtoken":"^9.0.2","ua-parser-js":"^1.0.39","cookie-parser":"^1.4.6","passport-apple":"^2.0.2","passport-local":"^1.0.0","express-session":"^1.18.0","passport-facebook":"^3.0.0","express-rate-limit":"^7.4.0","passport-google-oauth20":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/d-auth_1.0.2_1728148465004_0.21728890083767505","host":"s3://npm-registry-packages"}},"1.0.3":{"name":"@dheerajshrivastva-dev/d-auth","version":"1.0.3","keywords":["express","authentication","jwt","OAuth","middleware","Google login","email login","refresh tokens","session management"],"author":{"name":"Dheeraj Kumar Shrivastva"},"license":"MIT","_id":"@dheerajshrivastva-dev/d-auth@1.0.3","maintainers":[{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"}],"homepage":"https://github.com/dheerajshrivastva-dev/d-auth#readme","bugs":{"url":"https://github.com/dheerajshrivastva-dev/d-auth/issues"},"dist":{"shasum":"4199bb09518af5d996254dfcc7452a70aac902ef","tarball":"https://registry.npmjs.org/@dheerajshrivastva-dev/d-auth/-/d-auth-1.0.3.tgz","fileCount":23,"integrity":"sha512-OiMHlJqVUZCTL6BITqIfiYTIcbZcn+oBrDNXy3O4cJrCvbgATHJyJaEFQU5stUyvp18bQVvydwQrYabOIvmfGQ==","signatures":[{"sig":"MEUCICJD/U1WoHjtShkU4WGa+tsB+KEWwGrAsmhVn0NA3rdIAiEAnUrozMnEX7hITZeD5uVUBiWGSWDUU4rOYzw7/5s0fhE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":48432},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.js","gitHead":"263c4fa0d5a62851d16807baa847c6261bf1b846","scripts":{"dev":"nodemon ./src/app.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc --project tsconfig.build.json","start":"node ./dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"},"repository":{"url":"git+https://github.com/dheerajshrivastva-dev/d-auth.git","type":"git"},"_npmVersion":"10.8.2","description":"express js middleware for authentication using passportjs","directories":{},"_nodeVersion":"20.17.0","dependencies":{"cors":"^2.8.5","uuid":"^10.0.0","dotenv":"^16.4.5"},"_hasShrinkwrap":false,"devDependencies":{"rollup":"^2.79.1","nodemon":"^3.1.7","ts-node":"^10.9.2","typescript":"^5.6.2","@types/cors":"^2.8.17","@types/node":"^22.5.5","@types/uuid":"^10.0.0","@types/express":"^4.17.21","@types/bcryptjs":"^2.4.6","@types/passport":"^1.0.16","@types/nodemailer":"^6.4.16","@rollup/plugin-json":"^6.1.0","@types/jsonwebtoken":"^9.0.7","@types/ua-parser-js":"^0.7.39","@types/cookie-parser":"^1.4.7","rollup-plugin-terser":"^7.0.2","@types/passport-apple":"^2.0.3","@types/passport-local":"^1.0.38","@types/express-session":"^1.18.0","@rollup/plugin-commonjs":"^28.0.0","@types/passport-facebook":"^3.0.3","rollup-plugin-typescript2":"^0.36.0","@rollup/plugin-node-resolve":"^15.3.0","@types/passport-google-oauth20":"^2.0.16","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"express":"^4.21.0","bcryptjs":"^2.4.3","mongoose":"^8.6.3","passport":"^0.7.0","nodemailer":"^6.9.15","jsonwebtoken":"^9.0.2","ua-parser-js":"^1.0.39","cookie-parser":"^1.4.6","passport-apple":"^2.0.2","passport-local":"^1.0.0","express-session":"^1.18.0","passport-facebook":"^3.0.0","express-rate-limit":"^7.4.0","passport-google-oauth20":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/d-auth_1.0.3_1728591259765_0.6076977367109047","host":"s3://npm-registry-packages"}},"1.0.4":{"name":"@dheerajshrivastva-dev/d-auth","version":"1.0.4","keywords":["express","authentication","jwt","OAuth","middleware","Google login","email login","refresh tokens","session management"],"author":{"name":"Dheeraj Kumar Shrivastva"},"license":"MIT","_id":"@dheerajshrivastva-dev/d-auth@1.0.4","maintainers":[{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"}],"homepage":"https://github.com/dheerajshrivastva-dev/d-auth#readme","bugs":{"url":"https://github.com/dheerajshrivastva-dev/d-auth/issues"},"dist":{"shasum":"406d64248ec523cf04e69c1fca96e4f00ca07d0f","tarball":"https://registry.npmjs.org/@dheerajshrivastva-dev/d-auth/-/d-auth-1.0.4.tgz","fileCount":49,"integrity":"sha512-LJ/v5jJnaoxk03EpLamWjlXG605QvS/UIPnU4BwIbogVL2JlkzmzEYqu058YFyCUWFyECL97kDL/e9j8koM/7g==","signatures":[{"sig":"MEYCIQD1yO7e0F5jNgx6ZNLJoUVgEZRdxtalJCRN6OBCoSISkQIhAMDHEdM6DPD41JBekNikC5bc/9GfijE1GwUMRFmpEkuf","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":104083},"main":"src/app.js","gitHead":"b5068edce2dff6a7c44d340116574fbce3917289","scripts":{"dev":"nodemon ./src/app.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc --project tsconfig.build.json","start":"node ./dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"},"repository":{"url":"git+https://github.com/dheerajshrivastva-dev/d-auth.git","type":"git"},"_npmVersion":"10.8.2","description":"express js middleware for authentication using passportjs","directories":{},"_nodeVersion":"20.17.0","dependencies":{"cors":"^2.8.5","uuid":"^10.0.0","dotenv":"^16.4.5","winston":"^3.17.0","express-validation":"^4.1.1"},"_hasShrinkwrap":false,"devDependencies":{"nodemon":"^3.1.7","ts-node":"^10.9.2","typescript":"^5.6.2","@types/cors":"^2.8.17","@types/node":"^22.5.5","@types/uuid":"^10.0.0","@types/express":"^4.17.21","@types/bcryptjs":"^2.4.6","@types/passport":"^1.0.16","@types/nodemailer":"^6.4.16","@types/jsonwebtoken":"^9.0.7","@types/ua-parser-js":"^0.7.39","@types/cookie-parser":"^1.4.7","@types/passport-apple":"^2.0.3","@types/passport-local":"^1.0.38","@types/express-session":"^1.18.0","@types/passport-facebook":"^3.0.3","@types/passport-google-oauth20":"^2.0.16"},"peerDependencies":{"express":"^4.21.0","bcryptjs":"^2.4.3","mongoose":"^8.6.3","passport":"^0.7.0","nodemailer":"^6.9.15","jsonwebtoken":"^9.0.2","ua-parser-js":"^1.0.39","cookie-parser":"^1.4.6","passport-apple":"^2.0.2","passport-local":"^1.0.0","express-session":"^1.18.0","passport-facebook":"^3.0.0","express-rate-limit":"^7.4.0","passport-google-oauth20":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/d-auth_1.0.4_1734894560978_0.5095187254328826","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@dheerajshrivastva-dev/d-auth","version":"2.0.0","keywords":["express","authentication","jwt","OAuth","middleware","Google login","email login","refresh tokens","session management"],"author":{"name":"Dheeraj Kumar Shrivastva"},"license":"MIT","_id":"@dheerajshrivastva-dev/d-auth@2.0.0","maintainers":[{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"}],"homepage":"https://github.com/dheerajshrivastva-dev/d-auth#readme","bugs":{"url":"https://github.com/dheerajshrivastva-dev/d-auth/issues"},"dist":{"shasum":"489de0122e1a8f5e03f973d22aebfb9bcec27a5b","tarball":"https://registry.npmjs.org/@dheerajshrivastva-dev/d-auth/-/d-auth-2.0.0.tgz","fileCount":51,"integrity":"sha512-aaW2vd2xieFhejjhOEmOOysjfM/anrCZNy2yjHxc/WiBZhjd5rKaKTntcVEm+LE3iuz6vZ/OGF/exB2miTLUWQ==","signatures":[{"sig":"MEUCIEqFs7Uz6GjHG9QaUgZ83WEAbhQ1xkCaF7gyyrVahdWFAiEAsTCYTj1G2yL21wFkMyWxDnER8Lg9KZNr35ocHFRxlJM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":122055},"main":"src/app.js","gitHead":"bf9393d93c9f8316cf781adc2bfcf9c1811ba58f","scripts":{"dev":"nodemon ./src/app.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc --project tsconfig.build.json","start":"node ./dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"},"repository":{"url":"git+https://github.com/dheerajshrivastva-dev/d-auth.git","type":"git"},"_npmVersion":"10.8.2","description":"express js middleware for authentication using passportjs","directories":{},"_nodeVersion":"20.17.0","dependencies":{"cors":"^2.8.5","uuid":"^10.0.0","dotenv":"^16.4.5","winston":"^3.17.0","connect-mongo":"^5.1.0","express-validation":"^4.1.1"},"_hasShrinkwrap":false,"devDependencies":{"nodemon":"^3.1.7","ts-node":"^10.9.2","typescript":"^5.6.2","@types/cors":"^2.8.17","@types/node":"^22.5.5","@types/uuid":"^10.0.0","@types/express":"^4.17.21","@types/bcryptjs":"^2.4.6","@types/passport":"^1.0.16","@types/nodemailer":"^6.4.16","@types/jsonwebtoken":"^9.0.7","@types/ua-parser-js":"^0.7.39","@types/cookie-parser":"^1.4.7","@types/passport-apple":"^2.0.3","@types/passport-local":"^1.0.38","@types/express-session":"^1.18.0","@types/passport-facebook":"^3.0.3","@types/passport-google-oauth20":"^2.0.16"},"peerDependencies":{"express":"^4.21.0","bcryptjs":"^2.4.3","mongoose":"^8.6.3","passport":"^0.7.0","nodemailer":"^6.9.15","jsonwebtoken":"^9.0.2","ua-parser-js":"^1.0.39","cookie-parser":"^1.4.6","passport-apple":"^2.0.2","passport-local":"^1.0.0","express-session":"^1.18.0","passport-facebook":"^3.0.0","express-rate-limit":"^7.4.0","passport-google-oauth20":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/d-auth_2.0.0_1735401074481_0.12926485011148836","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@dheerajshrivastva-dev/d-auth","version":"2.0.1","keywords":["express","authentication","jwt","OAuth","middleware","Google login","email login","refresh tokens","session management"],"author":{"name":"Dheeraj Kumar Shrivastva"},"license":"MIT","_id":"@dheerajshrivastva-dev/d-auth@2.0.1","maintainers":[{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"}],"homepage":"https://github.com/dheerajshrivastva-dev/d-auth#readme","bugs":{"url":"https://github.com/dheerajshrivastva-dev/d-auth/issues"},"dist":{"shasum":"b3448844e8d1b7b6d137cb4151e2e60f01eaf07e","tarball":"https://registry.npmjs.org/@dheerajshrivastva-dev/d-auth/-/d-auth-2.0.1.tgz","fileCount":51,"integrity":"sha512-elsN1HGWhQ9Rowfk6KWQQoOnLMHsxcxc54N4B4sA2MEYY0bemFCeYzSbud7lmEIrcpUaz3AownhwKhpPzjZBUg==","signatures":[{"sig":"MEUCIGsw3at7aPoILQm1MqonLjPNLGyOxwi8pTdB/85c5hY9AiEAn2NBhqoj/FBY5a4rPGYF4Qe+6lHShHBkpqnzR1sbWb0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":122357},"main":"src/app.js","gitHead":"8eb05d3a446f1bded3cf3b37492aaad85d4f735d","scripts":{"dev":"nodemon ./src/app.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc --project tsconfig.build.json","start":"node ./dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"},"repository":{"url":"git+https://github.com/dheerajshrivastva-dev/d-auth.git","type":"git"},"_npmVersion":"10.8.2","description":"express js middleware for authentication using passportjs","directories":{},"_nodeVersion":"20.17.0","dependencies":{"cors":"^2.8.5","uuid":"^10.0.0","dotenv":"^16.4.5","winston":"^3.17.0","connect-mongo":"^5.1.0","express-validation":"^4.1.1"},"_hasShrinkwrap":false,"devDependencies":{"nodemon":"^3.1.7","ts-node":"^10.9.2","typescript":"^5.6.2","@types/cors":"^2.8.17","@types/node":"^22.5.5","@types/uuid":"^10.0.0","@types/express":"^4.17.21","@types/bcryptjs":"^2.4.6","@types/passport":"^1.0.16","@types/nodemailer":"^6.4.16","@types/jsonwebtoken":"^9.0.7","@types/ua-parser-js":"^0.7.39","@types/cookie-parser":"^1.4.7","@types/passport-apple":"^2.0.3","@types/passport-local":"^1.0.38","@types/express-session":"^1.18.0","@types/passport-facebook":"^3.0.3","@types/passport-google-oauth20":"^2.0.16"},"peerDependencies":{"express":"^4.21.0","bcryptjs":"^2.4.3","mongoose":"^8.6.3","passport":"^0.7.0","nodemailer":"^6.9.15","jsonwebtoken":"^9.0.2","ua-parser-js":"^1.0.39","cookie-parser":"^1.4.6","passport-apple":"^2.0.2","passport-local":"^1.0.0","express-session":"^1.18.0","passport-facebook":"^3.0.0","express-rate-limit":"^7.4.0","passport-google-oauth20":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/d-auth_2.0.1_1739614185712_0.6059669396099352","host":"s3://npm-registry-packages-npm-production"}},"2.0.2":{"name":"@dheerajshrivastva-dev/d-auth","version":"2.0.2","keywords":["express","authentication","jwt","OAuth","middleware","Google login","email login","refresh tokens","session management"],"author":{"name":"Dheeraj Kumar Shrivastva"},"license":"MIT","_id":"@dheerajshrivastva-dev/d-auth@2.0.2","maintainers":[{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"}],"homepage":"https://github.com/dheerajshrivastva-dev/d-auth#readme","bugs":{"url":"https://github.com/dheerajshrivastva-dev/d-auth/issues"},"dist":{"shasum":"47874cb3753a3da2cc7cac2f53051fb0d41cabbb","tarball":"https://registry.npmjs.org/@dheerajshrivastva-dev/d-auth/-/d-auth-2.0.2.tgz","fileCount":51,"integrity":"sha512-WBmxvjcSgR5pDBbHO0nE5DRJryR/pSeE8FNawDU6ctebK42Adkep0DK1BWEVgn/4r6/c6gUQge8CEbUVmR7vXw==","signatures":[{"sig":"MEUCIDtpt5gzQZHJYAdvD9Jx8mDgZDt+KXqCPverWMw1AH9zAiEAg520GR8pxw/L1KrIzU3R7Dr9fprrTATXIyIBA0e11zA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":122501},"main":"src/app.js","gitHead":"b9ad653ad1633363104e4cd1ec5e3d620ed2b26e","scripts":{"dev":"nodemon ./src/app.ts","test":"echo \"Error: no test specified\" && exit 1","build":"tsc --project tsconfig.build.json","start":"node ./dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"},"repository":{"url":"git+https://github.com/dheerajshrivastva-dev/d-auth.git","type":"git"},"_npmVersion":"10.8.2","description":"express js middleware for authentication using passportjs","directories":{},"_nodeVersion":"20.17.0","dependencies":{"cors":"^2.8.5","uuid":"^10.0.0","dotenv":"^16.4.5","winston":"^3.17.0","connect-mongo":"^5.1.0","express-validation":"^4.1.1"},"_hasShrinkwrap":false,"devDependencies":{"nodemon":"^3.1.7","ts-node":"^10.9.2","typescript":"^5.6.2","@types/cors":"^2.8.17","@types/node":"^22.5.5","@types/uuid":"^10.0.0","@types/express":"^4.17.21","@types/bcryptjs":"^2.4.6","@types/passport":"^1.0.16","@types/nodemailer":"^6.4.16","@types/jsonwebtoken":"^9.0.7","@types/ua-parser-js":"^0.7.39","@types/cookie-parser":"^1.4.7","@types/passport-apple":"^2.0.3","@types/passport-local":"^1.0.38","@types/express-session":"^1.18.0","@types/passport-facebook":"^3.0.3","@types/passport-google-oauth20":"^2.0.16"},"peerDependencies":{"express":"^4.21.0","bcryptjs":"^2.4.3","mongoose":"^8.6.3","passport":"^0.7.0","nodemailer":"^6.9.15","jsonwebtoken":"^9.0.2","ua-parser-js":"^1.0.39","cookie-parser":"^1.4.6","passport-apple":"^2.0.2","passport-local":"^1.0.0","express-session":"^1.18.0","passport-facebook":"^3.0.0","express-rate-limit":"^7.4.0","passport-google-oauth20":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/d-auth_2.0.2_1755460056655_0.1121010311594417","host":"s3://npm-registry-packages-npm-production"}},"3.0.0":{"name":"@dheerajshrivastva-dev/d-auth","version":"3.0.0","description":"express js middleware for authentication using passportjs","main":"src/app.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsup","prepublishOnly":"npm run build","start":"node ./dist/index.js","dev":"nodemon ./src/app.ts"},"repository":{"type":"git","url":"git+https://github.com/dheerajshrivastva-dev/d-auth.git"},"keywords":["express","authentication","jwt","OAuth","middleware","Google login","email login","refresh tokens","session management"],"author":{"name":"Dheeraj Kumar Shrivastva"},"license":"MIT","bugs":{"url":"https://github.com/dheerajshrivastva-dev/d-auth/issues"},"homepage":"https://github.com/dheerajshrivastva-dev/d-auth#readme","dependencies":{"connect-mongo":"^5.1.0","cors":"^2.8.5","dotenv":"^16.4.5","express-validation":"^4.1.1","uuid":"^10.0.0","winston":"^3.17.0"},"peerDependencies":{"bcryptjs":"^2.4.3","cookie-parser":"^1.4.6","express":"^4.21.0","express-rate-limit":"^7.4.0","express-session":"^1.18.0","jsonwebtoken":"^9.0.2","mongoose":"^8.6.3","nodemailer":"^6.9.15","passport":"^0.7.0","passport-apple":"^2.0.2","passport-facebook":"^3.0.0","passport-google-oauth20":"^2.0.0","passport-local":"^1.0.0","ua-parser-js":"^1.0.39"},"devDependencies":{"@types/bcryptjs":"^2.4.6","@types/cookie-parser":"^1.4.7","@types/cors":"^2.8.17","@types/express":"^4.17.21","@types/express-session":"^1.18.0","@types/jsonwebtoken":"^9.0.7","@types/node":"^22.5.5","@types/nodemailer":"^6.4.16","@types/passport":"^1.0.16","@types/passport-apple":"^2.0.3","@types/passport-facebook":"^3.0.3","@types/passport-google-oauth20":"^2.0.16","@types/passport-local":"^1.0.38","@types/ua-parser-js":"^0.7.39","@types/uuid":"^10.0.0","nodemon":"^3.1.7","ts-node":"^10.9.2","tsup":"^8.5.0","typescript":"^5.6.2"},"_id":"@dheerajshrivastva-dev/d-auth@3.0.0","gitHead":"d0222e752f9ad36f57d01e3e36a7416b59d81b89","_nodeVersion":"20.17.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-Vrl5MDeCAwUEBJG6tgp7QhfEMWKXB+7hIJlOvhnUAUBL5gcLUeOjgEF7zvR31X2qlBzTT29WFlqHFYixBLQj3Q==","shasum":"cfea5e2071753311a014f12f0be1856df171b179","tarball":"https://registry.npmjs.org/@dheerajshrivastva-dev/d-auth/-/d-auth-3.0.0.tgz","fileCount":7,"unpackedSize":140642,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDuHAqrF8jvnFxfrUYmCar978Z999cLZpw30q6eJbI3hgIhAJpHDZdm4hGREXR9MApXui0w5PCkKRN/GFPFXPbE6EIA"}]},"_npmUser":{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"},"directories":{},"maintainers":[{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/d-auth_3.0.0_1760840030342_0.9528890686923956"},"_hasShrinkwrap":false}},"time":{"created":"2024-10-03T04:45:50.532Z","modified":"2025-10-19T02:13:50.770Z","0.0.1":"2024-10-03T04:45:50.829Z","0.0.2":"2024-10-03T05:53:14.552Z","1.0.0":"2024-10-03T05:57:15.978Z","1.0.1":"2024-10-03T12:06:21.658Z","1.0.2":"2024-10-05T17:14:25.222Z","1.0.3":"2024-10-10T20:14:20.010Z","1.0.4":"2024-12-22T19:09:21.134Z","2.0.0":"2024-12-28T15:51:14.651Z","2.0.1":"2025-02-15T10:09:45.868Z","2.0.2":"2025-08-17T19:47:36.848Z","3.0.0":"2025-10-19T02:13:50.555Z"},"bugs":{"url":"https://github.com/dheerajshrivastva-dev/d-auth/issues"},"author":{"name":"Dheeraj Kumar Shrivastva"},"license":"MIT","homepage":"https://github.com/dheerajshrivastva-dev/d-auth#readme","keywords":["express","authentication","jwt","OAuth","middleware","Google login","email login","refresh tokens","session management"],"repository":{"type":"git","url":"git+https://github.com/dheerajshrivastva-dev/d-auth.git"},"description":"express js middleware for authentication using passportjs","maintainers":[{"name":"dheerajshrivastva-dev","email":"mailtodheeraj2@gmail.com"}],"readme":"# <img width=\"100\" alt=\"dauthlogo\" src=\"https://github.com/user-attachments/assets/ce5e8bfd-2e76-4048-ae7c-b0bd9cfd0203\" /> D-Auth\n\n**An all-in-one authentication middleware for Express.js with Role-Based Access Control (RBAC)**\n\n[![npm version](https://img.shields.io/npm/v/@dheerajshrivastva-dev/d-auth.svg)](https://www.npmjs.com/package/@dheerajshrivastva-dev/d-auth)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nD-Auth is a complete authentication solution providing cookie-session based authentication, OAuth (Google/Facebook), role-based access control with hierarchy, session management, rate limiting, and more.\n\n---\n\n## ✨ Features\n\n- 🔐 **Cookie-Session Authentication**: Secure session-based authentication with MongoDB\n- 🌐 **OAuth Integration**: Google and Facebook OAuth support\n- 👥 **Role-Based Access Control (RBAC)**: Hierarchical role system with 7 built-in roles\n- 🛡️ **Route Protection**: Simple middleware to guard routes by role\n- 📧 **Email Verification**: Built-in email verification with customizable templates\n- 🔑 **Password Reset**: Secure OTP-based password recovery via email\n- 🚦 **Rate Limiting**: Protect against brute-force attacks\n- 🍪 **Session Management**: Secure session storage with MongoDB\n- 📊 **User Management**: Built-in CRUD operations for user administration\n- 🌐 **Multi-Frontend Support**: Dynamic OAuth redirects for multiple frontends\n- ⚡ **Easy Integration**: Plug-and-play setup with Express.js\n\n**Note:** JWT-based authentication is not supported in v3.0 but is planned for v4.0.\n\n---\n\n## 📦 Installation\n\n```bash\nnpm install @dheerajshrivastva-dev/d-auth\n```\n\n**Requirements:**\n- Node.js 14+\n- MongoDB (for session and user storage)\n- Express.js\n\n---\n\n## 🚀 Quick Start\n\n### 1. Setup Environment Variables\n\nCreate a `.env` file:\n\n```env\n# MongoDB\nMONGO_URI=mongodb://localhost:27017/your-database\n\n# Session Secret\nSESSION_SECRET=your-super-secret-session-key\n\n# CORS\nCORS_ORIGIN=http://localhost:3000\n\n# Email (for verification and password reset)\nEMAIL_USERNAME=your-email@gmail.com\nEMAIL_PASSWORD=your-app-password\n\n# OAuth (Optional)\nGOOGLE_CLIENT_ID=your-google-client-id\nGOOGLE_CLIENT_SECRET=your-google-client-secret\n\nFACEBOOK_APP_ID=your-facebook-app-id\nFACEBOOK_APP_SECRET=your-facebook-app-secret\n\n# OAuth Dynamic Redirects (Optional)\nALLOWED_REDIRECT_URLS=http://localhost:3000,https://yourdomain.com\nSOCIAL_LOGIN_SUCCESS_URL=http://localhost:3000/dashboard\nSOCIAL_LOGIN_FAILURE_URL=http://localhost:3000/login\n```\n\n### 2. Basic Server Setup\n\n```typescript\nimport express, { Express, Request, Response } from \"express\";\nimport {\n  AuthenticatedRequest,\n  dAuthMiddleware,\n  requireRoles\n} from \"@dheerajshrivastva-dev/d-auth\";\nimport { UserRole } from \"@dheerajshrivastva-dev/d-auth\";\nimport dotenv from \"dotenv\";\n\ndotenv.config();\n\nconst app: Express = express();\nconst port = process.env.PORT || 3000;\n\n// Initialize D-Auth middleware\ndAuthMiddleware({\n  // Required: MongoDB connection\n  mongoDbUri: process.env.MONGO_URI!,\n  sessionSecret: process.env.SESSION_SECRET!,\n  authRouteinitials: \"/auth\", // Auth routes at /auth/*\n\n  // Required: Email configuration for password reset\n  nodeMailerConfig: {\n    service: 'gmail',\n    host: 'smtp.gmail.com',\n    port: 587,\n    secure: true,\n    auth: {\n      user: process.env.EMAIL_USERNAME!,\n      pass: process.env.EMAIL_PASSWORD!,\n    }\n  },\n\n  // Required: Company details for emails\n  companyDetails: {\n    name: \"Your Company\",\n    website: \"https://yourcompany.com\",\n    contact: \"support@yourcompany.com\",\n    privacyPolicy: \"https://yourcompany.com/privacy\",\n    termsOfService: \"https://yourcompany.com/terms\",\n    support: \"https://yourcompany.com/support\",\n    address: \"123 Main Street\"\n  },\n\n  // Optional: OAuth configuration\n  enableGoogleLogin: true,\n  googleLoginDetails: {\n    googleClientId: process.env.GOOGLE_CLIENT_ID!,\n    googleClientSecret: process.env.GOOGLE_CLIENT_SECRET!,\n  },\n\n  enableFacebookLogin: false, // Set to true if using Facebook\n\n  // Optional: CORS configuration\n  corsOptions: {\n    origin: process.env.CORS_ORIGIN || 'http://localhost:3000',\n  },\n\n  // Optional: Session options\n  sessionOptions: {\n    name: \"dauth-session\",\n    secret: process.env.SESSION_SECRET!,\n    resave: false,\n    saveUninitialized: false,\n    cookie: {\n      httpOnly: true,\n      secure: false, // Set true in production (HTTPS)\n      sameSite: \"lax\",\n      path: \"/\",\n      maxAge: 7 * 24 * 60 * 60 * 1000, // 7 days\n    },\n  },\n\n  // Optional: Custom role hierarchy\n  // roleHierarchy: {\n  //   [UserRole.ADMIN]: 100,\n  //   [UserRole.MANAGER]: 50,\n  //   [UserRole.EMPLOYEE]: 20,\n  //   [UserRole.USER]: 0\n  // }\n})(app);\n\n// Public route - no authentication\napp.get(\"/\", (req: Request, res: Response) => {\n  res.send(\"Welcome to D-Auth!\");\n});\n\n// Protected route - requires USER role (any authenticated user)\napp.get('/profile', requireRoles([UserRole.USER]), (req: AuthenticatedRequest, res: Response) => {\n  res.send(`Welcome ${req.user.email}`);\n});\n\n// Admin route - requires ADMIN role\napp.get('/admin/dashboard', requireRoles([UserRole.ADMIN]), (req: AuthenticatedRequest, res: Response) => {\n  res.send(`Admin Dashboard - ${req.user.email}`);\n});\n\napp.listen(port, () => {\n  console.log(`Server running at http://localhost:${port}`);\n});\n```\n---\n\n## 🔐 Authentication Routes\n\nD-Auth automatically creates these routes at your configured prefix (default `/auth`):\n\n| Route | Method | Description |\n|-------|--------|-------------|\n| `/auth/register` | POST | Register new user with email/password |\n| `/auth/login` | POST | Login with email/password |\n| `/auth/logout` | POST | Logout current user |\n| `/auth/refresh-token` | POST | Refresh authentication session |\n| `/auth/forgot-password` | POST | Request password reset OTP |\n| `/auth/reset-password` | POST | Reset password with OTP |\n| `/auth/reset-password/new-otp` | POST | Resend OTP |\n| `/auth/google` | GET | Initiate Google OAuth |\n| `/auth/google/callback` | GET | Google OAuth callback |\n| `/auth/facebook` | GET | Initiate Facebook OAuth |\n| `/auth/facebook/callback` | GET | Facebook OAuth callback |\n\n### Example: Register\n\n```bash\ncurl -X POST http://localhost:3000/auth/register \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"email\": \"user@example.com\",\n    \"password\": \"SecurePass123!\",\n    \"firstName\": \"John\",\n    \"lastName\": \"Doe\"\n  }'\n```\n\n### Example: Login\n\n```bash\ncurl -X POST http://localhost:3000/auth/login \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"email\": \"user@example.com\",\n    \"password\": \"SecurePass123!\"\n  }'\n```\n\nResponse sets HTTP-only session cookie for subsequent authenticated requests.\n\n---\n\n## 👥 Role-Based Access Control (RBAC)\n\n### Built-in Role Hierarchy\n\nD-Auth includes automatic role hierarchy where higher roles can access lower role routes:\n\n```\nADMIN (100)           ← Full access\n  └─ MODERATOR (80)\n      └─ MANAGER (60)\n          └─ SUPERVISOR (40)\n              └─ EMPLOYEE (20)\n                  └─ STAFF (10)\n                      └─ USER (0) ← Base level\n```\n\n###  Protecting Routes\n\n**Recommended: Router-Level Protection**\n\n```typescript\nimport { requireRoles, UserRole } from '@dheerajshrivastva-dev/d-auth';\n\n// Admin router - all routes require admin\nconst adminRouter = express.Router();\nadminRouter.get('/users', (req, res) => { /* ... */ });\nadminRouter.delete('/user/:id', (req, res) => { /* ... */ });\napp.use('/api/admin', requireRoles([UserRole.ADMIN]), adminRouter);\n\n// User router - all routes require authenticated user\nconst userRouter = express.Router();\nuserRouter.get('/profile', (req, res) => { /* ... */ });\napp.use('/api/user', requireRoles([UserRole.USER]), userRouter);\n\n// Public router - no authentication required\nconst publicRouter = express.Router();\npublicRouter.get('/info', (req, res) => { /* ... */ });\napp.use('/api/public', requireRoles([]), publicRouter);\n```\n\n**Single Route Protection**\n\n```typescript\n// Single role - user needs this role or higher\napp.get('/employee/dashboard',\n  requireRoles([UserRole.EMPLOYEE]),\n  (req, res) => { /* ... */ }\n);\n\n// Multiple role options (user needs ANY of these roles or higher)\napp.get('/schedule',\n  requireRoles([UserRole.STAFF, UserRole.EMPLOYEE]),\n  (req, res) => { /* ... */ }\n);\n\n// Public route - no authentication required\napp.get('/public/data',\n  requireRoles([]),\n  (req, res) => { /* ... */ }\n);\n```\n\n### Available Roles\n\n```typescript\nimport { UserRole } from '@dheerajshrivastva-dev/d-auth';\n\nUserRole.ADMIN       // Level 100\nUserRole.MODERATOR   // Level 80\nUserRole.MANAGER     // Level 60\nUserRole.SUPERVISOR  // Level 40\nUserRole.EMPLOYEE    // Level 20\nUserRole.STAFF       // Level 10\nUserRole.USER        // Level 0 (base)\n```\n\n### Managing User Roles\n\n```typescript\nimport { User, UserRole } from '@dheerajshrivastva-dev/d-auth';\n\n// Default role on registration\nconst user = new User({\n  email: 'user@example.com',\n  password: hashedPassword,\n  roles: [UserRole.USER] // Default\n});\n\n// Promote to employee\nuser.roles.push(UserRole.EMPLOYEE);\nawait user.save();\n\n// Make admin\nuser.roles = [UserRole.ADMIN];\nawait user.save();\n\n// Check role\nif (user.hasRole(UserRole.ADMIN)) {\n  // Admin logic\n}\n```\n\n---\n\n## 🌐 OAuth with Dynamic Redirects\n\nSupport multiple frontends (dev, staging, prod) with a single backend.\n\n### Frontend Usage\n\n```typescript\n// Your frontend\nconst handleGoogleLogin = () => {\n  const redirectUrl = `${window.location.origin}/dashboard`;\n  window.location.href = `https://api.myapp.com/auth/google?redirectUrl=${encodeURIComponent(redirectUrl)}`;\n};\n```\n\n### Configuration\n\n```env\n# Whitelist (comma-separated)\nALLOWED_REDIRECT_URLS=http://localhost:3000,https://staging.myapp.com,https://myapp.com\n\n# Fallback URLs\nSOCIAL_LOGIN_SUCCESS_URL=https://myapp.com/dashboard\nSOCIAL_LOGIN_FAILURE_URL=https://myapp.com/login\n```\n\n### How It Works\n\n1. Frontend calls `/auth/google?redirectUrl=http://localhost:3000/dashboard`\n2. Backend validates against whitelist\n3. Stores in OAuth `state` parameter\n4. After auth, redirects to specified URL\n\n**Security:** Only whitelisted URLs accepted (prevents open redirect attacks).\n\n---\n\n## 🔧 Configuration Reference\n\n### Required Options\n\n| Option | Type | Description |\n|--------|------|-------------|\n| `mongoDbUri` | string | MongoDB connection URI |\n| `sessionSecret` | string | Session encryption secret |\n| `nodeMailerConfig` | object | Email configuration (service, auth, etc) |\n| `companyDetails` | object | Company info for emails (name, website, etc) |\n\n### Optional Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `authRouteinitials` | string | `''` | Auth routes prefix |\n| `enableGoogleLogin` | boolean | `false` | Enable Google OAuth |\n| `googleLoginDetails` | object | - | Google client ID/secret |\n| `enableFacebookLogin` | boolean | `false` | Enable Facebook OAuth |\n| `facebookLoginDetails` | object | - | Facebook app ID/secret |\n| `corsOptions` | object | - | CORS configuration |\n| `sessionOptions` | object | - | Session configuration |\n| `cookieOptions` | object | - | Cookie configuration |\n| `roleHierarchy` | object | `DEFAULT_ROLE_HIERARCHY` | Custom role levels |\n\n---\n\n## 📚 Complete Example\n\nSee [src/app.ts](src/app.ts) for a working example with:\n- RBAC route protection\n- Public and protected routes\n- Admin routes\n- Role hierarchy in action\n\n---\n\n## 🔄 Migration from v2.x\n\n### Breaking Change: Middleware Initialization\n\n```typescript\n// ❌ v2.x\ndAuthMiddleware(app, options);\n\n// ✅ v3.0\ndAuthMiddleware(options)(app);\n```\n\n### Deprecated: `authenticateApiMiddleware`\n\n```typescript\n// ❌ v2.x (deprecated)\napp.use('/api', authenticateApiMiddleware);\n\n// ✅ v3.0 (recommended)\napp.use('/api/admin', requireRoles([UserRole.ADMIN]), adminRouter);\napp.use('/api/user', requireRoles([UserRole.USER]), userRouter);\n```\n\nSee [CHANGELOG.md](CHANGELOG.md) for complete migration guide.\n\n---\n\n## 📖 Documentation\n\n- **[CHANGELOG.md](CHANGELOG.md)** - Version history & migration\n- **[RELEASE_NOTES.md](RELEASE_NOTES.md)** - v3.0 release details\n- **[OAUTH_REDIRECT_CHANGES.md](OAUTH_REDIRECT_CHANGES.md)** - OAuth implementation guide\n\n---\n\n## 🐛 Issues & Support\n\n- **Issues:** [GitHub Issues](https://github.com/dheerajshrivastva-dev/d-auth/issues)\n- **Email:** dheerajshrivastva2@gmail.com\n\n---\n\n## 📄 License\n\nMIT License - see [LICENSE](LICENSE)\n\n---\n\n## 🙏 Acknowledgments\n\nBuilt with [Express.js](https://expressjs.com/), [Passport.js](http://www.passportjs.org/), [MongoDB](https://www.mongodb.com/), [Nodemailer](https://nodemailer.com/)\n\n---\n\n**Made with ❤️ by [Dheeraj Shrivastava](https://github.com/dheerajshrivastva-dev)**\n\n**Version:** 3.0.0 | **NPM:** [@dheerajshrivastva-dev/d-auth](https://www.npmjs.com/package/@dheerajshrivastva-dev/d-auth)\n","readmeFilename":"README.md"}