{"_id":"@bagubagu/amazon-cognito-auth-js","_rev":"10-158cd865ab0690f21710df3c9fe47cf1","name":"@bagubagu/amazon-cognito-auth-js","description":"Bagubagu Forked Amazon Cognito Auth JavaScript SDK","dist-tags":{"latest":"1.1.3"},"versions":{"1.1.1":{"name":"@bagubagu/amazon-cognito-auth-js","description":"Bagubagu Forked Amazon Cognito Auth JavaScript SDK","version":"1.1.1","author":{"name":"Amazon Web Services","email":"aws@amazon.com","url":"http://aws.amazon.com"},"private":false,"homepage":"http://aws.amazon.com/cognito","contributors":[{"name":"Crystal Wang","email":"wyuntuo@amazon.com"},{"name":"Mahesh Reddy","email":"gmreddy@amazon.com"},{"name":"Ionut Trestian","email":"trestian@amazon.com"},{"name":"Tim Hunt","email":"timhunt@amazon.com"},{"name":"Diane Olsen","email":"diaolsen@amazon.com"}],"repository":{"type":"git","url":"git+https://github.com/aws/amazon-cognito-auth-js.git"},"license":"SEE LICENSE IN LICENSE.txt","licenses":[{"type":"Apache License, Version 2.0","url":"http://aws.amazon.com/apache2.0/"}],"keywords":["amazon","aws","cognito","auth"],"scripts":{"clean":"rimraf lib es","build:commonjs":"cross-env BABEL_ENV=commonjs babel src --out-dir lib","build:es":"cross-env BABEL_ENV=es babel src --out-dir es","build:umd":"cross-env BABEL_ENV=commonjs NODE_ENV=development webpack dist/amazon-cognito-auth.js","build:umd:min":"cross-env BABEL_ENV=commonjs NODE_ENV=production webpack dist/amazon-cognito-auth.min.js","build":"npm run clean && npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min","doc":"jsdoc src -d docs","lint":"eslint src"},"main":"lib/index.js","module":"es/index.js","jsnext:main":"es/index.js","dependencies":{"aws-sdk":"^2.6.0"},"devDependencies":{"babel-cli":"^6.23.0","babel-core":"^6.13.2","babel-loader":"^6.2.4","babel-plugin-transform-es2015-modules-commonjs":"^6.23.0","babel-preset-es2015":"^6.22.0","cross-env":"^3.2.4","eslint":"^3.3.1","eslint-config-airbnb-base":"^5.0.2","eslint-import-resolver-webpack":"^0.5.1","eslint-plugin-import":"^1.13.0","jsdoc":"^3.4.0","rimraf":"^2.6.2","webpack":"^1.13.1"},"gitHead":"fd7d7e8fa2d43534881765a898c745ef7023054b","bugs":{"url":"https://github.com/aws/amazon-cognito-auth-js/issues"},"_id":"@bagubagu/amazon-cognito-auth-js@1.1.1","_npmVersion":"5.6.0","_nodeVersion":"8.9.1","_npmUser":{"name":"louislarry","email":"louis.larry@gmail.com"},"dist":{"integrity":"sha512-3AMnm+cugcvBmHV8jdi4L3HnndVzai0nTQgA73QyI0SKssD1ahx28FyZz94ZMxM02gA7NofXUNkiRNOYwGX3ew==","shasum":"bcbf13af2c3c23292854ae429b2cce741c7566f8","tarball":"https://registry.npmjs.org/@bagubagu/amazon-cognito-auth-js/-/amazon-cognito-auth-js-1.1.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFT/8ribs4C/TWTOgF/fEdAVm8yi6SfhR8H16AU0PYfdAiA+Cm5l19QxlRcCDLfgPN8/BG2xFAtDw7GgjbucPLrkhg=="}]},"maintainers":[{"name":"louislarry","email":"louis.larry@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/amazon-cognito-auth-js-1.1.1.tgz_1515835257232_0.7516753543168306"},"directories":{},"deprecated":"this package has been deprecated"},"1.1.2":{"name":"@bagubagu/amazon-cognito-auth-js","description":"Bagubagu Forked Amazon Cognito Auth JavaScript SDK","version":"1.1.2","author":{"name":"Amazon Web Services","email":"aws@amazon.com","url":"http://aws.amazon.com"},"types":"./index.d.ts","private":false,"homepage":"http://aws.amazon.com/cognito","contributors":[{"name":"Crystal Wang","email":"wyuntuo@amazon.com"},{"name":"Mahesh Reddy","email":"gmreddy@amazon.com"},{"name":"Ionut Trestian","email":"trestian@amazon.com"},{"name":"Tim Hunt","email":"timhunt@amazon.com"},{"name":"Diane Olsen","email":"diaolsen@amazon.com"}],"repository":{"type":"git","url":"git+https://github.com/aws/amazon-cognito-auth-js.git"},"license":"SEE LICENSE IN LICENSE.txt","licenses":[{"type":"Apache License, Version 2.0","url":"http://aws.amazon.com/apache2.0/"}],"keywords":["amazon","aws","cognito","auth"],"scripts":{"clean":"rimraf lib es","build:commonjs":"cross-env BABEL_ENV=commonjs babel src --out-dir lib","build:es":"cross-env BABEL_ENV=es babel src --out-dir es","build:umd":"cross-env BABEL_ENV=commonjs NODE_ENV=development webpack dist/amazon-cognito-auth.js","build:umd:min":"cross-env BABEL_ENV=commonjs NODE_ENV=production webpack dist/amazon-cognito-auth.min.js","build":"npm run clean && npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min","doc":"jsdoc src -d docs","lint":"eslint src"},"main":"lib/index.js","module":"es/index.js","jsnext:main":"es/index.js","dependencies":{"aws-sdk":"^2.6.0"},"devDependencies":{"babel-cli":"^6.23.0","babel-core":"^6.13.2","babel-loader":"^6.2.4","babel-plugin-transform-es2015-modules-commonjs":"^6.23.0","babel-preset-es2015":"^6.22.0","cross-env":"^3.2.4","eslint":"^3.3.1","eslint-config-airbnb-base":"^5.0.2","eslint-import-resolver-webpack":"^0.5.1","eslint-plugin-import":"^1.13.0","jsdoc":"^3.4.0","rimraf":"^2.6.2","webpack":"^1.13.1"},"gitHead":"fd7d7e8fa2d43534881765a898c745ef7023054b","bugs":{"url":"https://github.com/aws/amazon-cognito-auth-js/issues"},"_id":"@bagubagu/amazon-cognito-auth-js@1.1.2","_npmVersion":"5.6.0","_nodeVersion":"8.9.1","_npmUser":{"name":"louislarry","email":"louis.larry@gmail.com"},"dist":{"integrity":"sha512-W8vosit4HVCGOQx+UzwoCk1QsaRfUp2hUrchH9iTbj+hh11ACY1ar8TeAShSvEgeAdrI3tfETUAeNPP9ek5dVA==","shasum":"4965ba06924b42d722e7663007369f5d4849c72b","tarball":"https://registry.npmjs.org/@bagubagu/amazon-cognito-auth-js/-/amazon-cognito-auth-js-1.1.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHxfKs1nQPn08IDZ6N+2N9wkhRWBX5NKDTq/QXhRZhONAiA68smCnoGdlN+vDtDfhPRghZqtuU+1PeBspED3DoLFeg=="}]},"maintainers":[{"name":"rezonjov","email":"rezonjov@gmail.com"},{"name":"darkbcx","email":"darkbcx@yahoo.com"},{"name":"yezarela","email":"yezarela@gmail.com"},{"name":"pujie","email":"pw.prayitno@gmail.com"},{"name":"louislarry","email":"louis.larry@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/amazon-cognito-auth-js-1.1.2.tgz_1515836859562_0.15448630158789456"},"directories":{},"deprecated":"this package has been deprecated"},"1.1.3":{"name":"@bagubagu/amazon-cognito-auth-js","description":"Bagubagu Forked Amazon Cognito Auth JavaScript SDK","version":"1.1.3","author":{"name":"Amazon Web Services","email":"aws@amazon.com","url":"http://aws.amazon.com"},"homepage":"http://aws.amazon.com/cognito","contributors":[{"name":"Crystal Wang","email":"wyuntuo@amazon.com"},{"name":"Mahesh Reddy","email":"gmreddy@amazon.com"},{"name":"Ionut Trestian","email":"trestian@amazon.com"},{"name":"Tim Hunt","email":"timhunt@amazon.com"},{"name":"Diane Olsen","email":"diaolsen@amazon.com"}],"repository":{"type":"git","url":"git+https://github.com/aws/amazon-cognito-auth-js.git"},"license":"SEE LICENSE IN LICENSE.txt","licenses":[{"type":"Apache License, Version 2.0","url":"http://aws.amazon.com/apache2.0/"}],"keywords":["amazon","aws","cognito","auth"],"scripts":{"clean":"rimraf lib es","build:commonjs":"cross-env BABEL_ENV=commonjs babel src --out-dir lib","build:es":"cross-env BABEL_ENV=es babel src --out-dir es","build:umd":"cross-env BABEL_ENV=commonjs NODE_ENV=development webpack dist/amazon-cognito-auth.js","build:umd:min":"cross-env BABEL_ENV=commonjs NODE_ENV=production webpack dist/amazon-cognito-auth.min.js","build":"npm run clean && npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min","doc":"jsdoc src -d docs","lint":"eslint src"},"main":"lib/index.js","module":"es/index.js","jsnext:main":"es/index.js","types":"./index.d.ts","dependencies":{"aws-sdk":"^2.6.0"},"devDependencies":{"babel-cli":"^6.23.0","babel-core":"^6.13.2","babel-loader":"^6.2.4","babel-plugin-transform-es2015-modules-commonjs":"^6.23.0","babel-preset-es2015":"^6.22.0","cross-env":"^3.2.4","eslint":"^3.3.1","eslint-config-airbnb-base":"^5.0.2","eslint-import-resolver-webpack":"^0.5.1","eslint-plugin-import":"^1.13.0","jsdoc":"^3.4.0","rimraf":"^2.6.2","webpack":"^1.13.1"},"gitHead":"c3d4c1cf6baa4311fae3f5b9495fd6e1edcbb25b","bugs":{"url":"https://github.com/aws/amazon-cognito-auth-js/issues"},"_id":"@bagubagu/amazon-cognito-auth-js@1.1.3","_npmVersion":"5.6.0","_nodeVersion":"8.9.1","_npmUser":{"name":"louislarry","email":"louis.larry@gmail.com"},"dist":{"integrity":"sha512-2V/c2B+1Ra368/1926ZCbV3pJ2z0MZcoIRIlL8DYCTV6m0mmuYhswTrkSyija+dKWqgDlBKjJxiM53MD0Xypvw==","shasum":"49a5a91005cfcbf887944a438871b24cb3cd8d04","tarball":"https://registry.npmjs.org/@bagubagu/amazon-cognito-auth-js/-/amazon-cognito-auth-js-1.1.3.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDk/xFPHYI5wMWQVdZqecWuPRZtB+4PW4kGKNlbXJRB8AIhAP0NRqvKf+uG8nhylNmLDaemPeCUF+rmV4KoisUlgpIw"}]},"maintainers":[{"name":"rezonjov","email":"rezonjov@gmail.com"},{"name":"darkbcx","email":"darkbcx@yahoo.com"},{"name":"yezarela","email":"yezarela@gmail.com"},{"name":"pujie","email":"pw.prayitno@gmail.com"},{"name":"louislarry","email":"louis.larry@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/amazon-cognito-auth-js-1.1.3.tgz_1515842617365_0.5844580018892884"},"directories":{},"deprecated":"this package has been deprecated"}},"readme":"# Amazon Cognito Auth SDK for JavaScript\nYou can now use Amazon Cognito Auth to easily add sign-in and sign-out to your mobile and web apps. Your user pool in Amazon Cognito is a fully managed user directory that can scale to hundreds of millions of users, so you don't have to worry about building, securing, and scaling a solution to handle user management and authentication.\n\n[For more information about this new feature, see Amazon Cognito User Pools App Integration and Federation GA Release.](http://docs.aws.amazon.com/cognito/latest/developerguide/getting-started.html)\n\nWe welcome developer feedback on this project. You can reach us by creating an issue on the GitHub repository or posting to the Amazon Cognito Identity forums:\n\n* <https://github.com/aws/amazon-cognito-auth-js>\n* <https://forums.aws.amazon.com/forum.jspa?forumID=173>\n\n# Introduction\nThe Amazon Cognito Auth SDK for JavaScript simplifies adding sign-up, sign-in with user profile functionality to web apps.\n\nInstead of implementing a UI for sign-up and sign-in, this SDK provides the UI via a hosted page.  It supports sign-up, sign-in, confirmation, multifactor authentication, and sign-out.\n\n\n# Setup\n\nThe Amazon Cognito Auth SDK for JavaScript depends on:\n     The `CognitoIdentityServiceProvider` service from the [AWS SDK for JavaScript](https://github.com/aws/aws-sdk-js)\n\nThere are two ways to install the Amazon Cognito Auth SDK for JavaScript and its dependencies, depending on your project setup and experience with modern JavaScript build tools:\n\n* Download the JavaScript libraries and include them in your HTML, or\n\n* Install the dependencies with npm and use a bundler like webpack.\n\n### Install using separate JavaScript files\n\nThis method is simpler and does not require additional tools, but may have worse performance due to the browser having to download multiple files.\n\nDownload each of the following JavaScript files for the required libraries and place them in your project:\n\n1. The Amazon Cognito AWS SDK for JavaScript, from `/dist/aws-cognito-sdk.min.js`\n\n\tNote that the Amazon Cognito AWS SDK for JavaScript is just a slimmed down version of the AWS Javascript SDK namespaced as `AWSCognito` instead of `AWS`. It references only the Amazon Cognito Identity service.\n\t\n2. The Amazon Cognito Auth SDK for JavaScript, from `/dist/amazon-cognito-auth.min.js`\n\nOptionally, to use other AWS services, include a build of the `AWS SDK for JavaScript`.\n\nInclude all of the files in your HTML page before calling any Amazon Cognito Auth SDK APIs:\n\n```html\n<script src=\"/path/to/aws-cognito-sdk.min.js\"></script>\n<script src=\"/path/to/amazon-cognito-auth.min.js\"></script>\n<!-- optional: only if you use other AWS services -->\n<script src=\"/path/to/aws-sdk-2.6.10.js\"></script>\n```\n\n### Using NPM and Webpack\n\nThe following is a quick setup guide with specific notes for using the Amazon Cognito Auth SDK for JavaScript with Webpack, but there are many more ways it can be used. See [the Webpack site](https://webpack.github.io/), and in particular the [configuration documentation](http://webpack.github.io/docs/configuration.html)\n\nNote that webpack expects your source files to be structured as [CommonJS (Node.js-style) modules](https://webpack.github.io/docs/commonjs.html) (or [ECMAScript 2015 modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) if you are using a transpiler such as [Babel](https://babeljs.io/).) If your project is not already using modules you may wish to use [Webpack's module shimming features](http://webpack.github.io/docs/shimming-modules.html) to ease migration.\n\n* Install [Node.js](https://nodejs.org/en/) on your development machine (this will not be needed on your server.)\n* In your project add a `package.json`, either use `npm init` or the minimal, which means your repository is private:\n\n```json\n{\n\"private\" : true\n}\n```\n*  Install the Amazon Cognito Auth SDK for JavaScript and the Webpack tool into your project with `npm` (the Node Package Manager, which is installed with Node.js):\n\n```bash\n> npm install --save-dev webpack json-loader\n> npm install --save amazon-cognito-auth-js\n```\n\n* Create the configuration file for `webpack`, named `webpack.config.js`:\n\n```js\nmodule.exports = {\n  // Example setup for your project:\n  // The entry module that requires or imports the rest of your project.\n  // Must start with `./`!\n  entry: './src/entry',\n  // Place output files in `./dist/my-app.js`\n  output: {\n    path: 'dist',\n    filename: 'my-app.js'\n  },\n  module: {\n    loaders: [\n      {\n        test: /\\.json$/,\n        loader: 'json'\n      }\n    ]\n  }\n};\n```\n* Add the following into your `package.json`\n\n```js\n{\n  \"scripts\": {\n    \"build\": \"webpack\"\n  }\n}\n```\n* Build your application bundle with `npm run build`\n\n### Configuration\n\nThe Amazon Cognito Auth SDK for JavaScript requires three configuration values from your AWS Account in order to access your Cognito User Pool:\n\n* An User Pool App Client Id, e.g. `<TODO: add ClientId>` \n    * When creating the App, the generate client secret box must be **unchecked** because the JavaScript SDK doesn't support apps that have a client secret.\n* An App Web Domain, e.g. `<TODO: add App Web Domain>`\n    * When you click the `Domain name` tab, you can create a domain name there and save it for record. \n* Scope Array, e.g. `<TODO: add scope array>` \n    * When you click the `App settings` tab, you can select the identity provider which you want to use on your App. \n    * In the `sign in and sign out URLs` tab, you can set the `Callback URLs` and `Sign out URLs`. \n    * Under the `OAuth2.0` tab, you can select the OAuth flows and scopes enabled for this app. \n\nThe [AWS Console for Cognito User Pools](https://console.aws.amazon.com/cognito/users/) can be used to get or create these values.\n\nNote that the various errors returned by the service are valid JSON so one can access the different exception types (err.code) and status codes (err.statusCode).\n\n\n### Usage\n\nThe usage examples below use the unqualified names for types in the Amazon Cognito Auth SDK for JavaScript. Remember to import or qualify access to any of these types:\n\n```js\n// When using loose Javascript files:\nvar CognitoAuth = AmazonCognitoIdentity.CognitoAuth;\n\n// Under the original name:\nvar CognitoAuth = AWSCognito.CognitoIdentityServiceProvider.CognitoAuth;\n\n// Modules, e.g. Webpack:\nvar AmazonCognitoIdentity = require('amazon-cognito-auth-js');\nvar CognitoAuth = AmazonCognitoIdentity.CognitoAuth;\n\n// ES Modules, e.g. transpiling with Babel\nimport {CognitoAuth} from 'amazon-cognito-auth-js';\n```\n\n**Use case 1.** Registering an auth with the application. You need to create a CognitoAuth object by providing a App client ID, a App web domain, a scope array, a sign-in redirect URL, and a sign-out redirect URL:\n\n```js\n/*\n  TokenScopesArray\n  Valid values are found under:\n  AWS Console -> User Pools -> <Your user pool> -> App Integration -> App client settings\n  Example values: ['profile', 'email', 'openid', 'aws.cognito.signin.user.admin', 'phone']\n\n  RedirectUriSignOut \n  This value must match the value specified under:\n  AWS Console -> User Pools -> <Your user pool> -> App Integration -> App client settings -> Sign out URL(s)\n*/\nvar authData = {\n\tClientId : '<TODO: add ClientId>', // Your client id here\n\tAppWebDomain : '<TODO: add App Web Domain>',\n\tTokenScopesArray : '<TODO: add scope array>',\n\tRedirectUriSignIn : '<TODO: add redirect url when signed in>',\n\tRedirectUriSignOut : '<TODO: add redirect url when signed out>'\n};\nvar auth = new AWSCognito.CognitoIdentityServiceProvider.CognitoAuth(authData);\n```\n\nAlso you can provide onSuccess callback and onFailure callback:\n\n```js\nauth.userhandler = {\n\tonSuccess: function(result) {\n\t\talert(\"Sign in success\");\n\t\tshowSignedIn(result);\n\t},\n\tonFailure: function(err) {\n\t\talert(\"Error!\");\n\t}\n};\n```\n**Use case 2.** Sign-in using `getSession()` API:\n\n```js\nauth.getSession();\n```\n\nFor the cache tokens and scopes, use the `parseCognitoWebResponse(Response)` API, e.g. the response is the current window url:\n\n```js\nvar curUrl = window.location.href;\nauth.parseCognitoWebResponse(curUrl);\n```\nTypically, you can put this part of logic in the `onLoad()`, e.g.:\n\n```js\nfunction onLoad() {\n\tvar auth = initCognitoSDK();\n\tvar curUrl = window.location.href;\n\tauth.parseCognitoWebResponse(curUrl);\n}\n```\n\n**Use case 3.** Sign-out using `signOut()`:\n\n```js\nauth.signOut();\n```\n**Important to know**\n\nBy default, the SDK uses implicit flow(token flow), if you want to enable authorization code grant flow, you need to call useCodeGrantFlow(). For example, please check our sample index.html, in that file, you need to uncomment \"auth.useCodeGrantFlow()\".  \nAlso, when you meet some problems using our SDK, please make sure you downloaded the lastest version directly from Github repo. \n\n### Change Log\n\n**v1.2.1**\n\n* Add initial typescript typing\n\n**v1.1.1**\n\n* Bug fix, username should be updated when caching tokens and scopes.\n\n\n**v1.1.0**\n\n* Added support for Cognito Advanced Security. \n\n\n**v1.0.0**\n\n* GA release. In this GA service launch, we made this feature generally available. \n\n\n**v0.9.0:** \n\n* Public beta release. Developer preview.\n","maintainers":[{"email":"faishalkings@gmail.com","name":"mochfamir"},{"email":"louis.larry@gmail.com","name":"louislarry"},{"email":"darkbcx@yahoo.com","name":"darkbcx"}],"time":{"modified":"2022-04-04T17:30:30.608Z","created":"2018-01-13T09:20:57.353Z","1.1.1":"2018-01-13T09:20:57.353Z","1.1.2":"2018-01-13T09:47:39.672Z","1.1.3":"2018-01-13T11:23:37.564Z"},"homepage":"http://aws.amazon.com/cognito","keywords":["amazon","aws","cognito","auth"],"repository":{"type":"git","url":"git+https://github.com/aws/amazon-cognito-auth-js.git"},"contributors":[{"name":"Crystal Wang","email":"wyuntuo@amazon.com"},{"name":"Mahesh Reddy","email":"gmreddy@amazon.com"},{"name":"Ionut Trestian","email":"trestian@amazon.com"},{"name":"Tim Hunt","email":"timhunt@amazon.com"},{"name":"Diane Olsen","email":"diaolsen@amazon.com"}],"author":{"name":"Amazon Web Services","email":"aws@amazon.com","url":"http://aws.amazon.com"},"bugs":{"url":"https://github.com/aws/amazon-cognito-auth-js/issues"},"license":"SEE LICENSE IN LICENSE.txt","readmeFilename":"README.md"}