{"_id":"passport-cognito-oauth2","_rev":"2-6939b32141d7ec0571c721bc7bc175a7","name":"passport-cognito-oauth2","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"author":{"name":"ebuychance"},"bugs":{"url":"https://github.com/ebuychance/passport-cognito-oauth2/issues"},"dependencies":{"aws-sdk":"^2.303.0","passport-oauth2":"^1.4.0","util":"^0.10.4"},"description":"Passport strategy for authenticating and fetching profile data from AWS Cognito User pools using OAuth2 and the Amazon SDK","homepage":"https://github.com/ebuychance/passport-cognito-oauth2#readme","keywords":["aws","cognito","express","oauth","passport"],"license":"MIT","main":"lib/index.js","name":"passport-cognito-oauth2","repository":{"type":"git","url":"git+https://github.com/ebuychance/passport-cognito-oauth2.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"0.1.0","gitHead":"1bd71baeb42ec481d1ffc2079d52e7467fc8f730","_id":"passport-cognito-oauth2@0.1.0","_npmVersion":"6.4.0","_nodeVersion":"10.7.0","_npmUser":{"name":"ebuyc","email":"EBUYCHANCE@GMAIL.COM"},"dist":{"integrity":"sha512-jksav/QpUXjJS0ivWdAkJul5ySGoiiwghVjLfSqXpKJ9b4ajnwuYTOT87x8TpgIMAKFHKlVfZxypNs60rDORUg==","shasum":"303d0c33b527208c3ed4e814ccd7463782f1ea69","tarball":"https://registry.npmjs.org/passport-cognito-oauth2/-/passport-cognito-oauth2-0.1.0.tgz","fileCount":5,"unpackedSize":7850,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbhXX3CRA9TVsSAnZWagAA2UQP/jJPZCUliz2gkLfZSxh3\n75sZlLakARmOt0Ghw9rIEauTPo4kEduIaXtQ0SZ0BMcK7rlxcT/OFHwjVACi\np5etstGlday6nG8LR5wubmT9+CIammidg37Jcy1Hjt5nzsU1SnMg50GyyWaj\ndSLz9GGN9VAn1/0/9qKNkBx14M5xKAtZ97uOJYfgBkTyF4UVFNDmFjQhJhO3\n3Ui8oTzhCiISERLJ+AZtgcoLKuPXwY2IWCI4iE3M6mRQ1vSNLSYgG4JiZtBU\n33+UZrV9A/wZFkaTqAzpG2uwWdUjAMyhFWczvijlfYc0m7RmzbthqC7zMDwe\n5eZEiWMjEmSsZ6KJujxVZWeDdMDd3L5yD0is57yGhxCmDdymM/D6Qtt+97Yu\ngN2kbBrcbebBMlUVa3PXHKI2XaifLmVG8QjD9SezX+1PaPKhNPzbRhlqUqe6\nJZ2u26da4cEoEGwvQbEF3FtuPfwit7arodDJ4ua1RzPbZ4BsT+TvX7u4KXHy\n0IVIpat+uxfW5yLOZoDcliTHDVOJj1AvadHHsAyKFGFJoNunvGV0XOmNFzrb\nDNsn4dsO4SxrEXnEYb3agvjr75VkAwBkXVsh8NhycJcGuNOv1TXeYLH5rhv0\nV0KXg73J3ZYfDJQumXFzxuQmYYCnJvyfxbVOsqJ1G+l3OcmGGLGc/VReTYmx\nCtuG\r\n=BXuq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAnduQCDg/4k+aVmxe6FiqCZ8xNYFEnIF5bvggwC8PPFAiAU9hGCItI92lsBIygfCZNrny7O022HLvDEGz+QxcdSOg=="}]},"maintainers":[{"name":"ebuyc","email":"EBUYCHANCE@GMAIL.COM"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/passport-cognito-oauth2_0.1.0_1535473142657_0.7094420321515338"},"_hasShrinkwrap":false},"0.1.1":{"author":{"name":"ebuychance"},"bugs":{"url":"https://github.com/ebuychance/passport-cognito-oauth2/issues"},"dependencies":{"aws-sdk":"^2.303.0","passport-oauth2":"^1.4.0","util":"^0.10.4"},"description":"Passport strategy for authenticating and fetching profile data from AWS Cognito User pools using OAuth2 and the Amazon SDK","homepage":"https://github.com/ebuychance/passport-cognito-oauth2#readme","keywords":["aws","cognito","express","oauth","passport"],"license":"MIT","main":"lib/index.js","name":"passport-cognito-oauth2","repository":{"type":"git","url":"git+https://github.com/ebuychance/passport-cognito-oauth2.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"0.1.1","gitHead":"f7fc57a08553cd1b550fcba3b980aa7d26c6af90","_id":"passport-cognito-oauth2@0.1.1","_npmVersion":"6.4.0","_nodeVersion":"10.7.0","_npmUser":{"name":"ebuyc","email":"EBUYCHANCE@GMAIL.COM"},"dist":{"integrity":"sha512-2gRuwoCGvkBAtrDYC4eSQoVWKqtqtAEMTBd7xpNFeD2RXm9+PebZ08kGCbsutk1E3aOtAp/5/JNoiQ4wzNz2Uw==","shasum":"aee22dfbe956245cb98d8aae73c3163313b14f57","tarball":"https://registry.npmjs.org/passport-cognito-oauth2/-/passport-cognito-oauth2-0.1.1.tgz","fileCount":5,"unpackedSize":7850,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbhX3bCRA9TVsSAnZWagAAIGYP/1Rq8ZZffvINIbQ4FP/Q\nGEq1VnX5uKhby6F8oxwHaGRg41e/dTOssb/dEjVucqw5VbRMNeX7apiX2Ht5\nTK8chVdnUuHGso50aclnaZmfpZdPNBUjTUO89rEcW4d2aY9i5m6P9cjLCdj7\nx1cLFYk7Ff+s634PDQbxQchQxzUkxDTf4fzGsp7IhpyNTSupwNyh3L3l043N\nljLct1XZikDpjPIpBZ2YDDyWN/jG7aXh6S3TJYwJuhOGfXUtSGjfYyjgFn/a\nYANaFjZfdNiZj03d8T977gZUhl0g9d5asbFjvWZIDRbNmvi9DhlvMKPzUbDj\nIrvSJ481zvCw72uEjOdraf2FNfBWFlYYBFRvsvD1d422jRilRFAKmO4Q4Ym5\nX5bRHbocpgo3Jl7q6xXu3lGZE+4by7Bux7aOAxRZBrFCiegw9xjcVcZ1WdTm\nnY3zVRynF+rozphDIjPgj6Vl3vLBIIc6lIzTiZjWgIkMyffnJZyumJf2WRDc\nOffLYQZXiI6Lr7CEEm+8O9VhZkgylJ9eadxUbaIFTKxsdtgATR50Zn88naH1\nUISe3D38mO7/Tf6kvp6RniwIRgv3JxJSuVozSgwqRpFSFbcCsvrI2kV2/dVu\nXPRWmxj0oIAfpE3J2ZD8H1z/CW85Cb3PATW4xGcDntwAFUXXlgJYE7s/i03c\ngF1g\r\n=1rVE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGe7wP4YdCYdUUz/sZo/W9iGkIZ/SVFtK0xoMwZAficWAiEAswP+tXbeO39DrO0Wl7i+uKap4BaqzIL7eN33hFE/ZpQ="}]},"maintainers":[{"name":"ebuyc","email":"EBUYCHANCE@GMAIL.COM"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/passport-cognito-oauth2_0.1.1_1535475162341_0.3899164910189863"},"_hasShrinkwrap":false}},"time":{"created":"2018-08-28T16:19:02.656Z","0.1.0":"2018-08-28T16:19:02.743Z","modified":"2022-05-12T15:34:57.100Z","0.1.1":"2018-08-28T16:52:42.464Z"},"maintainers":[{"name":"ebuyc","email":"EBUYCHANCE@GMAIL.COM"}],"description":"Passport strategy for authenticating and fetching profile data from AWS Cognito User pools using OAuth2 and the Amazon SDK","homepage":"https://github.com/ebuychance/passport-cognito-oauth2#readme","keywords":["aws","cognito","express","oauth","passport"],"repository":{"type":"git","url":"git+https://github.com/ebuychance/passport-cognito-oauth2.git"},"author":{"name":"ebuychance"},"bugs":{"url":"https://github.com/ebuychance/passport-cognito-oauth2/issues"},"license":"MIT","readme":"# passport-cognito-oauth2\n[Passport](https://github.com/jaredhanson/passport) \n[strategy](https://github.com/jaredhanson/passport-strategy) for authenticating and fetching profile data from \n[AWS Cognito](https://aws.amazon.com/cognito/) \n[User pools](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools.html) using \n[OAuth2](https://oauth.net/2/) and the \n[Amazon SDK](https://aws.amazon.com/sdk-for-node-js/)\n\n## Install\n\n    $ npm install passport-cognito-oauth2\n    \n## Usage\n\n#### Configure Strategy\n\nThe Cognito OAuth 2.0 authentication strategy authenticates requests using the \nOAuth 2.0 framework and retrieves user data from AWS Cognito User Pools.\nThe strategy requires a `verify` callback, which accepts these\ncredentials and calls `done` providing a user, as well as `options` specifying a\nconsumer key, consumer secret, and callback URL.\n    \n    const passport = require('passport')\n    const CognitoOAuth2Strategy = require('passport-cognito-oauth2');\n    \n    const options = {\n      callbackURL: 'https://myapp.com/auth/cognito/callback',\n      clientDomain: 'https://myapp.auth.us-west-2.amazoncognito.com',\n      clientID: '123-456-789',\n      clientSecret: 'shhh-its-a-secret',\n      region: 'us-west-2'\n    };\n   \n    function verify(accessToken, refreshToken, profile, done) {\n      User.findOrCreate(profile, (err, user) => {\n        done(err, user);\n      });\n    }\n    \n    passport.use(new CognitoOAuth2Strategy(options, verify));  \n    passport.serializeUser((user, done) => done(null, user));\n    passport.deserializeUser((obj, done) => done(null, obj));\n    \n#### Authenticate Requests\n\nUse `passport.authenticate()`, specifying the `'cognito-oauth2'` strategy, to\nauthenticate requests.\n\nFor example, as route middleware in an [Express](http://expressjs.com/)\napplication:\n\n    app.get('/auth/cognito',\n      passport.authenticate('cognito-oauth2')\n    );\n    app.get('/auth/cognito/callback',\n      passport.authenticate('cognito-oauth2'),\n      (req,res) => res.send(req.user)  \n    );\n\n## Cognito configuration\n\nWhen you create your App Client, you will need to generate an App Client Secret\n\nYour App client settings will need:\n\nEnabled Identity Providers: Cognito User Pool\n\nCallback URL(s): `options.callbackURL`\n\nAllowed OAuth Flows: Authorization code grant\n\nAllowed OAuth Scopes: [openid, aws.cognito.signin.user.admin, profile]\n\nYou must also configure a Domain name for use as `options.clientDomain`","readmeFilename":"README.md"}