{"_id":"@352inc/react-native-aws-cognito-js","_rev":"5-38c122357f89cd06092dff4716127888","name":"@352inc/react-native-aws-cognito-js","dist-tags":{"latest":"0.0.9"},"versions":{"0.0.8":{"name":"@352inc/react-native-aws-cognito-js","version":"0.0.8","description":"React Native AWS Cognito JS library.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/AirLabsTeam/react-native-aws-cognito-js.git"},"keywords":["react-native","amazon","aws","cognito","identity"],"homepage":"https://github.com/AirLabsTeam/react-native-aws-cognito-js","author":{"name":"Jon Parsons","email":"jonparsons@gmail.com","url":"https://github.com/jmparsons"},"license":"SEE LICENSE IN LICENSE","dependencies":{"aws-sdk":"*"},"licenseText":"The AWS SDK for JavaScript is licensed under the Apache 2.0 License, with the Amazon Cognito Identity Provider SDK for JavaScript components being licensed under the Amazon Software License.\n","noticeText":"react-native-aws-cognito-js\nCopyright 2017 Air Labs, Inc. or its affiliates. All Rights Reserved.\n\nThis product includes software developed by Amazon Technologies, Inc (http://www.amazon.com/).\n\nLicensed under the Amazon Software License included in LICENSE.txt.\n\n*****************************\nAMAZON PROPRIETARY COMPONENTS\n*****************************\n\nThe following components are distributed under a proprietary license by Amazon Technologies, Inc\n\n- Amazon Cognito Identity Provider SDK for JavaScript\n  Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n  https://github.com/aws/amazon-cognito-identity-js\n\n\n- AWS SDK for JavaScript\n  Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n  This product includes software developed at\n  Amazon Web Services, Inc. (http://aws.amazon.com/).\n  https://github.com/aws/aws-sdk-js\n\nSee the License for the specific language governing permissions and limitations under the License.\n\n**********************\nTHIRD PARTY COMPONENTS\n**********************\n\nThis software includes third party software subject to the following copyrights:\n\n- JKBigInteger – Copyright (c) 2015 Midfar Sun. All rights reserved. – MIT License\n  https://github.com/kirsteins/JKBigInteger/\n\n- Basic JavaScript BN library - Copyright (c) 2005  Tom Wu. All Rights Reserved.\n  http://www-cs-students.stanford.edu/%7Etjw/jsbn/jsbn.js\n\n====================\n\nJKBigInteger – Copyright (c) 2015 Midfar Sun. All rights reserved.\n\nCopyright (C) 2013 Jānis Kiršteins\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n====================\n\nLicensing\n---------\n\nThis software is covered under the following copyright:\n\n/*\n * Copyright (c) 2003-2005  Tom Wu\n * All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY\n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.\n *\n * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,\n * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER\n * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF\n * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT\n * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n * In addition, the following condition applies:\n *\n * All redistributions must retain an intact copy of this copyright notice\n * and disclaimer.\n */\n\nAddress all questions regarding this license to:\n\n  Tom Wu\n  tjw@cs.Stanford.EDU\n\n====================\n","_id":"@352inc/react-native-aws-cognito-js@0.0.8","dist":{"shasum":"aa7c76b7141919f02704fd7bf37838140719c538","tarball":"https://registry.npmjs.org/@352inc/react-native-aws-cognito-js/-/react-native-aws-cognito-js-0.0.8.tgz","fileCount":49,"unpackedSize":354859,"integrity":"sha512-p+bg+BL2+UATdvuOX1xoVhp4F2jgllHuxJad7CStKP6CMwJSPs8XmR/FAiJHXtxW1Kzlyuc53g63SWQOUV+ggw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCHTw4PB+g9IXktgWcZQS8ol7LBbnaGH8wtzahYg+3GggIhANyIvlZqTGKVFM9pV7SiKSHNn1cyrQfNGCDwwTG4Zkfz"}]},"maintainers":[{"name":"eschoellhorn","email":"eschoellhorn@352inc.com"}],"_npmUser":{"name":"eschoellhorn","email":"eschoellhorn@352inc.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-aws-cognito-js_0.0.8_1521169811664_0.5652499199464347"},"_hasShrinkwrap":false},"0.0.9":{"name":"@352inc/react-native-aws-cognito-js","version":"0.0.9","description":"React Native AWS Cognito JS library.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/AirLabsTeam/react-native-aws-cognito-js.git"},"keywords":["react-native","amazon","aws","cognito","identity"],"homepage":"https://github.com/AirLabsTeam/react-native-aws-cognito-js","author":{"name":"Jon Parsons","email":"jonparsons@gmail.com","url":"https://github.com/jmparsons"},"license":"SEE LICENSE IN LICENSE","dependencies":{"aws-sdk":"*"},"licenseText":"The AWS SDK for JavaScript is licensed under the Apache 2.0 License, with the Amazon Cognito Identity Provider SDK for JavaScript components being licensed under the Amazon Software License.\n","noticeText":"react-native-aws-cognito-js\nCopyright 2017 Air Labs, Inc. or its affiliates. All Rights Reserved.\n\nThis product includes software developed by Amazon Technologies, Inc (http://www.amazon.com/).\n\nLicensed under the Amazon Software License included in LICENSE.txt.\n\n*****************************\nAMAZON PROPRIETARY COMPONENTS\n*****************************\n\nThe following components are distributed under a proprietary license by Amazon Technologies, Inc\n\n- Amazon Cognito Identity Provider SDK for JavaScript\n  Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n  https://github.com/aws/amazon-cognito-identity-js\n\n\n- AWS SDK for JavaScript\n  Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n  This product includes software developed at\n  Amazon Web Services, Inc. (http://aws.amazon.com/).\n  https://github.com/aws/aws-sdk-js\n\nSee the License for the specific language governing permissions and limitations under the License.\n\n**********************\nTHIRD PARTY COMPONENTS\n**********************\n\nThis software includes third party software subject to the following copyrights:\n\n- JKBigInteger – Copyright (c) 2015 Midfar Sun. All rights reserved. – MIT License\n  https://github.com/kirsteins/JKBigInteger/\n\n- Basic JavaScript BN library - Copyright (c) 2005  Tom Wu. All Rights Reserved.\n  http://www-cs-students.stanford.edu/%7Etjw/jsbn/jsbn.js\n\n====================\n\nJKBigInteger – Copyright (c) 2015 Midfar Sun. All rights reserved.\n\nCopyright (C) 2013 Jānis Kiršteins\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n====================\n\nLicensing\n---------\n\nThis software is covered under the following copyright:\n\n/*\n * Copyright (c) 2003-2005  Tom Wu\n * All Rights Reserved.\n *\n * Permission is hereby granted, free of charge, to any person obtaining\n * a copy of this software and associated documentation files (the\n * \"Software\"), to deal in the Software without restriction, including\n * without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to\n * permit persons to whom the Software is furnished to do so, subject to\n * the following conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS-IS\" AND WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY\n * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.\n *\n * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,\n * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER\n * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF\n * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT\n * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n * In addition, the following condition applies:\n *\n * All redistributions must retain an intact copy of this copyright notice\n * and disclaimer.\n */\n\nAddress all questions regarding this license to:\n\n  Tom Wu\n  tjw@cs.Stanford.EDU\n\n====================\n","_id":"@352inc/react-native-aws-cognito-js@0.0.9","dist":{"shasum":"502b99e9a25279794e609e73c9f23cd2c5706fe7","tarball":"https://registry.npmjs.org/@352inc/react-native-aws-cognito-js/-/react-native-aws-cognito-js-0.0.9.tgz","fileCount":49,"unpackedSize":354959,"integrity":"sha512-9keEckfVyLGagrXa5A7dbzQo4H6oX8iCIvtaVxBQ8Q8XPNVGiMuELUv8kASP648qiNRUe2vtkzf5o9LjzAz24Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICObXqOqzprvUErr3rRLkxGx/GICI083EWoGW92EBBkCAiEAgM23MjoPRDDOQ9gN9yOY8O+yT3LK3AFkJFjvOj3Hmc8="}]},"maintainers":[{"name":"eschoellhorn","email":"eschoellhorn@352inc.com"}],"_npmUser":{"name":"eschoellhorn","email":"eschoellhorn@352inc.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-aws-cognito-js_0.0.9_1521170806023_0.0714886115912221"},"_hasShrinkwrap":false}},"time":{"created":"2018-03-16T03:10:11.606Z","0.0.8":"2018-03-16T03:10:11.717Z","modified":"2022-06-12T14:10:52.018Z","0.0.9":"2018-03-16T03:26:46.154Z"},"maintainers":[{"email":"landerson@352inc.com","name":"linc"},{"email":"eschoellhorn@352inc.com","name":"eschoellhorn"}],"description":"React Native AWS Cognito JS library.","homepage":"https://github.com/AirLabsTeam/react-native-aws-cognito-js","keywords":["react-native","amazon","aws","cognito","identity"],"repository":{"type":"git","url":"https://github.com/AirLabsTeam/react-native-aws-cognito-js.git"},"author":{"name":"Jon Parsons","email":"jonparsons@gmail.com","url":"https://github.com/jmparsons"},"license":"SEE LICENSE IN LICENSE","readme":"## react-native-aws-cognito-js [![npm version](https://badge.fury.io/js/react-native-aws-cognito-js.svg)](http://badge.fury.io/js/react-native-aws-cognito-js)\n\nThis is an adaptation of [Amazon Cognito Identity SDK for JavaScript](https://github.com/aws/amazon-cognito-identity-js) in combination with [AWS SDK for JavaScript](https://github.com/aws/aws-sdk-js/tree/react-native) for [React Native](https://github.com/facebook/react-native/).\n\nThis project uses Native Modules to handle intensive math operations on the device using the React Native bridge.\n\n## Installation\n\nInstall in your application directory:\n\n```bash\nnpm install --save react-native-aws-cognito-js\n```\n\nor\n\n```bash\nyarn add react-native-aws-cognito-js\n```\n\nLink project:\n\n```bash\nreact-native link react-native-aws-cognito-js\n```\n\n## MemoryStorage\n\nThe local MemoryStorage can handle everything on the authentication side, but the data is lost when the app is reopened. The storage sync method will grab only the MemoryStorage data from AsyncStorage and update the local MemoryStage with the values.\n\nThe new sync method can be used from either the userPool or cognitoUser:\n\n```js\nuserPool.storage.sync((err, result) => {\n  // MemoryStorage is now updated with AsyncStorage values\n});\n```\n\nor\n\n```js\ncognitoUser.storage.sync((err, result) => {\n  // MemoryStorage is now updated with AsyncStorage values\n});\n```\n\n## Usage\n\nRefer to the Amazon Cognito Identity SDK for JavaScript usage [examples](https://github.com/aws/amazon-cognito-identity-js#usage).\n\n## Example\n\nThis is a user authentication sample:\n\n```js\n//imports\nimport {\n  Config,\n  CognitoIdentityCredentials\n} from 'aws-sdk/dist/aws-sdk-react-native';\n\nimport {\n  AuthenticationDetails,\n  CognitoUser,\n  CognitoUserPool,\n  CognitoUserAttribute\n} from 'react-native-aws-cognito-js';\n\nconst appConfig = {\n  region: '',\n  IdentityPoolId: '',\n  UserPoolId: '',\n  ClientId: '',\n}\n\n//setting config\nConfig.region = appConfig.region;\n\n//component:\nstate = {\n  username: '',\n  password: '',\n}\n\nlogin = () => {\n  const { username, password } = this.state;\n  const authenticationData = {\n    Username: username,\n    Password: password,\n  };\n  const authenticationDetails = new AuthenticationDetails(authenticationData);\n  const poolData = {\n    UserPoolId: appConfig.UserPoolId,\n    ClientId: appConfig.ClientId\n  };\n  const userPool = new CognitoUserPool(poolData);\n  const userData = {\n    Username: username,\n    Pool: userPool\n  };\n  const cognitoUser = new CognitoUser(userData);\n  cognitoUser.authenticateUser(authenticationDetails, {\n    onSuccess: (result) => {\n      console.log('access token + ' + result.getAccessToken().getJwtToken());\n      Config.credentials = new CognitoIdentityCredentials({\n        IdentityPoolId: appConfig.IdentityPoolId,\n        Logins: {\n          [`cognito-idp.${appConfig.region}.amazonaws.com/${appConfig.UserPoolId}`]: result.getIdToken().getJwtToken()\n        }\n      });\n      alert('Success');\n      console.log(Config.credentials);\n    },\n    onFailure: (err) => {\n      alert(err);\n    },\n  });\n}\n```\n\n## Advanced Example\n\n```js\n//- AWS.js\n//create AWS with userPool using dotenv to hold environment variables\nimport AWS, { CognitoIdentityServiceProvider } from 'aws-sdk/dist/aws-sdk-react-native';\nimport * as enhancements from 'react-native-aws-cognito-js';\nimport { AWS_REGION, AWS_POOL_ID, AWS_POOL_CLIENT_ID } from 'react-native-dotenv';\n\nObject.keys(enhancements).forEach(key => (CognitoIdentityServiceProvider[key] = enhancements[key]));\n\nAWS.config.update({ region: AWS_REGION });\n\nexport const poolData = {\n  UserPoolId: AWS_POOL_ID,\n  ClientId: AWS_POOL_CLIENT_ID,\n};\n\nexport const userPool = new AWS.CognitoIdentityServiceProvider.CognitoUserPool(poolData);\n\nexport default AWS;\n```\n\n```js\n//import AWS and userPool\nimport AWS, { userPool } from './AWS';\n\n//component:\nstate = {\n  username: '',\n  password: '',\n}\n\nlogin = () => {\n  const { username, password } = this.state;\n  const authenticationData = { Username: username, Password: password };\n  const authenticationDetails = new AWS.CognitoIdentityServiceProvider.AuthenticationDetails(authenticationData);\n  const userData = { Username: username, Pool: userPool };\n  const cognitoUser = new AWS.CognitoIdentityServiceProvider.CognitoUser(userData);\n  cognitoUser.authenticateUser(authenticationDetails, {\n    onSuccess: (result) => {\n      console.log('result', result);\n      console.log('access token:', result.getAccessToken().getJwtToken());\n    },\n    onFailure: (error) => {\n      Alert.alert(error.code, error.message);\n    },\n  });\n}\n```\n","readmeFilename":"README.md"}