{"_id":"react-oidc","_rev":"22-0e9cfc0cfd4ef7a7227f35516d2b9fd6","name":"react-oidc","dist-tags":{"latest":"1.0.3","beta":"0.2.0-0","next":"0.4.0-alpha.0"},"versions":{"0.0.1":{"name":"react-oidc","version":"0.0.1","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"license":"MIT","gitHead":"beaaf4dfb7679c5bd8312205ddc5abe3b35dd169","_id":"react-oidc@0.0.1","_npmVersion":"6.1.0","_nodeVersion":"10.7.0","_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"dist":{"integrity":"sha512-co7mMYVvnu6f9BabLosRvRBpIAsOCdjKxUVvC8GdWapUeEVbYKD/xdPUiGl/5teGDK/RNNXWdu00iKiftxOSrA==","shasum":"cf5b82d0914e180e5638befca9caddeb438c73e1","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.0.1.tgz","fileCount":1,"unpackedSize":370,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbVrFlCRA9TVsSAnZWagAAHrAQAJoVlTYTGHTzbB0VmupU\njiOrGS/2YtEppyWF+LLZXhW3wsubEbFkMzySvLlDxyUv924/SRoYMWdqQcCW\nPpwbe8Hg5AUtukc/2ohdhreleVPhJRyO1AbLKGWLA/sYtSogbbemdcCSJ/sO\nIRIAn86v34NoNEU/mJ0nVuBtmrW3mYfiR8iXzi0nEZkzWDZlSoW/6fgr+KKi\n5y6yvbe9bJDDOFOXgFNBrL6U5h8QIY78cbjlnGXENidmuMvv7DFXCfQ8qhX/\nGy98Us9ay8JjPCjde4GcQh981vFgiU2tzFl/gaEYPTss6/BR8r5T3PyAqkED\nWkm80e8QlDN/nuYUQclmKLUIaURpBuTUWKWyusR2SzBsrMYl3Tvi+Sy+58Gj\ncrC9halnVKHDYmMsc/nMyHMGwokiksD8s80P7WxCizkSZW3Pl1xm4fZtA+CB\n1pLL8BhYMm/VWj1IBdiLCL0bxnYXi8KHnypFi3JMseVygB6HLW8I80lg5YMU\nEaYcfb/o+RUXfvrAtnPgGNpCWhgg2b/L7m3YVVJJMwAzksVMp9vUpMzBYvvj\n9W5TPU5suFwr7Gnwcjns/95BXo6xfB56a+byJKz64wwpy+wvMYjzF9TVVlhE\nn8TjYksWF7QVgxic0OQreUU2jEBmHVWE4Pt610z+o0YD+mCOItTdL1VCfLrC\nd0IJ\r\n=onlA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCK07E5tRTY9dZgXyUwQ/j25ry8goczAD8umagGuH4aegIhAKh31Sugp3Vv+va7uFQfwdbnuSdjJbkQav//0kLeeuOr"}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.0.1_1532408165529_0.36381327514823103"},"_hasShrinkwrap":false},"0.0.2":{"name":"react-oidc","version":"0.0.2","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"echo \"Error: no test specified\" && exit 1"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"github/thchia/react-oidc"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","@types/react-dom":"^16.0.6","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/react":"^16.4.7","@types/react-dom":"^16.0.6","react":"^16.4.1","react-dom":"^16.4.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"_id":"react-oidc@0.0.2","dist":{"shasum":"6a8463e2f832a08d73d6d130c7f6fa9d6c19000c","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.0.2.tgz","fileCount":18,"unpackedSize":14108,"integrity":"sha512-AztcYXkghvbvmqHB7JH72DVORsmNhD4w9HG3NDK0CoqyQUK+T1Zxnd0F7bxdrvn0q2zCVm0yr7euGvr8tBl+eQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC6z4R+3+j0Ll8dw7T228C19NBkrFworwW2k94ZNPuRPQIhAMcXBBTZFUdiUHuIzv8HQR7ecx8ZFpA/vw5/A7e3RMLW"}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.0.2_1532412937666_0.9727493145924642"},"_hasShrinkwrap":false},"0.0.3":{"name":"react-oidc","version":"0.0.3","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"echo \"Error: no test specified\" && exit 1"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","@types/react-dom":"^16.0.6","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/react":"^16.4.7","@types/react-dom":"^16.0.6","react":"^16.4.1","react-dom":"^16.4.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"_id":"react-oidc@0.0.3","dist":{"shasum":"aa485d5377f627e9d6bfef5f1e646f2b7ab01e48","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.0.3.tgz","fileCount":18,"unpackedSize":14108,"integrity":"sha512-qWstPI7qa4sl+OUgCRYGGXLb8HGdtHEUdi+XNTeVnOh8K34y9Ysh7CQZ5nC8mAH8ZjbAJAl/MzjCfl5510SUjg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID5aE18QvQW4tK4yicly6IQ72E0i4G1NCzkUHaZs6rhrAiEA0NzB1wnmudU2qn+/m1LHN3uMp8CHfXdkIDUbhSxWAcQ="}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.0.3_1532413064279_0.724676930435842"},"_hasShrinkwrap":false},"0.0.4":{"name":"react-oidc","version":"0.0.4","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"echo \"Error: no test specified\" && exit 1"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"_id":"react-oidc@0.0.4","dist":{"shasum":"a16bccc43dda064916cfb8667645aa057da2192d","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.0.4.tgz","fileCount":18,"unpackedSize":18419,"integrity":"sha512-q5GO95iRNPB6pIp9J+rupXxx6KhZ3IYFw7rsZy3+5mO+1OBWycepAoHRpJF0EZUPcu5GV0qzsuvW9Df+Js4rIw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDvkFtRRA7gJh02zf4dak0q8GEDKyl8+XQzRd8pKSGStQIgG8UgXNjvMTKD5zanOqIZT1vWHZwWm4vswF4VnFdwmsg="}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.0.4_1532433887456_0.10613410125608702"},"_hasShrinkwrap":false},"0.0.5":{"name":"react-oidc","version":"0.0.5","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"jest","test:watch":"jest --watch"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/jest":"^23.3.0","@types/react":"^16.4.7","jest":"^23.4.1","react":"^16.4.1","react-dom":"^16.4.1","react-testing-library":"^4.1.3","ts-jest":"^23.0.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"_id":"react-oidc@0.0.5","dist":{"shasum":"ae8984218d28915ef6dc2bfb1b97df4e03010aac","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.0.5.tgz","fileCount":27,"unpackedSize":22764,"integrity":"sha512-oRw09glt8AKSTfWqB919NDexgOkSGjDqkBsi44ZGWCw1RlnFWFWX3ILenaPVxI1dS4DX0SPCp+ASR6tFJSBghQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAGy8z/I+2jIVtOZhK4rb+SV+q5CcQrWHCgucuaCtWbYAiB/iZ+9oAtVmK4zb095I/h1k8eQncsjOo2vryvXzDxRjQ=="}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.0.5_1532488461793_0.7778076321158067"},"_hasShrinkwrap":false},"0.1.0":{"name":"react-oidc","version":"0.1.0","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"jest","test:watch":"jest --watch"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/jest":"^23.3.0","@types/react":"^16.4.7","jest":"^23.4.1","react":"^16.4.1","react-dom":"^16.4.1","react-testing-library":"^4.1.3","ts-jest":"^23.0.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"_id":"react-oidc@0.1.0","dist":{"shasum":"8d2e5f6715fc8e09146336bac27c98289a4285e7","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.1.0.tgz","fileCount":31,"unpackedSize":25628,"integrity":"sha512-NrAuAIfGiY2wTNoCZqH6gwTXQbz8IPVCozDa9oHdSgiqJ9NkNzge615r3Kgd8pHoyiewUKsZoA2jYsIoZEY/OA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDIVIPQMTdT2OEH0LlCLPUIsz2N1NTyY9lAvxRc3vHzKgIgFtY8LOcONzuFxIII0c75hY7gz1LbGlcS9+itibbXDuA="}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.1.0_1532497854280_0.7271495487833668"},"_hasShrinkwrap":false},"0.1.1":{"name":"react-oidc","version":"0.1.1","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"jest","test:watch":"jest --watch"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"git+https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/jest":"^23.3.0","@types/react":"^16.4.7","jest":"^23.4.1","react":"^16.4.1","react-dom":"^16.4.1","react-testing-library":"^4.1.3","ts-jest":"^23.0.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"gitHead":"d889ca150d45374f775fa82e301d23c1cae83d6d","bugs":{"url":"https://github.com/thchia/react-oidc/issues"},"homepage":"https://github.com/thchia/react-oidc#readme","_id":"react-oidc@0.1.1","_npmVersion":"6.1.0","_nodeVersion":"10.7.0","_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"dist":{"integrity":"sha512-WTT8AcFnnt/RmlaBCNU0DSAIib2utOdYT/bcyh3N8HoZuTEyqT3UHzbv1RhjG6Be5FjgftyOC3W0cajof1Lyvw==","shasum":"2ad8b55c76707618848089126bb10187c157b5cd","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.1.1.tgz","fileCount":25,"unpackedSize":146548,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcGQtVCRA9TVsSAnZWagAAkIYQAKIN217oG1nKoKcmIZjE\nazbCcktKfcmzh9p7mN8U4KP3Ar+Yr63WQGTLma2rou7Wft01GCyPFl6BvTW4\n7VzxpF69sDZxiVeocNn5Vdi/cnhBvP7ig1Adrc8x9EZawtashun3LgFyNN8Z\nvWAVXBgmoZ93398UAEa3rAbtvHxcwmBjA4RYa/B8/bpD3FNQQp5vE8KGkf98\n53tDFmuNNOjUW0qrviB7Q3CF79M3jo8wDouohal2ucDWCZyo+k72Pc3i853F\noPY/k+/uyD+ks/yqxXDa0FxdhKNSuCsxid59C02PBXmEcVnoDGV9Egv55HUz\n8Kj0JIr28rXukZlih9zaUN0p9/s0V0Dnkz8Cfg0Q5FL5YTmgRibYZqv/VtWq\nSUl+UompDUCHXdmTzKRZ2p7iynsUUMpjVYxqL2PhMFmBbFv7un0Mwzb49gkF\nc2Eyw+itC9pmei3T1r2OQ/zZEXi7eFQ2NNdyKzb5CnF2A739G0MCwavenoN8\ndgedspTjXukstFZFfdv3/MsD4YsvbxfJBknVWFkeUuiiT1OyWOV2xu9SHz8c\nSHq5WNZlBjzszsFU/nNqbc61bc3QsobHJ+gpqlDZuaP7u8ymTua4F+shTRdX\n7hq/GPo0Yv6HsHP/O5hMUsIxe0n2SKd6l7f6vfZ9O18+0HvarIECetim/Sea\nzZ18\r\n=KKEP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC1kAgYtXIi+AnxzwblWaVEFgwXjqg2vrQFV5Tf7Fq+VAiAVq6l4mN9bHiVI0c6DY1/0rQyKIzhppi/Qd7PV2+8sgw=="}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.1.1_1545145173080_0.42776766382741616"},"_hasShrinkwrap":false},"0.1.2-0":{"name":"react-oidc","version":"0.1.2-0","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"jest","test:watch":"jest --watch"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"git+https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/jest":"^23.3.0","@types/react":"^16.4.7","jest":"^23.4.1","react":"^16.4.1","react-dom":"^16.4.1","react-testing-library":"^4.1.3","ts-jest":"^23.0.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"readme":"# React OIDC\n\nWrapper for [oidc-client-js](https://github.com/IdentityModel/oidc-client-js), to be used in React apps.\n\n**This is an alpha version**\n\n## Quick start\n\n> You should read the [slow start](https://github.com/thchia/react-oidc#slow-start) and [Routing Considerations](https://github.com/thchia/react-oidc#routing-considerations) too\n\n```bash\nyarn add react-oidc\n```\n\nYou will need the [config](https://github.com/IdentityModel/oidc-client-js/wiki#configuration) for the `UserManager` class.\n\nExample using `react-router`\n\n```jsx\nimport { makeAuthenticator, makeUserManager, Callback } from 'react-oidc'\n\n// supply this yourself\nimport userManagerConfig from '../config'\n\nconst userManager = makeUserManager(userManagerConfig)\nconst AppWithAuth = makeAuthenticator({\n  userManager\n})(<App />)\n\nexport default () => (\n  <Router>\n    <Switch>\n      <Route\n        path=\"/callback\"\n        render={routeProps => (\n          <Callback\n            onSuccess={() => routeProps.history.push('/')}\n            userManager={userManager}\n          />\n        )}\n      />\n      <AppWithAuth />\n    </Switch>\n  </Router>\n)\n```\n\n## Slow start\n\nThere are 3 main parts to this library:\n\n- `makeUserManager` function;\n- `makeAuthenticator` function;\n- `Callback` component\n\n### `makeUserManager(config)`\n\n| Param    | Type                           | Required | Default Value | Description                            |\n| -------- | ------------------------------ | -------- | ------------- | -------------------------------------- |\n| `config` | object (`UserManagerSettings`) | Yes      | `undefined`   | Config object to pass to `UserManager` |\n\nHelper utility to create a `UserManager` instance.\n\n### `makeAuthenticator(params)(<ProtectedApp />)`\n\n| Param                  | Type          | Required | Default Value | Description                                                      |\n| ---------------------- | ------------- | -------- | ------------- | ---------------------------------------------------------------- |\n| `userManager`          | `UserManager` | Yes      | `undefined`   | `UserManager` instance (the result of `makeUserManager()`)       |\n| `placeholderComponent` | Component     | No       | `null`        | Optional component to render while auth state is being retrieved |\n\nThis is a higher-order function that accepts a `UserManager` instance, and optionally a placeholder component to render when user auth state is being retrieved. It returns a function that accepts a React component. This component should contain all components that you want to be protected by your authentication. Ultimately you will get back a component that either renders the component you passed it (if the user is authenticated), or redirects to the OIDC login screen as defined by the Identity Provider.\n\nThe lifecycle of this component is as follows:\n\n1.  The component is constructed with a fetching flag set to true.\n\n2.  On mount, the `.getUser()` method from `UserManager` is called. If the user is already authenticated, it will set the fetching flag to false and render the component you passed it.\n\n3.  If the user is not authenticated or their token has expired, the user will be redirected to the login URL (defined by the Identity Provider) and the fetching flag will be set to false.\n\n4.  Upon successful authentication with the Identity Provider, the user will be redirected to the `redirect_uri`. You should render the `Callback` component at this location.\n\n#### Note on the fetching flag\n\n> The fetching flag is set to `true` initially because of the asynchronous nature of `.getUser()`. There is a need to ensure that we do not redirect to the login page whilst `getUser` is resolving. Without some way of knowing when the user auth state query is complete, we would end up **always** redirecting to the login page.\n\n### `<Callback />`\n\n| Prop          | Type          | Required | Default Value | Description                                                                                     |\n| ------------- | ------------- | -------- | ------------- | ----------------------------------------------------------------------------------------------- |\n| `userManager` | `UserManager` | Yes      | `undefined`   | `UserManager` instance (the result of `makeUserManager()`)                                      |\n| `children`    | Component     | No       | null          | Optional component to render at the redirect page                                               |\n| `onError`     | function      | No       | `undefined`   | Optional callback if there is an error from the Promise returned by `.signinRedirectCallback()` |\n| `onSuccess`   | function      | No       | `undefined`   | Optional callback when the Promise from `.signinRedirectCallback()` resolves                    |\n\nThe `Callback` component will call the `.signinRedirectCallback()` method from `UserManager` and if successful, call the `onSuccess` prop. On error it will call the `onError` prop. You should pass the same instance of `UserManager` that you passed to `makeAuthenticator`.\n\n### `<UserData />`\n\nThis component exposes the data of the authenticated user. If you are familiar with React's Context API (the official v16.3.x one), this component is just a `Consumer`.\n\n```jsx\n<UserData>{context => <p>{context.user.id_token}</p>}</UserData>\n```\n\nRender prop function\n\n| Argument (key of `context`) | Type          | Description                                  |\n| --------------------------- | ------------- | -------------------------------------------- |\n| `signOut`                   | function      | Call this to sign the current user out       |\n| `user`                      | `User`        | This is the `User` object from `oidc-client` |\n| `userManager`               | `UserManager` | `UserManager` instance from `oidc-client`    |\n\n## Routing considerations\n\nThis library is deliberately unopinionated about routing, however there are restrictions from the `oidc-client` library that should be considered.\n\n1.  **There will be url redirects**. It is highly recommended to use a routing library like `react-router` to help deal with this.\n\n2.  **The `redirect_uri` should match eagerly**. You should not render the result of `makeAuthenticator()()` at the location of the `redirect_uri`. If you do, you will end up in a redirect loop that ultimately leads you back to the authentication page. In the quick start above, a `Switch` from `react-router` is used, and the `Callback` component is placed _before_ `AppWithAuth`. This ensures that when the user is redirected to the `redirect_uri`, `AppWithAuth` is not rendered. Once the user data has been loaded into storage, `onSuccess` is called and the user is redirected back to a protected route. When `AppWithAuth` loads now, the valid user session is in storage and the protected routes are rendered.\n","readmeFilename":"README.md","gitHead":"40447a1aecba2e8aded496c43d75b48bc1f13c75","bugs":{"url":"https://github.com/thchia/react-oidc/issues"},"homepage":"https://github.com/thchia/react-oidc#readme","_id":"react-oidc@0.1.2-0","_npmVersion":"6.1.0","_nodeVersion":"10.7.0","_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"dist":{"integrity":"sha512-xVcUH9zZCqJ3hziGHwdA2UUV//Gb2pQprnd1oSdJHjT7mGWNkJtc5YmTLxWZk1myxxj5uODpdpZGyrW0DcYT/Q==","shasum":"d551cc6633d6491ba25bd8f1c81e7d1b9dd23fef","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.1.2-0.tgz","fileCount":25,"unpackedSize":146649,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcG3rhCRA9TVsSAnZWagAAuJMQAJNs2hUiH69Oz5K0t6e+\nC+GA7DnTM2l7ZXQw4wGJS9iwpGqevGGGp1kaM7V536BJqxzoCZlOkQA1c3D8\n1vQgaErMPmm/1naNholflekkEc/OJ11y2AZIzN5LLxQspksFCTzuvOEFhgVq\nhOKRf5JdT1qbyElkGIrwDR2P/BoqjFX5KVH8FGB0xMXVheiBrCBXdGfexyfc\n6PUnya2Jl8ykuEhQi6i3HatuKUGU2DGdDUERRPMITXl6yyMRH11TrLN1601T\nsCzBckJoWLHfVT+cS5Nkph4eYyS4bK07O3CueMePaXJPYuQnNkvgrU7n4hoj\njTtqnhOnCuaZII6yzZ74cVeXDxL2HxQN9lIhATOD0wnc6v9aAx/otylVG45I\nobRjcISXJVYZDPNc11AzgZIYytRSCWS00PhwwORQWGXPCNsjJFPbXNDa8lkF\n/bNURFIWOC9o4XOzvhQTTNM0955LT8n489khzYGSMKdXLZ+twmBePez1KGxn\ndntGFUYATqu+a5Ny4rAKLUpjE3AVO9w40Dz+9IZ54sMi1gZo7DBCf29s6+G2\n2qpChEqQudLwH6a+i1/8j22jHre1Sa6NJOlEvX8qFiJNaKbtv4TmwZAJF+Sj\nHIKi0PlcNmdwI4zuMo8OoRm2+xiibjHvifYko7l6axsHFZzuq8yDz6MCoFd1\n3Knk\r\n=RA0T\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCPH9BYX8noQaFqKr6YqM62pxsJ1ew1NFTn2EkNtk4mLgIhAMEIsGrQ64KNHMojqoJSSXDFpjJvxH2ub5gjC28u0OCc"}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.1.2-0_1545304801279_0.279820854782759"},"_hasShrinkwrap":false},"0.1.2":{"name":"react-oidc","version":"0.1.2","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"jest","test:watch":"jest --watch"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"git+https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/jest":"^23.3.0","@types/react":"^16.4.7","jest":"^23.4.1","react":"^16.4.1","react-dom":"^16.4.1","react-testing-library":"^4.1.3","ts-jest":"^23.0.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"gitHead":"1e84d491fdeff6c7d2bab85d161a2482d99a6994","bugs":{"url":"https://github.com/thchia/react-oidc/issues"},"homepage":"https://github.com/thchia/react-oidc#readme","_id":"react-oidc@0.1.2","_npmVersion":"6.1.0","_nodeVersion":"10.7.0","_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"dist":{"integrity":"sha512-qyPvVDKF9ykGRfSPUVD7FDKVg7NIyngb6ejiQ1tEYiGj0r/LIi1GJk2ZUJEXx/powxg2Nsqbn6ih71KLBbdMsg==","shasum":"dd8b14de3aa0f691403a61367bc7e371aacd6d7f","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.1.2.tgz","fileCount":25,"unpackedSize":146647,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcHHgoCRA9TVsSAnZWagAA5ZsP/0qqnUoFo8glaEeoSnGI\nPy5Mt149iiYNeUmmX99DROC2mi8ubWOQVASrOByDY+mY+8IMnVpfcJSxpktg\nlcP6/EWWHgBcxg/wiiG+Ob+Q5jjl4cEQsrn75MHVw4G9pisBogD5ZrTQdyjn\n9GRT66QsPNOGLmHPhCQ5BUOgqWwoMc/NbrWOXvqtt+yWeMFHOq/UB0Jc+ipN\nfGzz7h6500JJ+gzETQ4m+6tNKbNjavy+h+NVs9T3IwNrZddlCzpgIvAIBfkZ\ncZB03a11+yH5uwHDGZoeKT+Beu3WJ7Xgl1NZo8CCXIEBeeDOEP6xJkPgnyUm\nHkNrAT5w7TW8+SHbVQ4U1GGjDbsJ9AQTivupKV0jscQuJfS08vpkqMRymxTj\ntJQfj/RAHpB0UiHBKxWXhc8HpPdgPPp3ire4Eq662QtMn+wlBuGKKUG0Q9zk\n0dAepARzaC90lRTkELlNZNuqDZXuXUrwnjGvXr8Fb2C81PMb43x3l0zctxrd\nRb1523tUX52oVufsrHjkRAARDDs7rRzFWH7lyRwIzryF6Amx0AuIW4isfJL2\nRWZe38PYPT225bNUAcFNhb9PdPDMrKzHTi7BGEG0U3rlzr9Gz9IIsuhnqxUR\nuZnTDQrMcvM2C7ovs2sWVf4i4VqHSJC+7jyl9VuoezwKS9cbwdcca42DS+ch\n5PjF\r\n=TE3A\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEkvW3xwKug9SONqlpbUZsYIop+LIv8PKAMBp1zVbn7bAiB3c7nPfZrwt0FqDQpienEHtnaEA92F6XQtpCGmNFDt2A=="}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.1.2_1545369639368_0.4981986795816249"},"_hasShrinkwrap":false},"0.2.0-0":{"name":"react-oidc","version":"0.2.0-0","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"jest","test:watch":"jest --watch"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"git+https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/jest":"^23.3.0","@types/react":"^16.4.7","jest":"^23.4.1","react":"^16.4.1","react-dom":"^16.4.1","react-testing-library":"^4.1.3","ts-jest":"^23.0.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"readme":"# React OIDC\n\nWrapper for [oidc-client-js](https://github.com/IdentityModel/oidc-client-js), to be used in React apps.\n\n**This is an alpha version**\n\n## Quick start\n\n> You should read the [slow start](https://github.com/thchia/react-oidc#slow-start) and [Routing Considerations](https://github.com/thchia/react-oidc#routing-considerations) too\n\n```bash\nyarn add react-oidc\n```\n\nYou will need the [config](https://github.com/IdentityModel/oidc-client-js/wiki#configuration) for the `UserManager` class.\n\nExample using `react-router`\n\n```jsx\nimport { makeAuthenticator, makeUserManager, Callback } from 'react-oidc'\n\n// supply this yourself\nimport userManagerConfig from '../config'\n\nconst userManager = makeUserManager(userManagerConfig)\nconst AppWithAuth = makeAuthenticator({\n  userManager\n})(<App />)\n\nexport default () => (\n  <Router>\n    <Switch>\n      <Route\n        path=\"/callback\"\n        render={routeProps => (\n          <Callback\n            onSuccess={() => routeProps.history.push('/')}\n            userManager={userManager}\n          />\n        )}\n      />\n      <AppWithAuth />\n    </Switch>\n  </Router>\n)\n```\n\n## Slow start\n\nThere are 3 main parts to this library:\n\n- `makeUserManager` function;\n- `makeAuthenticator` function;\n- `Callback` component\n\n### `makeUserManager(config)`\n\n| Param    | Type                           | Required | Default Value | Description                            |\n| -------- | ------------------------------ | -------- | ------------- | -------------------------------------- |\n| `config` | object (`UserManagerSettings`) | Yes      | `undefined`   | Config object to pass to `UserManager` |\n\nHelper utility to create a `UserManager` instance.\n\n### `makeAuthenticator(params)(<ProtectedApp />)`\n\n| Param                  | Type          | Required | Default Value | Description                                                      |\n| ---------------------- | ------------- | -------- | ------------- | ---------------------------------------------------------------- |\n| `userManager`          | `UserManager` | Yes      | `undefined`   | `UserManager` instance (the result of `makeUserManager()`)       |\n| `placeholderComponent` | Component     | No       | `null`        | Optional component to render while auth state is being retrieved |\n\nThis is a higher-order function that accepts a `UserManager` instance, and optionally a placeholder component to render when user auth state is being retrieved. It returns a function that accepts a React component. This component should contain all components that you want to be protected by your authentication. Ultimately you will get back a component that either renders the component you passed it (if the user is authenticated), or redirects to the OIDC login screen as defined by the Identity Provider.\n\nThe lifecycle of this component is as follows:\n\n1.  The component is constructed with a fetching flag set to true.\n\n2.  On mount, the `.getUser()` method from `UserManager` is called. If the user is already authenticated, it will set the fetching flag to false and render the component you passed it.\n\n3.  If the user is not authenticated or their token has expired, the user will be redirected to the login URL (defined by the Identity Provider) and the fetching flag will be set to false.\n\n4.  Upon successful authentication with the Identity Provider, the user will be redirected to the `redirect_uri`. You should render the `Callback` component at this location.\n\n#### Note on the fetching flag\n\n> The fetching flag is set to `true` initially because of the asynchronous nature of `.getUser()`. There is a need to ensure that we do not redirect to the login page whilst `getUser` is resolving. Without some way of knowing when the user auth state query is complete, we would end up **always** redirecting to the login page.\n\n### `<Callback />`\n\n| Prop          | Type          | Required | Default Value | Description                                                                                     |\n| ------------- | ------------- | -------- | ------------- | ----------------------------------------------------------------------------------------------- |\n| `userManager` | `UserManager` | Yes      | `undefined`   | `UserManager` instance (the result of `makeUserManager()`)                                      |\n| `children`    | Component     | No       | null          | Optional component to render at the redirect page                                               |\n| `onError`     | function      | No       | `undefined`   | Optional callback if there is an error from the Promise returned by `.signinRedirectCallback()` |\n| `onSuccess`   | function      | No       | `undefined`   | Optional callback when the Promise from `.signinRedirectCallback()` resolves                    |\n\nThe `Callback` component will call the `.signinRedirectCallback()` method from `UserManager` and if successful, call the `onSuccess` prop. On error it will call the `onError` prop. You should pass the same instance of `UserManager` that you passed to `makeAuthenticator`.\n\n### `<UserData />`\n\nThis component exposes the data of the authenticated user. If you are familiar with React's Context API (the official v16.3.x one), this component is just a `Consumer`.\n\n```jsx\n<UserData>{context => <p>{context.user.id_token}</p>}</UserData>\n```\n\nRender prop function\n\n| Argument (key of `context`) | Type          | Description                                  |\n| --------------------------- | ------------- | -------------------------------------------- |\n| `signOut`                   | function      | Call this to sign the current user out       |\n| `user`                      | `User`        | This is the `User` object from `oidc-client` |\n| `userManager`               | `UserManager` | `UserManager` instance from `oidc-client`    |\n\n## Routing considerations\n\nThis library is deliberately unopinionated about routing, however there are restrictions from the `oidc-client` library that should be considered.\n\n1.  **There will be url redirects**. It is highly recommended to use a routing library like `react-router` to help deal with this.\n\n2.  **The `redirect_uri` should match eagerly**. You should not render the result of `makeAuthenticator()()` at the location of the `redirect_uri`. If you do, you will end up in a redirect loop that ultimately leads you back to the authentication page. In the quick start above, a `Switch` from `react-router` is used, and the `Callback` component is placed _before_ `AppWithAuth`. This ensures that when the user is redirected to the `redirect_uri`, `AppWithAuth` is not rendered. Once the user data has been loaded into storage, `onSuccess` is called and the user is redirected back to a protected route. When `AppWithAuth` loads now, the valid user session is in storage and the protected routes are rendered.\n","readmeFilename":"README.md","gitHead":"2db3af61c4bf41916cee8a96d06d397888847142","bugs":{"url":"https://github.com/thchia/react-oidc/issues"},"homepage":"https://github.com/thchia/react-oidc#readme","_id":"react-oidc@0.2.0-0","_npmVersion":"6.1.0","_nodeVersion":"10.7.0","_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"dist":{"integrity":"sha512-iopEVWCfObveKbjf6/aOQZoOOlF5qRusTc9QiPgPUBseHDvnD86U1RKSZdrb1AlFBJWmPmcqXrmp3CFBerNsHg==","shasum":"09c451320517363e837d5e232efc20ba4600fff2","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.2.0-0.tgz","fileCount":25,"unpackedSize":150536,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcHJzDCRA9TVsSAnZWagAA+CoP/0qink1VF4D/wkYv1QrW\n0tsNxkSBPrRzj0OAMZXvkpEoDPRib3FvP3MZ21y1NZGo5tNpsVcuaKtZ/8Vc\nlTutIyJA1nFOz+P8tSXJqcwWlxJEOs0rssNLzBpYpxCqBFiRUweytrcqvKGu\nJy5ancqYk3hwzAs6aWqNgSoLyv3HH0HQEoq0a/b54wVv4keM5hFviJX5g7Hd\nP0Hz+lPxuXYTRHZvuXWBkry3krkjtmLCxMoK2G88nzDkrayZZBzAPqC0s6lG\nzaV+uX5Slb871Yn6ifzFKwRUSXZz0sVrhAF35nzPpu3jva+ihdKwZvFTLDuF\n9YHYtSYIio+++HTrxiKAZVbo+IgbebYQHS6EIiyZWXcAAHJ9bgYbgLSGiSgm\nRHSPFHjkJ8L6mG6JJ+U/bPylevEJrIMnO/qYui8HS+T6crASr5DpbVwZPPx4\nkXZHDHiCsH7W8aBavzCscQmg3Vabr6nQ0PUAqMkhnIDRxQASqrT5qClVhxeD\nnraqJsVkncOu5uHK9pM3+HFKx8HHdqbx9H07yJ7l0dHNP+3oJzS3fGwts3SH\ndI2/5tx4DKeuUQvFmYoiexiX714QcKBFV7BV1pTCgMYf8ARmjCCnMIWKdNi6\nvpjwTXKcq3TOcP6fhDcFhWu0soSztAaoh9oKKNkWVXR9NiKSxvyENq0kKQMm\nQnvd\r\n=y9iP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwOO/aPpAqHVxGsJ0sJEMnipG8qp1XTmqGi47bQcl6uAIgUhFfT6znF3+KAiJgnsf6TyY3EYCAstWV/j3Yd70dDTQ="}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.2.0-0_1545379011260_0.7461604534548665"},"_hasShrinkwrap":false},"0.2.1":{"name":"react-oidc","version":"0.2.1","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"jest","test:watch":"jest --watch"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"git+https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/jest":"^23.3.0","@types/react":"^16.4.7","jest":"^23.4.1","react":"^16.4.1","react-dom":"^16.4.1","react-testing-library":"^4.1.3","ts-jest":"^23.0.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"gitHead":"771084783f6336341e9d6dc7e67ae4d7f999cebe","bugs":{"url":"https://github.com/thchia/react-oidc/issues"},"homepage":"https://github.com/thchia/react-oidc#readme","_id":"react-oidc@0.2.1","_npmVersion":"5.6.0","_nodeVersion":"9.11.2","_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"dist":{"integrity":"sha512-LURjDyI5LLAKFw4XlP+TfGv4WqQrZ5yA+ma8BgqsXnYNdBPC2AmEq/I2/wi/16iYgk4vI/Olcvw5C3kVWvmrWw==","shasum":"1f1206a07f3f68a7e7e60dc979f34bd1c8839b26","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.2.1.tgz","fileCount":25,"unpackedSize":150569,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcIKWcCRA9TVsSAnZWagAAQ5wP/2C6LRVDPGXkdYJ7oqej\nGro8bvfdb/IYuCM9pXPIOxZMgD/eQNHRx2HeZFZxbhbbZv57+S0fp0Z4ossY\nTX5OHz3V49uBoA8wLRHRVOC3k1Ac+pU86V7dQS90YzOOXAYcScDQpumGXUGN\nqGLJ2GLPIGThszAkR00GEph5hdPVMYu15ZE8dLTWDXeo6FL/BX0B1n9MuB71\nJ5sykhUdQV+jjgq8BRcgOeV0UbeVQ4b/fk2R3+8UO2FF+K84mAq31uixtpWV\nCu5r7Jet9iy96oGUGQH0wsipqDbneS5CBM80uUvUBisYaUGGtEfIaufurJyq\n6zfux8Ocy2Bi+R2ICRtmTpSYS+7BrKGdGrXt6LTmeUxD2ZBC+HFNqmBqFuBb\nXeCHZ9MnFQfjgbYuk0Ce5BH73hj1rJdDAYp1H1qdGVwij/uoP6bw6vVbwgqZ\nysflI2nVfBq+3pOr8CGC3YxDOMeYBocITQYUxq3DrF36RD+MNdu9pw6EkAO7\nx/djUcg6CmpZkZPrh7KcxTocCrR4TE2KVLP2o881iY42c1ct+c0Qee8kWj7Y\nlOuHgleqAoNKZYOasrSmIySQ9EP76myZeGd7JBMGgZr+k+Y3QjZ7u1wwKk2n\na9D8Kpr6LW9tT2VCws5YPMv19yl1CRyp53KKi8pq3TyheWARWvuBI/GtrhT5\nBM4l\r\n=7h7R\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEq7M5Uc6XwKWIGeNbI5ibBK3BZ+uvNPaUO/YcUBxgcUAiEAoH4fZvRVnFOf5qFsA0P9gOsjgQAH+L2NWu87v2YyCuk="}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.2.1_1545643420205_0.2109675946801639"},"_hasShrinkwrap":false},"0.3.0":{"name":"react-oidc","version":"0.3.0","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"jest","test:watch":"jest --watch"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"git+https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/jest":"^23.3.0","@types/react":"^16.4.7","jest":"^23.4.1","react":"^16.4.1","react-dom":"^16.4.1","react-testing-library":"^4.1.3","ts-jest":"^23.0.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"gitHead":"3cc8e4fdcad520016eb50318a7f5b406bd312524","bugs":{"url":"https://github.com/thchia/react-oidc/issues"},"homepage":"https://github.com/thchia/react-oidc#readme","_id":"react-oidc@0.3.0","_npmVersion":"6.1.0","_nodeVersion":"10.7.0","_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"dist":{"integrity":"sha512-LtvXQ19GC4KyLEhLvRivFh26BDFqOyKVxZROemxbnRz1IlwmG7wEd1A787I2psXK+0JIWsOq4rMiIFVT1Uidkw==","shasum":"e3b373c4a1e67eba06db32c5af682b14d339dcb3","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.3.0.tgz","fileCount":25,"unpackedSize":150651,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcLxRlCRA9TVsSAnZWagAACogP/0JJPVf2shDxclPFV9T0\no8wlHeCaUgfYgMQ656zMcCzIKAzUAQtpeu0bxCE68ygNrKWsbwn3jSFdDTj/\nYmBF7l2W39fD6NANfmByXh6Ex/K3ENstURxnHWIuxc2z/YqwSoNGyW0YCE4b\n++qbc6a5HbMqEIWuKHX60sYMUWY3FpRb+j5F3LgasGV1Utgm+EZuXmA1fGkh\nytQJ327T/YfGGt4ebTswq1Ab/l2nDzjQWup4JiJI6cm8WU0GmjOIbsdF7uJg\n27ZF7FB8asw1aozhQJt3dvzSglIXUZlvYj9jM/t0iBlAYXLR21g/CZlNpuVf\nmhsNUBdwcD8H3AO2SxyDtOKrGjPZ4hWuYWje+rE4LwfDYltsOf08efQ4LDeO\nwd5YFeL+CUChugTLtdzloKjxakyAKv3y2YpVvTe892p2MqFXcXNt5YXxjUxt\nuL956h50UwIjyVKNirA8WzJ68jz8eT7H2sqOZhnJpu+YPODYBTuIA6OBCVN3\nq8QC23TYxEqpuh7ksztH5CzXGDiCfvajSxIljBTg+bj3EwYZJ7sB1AdCo5Kc\np+AnNRZcVPQFZI4edKjtybOs72SNOk1322G2ylEca6p8Z/NkpHiofVnToO+9\n/iAtW5Ngq2cDJa5xa16i98Ce0bNtcQ+B9Q9Ba3F4xemj795osJDyJ13RDd9c\n9+uC\r\n=hGDU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCLvDbrP7UuQbLV+jdMbJQiCRiBEglu7rf9Bei0BCctpAIhAKtexzE0Sx5Hv1rf7WtLRyr2I46mUegB8pgVqeRmfKxU"}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.3.0_1546589285067_0.2950330948975286"},"_hasShrinkwrap":false},"0.4.0-alpha.0":{"name":"react-oidc","version":"0.4.0-alpha.0","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"jest","test:watch":"jest --watch"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"git+https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/jest":"^23.3.0","@types/react":"^16.4.7","jest":"^23.4.1","react":"^16.4.1","react-dom":"^16.4.1","react-testing-library":"^4.1.3","ts-jest":"^23.0.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"readme":"# React OIDC\n\nWrapper for [oidc-client-js](https://github.com/IdentityModel/oidc-client-js), to be used in React apps.\n\n**This is an alpha version**\n\n## Quick start\n\n> You should read the [slow start](https://github.com/thchia/react-oidc#slow-start) and [Routing Considerations](https://github.com/thchia/react-oidc#routing-considerations) too\n\n```bash\nyarn add react-oidc\n```\n\nYou will need the [config](https://github.com/IdentityModel/oidc-client-js/wiki#configuration) for the `UserManager` class.\n\nExample using `react-router`\n\n```jsx\nimport {\n  makeAuthenticator,\n  makeUserManager,\n  Callback,\n  SignoutCallback\n} from 'react-oidc'\n\n// supply this yourself\nimport userManagerConfig from '../config'\n\nconst userManager = makeUserManager(userManagerConfig)\nconst AppWithAuth = makeAuthenticator({\n  userManager\n})(<App />)\n\nexport default () => (\n  <Router>\n    <Switch>\n      <Route\n        path=\"/callback\"\n        render={routeProps => (\n          <Callback\n            onSuccess={() => routeProps.history.push('/')}\n            userManager={userManager}\n          />\n        )}\n      />\n      <Route\n        path=\"/logout\"\n        render={routeProps => (\n          <SignoutCallback\n            onSuccess={() => routeProps.history.push('/')}\n            userManager={userManager}\n          />\n        )}\n      />\n      <AppWithAuth />\n    </Switch>\n  </Router>\n)\n```\n\n## Slow start\n\nThere are 4 main parts to this library:\n\n- `makeUserManager` function;\n- `makeAuthenticator` function;\n- `Callback` component;\n- `SignoutCallback` component\n\n### `makeUserManager(config)`\n\n| Param    | Type                           | Required | Default Value | Description                            |\n| -------- | ------------------------------ | -------- | ------------- | -------------------------------------- |\n| `config` | object (`UserManagerSettings`) | Yes      | `undefined`   | Config object to pass to `UserManager` |\n\nHelper utility to create a `UserManager` instance.\n\n### `makeAuthenticator(params)(<ProtectedApp />)`\n\n| Param                  | Type          | Required | Default Value | Description                                                      |\n| ---------------------- | ------------- | -------- | ------------- | ---------------------------------------------------------------- |\n| `userManager`          | `UserManager` | Yes      | `undefined`   | `UserManager` instance (the result of `makeUserManager()`)       |\n| `placeholderComponent` | Component     | No       | `null`        | Optional component to render while auth state is being retrieved |\n\nThis is a higher-order function that accepts a `UserManager` instance, and optionally a placeholder component to render when user auth state is being retrieved. It returns a function that accepts a React component. This component should contain all components that you want to be protected by your authentication. Ultimately you will get back a component that either renders the component you passed it (if the user is authenticated), or redirects to the OIDC login screen as defined by the Identity Provider.\n\nThe lifecycle of this component is as follows:\n\n1.  The component is constructed with a fetching flag set to true.\n\n2.  On mount, the `.getUser()` method from `UserManager` is called. If the user is already authenticated, it will set the fetching flag to false and render the component you passed it.\n\n3.  If the user is not authenticated or their token has expired, the user will be redirected to the login URL (defined by the Identity Provider) and the fetching flag will be set to false.\n\n4.  Upon successful authentication with the Identity Provider, the user will be redirected to the `redirect_uri`. You should render the `Callback` component at this location.\n\n#### Note on the fetching flag\n\n> The fetching flag is set to `true` initially because of the asynchronous nature of `.getUser()`. There is a need to ensure that we do not redirect to the login page whilst `getUser` is resolving. Without some way of knowing when the user auth state query is complete, we would end up **always** redirecting to the login page.\n\n### `<Callback />`\n\n| Prop          | Type          | Required | Default Value | Description                                                                                     |\n| ------------- | ------------- | -------- | ------------- | ----------------------------------------------------------------------------------------------- |\n| `userManager` | `UserManager` | Yes      | `undefined`   | `UserManager` instance (the result of `makeUserManager()`)                                      |\n| `children`    | Component     | No       | null          | Optional component to render at the redirect page                                               |\n| `onError`     | function      | No       | `undefined`   | Optional callback if there is an error from the Promise returned by `.signinRedirectCallback()` |\n| `onSuccess`   | function      | No       | `undefined`   | Optional callback when the Promise from `.signinRedirectCallback()` resolves                    |\n\nThe `Callback` component will call the `.signinRedirectCallback()` method from `UserManager` and if successful, call the `onSuccess` prop. On error it will call the `onError` prop. You should pass the same instance of `UserManager` that you passed to `makeAuthenticator`.\n\n### `<SignoutCallback />`\n\n| Prop          | Type          | Required | Default Value | Description                                                                                      |\n| ------------- | ------------- | -------- | ------------- | ------------------------------------------------------------------------------------------------ |\n| `userManager` | `UserManager` | Yes      | `undefined`   | `UserManager` instance (the result of `makeUserManager()`)                                       |\n| `children`    | Component     | No       | null          | Optional component to render at the redirect page                                                |\n| `onError`     | function      | No       | `undefined`   | Optional callback if there is an error from the Promise returned by `.signoutRedirectCallback()` |\n| `onSuccess`   | function      | No       | `undefined`   | Optional callback when the Promise from `.signoutRedirectCallback()` resolves                    |\n\nThe `SignoutCallback` component will call the `.signoutRedirectCallback()` method from `UserManager` and if successful, call the `onSuccess` prop. On error it will call the `onError` prop. You should pass the same instance of `UserManager` that you passed to `makeAuthenticator`.\n\n### `<UserData />`\n\nThis component exposes the data of the authenticated user. If you are familiar with React's Context API (the official v16.3.x one), this component is just a `Context`.\n\n```jsx\n<UserData.Consumer>\n  {context => <p>{context.user.id_token}</p>}\n</UserData.Consumer>\n```\n\nRender prop function\n\n| Argument (key of `context`) | Type          | Description                                  |\n| --------------------------- | ------------- | -------------------------------------------- |\n| `signOut`                   | function      | Call this to sign the current user out       |\n| `user`                      | `User`        | This is the `User` object from `oidc-client` |\n| `userManager`               | `UserManager` | `UserManager` instance from `oidc-client`    |\n\n## Routing considerations\n\nThis library is deliberately unopinionated about routing, however there are restrictions from the `oidc-client` library that should be considered.\n\n1.  **There will be url redirects**. It is highly recommended to use a routing library like `react-router` to help deal with this.\n\n2.  **The `redirect_uri` should match eagerly (for both login and logout)**. You should not render the result of `makeAuthenticator()()` at the location of the `redirect_uri`. If you do, you will end up in a redirect loop that ultimately leads you back to the authentication page. In the quick start above, a `Switch` from `react-router` is used, and the `Callback` component is placed _before_ `AppWithAuth`. This ensures that when the user is redirected to the `redirect_uri`, `AppWithAuth` is not rendered. Once the user data has been loaded into storage, `onSuccess` is called and the user is redirected back to a protected route. When `AppWithAuth` loads now, the valid user session is in storage and the protected routes are rendered.\n","readmeFilename":"README.md","gitHead":"8e813bc33e198d9b78e3e04dcafeb16203d76288","bugs":{"url":"https://github.com/thchia/react-oidc/issues"},"homepage":"https://github.com/thchia/react-oidc#readme","_id":"react-oidc@0.4.0-alpha.0","_npmVersion":"6.1.0","_nodeVersion":"10.7.0","_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"dist":{"integrity":"sha512-s8jMglKObcEfKuT8DZrZ71nlDYAx3hPxM02JHx9G8zyWb13a7Iz29PY1cuUm2kgIJ1shnnopqlRDwg5FImjD0g==","shasum":"e09d620a5f055a7c0aa515f8e9c95214c6390600","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.4.0-alpha.0.tgz","fileCount":53,"unpackedSize":291527,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcOLF6CRA9TVsSAnZWagAAjoYQAJ9SzDA702wTI3ldbcui\nFWYwpQnFC0Z6FS+Hc9L1fiWn8IE9KslvQUsGEfWYtta+Xgd2DVSlQsfn+yTA\nfO40Kups+ryf2dDN/j6YeFwbb5hLkink/qjKN+Ce128PJd4ms4r52t/RY4GJ\nEwi38zQ3H16BaAcwBbKATk+89qQQ6byRH7znuOMxVXZKTwlQWyJM/czLyzZ5\no54obY3FJOL9Hucoyr0jLkiO0Vbm991/TT4RVFaoiBBY4cNmik8MNqS2W0jY\n3xQNSA+phXAiFJy7rkLKrk3uR7Sm7fW6QXZ8Tv+raamEDV1XR7I7XmhZ++zB\nV7ThJsfR72vCN3aTwqiChgFdDxEhXOPRbHyFM5VAHdZC7yit1ioO5oRx09NP\nn2+JRFmxXcf0wea4wubaaQ3y8TTa9GpbulSKxVLkGkoVAS0D1H9dXzLipRY8\nk8Qgjq4uH535NCIt2J27AXpD4f1OSDdvfSCcIROcSFpc5WA2BRBzfgYgU6IJ\n/LDBcJkf8994e02fSRCnjmju6YZV7/yQTJ4pzAhBf7thnTNSavgcNZRwdl2e\nDe64sUNM7kl1P1SF1wOmG8GwQgiwpD62O+x0940hn0sOOSgz2fy0Q2cFhrIq\n/fUWOHQeV75q85ODMSUyInuJVjC5TExJl7wuQ6ei2iqjANyDJaM1EBz3LWph\ntdFs\r\n=Lob1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD16IZQEjnRFq7jtpeC08mTjdNGekq2W4mLLJ1ePoUU1gIgbsIp6oVIE3q0NYNkAGt3UrlwxGZBh8bIP6DGd9ET0Qc="}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.4.0-alpha.0_1547219322225_0.007036087035232397"},"_hasShrinkwrap":false},"0.3.1":{"name":"react-oidc","version":"0.3.1","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"jest","test:watch":"jest --watch"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"git+https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/jest":"^23.3.0","@types/react":"^16.4.7","jest":"^23.4.1","react":"^16.4.1","react-dom":"^16.4.1","react-testing-library":"^4.1.3","ts-jest":"^23.0.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"gitHead":"33ecbe14e54c9716861fc75d931462c4b5a6e1f8","bugs":{"url":"https://github.com/thchia/react-oidc/issues"},"homepage":"https://github.com/thchia/react-oidc#readme","_id":"react-oidc@0.3.1","_npmVersion":"6.1.0","_nodeVersion":"10.7.0","_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"dist":{"integrity":"sha512-V/E61D9vSY0WGaroOnVlsfL7Za7I2p5ArI7a4qSU2QRFW2CeZlKhLI95JNsTUkleC9YHoUT1u/WWSpzweGfX7w==","shasum":"f0d7d49d9d0ad0ac231b27bbafc549632ad6c3e4","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.3.1.tgz","fileCount":47,"unpackedSize":286980,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcQJAFCRA9TVsSAnZWagAAHFQP/2iCR8BKa2MkOQC63uKk\nCJFXPLuMm0HwGDhPRb7nM5aUz0CFT/lhbKy1lLjB/LvLVocjo2ybQOeKFhUh\n4SpoBEEqQR60cRSsDLu/uub+MEUnJThUmufKozfs0jzxohKXT0zCSMEF8Zex\nAWGwM1g9M5+BKtc7DFbHSa5dGsd0pnMsGH1rIpv/Vkj33P2Pn7hCaICKkPev\ndCOg0Fijgu5Q3byziG7E0yow1IKl7RYLX7JLnFXXETNjSwKFNToQfncvgNJm\nC4dWBdOo8/V/+pkmW7n7I9IQ/Uk4wFIhMTJ1rRgSTbicq1cwH/BBi68KSnjH\n049Yz8hclIXLKtByOTJFK89VagZ/4u5Sr7F5KFq7fdEKD7wM6Ivvb80cxZdv\nmjj22gjqEE77tVeX6A/R4wJ3Sxgdp5mY+iYzpRmGn3MnIh6qreY20WLeRJhk\nYKlPlLCOSVFqaQSJBi9OAdQiG+1juyqvR9S7HsVv3JUf3svMl88ZJAue2SWU\nJ2rkjQ7qE9CtrJnyguzNX584QEPOXfF4Bhjc4PK0Or9OwHQBj9t8UTngrJd2\nNRgXbaOgP++Xm1KfEVkgrPohHAvtMopxocb2QgEQ8pBhgX6VQj1MgzyKZ9tM\nwM8uT2aKRnqsVbTJcnQ1nYmSl5mnUIObU1yAFzFvgs6YmAv0nYg+2Rq4FoOY\neZ0x\r\n=Tbz4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDFAjgJkdEcn6VzJBUu1SW3aEFv9zGmUu7WCKPABYMmTAiAq1qMTa4x1OpCqMXzcq6HbbJgsadFT5xip1uQCgFIPEQ=="}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.3.1_1547735044292_0.8924155914363809"},"_hasShrinkwrap":false},"0.3.2":{"name":"react-oidc","version":"0.3.2","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"jest","test:watch":"jest --watch"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"git+https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/jest":"^23.3.0","@types/react":"^16.4.7","jest":"^23.6","react":"^16.4.1","react-dom":"^16.4.1","react-testing-library":"^4.1.3","ts-jest":"^23.0.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"gitHead":"49293dacade4be128438c0b9d388b2b246e986a8","bugs":{"url":"https://github.com/thchia/react-oidc/issues"},"homepage":"https://github.com/thchia/react-oidc#readme","_id":"react-oidc@0.3.2","_npmVersion":"6.1.0","_nodeVersion":"10.7.0","_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"dist":{"integrity":"sha512-AYvBAJ5z/7hJ9RPWbGr0wb/+oPaVWPs9N9UJBKzm4libGchNHyv45yvh+5axvozcwcIkrK4OVRxyuj+71BxAnw==","shasum":"6e1a2c147dda52190296e850acf189243f478d4f","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-0.3.2.tgz","fileCount":47,"unpackedSize":298488,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdCkWkCRA9TVsSAnZWagAAcNIP/0WUlaPEZhv+qcAMxkT3\nK2gP9yUgr0UbEjPnqyK5Lvr44yEVjUUCCtlqa3aiktaZpHiHMkeqjYrgfuKE\nXIGaCnlYtbP1Ke6RVKuWr2v6bNO6AOUdBTa0YxemXvNMB/WUxDvfy3mIKEsy\nE2Y7ysLBFj+IYZ8u000/HX1LPNEspbwJ8L133UQs0zJ8lRBUegU5RUEEdDpQ\nAf59ovWlAmPKbLsuAlhQ9Lzf0d8eCfQPLvEj1a3Kp0IEZPxROKk2F52r9I1w\n8iZAj6DLdq1Jkw6TdUO05Nm8MRE/DyyfMBXZ7xGusbtWhEW7CSAq26Y2MehB\narxPADCQysFFV80CpPkTWcpRCiDCdYa6M5cRDheyvV0GSeAscBrmOh4rTRuW\nEkeWHN99xV73WV/5WdDIv9zGTbgRpi8AAKT8JxnIcrrsMZ03Q/nsoNKmOp4U\n5btkxBFJb/p2l7FfrYvT1f9UFtn0TuoBZxBOLRdozFKoL88NKTXhCAmCbc32\nPNyPSP5/jG+wJx4F1B6eyZbrTPtHSg4MfXqoSxdnbEIyLcuyhpf1ZMrP/S/5\nCFtlpBgS3ek+Tq0csCp+3mEET9/T9OBiQZBdUxyrWmQF/s3a+oiCAfayy1eg\nHs3Lz0oSrzJFotkz4XqOW3FoqxvWD/GGhK2ypJ6s1jiFVvPkOy6ilxAgS5oQ\n979R\r\n=49wu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCQXXdJ5NzNtRjSHCZEIPwzK5byka7N7YWbwYdimU+j3wIhAKbQlJ6jHkupw4kRyox5KK3jyVH+4omAbQp43OCxYN1E"}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_0.3.2_1560954275470_0.926380116332888"},"_hasShrinkwrap":false},"1.0.0":{"name":"react-oidc","version":"1.0.0","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"jest","test:watch":"jest --watch"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"git+https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/jest":"^23.3.0","@types/react":"^16.4.7","jest":"^23.6","react":"^16.4.1","react-dom":"^16.4.1","react-testing-library":"^4.1.3","ts-jest":"^23.0.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"gitHead":"ea725a79d4f81b030c6243f6947547633e250949","bugs":{"url":"https://github.com/thchia/react-oidc/issues"},"homepage":"https://github.com/thchia/react-oidc#readme","_id":"react-oidc@1.0.0","_npmVersion":"6.1.0","_nodeVersion":"10.7.0","_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"dist":{"integrity":"sha512-99uV1rxhu1Z3ZqSoTUCPo6CEKYTOqHaGenkOUj8n9S+Dh19CQdcEwa/A/xYI6ld2wf5URFYI9XYo42w8a/oSuw==","shasum":"eabc39576f190134a49a0862e94c62619c8cf944","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-1.0.0.tgz","fileCount":47,"unpackedSize":299029,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdPp5uCRA9TVsSAnZWagAAa5YP/3BBceLahiTnK0xrG9Hn\n4bMs56khZ1McoMkPwMgMkwXGj2ueg+0WcsTsmsNBJ1o41EfwbGaDFb3QS0Mq\n7uAdNoZfzx9ueCqJPiK/JzKhYXgX4bZzTGhV7XDL0CN9beJP/t/GW82v4+uh\n7gmfG99Vg7R8+/BCgQC8liW/f2lbsCXXfD5AnVQY3+0rdgv3AmhQFE7ThmL2\nVVhwqIE5uofT/NZSUmVetSJHaIQCWfClNOsz6uSIoBS1AU1IcWBQG+EMWDB/\na3SwpLSeDUnpDNZ7XO3BOoCfWm7lh0rAhmcbshTsAN5sHamoysbK/xExhy9R\n1ZIkraRH/vRxAgYStqvgzFXQAgyYCyGQ/l4CqJpQefb0Yo4VjSz00DEKrK6s\nmBXVbobu/gJduZOdeH3z03BWwu0oiuxlgjG/C+9WxEaQ63L5teEcFxjSl/j1\nHST83Qlxa6ggddulI9Q2UokdnSxZypvtINsHlK+rWpFtOX3TUXsX3e8G44np\nm/Ax/a5b0vAxaFluSpGN4xiP7teCNDi5o4hBTnI9+FDie1ofViT5PSE+xldm\nV5wuXok71Qz4GZe6j6kcl8OUKfiGM/iCsERItxl7vmk2BzUI6zo7h7hNJRnP\nybdtWfd6ylqYWlgoo1OTw5NSWk+Ry14ghSMEwerCa5YCI1bdpt72d9Av9Dpo\n4Sin\r\n=xVzc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFuUYcZAUhV2KQEYv5QwiLBXxDbWoFM7FYcBPiuSu59lAiBFT1Ri+ul+BITNUZcjHeHveUEJYrw4HWLTjJqqluu8ZA=="}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_1.0.0_1564384877394_0.13868062361162758"},"_hasShrinkwrap":false},"1.0.2":{"name":"react-oidc","version":"1.0.2","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"jest","test:watch":"jest --watch"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"git+https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/jest":"^23.3.0","@types/react":"^16.4.7","jest":"^23.6","react":"^16.4.1","react-dom":"^16.4.1","react-testing-library":"^4.1.3","ts-jest":"^23.0.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"gitHead":"d562981ed0a3eb01e1bf1be4355d7e00e3422503","bugs":{"url":"https://github.com/thchia/react-oidc/issues"},"homepage":"https://github.com/thchia/react-oidc#readme","_id":"react-oidc@1.0.2","_npmVersion":"6.1.0","_nodeVersion":"10.7.0","_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"dist":{"integrity":"sha512-sfkd5bJOKbs5NJ+XHHB/FFmSTY9wx4hyv13/QrJk0qzFdTHLgP3c0Vi452GJGCFvaaJnALSjh/aHm1qJBiW/8Q==","shasum":"90025d87ec53c155e7070d75c62919204c7ea03d","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-1.0.2.tgz","fileCount":47,"unpackedSize":300362,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJehHsuCRA9TVsSAnZWagAArzIP/0G9TdNoQt4ps8MiPc18\nyj8nF0AMvF8hqgOp0VgaG1OfsSBlqclzBBS4ldEVbIJy3GNZoY6hIB7V+Ljn\n4c5b4X8TUEdeTbtEV4hns7ydQT2pP5G3It9NVX/GlIb08zZ2hGip3JaZ1dDz\nVm1hsfeqAiauNALzy3iLe8mKZPThcSvZXBWbFhdmZlCnR6kLCoZNy5oHwyum\n+ixX7cgFKwuXmiBIADOYFL0iIRBEX9l9kPzSxD/4AQe8TzCFYZyf62EgTxKQ\nK6Dzar4k43b7a3DrVSVETKgGZz4AJfEIHc5+mLdTnpEkNApZ4T+rx1qf1GSQ\n6G3ZxjGjddvy3hu4B3L1FpEqi2kxqinWEcZTaIK9xhhn/Q8TPoXHjY2WfJPd\nMD0eAXN3ja5g8XAtxieYUZsbssN6gl6VWr8wc0aDYJD+S2Z2k5tA6Fo4N2IM\nFOrR3xTsTeuNC2SBUtVbhdo0BMYCwKjK/+dyp0TLt8e707HLEF93XojwGDWv\nRHATe0iwqJ0ygB2eflsJhvMu8wY+Ki3zYO0fJI88HC9zACGGdbPBbnHQfkXn\nSZolt0aUF/bAX0KHJc3ewikEMNNX5+Z1VhI+FYf5QhIiFct1H/sQC0Wj4nrD\ncUpQP24Y0O8d+jJVKey2fpDwkr5KDMMYlZd096XHgtBitEAz8eG0J0vo7YVH\n6W9G\r\n=9Ltm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEvAiac8Md3idCYVO54Y+HO7xXeBB5WM4XGTGwLCjcu1AiEAwaF2YOg25BthQk4i4jIR0M6gMIyWc1ZJSssSvx5P8Kw="}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_1.0.2_1585740589622_0.6106140588532276"},"_hasShrinkwrap":false},"1.0.3":{"name":"react-oidc","version":"1.0.3","description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","main":"./lib/index.js","types":"./lib/index.d.ts","scripts":{"build":"rm -rf ./lib && tsc","prepare":"yarn build","test":"jest","test:watch":"jest --watch"},"keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"repository":{"type":"git","url":"git+https://github.com/thchia/react-oidc.git"},"license":"MIT","peerDependencies":{"@types/react":"^16.4.7","react":"^16.4.1","react-dom":"^16.4.1"},"devDependencies":{"@types/jest":"^23.3.0","@types/react":"^16.4.7","jest":"^23.6","react":"^16.4.1","react-dom":"^16.4.1","react-testing-library":"^4.1.3","ts-jest":"^23.0.1"},"dependencies":{"oidc-client":"^1.5.2","typescript":"^2.9.2"},"gitHead":"911704f9b27990810d380752397c4dcdb3dfc649","bugs":{"url":"https://github.com/thchia/react-oidc/issues"},"homepage":"https://github.com/thchia/react-oidc#readme","_id":"react-oidc@1.0.3","_nodeVersion":"12.13.1","_npmVersion":"6.12.1","dist":{"integrity":"sha512-CJkCcoUKJXhHRU75BYc6lEmRZIBkULS/8b8/jMH0YvAEL0vnWe2e6FhbbDHlvXIppcszuu4x6hbOOxhAWI6CkQ==","shasum":"2ab0677ead9dddd8eba98f0047d88f3b726aa47b","tarball":"https://registry.npmjs.org/react-oidc/-/react-oidc-1.0.3.tgz","fileCount":47,"unpackedSize":168714,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfiXLOCRA9TVsSAnZWagAAc9IP/j9v6rdBhyIKEkbT1492\nniO3vLsOBXqC+5h/tA6lBIXEiXVbW0/OSEWra1klbcpbe3C/OPUNswgaN9jp\na7Zp8EDDYvsIZ7g4Ff13n0zH/PM+hVel6vF60tAyu6ZG6PyZPA2xkrygM/jm\nIFQOkekfRMLnoiJrvwy62BHVQ1AMm4lHMrwugtyIrvTP4GXADU+vye0W+CtG\ng95PSGItdM2tu0cgu4o9Moq0QO077vrhgtLHBIWbOhxQGJMDuPfPauNIr+uW\n4l+lXz56+J2x5gLyQVF8hq4fEETSzKrrtPmG6RAzsv7lzLcQp8DWlQsE1W97\n2oJZ374L6zmae7XAqbR7lsu29ADEMwFAK8ATER1Wz9TgkQunZLhxQjstpWyr\nNjbVwXfG/A1wNUDLaBL0M83swHocbFeb3irOWCaLy16bmaEX8MZBf7KJK8tl\nYheTMJYLymzhkLj7Wo9vWFbi2NqZnWV2NBWInEdahEngb7NhKNo591LqTmh3\nmRl57o6w2RMUUV7VJlXgmUZ9FnVvHw9sZlIZqQ3nIjZquacCaMfoHbqcUNC4\ngaGZbDSBBqaC3RriZw19m7Rr4uJwNp5NI4PiLTS+ULSSM6t54VpjC/JWtIlX\nUE4V0hX6MtiQ7J4ALIAxOkcF3mAO0g+Nr126YYbgLcDvipPxQHI42JhhkeNP\nX3Y7\r\n=qZqw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDHEPgxSlBZImaGGMEWykbJVkdSjutObGK8+ARWAYMRZwIgHube6XfKmfwwGuuV8p4ffCVQyaHumSSidg9KKvqow7g="}]},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"_npmUser":{"name":"thchia","email":"thomas.h.chia@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-oidc_1.0.3_1602843342387_0.4195152138106455"},"_hasShrinkwrap":false}},"time":{"created":"2018-07-24T04:56:05.529Z","0.0.1":"2018-07-24T04:56:05.641Z","modified":"2022-06-26T07:27:58.778Z","0.0.2":"2018-07-24T06:15:37.738Z","0.0.3":"2018-07-24T06:17:44.379Z","0.0.4":"2018-07-24T12:04:47.550Z","0.0.5":"2018-07-25T03:14:21.873Z","0.1.0":"2018-07-25T05:50:54.361Z","1.0.1":"2018-12-18T14:42:47.023Z","0.1.1":"2018-12-18T14:59:33.279Z","0.1.2-0":"2018-12-20T11:20:01.422Z","0.1.2":"2018-12-21T05:20:39.573Z","0.2.0-0":"2018-12-21T07:56:51.442Z","0.2.1":"2018-12-24T09:23:40.425Z","0.3.0":"2019-01-04T08:08:05.353Z","0.4.0-alpha.0":"2019-01-11T15:08:42.413Z","0.3.1":"2019-01-17T14:24:04.438Z","0.3.2":"2019-06-19T14:24:35.594Z","1.0.0":"2019-07-29T07:21:17.529Z","1.0.2":"2020-04-01T11:29:49.772Z","1.0.3":"2020-10-16T10:15:42.577Z"},"maintainers":[{"name":"thchia","email":"thomas.h.chia@gmail.com"}],"description":"Wrapper for the OIDC JavaScript client, to be used in React projects.","keywords":["oidc","react","auth","oauth","openid"],"author":{"name":"Thomas Chia"},"license":"MIT","readme":"# React OIDC\n\nWrapper for [oidc-client-js](https://github.com/IdentityModel/oidc-client-js), to be used in React apps.\n\n## Quick start\n\n> You should read the [slow start](https://github.com/thchia/react-oidc#slow-start) and [Routing Considerations](https://github.com/thchia/react-oidc#routing-considerations) too\n\n```bash\nyarn add react-oidc\n```\n\nYou will need the [config](https://github.com/IdentityModel/oidc-client-js/wiki#configuration) for the `UserManager` class.\n\nExample using `react-router`\n\n```jsx\nimport { makeAuthenticator, makeUserManager, Callback } from 'react-oidc'\n\n// supply this yourself\nimport App from '../layouts/App'\nimport userManagerConfig from '../config'\n\nconst userManager = makeUserManager(userManagerConfig)\nconst AppWithAuth = makeAuthenticator({\n  userManager: userManager,\n  signinArgs: {\n    state: {\n      foo: 15\n    }\n  }\n})(App)\n\nexport default () => (\n  <Router>\n    <Switch>\n      <Route\n        path=\"/callback\"\n        render={routeProps => (\n          <Callback\n            onSuccess={user => {\n              // `user.state` will reflect the state that was passed in via signinArgs.\n              routeProps.history.push('/')\n            }}\n            userManager={userManager}\n          />\n        )}\n      />\n      <AppWithAuth />\n    </Switch>\n  </Router>\n)\n```\n\n## Slow start\n\nThere are 3 main parts to this library:\n\n- `makeUserManager` function;\n- `makeAuthenticator` function;\n- `Callback` component\n\n### `makeUserManager(config)`\n\n| Param    | Type                           | Required | Default Value | Description                            |\n| -------- | ------------------------------ | -------- | ------------- | -------------------------------------- |\n| `config` | object (`UserManagerSettings`) | Yes      | `undefined`   | Config object to pass to `UserManager` |\n\nHelper utility to create a `UserManager` instance.\n\n### `makeAuthenticator(params)(<ProtectedApp />)`\n\n| Param                  | Type          | Required | Default Value | Description                                                      |\n| ---------------------- | ------------- | -------- | ------------- | ---------------------------------------------------------------- |\n| `userManager`          | `UserManager` | Yes      | `undefined`   | `UserManager` instance (the result of `makeUserManager()`)       |\n| `placeholderComponent` | Component     | No       | `null`        | Optional component to render while auth state is being retrieved |\n\nThis is a higher-order function that accepts a `UserManager` instance, and optionally a placeholder component to render when user auth state is being retrieved. It returns a function that accepts a React component. This component should contain all components that you want to be protected by your authentication. Ultimately you will get back a component that either renders the component you passed it (if the user is authenticated), or redirects to the OIDC login screen as defined by the Identity Provider.\n\nThe lifecycle of this component is as follows:\n\n1.  The component is constructed with a fetching flag set to true.\n\n2.  On mount, the `.getUser()` method from `UserManager` is called. If the user is already authenticated, it will set the fetching flag to false and render the component you passed it.\n\n3.  If the user is not authenticated or their token has expired, the user will be redirected to the login URL (defined by the Identity Provider) and the fetching flag will be set to false.\n\n4.  Upon successful authentication with the Identity Provider, the user will be redirected to the `redirect_uri`. You should render the `Callback` component at this location.\n\n#### Note on the fetching flag\n\n> The fetching flag is set to `true` initially because of the asynchronous nature of `.getUser()`. There is a need to ensure that we do not redirect to the login page whilst `getUser` is resolving. Without some way of knowing when the user auth state query is complete, we would end up **always** redirecting to the login page.\n\n### `<Callback />`\n\n| Prop          | Type          | Required | Default Value | Description                                                                                     |\n| ------------- | ------------- | -------- | ------------- | ----------------------------------------------------------------------------------------------- |\n| `userManager` | `UserManager` | Yes      | `undefined`   | `UserManager` instance (the result of `makeUserManager()`)                                      |\n| `children`    | Component     | No       | null          | Optional component to render at the redirect page                                               |\n| `onError`     | function      | No       | `undefined`   | Optional callback if there is an error from the Promise returned by `.signinRedirectCallback()` |\n| `onSuccess`   | function      | No       | `undefined`   | Optional callback when the Promise from `.signinRedirectCallback()` resolves                    |\n\nThe `Callback` component will call the `.signinRedirectCallback()` method from `UserManager` and if successful, call the `onSuccess` prop. On error it will call the `onError` prop. You should pass the same instance of `UserManager` that you passed to `makeAuthenticator`.\n\n### `<UserData />`\n\nThis component exposes the data of the authenticated user. If you are familiar with React's Context API (the official v16.3.x one), this component is just a `Context`.\n\n```jsx\n<UserData.Consumer>\n  {context => <p>{context.user.id_token}</p>}\n</UserData.Consumer>\n```\n\nRender prop function\n\n| Argument (key of `context`) | Type          | Description                                  |\n| --------------------------- | ------------- | -------------------------------------------- |\n| `signOut`                   | function      | Call this to sign the current user out       |\n| `user`                      | `User`        | This is the `User` object from `oidc-client` |\n| `userManager`               | `UserManager` | `UserManager` instance from `oidc-client`    |\n\n## Routing considerations\n\nThis library is deliberately unopinionated about routing, however there are restrictions from the `oidc-client` library that should be considered.\n\n1.  **There will be url redirects**. It is highly recommended to use a routing library like `react-router` to help deal with this.\n\n2.  **The `redirect_uri` should match eagerly**. You should not render the result of `makeAuthenticator()()` at the location of the `redirect_uri`. If you do, you will end up in a redirect loop that ultimately leads you back to the authentication page. In the quick start above, a `Switch` from `react-router` is used, and the `Callback` component is placed _before_ `AppWithAuth`. This ensures that when the user is redirected to the `redirect_uri`, `AppWithAuth` is not rendered. Once the user data has been loaded into storage, `onSuccess` is called and the user is redirected back to a protected route. When `AppWithAuth` loads now, the valid user session is in storage and the protected routes are rendered.\n","readmeFilename":"README.md","repository":{"type":"git","url":"git+https://github.com/thchia/react-oidc.git"},"homepage":"https://github.com/thchia/react-oidc#readme","bugs":{"url":"https://github.com/thchia/react-oidc/issues"}}