├── .circleci └── config.yml ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── Bug Report.yml │ ├── Feature Request.yml │ └── config.yml ├── dependabot.yml ├── stale.yml └── workflows │ └── semgrep.yml ├── .gitignore ├── 01-Login ├── .dockerignore ├── .gitignore ├── .prettierrc.yaml ├── Dockerfile ├── README.md ├── auth_config.json.example ├── bin │ └── www ├── exec.ps1 ├── exec.sh ├── index.html ├── package-lock.json ├── package.json ├── public │ ├── css │ │ └── main.css │ ├── images │ │ └── logo.png │ └── js │ │ ├── app.js │ │ └── ui.js └── server.js ├── 02-Calling-an-API ├── .dockerignore ├── .gitignore ├── .prettierrc.yaml ├── Dockerfile ├── README.md ├── auth_config.json.example ├── bin │ └── www ├── exec.ps1 ├── exec.sh ├── index.html ├── package-lock.json ├── package.json ├── public │ ├── css │ │ └── main.css │ ├── images │ │ └── logo.png │ └── js │ │ ├── app.js │ │ └── ui.js └── server.js ├── LICENSE ├── README.md └── netlify.toml /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # Environment variables to be defined in the build configuration: 2 | # AUTH0_TEST_CLIENT_ID = Client id to use in test 3 | # AUTH0_TEST_DOMAIN = Domain to use in test 4 | # AUTH0_TEST_AUDIENCE = API Audience to use in test 5 | 6 | # Common logic 7 | defaults: &defaults 8 | steps: 9 | - attach_workspace: 10 | at: ~/ 11 | - run: 12 | name: Replace Auth0 test credentials 13 | command: | 14 | echo "{ \"domain\": \"$AUTH0_TEST_DOMAIN\", \"clientId\": \"$AUTH0_TEST_CLIENT_ID\", \"audience\": \"$AUTH0_TEST_API_IDENTIFIER\" }" > $AUTH0_CFG 15 | 16 | - run: 17 | name: Build pull request 18 | command: | 19 | docker build -t $CIRCLE_JOB ./$SAMPLE_PATH 20 | docker run -d -p 3000:3000 --name $CIRCLE_SHA1 $CIRCLE_JOB 21 | - run: 22 | name: Wait for app to be available 23 | command: | 24 | sleep 10 25 | docker run --network host --rm appropriate/curl --retry 8 --retry-connrefused -v localhost:3000 26 | - run: 27 | name: Run tests 28 | command: | 29 | docker create --network host --name tester codeceptjs/codeceptjs codeceptjs run-multiple --all --steps --verbose 30 | docker cp $(pwd)/lock_login_spa_test.js tester:/tests/lock_login_test.js 31 | docker cp $(pwd)/codecept.conf.js tester:/tests/codecept.conf.js 32 | docker start -i tester 33 | working_directory: scripts 34 | - run: 35 | name: Copy app container logs 36 | command: | 37 | mkdir -p /tmp/out 38 | docker logs $CIRCLE_SHA1 > /tmp/out/app_logs.log 39 | docker cp tester:/tests/out /tmp/ 40 | when: on_fail 41 | - store_artifacts: 42 | path: /tmp/out 43 | 44 | # Jobs and Workflows 45 | version: 2 46 | jobs: 47 | checkout: 48 | machine: true 49 | steps: 50 | - checkout 51 | - run: git clone https://github.com/auth0-samples/spa-quickstarts-tests scripts 52 | - persist_to_workspace: 53 | root: ~/ 54 | paths: 55 | - project 56 | - scripts 57 | 01-login: 58 | machine: true 59 | environment: 60 | - AUTH0_CFG: 01-Login/auth_config.json 61 | - SAMPLE_PATH: 01-Login 62 | <<: *defaults 63 | 64 | 02-calling-an-api: 65 | machine: true 66 | environment: 67 | - AUTH0_CFG: 02-Calling-an-API/auth_config.json 68 | - SAMPLE_PATH: 02-Calling-an-API 69 | <<: *defaults 70 | 71 | workflows: 72 | version: 2 73 | quickstarts_login: 74 | jobs: 75 | - checkout: 76 | context: Quickstart SPA Test 77 | - 01-login: 78 | context: Quickstart SPA Test 79 | requires: 80 | - checkout 81 | - 02-calling-an-api: 82 | context: Quickstart SPA Test 83 | requires: 84 | - checkout 85 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @auth0-samples/dx-sdks-engineer 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Bug Report.yml: -------------------------------------------------------------------------------- 1 | name: 🐞 Report a bug 2 | description: Have you found a bug or issue? Create a bug report for this sample 3 | 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | **Please do not report security vulnerabilities here**. The [Responsible Disclosure Program](https://auth0.com/responsible-disclosure-policy) details the procedure for disclosing security issues. 9 | 10 | - type: checkboxes 11 | id: checklist 12 | attributes: 13 | label: Checklist 14 | options: 15 | - label: I have looked into the Readme ([Login](https://github.com/auth0-samples/auth0-javascript-samples/tree/master/01-Login#readme)/[Calling an API](https://github.com/auth0-samples/auth0-javascript-samples/tree/master/02-Calling-an-API#readme)) and have not found a suitable solution or answer. 16 | required: true 17 | - label: I have searched the [issues](https://github.com/auth0-samples/auth0-javascript-samples/issues) and have not found a suitable solution or answer. 18 | required: true 19 | - label: I have searched the [Auth0 Community](https://community.auth0.com) forums and have not found a suitable solution or answer. 20 | required: true 21 | - label: I agree to the terms within the [Auth0 Code of Conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md). 22 | required: true 23 | 24 | - type: textarea 25 | id: description 26 | attributes: 27 | label: Description 28 | description: Provide a clear and concise description of the issue, including what you expected to happen. 29 | validations: 30 | required: true 31 | 32 | - type: textarea 33 | id: reproduction 34 | attributes: 35 | label: Reproduction 36 | description: Detail the steps taken to reproduce this error, and whether this issue can be reproduced consistently or if it is intermittent. 37 | placeholder: | 38 | 1. Step 1... 39 | 2. Step 2... 40 | 3. ... 41 | validations: 42 | required: true 43 | 44 | - type: textarea 45 | id: additional-context 46 | attributes: 47 | label: Additional context 48 | description: Any other relevant information you think would be useful. 49 | validations: 50 | required: false 51 | 52 | - type: dropdown 53 | id: environment-sample 54 | attributes: 55 | label: Sample 56 | multiple: false 57 | options: 58 | - Login 59 | - Calling an API 60 | validations: 61 | required: true 62 | 63 | - type: dropdown 64 | id: environment-browser 65 | attributes: 66 | label: Which browsers have you tested in? 67 | multiple: true 68 | options: 69 | - Chrome 70 | - Edge 71 | - Safari 72 | - Firefox 73 | - Opera 74 | - Other 75 | validations: 76 | required: true 77 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Feature Request.yml: -------------------------------------------------------------------------------- 1 | name: 🧩 Feature request 2 | description: Suggest an idea or a feature for this sample 3 | labels: ["feature request"] 4 | 5 | body: 6 | - type: checkboxes 7 | id: checklist 8 | attributes: 9 | label: Checklist 10 | options: 11 | - label: I have looked into the Readme ([Login](https://github.com/auth0-samples/auth0-javascript-samples/tree/master/01-Login#readme)/[Calling an API](https://github.com/auth0-samples/auth0-javascript-samples/tree/master/02-Calling-an-API#readme)) and have not found a suitable solution or answer. 12 | required: true 13 | - label: I have searched the [issues](https://github.com/auth0-samples/auth0-javascript-samples/issues) and have not found a suitable solution or answer. 14 | required: true 15 | - label: I have searched the [Auth0 Community](https://community.auth0.com) forums and have not found a suitable solution or answer. 16 | required: true 17 | - label: I agree to the terms within the [Auth0 Code of Conduct](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md). 18 | required: true 19 | 20 | - type: textarea 21 | id: description 22 | attributes: 23 | label: Describe the problem you'd like to have solved 24 | description: A clear and concise description of what the problem is. 25 | validations: 26 | required: true 27 | 28 | - type: textarea 29 | id: ideal-solution 30 | attributes: 31 | label: Describe the ideal solution 32 | description: A clear and concise description of what you want to happen. 33 | validations: 34 | required: true 35 | 36 | - type: textarea 37 | id: alternatives-and-workarounds 38 | attributes: 39 | label: Alternatives and current workarounds 40 | description: A clear and concise description of any alternatives you've considered or any workarounds that are currently in place. 41 | validations: 42 | required: false 43 | 44 | - type: textarea 45 | id: additional-context 46 | attributes: 47 | label: Additional context 48 | description: Add any other context or screenshots about the feature request here. 49 | validations: 50 | required: false 51 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: 🤔 Help & Questions 4 | url: https://community.auth0.com 5 | about: Ask general support or usage questions in the Auth0 Community forums. 6 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | 4 | - package-ecosystem: "npm" 5 | directory: "/01-Login" 6 | schedule: 7 | interval: "daily" 8 | ignore: 9 | - dependency-name: "*" 10 | update-types: ["version-update:semver-major", "version-update:semver-patch"] 11 | 12 | - package-ecosystem: "npm" 13 | directory: "/02-Calling-an-API" 14 | schedule: 15 | interval: "daily" 16 | ignore: 17 | - dependency-name: "*" 18 | update-types: ["version-update:semver-major", "version-update:semver-patch"] 19 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-stale - https://github.com/probot/stale 2 | 3 | # Number of days of inactivity before an Issue or Pull Request becomes stale 4 | daysUntilStale: 90 5 | 6 | # Number of days of inactivity before an Issue or Pull Request with the stale label is closed. 7 | daysUntilClose: 7 8 | 9 | # Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable 10 | exemptLabels: [] 11 | 12 | # Set to true to ignore issues with an assignee (defaults to false) 13 | exemptAssignees: true 14 | 15 | # Label to use when marking as stale 16 | staleLabel: closed:stale 17 | 18 | # Comment to post when marking as stale. Set to `false` to disable 19 | markComment: > 20 | This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️ -------------------------------------------------------------------------------- /.github/workflows/semgrep.yml: -------------------------------------------------------------------------------- 1 | name: Semgrep 2 | 3 | on: 4 | pull_request: {} 5 | 6 | push: 7 | branches: ["master", "main"] 8 | 9 | schedule: 10 | - cron: '30 0 1,15 * *' 11 | 12 | jobs: 13 | semgrep: 14 | name: Scan 15 | runs-on: ubuntu-latest 16 | container: 17 | image: returntocorp/semgrep 18 | # Skip any PR created by dependabot to avoid permission issues 19 | if: (github.actor != 'dependabot[bot]') 20 | steps: 21 | - uses: actions/checkout@v3 22 | 23 | - run: semgrep ci 24 | env: 25 | SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | .DS_Store -------------------------------------------------------------------------------- /01-Login/.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .gitignore 3 | README.md -------------------------------------------------------------------------------- /01-Login/.gitignore: -------------------------------------------------------------------------------- 1 | a0-variables.js 2 | auth_config.json 3 | node_modules/ -------------------------------------------------------------------------------- /01-Login/.prettierrc.yaml: -------------------------------------------------------------------------------- 1 | semi: true 2 | arrowParens: always 3 | -------------------------------------------------------------------------------- /01-Login/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:10-alpine 2 | 3 | RUN mkdir /app 4 | 5 | WORKDIR /app 6 | 7 | COPY package.json . 8 | 9 | RUN npm install --production 10 | 11 | COPY . . 12 | 13 | EXPOSE 3000 14 | 15 | CMD ["node", "bin/www"] -------------------------------------------------------------------------------- /01-Login/README.md: -------------------------------------------------------------------------------- 1 | # Sample 01 - Login 2 | 3 | The purpose of this article is to demonstrate how simple it is to set up and use the new Single Page Application SDK, and authenticate a user in your application using Auth0's Universal Login Page. 4 | 5 | ## Running the Sample Application 6 | 7 | The sample can be run locally, by cloning the repository to your machine and then following the steps below. 8 | 9 | ### Specifying Auth0 Credentials 10 | 11 | To specify the application client ID and domain, make a copy of `auth_config.json.example` and rename it to `auth_config.json`. Then open it in a text editor and supply the values for your application: 12 | 13 | ```json 14 | { 15 | "domain": "{DOMAIN}", 16 | "clientId": "{CLIENT_ID}" 17 | } 18 | ``` 19 | 20 | ### Installation 21 | 22 | After cloning the repository, run: 23 | 24 | ```bash 25 | $ npm install 26 | ``` 27 | 28 | This will install all of the necessary packages in order for the sample to run. 29 | 30 | ### Running the Application 31 | 32 | This version of the application uses an [Express](https://expressjs.com) server that can serve the site from a single page. To start the app from the terminal, run: 33 | 34 | ```bash 35 | $ npm run dev 36 | ``` 37 | 38 | ## Frequently Asked Questions 39 | 40 | We are compiling a list of questions and answers regarding the new JavaScript SDK - if you're having issues running the sample applications, [check the FAQ](https://github.com/auth0/auth0-spa-js/blob/master/FAQ.md)! 41 | 42 | ## What is Auth0? 43 | 44 | Auth0 helps you to: 45 | 46 | - Add authentication with [multiple authentication sources](https://docs.auth0.com/identityproviders), either social like **Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, among others**, or enterprise identity systems like **Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider**. 47 | - Add authentication through more traditional **[username/password databases](https://docs.auth0.com/mysql-connection-tutorial)**. 48 | - Add support for **[linking different user accounts](https://docs.auth0.com/link-accounts)** with the same user. 49 | - Support for generating signed [Json Web Tokens](https://docs.auth0.com/jwt) to call your APIs and **flow the user identity** securely. 50 | - Analytics of how, when and where users are logging in. 51 | - Pull data from other sources and add it to the user profile, through [JavaScript rules](https://docs.auth0.com/rules). 52 | 53 | ## Create a free Auth0 account 54 | 55 | 1. Go to [Auth0](https://auth0.com/signup) and click Sign Up. 56 | 2. Use Google, GitHub or Microsoft Account to login. 57 | 58 | ## Issue Reporting 59 | 60 | If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues. 61 | 62 | ## Author 63 | 64 | [Auth0](auth0.com) 65 | 66 | ## License 67 | 68 | This project is licensed under the MIT license. See the [LICENSE](LICENSE.txt) file for more info. 69 | -------------------------------------------------------------------------------- /01-Login/auth_config.json.example: -------------------------------------------------------------------------------- 1 | { 2 | "domain": "{DOMAIN}", 3 | "clientId": "{CLIENT_ID}" 4 | } -------------------------------------------------------------------------------- /01-Login/bin/www: -------------------------------------------------------------------------------- 1 | const app = require('../server'); 2 | const port = process.env.PORT || 3000; 3 | 4 | app.listen(port, () => console.log(`Server running on port ${port}`)); -------------------------------------------------------------------------------- /01-Login/exec.ps1: -------------------------------------------------------------------------------- 1 | docker build --rm -t auth0-javascript-sample-01-login . 2 | docker run -p 3000:3000 -it auth0-javascript-sample-01-login 3 | -------------------------------------------------------------------------------- /01-Login/exec.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | docker build -t auth0-javascript-sample-01-login . 3 | docker run --init -p 3000:3000 -it auth0-javascript-sample-01-login -------------------------------------------------------------------------------- /01-Login/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SPA SDK Sample 6 | 10 | 11 | 15 | 21 | 27 | 28 | 32 | 33 | 34 | 35 |
36 | 163 | 164 |
165 |
166 |
167 | 173 |

JavaScript Sample Project

174 | 175 |

176 | This is a sample application that demonstrates an authentication 177 | flow for an SPA, using plain JavaScript 178 |

179 |
180 | 181 |
182 |

What can I do next?

183 | 184 |
185 |
186 |
187 | 188 | Configure other identity 189 | providers 190 | 191 |
192 |

193 | Auth0 supports social providers as Facebook, Twitter, 194 | Instagram and 100+, Enterprise providers as Microsoft Office 195 | 365, Google Apps, Azure, and more. You can also use any OAuth2 196 | Authorization Server. 197 |

198 |
199 | 200 |
201 | 202 |
203 |
204 | 205 | Enable Multifactor 206 | Authentication 207 | 208 |
209 |

210 | Add an extra layer of security by enabling Multi-factor 211 | Authentication, requiring your users to provide more than one 212 | piece of identifying information. Push notifications, 213 | authenticator apps, SMS, and DUO Security are supported. 214 |

215 |
216 |
217 | 218 |
219 |
220 |
221 | 222 | Anomaly Detection 223 | 224 |
225 |

226 | Auth0 can detect anomalies and stop malicious attempts to 227 | access your application. Anomaly detection can alert you and 228 | your users of suspicious activity, as well as block further 229 | login attempts. 230 |

231 |
232 | 233 |
234 | 235 |
236 |
237 | 238 | Learn About Rules 239 | 240 |
241 |

242 | Rules are JavaScript functions that execute when a user 243 | authenticates to your application. They run once the 244 | authentication process is complete, and you can use them to 245 | customize and extend Auth0's capabilities. 246 |

247 |
248 |
249 |
250 |
251 | 252 |
253 |
254 |
255 |
256 | User's profile picture 260 |
261 |
262 |

263 |

264 |
265 |
266 | 267 |
268 |
269 |                 
270 |
271 |
272 |
273 |
274 | 275 | 282 |
283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | -------------------------------------------------------------------------------- /01-Login/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "01-login", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "abbrev": { 8 | "version": "1.1.1", 9 | "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", 10 | "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", 11 | "dev": true 12 | }, 13 | "accepts": { 14 | "version": "1.3.8", 15 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", 16 | "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", 17 | "requires": { 18 | "mime-types": "~2.1.34", 19 | "negotiator": "0.6.3" 20 | } 21 | }, 22 | "anymatch": { 23 | "version": "3.1.2", 24 | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", 25 | "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", 26 | "dev": true, 27 | "requires": { 28 | "normalize-path": "^3.0.0", 29 | "picomatch": "^2.0.4" 30 | } 31 | }, 32 | "array-flatten": { 33 | "version": "1.1.1", 34 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 35 | "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" 36 | }, 37 | "balanced-match": { 38 | "version": "1.0.2", 39 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", 40 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", 41 | "dev": true 42 | }, 43 | "basic-auth": { 44 | "version": "2.0.1", 45 | "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", 46 | "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==", 47 | "requires": { 48 | "safe-buffer": "5.1.2" 49 | } 50 | }, 51 | "binary-extensions": { 52 | "version": "2.2.0", 53 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", 54 | "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", 55 | "dev": true 56 | }, 57 | "body-parser": { 58 | "version": "1.20.1", 59 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", 60 | "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", 61 | "requires": { 62 | "bytes": "3.1.2", 63 | "content-type": "~1.0.4", 64 | "debug": "2.6.9", 65 | "depd": "2.0.0", 66 | "destroy": "1.2.0", 67 | "http-errors": "2.0.0", 68 | "iconv-lite": "0.4.24", 69 | "on-finished": "2.4.1", 70 | "qs": "6.11.0", 71 | "raw-body": "2.5.1", 72 | "type-is": "~1.6.18", 73 | "unpipe": "1.0.0" 74 | }, 75 | "dependencies": { 76 | "on-finished": { 77 | "version": "2.4.1", 78 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", 79 | "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", 80 | "requires": { 81 | "ee-first": "1.1.1" 82 | } 83 | } 84 | } 85 | }, 86 | "bowser": { 87 | "version": "2.9.0", 88 | "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.9.0.tgz", 89 | "integrity": "sha512-2ld76tuLBNFekRgmJfT2+3j5MIrP6bFict8WAIT3beq+srz1gcKNAdNKMqHqauQt63NmAa88HfP1/Ypa9Er3HA==" 90 | }, 91 | "brace-expansion": { 92 | "version": "1.1.11", 93 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 94 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 95 | "dev": true, 96 | "requires": { 97 | "balanced-match": "^1.0.0", 98 | "concat-map": "0.0.1" 99 | } 100 | }, 101 | "braces": { 102 | "version": "3.0.2", 103 | "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", 104 | "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", 105 | "dev": true, 106 | "requires": { 107 | "fill-range": "^7.0.1" 108 | } 109 | }, 110 | "bytes": { 111 | "version": "3.1.2", 112 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", 113 | "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" 114 | }, 115 | "call-bind": { 116 | "version": "1.0.2", 117 | "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", 118 | "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", 119 | "requires": { 120 | "function-bind": "^1.1.1", 121 | "get-intrinsic": "^1.0.2" 122 | } 123 | }, 124 | "camelize": { 125 | "version": "1.0.0", 126 | "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz", 127 | "integrity": "sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=" 128 | }, 129 | "chokidar": { 130 | "version": "3.5.3", 131 | "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", 132 | "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", 133 | "dev": true, 134 | "requires": { 135 | "anymatch": "~3.1.2", 136 | "braces": "~3.0.2", 137 | "fsevents": "~2.3.2", 138 | "glob-parent": "~5.1.2", 139 | "is-binary-path": "~2.1.0", 140 | "is-glob": "~4.0.1", 141 | "normalize-path": "~3.0.0", 142 | "readdirp": "~3.6.0" 143 | } 144 | }, 145 | "concat-map": { 146 | "version": "0.0.1", 147 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 148 | "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", 149 | "dev": true 150 | }, 151 | "content-disposition": { 152 | "version": "0.5.4", 153 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", 154 | "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", 155 | "requires": { 156 | "safe-buffer": "5.2.1" 157 | }, 158 | "dependencies": { 159 | "safe-buffer": { 160 | "version": "5.2.1", 161 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 162 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" 163 | } 164 | } 165 | }, 166 | "content-security-policy-builder": { 167 | "version": "2.1.0", 168 | "resolved": "https://registry.npmjs.org/content-security-policy-builder/-/content-security-policy-builder-2.1.0.tgz", 169 | "integrity": "sha512-/MtLWhJVvJNkA9dVLAp6fg9LxD2gfI6R2Fi1hPmfjYXSahJJzcfvoeDOxSyp4NvxMuwWv3WMssE9o31DoULHrQ==" 170 | }, 171 | "content-type": { 172 | "version": "1.0.4", 173 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 174 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" 175 | }, 176 | "cookie": { 177 | "version": "0.5.0", 178 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", 179 | "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" 180 | }, 181 | "cookie-signature": { 182 | "version": "1.0.6", 183 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 184 | "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" 185 | }, 186 | "dasherize": { 187 | "version": "2.0.0", 188 | "resolved": "https://registry.npmjs.org/dasherize/-/dasherize-2.0.0.tgz", 189 | "integrity": "sha1-bYCcnNDPe7iVLYD8hPoT1H3bEwg=" 190 | }, 191 | "debug": { 192 | "version": "2.6.9", 193 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 194 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 195 | "requires": { 196 | "ms": "2.0.0" 197 | } 198 | }, 199 | "depd": { 200 | "version": "2.0.0", 201 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", 202 | "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" 203 | }, 204 | "destroy": { 205 | "version": "1.2.0", 206 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", 207 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" 208 | }, 209 | "dont-sniff-mimetype": { 210 | "version": "1.1.0", 211 | "resolved": "https://registry.npmjs.org/dont-sniff-mimetype/-/dont-sniff-mimetype-1.1.0.tgz", 212 | "integrity": "sha512-ZjI4zqTaxveH2/tTlzS1wFp+7ncxNZaIEWYg3lzZRHkKf5zPT/MnEG6WL0BhHMJUabkh8GeU5NL5j+rEUCb7Ug==" 213 | }, 214 | "ee-first": { 215 | "version": "1.1.1", 216 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 217 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 218 | }, 219 | "encodeurl": { 220 | "version": "1.0.2", 221 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 222 | "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" 223 | }, 224 | "escape-html": { 225 | "version": "1.0.3", 226 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 227 | "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" 228 | }, 229 | "etag": { 230 | "version": "1.8.1", 231 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 232 | "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==" 233 | }, 234 | "express": { 235 | "version": "4.18.2", 236 | "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", 237 | "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", 238 | "requires": { 239 | "accepts": "~1.3.8", 240 | "array-flatten": "1.1.1", 241 | "body-parser": "1.20.1", 242 | "content-disposition": "0.5.4", 243 | "content-type": "~1.0.4", 244 | "cookie": "0.5.0", 245 | "cookie-signature": "1.0.6", 246 | "debug": "2.6.9", 247 | "depd": "2.0.0", 248 | "encodeurl": "~1.0.2", 249 | "escape-html": "~1.0.3", 250 | "etag": "~1.8.1", 251 | "finalhandler": "1.2.0", 252 | "fresh": "0.5.2", 253 | "http-errors": "2.0.0", 254 | "merge-descriptors": "1.0.1", 255 | "methods": "~1.1.2", 256 | "on-finished": "2.4.1", 257 | "parseurl": "~1.3.3", 258 | "path-to-regexp": "0.1.7", 259 | "proxy-addr": "~2.0.7", 260 | "qs": "6.11.0", 261 | "range-parser": "~1.2.1", 262 | "safe-buffer": "5.2.1", 263 | "send": "0.18.0", 264 | "serve-static": "1.15.0", 265 | "setprototypeof": "1.2.0", 266 | "statuses": "2.0.1", 267 | "type-is": "~1.6.18", 268 | "utils-merge": "1.0.1", 269 | "vary": "~1.1.2" 270 | }, 271 | "dependencies": { 272 | "on-finished": { 273 | "version": "2.4.1", 274 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", 275 | "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", 276 | "requires": { 277 | "ee-first": "1.1.1" 278 | } 279 | }, 280 | "safe-buffer": { 281 | "version": "5.2.1", 282 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 283 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" 284 | } 285 | } 286 | }, 287 | "feature-policy": { 288 | "version": "0.3.0", 289 | "resolved": "https://registry.npmjs.org/feature-policy/-/feature-policy-0.3.0.tgz", 290 | "integrity": "sha512-ZtijOTFN7TzCujt1fnNhfWPFPSHeZkesff9AXZj+UEjYBynWNUIYpC87Ve4wHzyexQsImicLu7WsC2LHq7/xrQ==" 291 | }, 292 | "fill-range": { 293 | "version": "7.0.1", 294 | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", 295 | "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", 296 | "dev": true, 297 | "requires": { 298 | "to-regex-range": "^5.0.1" 299 | } 300 | }, 301 | "finalhandler": { 302 | "version": "1.2.0", 303 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", 304 | "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", 305 | "requires": { 306 | "debug": "2.6.9", 307 | "encodeurl": "~1.0.2", 308 | "escape-html": "~1.0.3", 309 | "on-finished": "2.4.1", 310 | "parseurl": "~1.3.3", 311 | "statuses": "2.0.1", 312 | "unpipe": "~1.0.0" 313 | }, 314 | "dependencies": { 315 | "on-finished": { 316 | "version": "2.4.1", 317 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", 318 | "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", 319 | "requires": { 320 | "ee-first": "1.1.1" 321 | } 322 | } 323 | } 324 | }, 325 | "forwarded": { 326 | "version": "0.2.0", 327 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", 328 | "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" 329 | }, 330 | "fresh": { 331 | "version": "0.5.2", 332 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 333 | "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" 334 | }, 335 | "fsevents": { 336 | "version": "2.3.2", 337 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", 338 | "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", 339 | "dev": true, 340 | "optional": true 341 | }, 342 | "function-bind": { 343 | "version": "1.1.1", 344 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 345 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 346 | }, 347 | "get-intrinsic": { 348 | "version": "1.1.3", 349 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", 350 | "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", 351 | "requires": { 352 | "function-bind": "^1.1.1", 353 | "has": "^1.0.3", 354 | "has-symbols": "^1.0.3" 355 | } 356 | }, 357 | "glob-parent": { 358 | "version": "5.1.2", 359 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", 360 | "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", 361 | "dev": true, 362 | "requires": { 363 | "is-glob": "^4.0.1" 364 | } 365 | }, 366 | "has": { 367 | "version": "1.0.3", 368 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 369 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 370 | "requires": { 371 | "function-bind": "^1.1.1" 372 | } 373 | }, 374 | "has-flag": { 375 | "version": "3.0.0", 376 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", 377 | "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", 378 | "dev": true 379 | }, 380 | "has-symbols": { 381 | "version": "1.0.3", 382 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", 383 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" 384 | }, 385 | "helmet": { 386 | "version": "3.23.3", 387 | "resolved": "https://registry.npmjs.org/helmet/-/helmet-3.23.3.tgz", 388 | "integrity": "sha512-U3MeYdzPJQhtvqAVBPntVgAvNSOJyagwZwyKsFdyRa8TV3pOKVFljalPOCxbw5Wwf2kncGhmP0qHjyazIdNdSA==", 389 | "requires": { 390 | "depd": "2.0.0", 391 | "dont-sniff-mimetype": "1.1.0", 392 | "feature-policy": "0.3.0", 393 | "helmet-crossdomain": "0.4.0", 394 | "helmet-csp": "2.10.0", 395 | "hide-powered-by": "1.1.0", 396 | "hpkp": "2.0.0", 397 | "hsts": "2.2.0", 398 | "nocache": "2.1.0", 399 | "referrer-policy": "1.2.0", 400 | "x-xss-protection": "1.3.0" 401 | }, 402 | "dependencies": { 403 | "depd": { 404 | "version": "2.0.0", 405 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", 406 | "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" 407 | } 408 | } 409 | }, 410 | "helmet-crossdomain": { 411 | "version": "0.4.0", 412 | "resolved": "https://registry.npmjs.org/helmet-crossdomain/-/helmet-crossdomain-0.4.0.tgz", 413 | "integrity": "sha512-AB4DTykRw3HCOxovD1nPR16hllrVImeFp5VBV9/twj66lJ2nU75DP8FPL0/Jp4jj79JhTfG+pFI2MD02kWJ+fA==" 414 | }, 415 | "helmet-csp": { 416 | "version": "2.10.0", 417 | "resolved": "https://registry.npmjs.org/helmet-csp/-/helmet-csp-2.10.0.tgz", 418 | "integrity": "sha512-Rz953ZNEFk8sT2XvewXkYN0Ho4GEZdjAZy4stjiEQV3eN7GDxg1QKmYggH7otDyIA7uGA6XnUMVSgeJwbR5X+w==", 419 | "requires": { 420 | "bowser": "2.9.0", 421 | "camelize": "1.0.0", 422 | "content-security-policy-builder": "2.1.0", 423 | "dasherize": "2.0.0" 424 | } 425 | }, 426 | "hide-powered-by": { 427 | "version": "1.1.0", 428 | "resolved": "https://registry.npmjs.org/hide-powered-by/-/hide-powered-by-1.1.0.tgz", 429 | "integrity": "sha512-Io1zA2yOA1YJslkr+AJlWSf2yWFkKjvkcL9Ni1XSUqnGLr/qRQe2UI3Cn/J9MsJht7yEVCe0SscY1HgVMujbgg==" 430 | }, 431 | "hpkp": { 432 | "version": "2.0.0", 433 | "resolved": "https://registry.npmjs.org/hpkp/-/hpkp-2.0.0.tgz", 434 | "integrity": "sha1-EOFCJk52IVpdMMROxD3mTe5tFnI=" 435 | }, 436 | "hsts": { 437 | "version": "2.2.0", 438 | "resolved": "https://registry.npmjs.org/hsts/-/hsts-2.2.0.tgz", 439 | "integrity": "sha512-ToaTnQ2TbJkochoVcdXYm4HOCliNozlviNsg+X2XQLQvZNI/kCHR9rZxVYpJB3UPcHz80PgxRyWQ7PdU1r+VBQ==", 440 | "requires": { 441 | "depd": "2.0.0" 442 | }, 443 | "dependencies": { 444 | "depd": { 445 | "version": "2.0.0", 446 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", 447 | "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" 448 | } 449 | } 450 | }, 451 | "http-errors": { 452 | "version": "2.0.0", 453 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", 454 | "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", 455 | "requires": { 456 | "depd": "2.0.0", 457 | "inherits": "2.0.4", 458 | "setprototypeof": "1.2.0", 459 | "statuses": "2.0.1", 460 | "toidentifier": "1.0.1" 461 | } 462 | }, 463 | "iconv-lite": { 464 | "version": "0.4.24", 465 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 466 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 467 | "requires": { 468 | "safer-buffer": ">= 2.1.2 < 3" 469 | } 470 | }, 471 | "ignore-by-default": { 472 | "version": "1.0.1", 473 | "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", 474 | "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", 475 | "dev": true 476 | }, 477 | "inherits": { 478 | "version": "2.0.4", 479 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 480 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 481 | }, 482 | "ipaddr.js": { 483 | "version": "1.9.1", 484 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", 485 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" 486 | }, 487 | "is-binary-path": { 488 | "version": "2.1.0", 489 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", 490 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", 491 | "dev": true, 492 | "requires": { 493 | "binary-extensions": "^2.0.0" 494 | } 495 | }, 496 | "is-extglob": { 497 | "version": "2.1.1", 498 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", 499 | "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", 500 | "dev": true 501 | }, 502 | "is-glob": { 503 | "version": "4.0.3", 504 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", 505 | "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", 506 | "dev": true, 507 | "requires": { 508 | "is-extglob": "^2.1.1" 509 | } 510 | }, 511 | "is-number": { 512 | "version": "7.0.0", 513 | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", 514 | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", 515 | "dev": true 516 | }, 517 | "media-typer": { 518 | "version": "0.3.0", 519 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 520 | "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==" 521 | }, 522 | "merge-descriptors": { 523 | "version": "1.0.1", 524 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 525 | "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" 526 | }, 527 | "methods": { 528 | "version": "1.1.2", 529 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 530 | "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==" 531 | }, 532 | "mime": { 533 | "version": "1.6.0", 534 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 535 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" 536 | }, 537 | "mime-db": { 538 | "version": "1.52.0", 539 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", 540 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" 541 | }, 542 | "mime-types": { 543 | "version": "2.1.35", 544 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", 545 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", 546 | "requires": { 547 | "mime-db": "1.52.0" 548 | } 549 | }, 550 | "minimatch": { 551 | "version": "3.1.2", 552 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 553 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 554 | "dev": true, 555 | "requires": { 556 | "brace-expansion": "^1.1.7" 557 | } 558 | }, 559 | "morgan": { 560 | "version": "1.10.0", 561 | "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz", 562 | "integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==", 563 | "requires": { 564 | "basic-auth": "~2.0.1", 565 | "debug": "2.6.9", 566 | "depd": "~2.0.0", 567 | "on-finished": "~2.3.0", 568 | "on-headers": "~1.0.2" 569 | }, 570 | "dependencies": { 571 | "depd": { 572 | "version": "2.0.0", 573 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", 574 | "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" 575 | } 576 | } 577 | }, 578 | "ms": { 579 | "version": "2.0.0", 580 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 581 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 582 | }, 583 | "negotiator": { 584 | "version": "0.6.3", 585 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", 586 | "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" 587 | }, 588 | "nocache": { 589 | "version": "2.1.0", 590 | "resolved": "https://registry.npmjs.org/nocache/-/nocache-2.1.0.tgz", 591 | "integrity": "sha512-0L9FvHG3nfnnmaEQPjT9xhfN4ISk0A8/2j4M37Np4mcDesJjHgEUfgPhdCyZuFI954tjokaIj/A3NdpFNdEh4Q==" 592 | }, 593 | "nodemon": { 594 | "version": "2.0.19", 595 | "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.19.tgz", 596 | "integrity": "sha512-4pv1f2bMDj0Eeg/MhGqxrtveeQ5/G/UVe9iO6uTZzjnRluSA4PVWf8CW99LUPwGB3eNIA7zUFoP77YuI7hOc0A==", 597 | "dev": true, 598 | "requires": { 599 | "chokidar": "^3.5.2", 600 | "debug": "^3.2.7", 601 | "ignore-by-default": "^1.0.1", 602 | "minimatch": "^3.0.4", 603 | "pstree.remy": "^1.1.8", 604 | "semver": "^5.7.1", 605 | "simple-update-notifier": "^1.0.7", 606 | "supports-color": "^5.5.0", 607 | "touch": "^3.1.0", 608 | "undefsafe": "^2.0.5" 609 | }, 610 | "dependencies": { 611 | "debug": { 612 | "version": "3.2.7", 613 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", 614 | "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", 615 | "dev": true, 616 | "requires": { 617 | "ms": "^2.1.1" 618 | } 619 | }, 620 | "ms": { 621 | "version": "2.1.3", 622 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 623 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", 624 | "dev": true 625 | } 626 | } 627 | }, 628 | "nopt": { 629 | "version": "1.0.10", 630 | "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", 631 | "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", 632 | "dev": true, 633 | "requires": { 634 | "abbrev": "1" 635 | } 636 | }, 637 | "normalize-path": { 638 | "version": "3.0.0", 639 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", 640 | "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", 641 | "dev": true 642 | }, 643 | "object-inspect": { 644 | "version": "1.12.2", 645 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", 646 | "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==" 647 | }, 648 | "on-finished": { 649 | "version": "2.3.0", 650 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 651 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 652 | "requires": { 653 | "ee-first": "1.1.1" 654 | } 655 | }, 656 | "on-headers": { 657 | "version": "1.0.2", 658 | "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", 659 | "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==" 660 | }, 661 | "parseurl": { 662 | "version": "1.3.3", 663 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 664 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" 665 | }, 666 | "path-to-regexp": { 667 | "version": "0.1.7", 668 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 669 | "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" 670 | }, 671 | "picomatch": { 672 | "version": "2.3.1", 673 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", 674 | "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", 675 | "dev": true 676 | }, 677 | "proxy-addr": { 678 | "version": "2.0.7", 679 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", 680 | "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", 681 | "requires": { 682 | "forwarded": "0.2.0", 683 | "ipaddr.js": "1.9.1" 684 | } 685 | }, 686 | "pstree.remy": { 687 | "version": "1.1.8", 688 | "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", 689 | "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", 690 | "dev": true 691 | }, 692 | "qs": { 693 | "version": "6.11.0", 694 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", 695 | "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", 696 | "requires": { 697 | "side-channel": "^1.0.4" 698 | } 699 | }, 700 | "range-parser": { 701 | "version": "1.2.1", 702 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 703 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" 704 | }, 705 | "raw-body": { 706 | "version": "2.5.1", 707 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", 708 | "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", 709 | "requires": { 710 | "bytes": "3.1.2", 711 | "http-errors": "2.0.0", 712 | "iconv-lite": "0.4.24", 713 | "unpipe": "1.0.0" 714 | } 715 | }, 716 | "readdirp": { 717 | "version": "3.6.0", 718 | "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", 719 | "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", 720 | "dev": true, 721 | "requires": { 722 | "picomatch": "^2.2.1" 723 | } 724 | }, 725 | "referrer-policy": { 726 | "version": "1.2.0", 727 | "resolved": "https://registry.npmjs.org/referrer-policy/-/referrer-policy-1.2.0.tgz", 728 | "integrity": "sha512-LgQJIuS6nAy1Jd88DCQRemyE3mS+ispwlqMk3b0yjZ257fI1v9c+/p6SD5gP5FGyXUIgrNOAfmyioHwZtYv2VA==" 729 | }, 730 | "safe-buffer": { 731 | "version": "5.1.2", 732 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 733 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 734 | }, 735 | "safer-buffer": { 736 | "version": "2.1.2", 737 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 738 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 739 | }, 740 | "semver": { 741 | "version": "5.7.1", 742 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", 743 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", 744 | "dev": true 745 | }, 746 | "send": { 747 | "version": "0.18.0", 748 | "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", 749 | "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", 750 | "requires": { 751 | "debug": "2.6.9", 752 | "depd": "2.0.0", 753 | "destroy": "1.2.0", 754 | "encodeurl": "~1.0.2", 755 | "escape-html": "~1.0.3", 756 | "etag": "~1.8.1", 757 | "fresh": "0.5.2", 758 | "http-errors": "2.0.0", 759 | "mime": "1.6.0", 760 | "ms": "2.1.3", 761 | "on-finished": "2.4.1", 762 | "range-parser": "~1.2.1", 763 | "statuses": "2.0.1" 764 | }, 765 | "dependencies": { 766 | "ms": { 767 | "version": "2.1.3", 768 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 769 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" 770 | }, 771 | "on-finished": { 772 | "version": "2.4.1", 773 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", 774 | "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", 775 | "requires": { 776 | "ee-first": "1.1.1" 777 | } 778 | } 779 | } 780 | }, 781 | "serve-static": { 782 | "version": "1.15.0", 783 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", 784 | "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", 785 | "requires": { 786 | "encodeurl": "~1.0.2", 787 | "escape-html": "~1.0.3", 788 | "parseurl": "~1.3.3", 789 | "send": "0.18.0" 790 | } 791 | }, 792 | "setprototypeof": { 793 | "version": "1.2.0", 794 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", 795 | "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" 796 | }, 797 | "side-channel": { 798 | "version": "1.0.4", 799 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", 800 | "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", 801 | "requires": { 802 | "call-bind": "^1.0.0", 803 | "get-intrinsic": "^1.0.2", 804 | "object-inspect": "^1.9.0" 805 | } 806 | }, 807 | "simple-update-notifier": { 808 | "version": "1.0.7", 809 | "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.0.7.tgz", 810 | "integrity": "sha512-BBKgR84BJQJm6WjWFMHgLVuo61FBDSj1z/xSFUIozqO6wO7ii0JxCqlIud7Enr/+LhlbNI0whErq96P2qHNWew==", 811 | "dev": true, 812 | "requires": { 813 | "semver": "~7.0.0" 814 | }, 815 | "dependencies": { 816 | "semver": { 817 | "version": "7.0.0", 818 | "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", 819 | "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", 820 | "dev": true 821 | } 822 | } 823 | }, 824 | "statuses": { 825 | "version": "2.0.1", 826 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", 827 | "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" 828 | }, 829 | "supports-color": { 830 | "version": "5.5.0", 831 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", 832 | "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", 833 | "dev": true, 834 | "requires": { 835 | "has-flag": "^3.0.0" 836 | } 837 | }, 838 | "to-regex-range": { 839 | "version": "5.0.1", 840 | "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", 841 | "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", 842 | "dev": true, 843 | "requires": { 844 | "is-number": "^7.0.0" 845 | } 846 | }, 847 | "toidentifier": { 848 | "version": "1.0.1", 849 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", 850 | "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" 851 | }, 852 | "touch": { 853 | "version": "3.1.0", 854 | "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", 855 | "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", 856 | "dev": true, 857 | "requires": { 858 | "nopt": "~1.0.10" 859 | } 860 | }, 861 | "type-is": { 862 | "version": "1.6.18", 863 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 864 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", 865 | "requires": { 866 | "media-typer": "0.3.0", 867 | "mime-types": "~2.1.24" 868 | } 869 | }, 870 | "undefsafe": { 871 | "version": "2.0.5", 872 | "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", 873 | "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", 874 | "dev": true 875 | }, 876 | "unpipe": { 877 | "version": "1.0.0", 878 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 879 | "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" 880 | }, 881 | "utils-merge": { 882 | "version": "1.0.1", 883 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 884 | "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" 885 | }, 886 | "vary": { 887 | "version": "1.1.2", 888 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 889 | "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" 890 | }, 891 | "x-xss-protection": { 892 | "version": "1.3.0", 893 | "resolved": "https://registry.npmjs.org/x-xss-protection/-/x-xss-protection-1.3.0.tgz", 894 | "integrity": "sha512-kpyBI9TlVipZO4diReZMAHWtS0MMa/7Kgx8hwG/EuZLiA6sg4Ah/4TRdASHhRRN3boobzcYgFRUFSgHRge6Qhg==" 895 | } 896 | } 897 | } 898 | -------------------------------------------------------------------------------- /01-Login/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "01-login", 3 | "version": "1.0.0", 4 | "description": "Sample application for the new Auth0 SPA SDK", 5 | "main": "server.js", 6 | "scripts": { 7 | "start": "node bin/www", 8 | "dev": "nodemon bin/www" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "MIT", 13 | "devDependencies": { 14 | "nodemon": "^2.0.19" 15 | }, 16 | "dependencies": { 17 | "express": "^4.18.2", 18 | "helmet": "^3.23.3", 19 | "morgan": "^1.10.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /01-Login/public/css/main.css: -------------------------------------------------------------------------------- 1 | .hidden { 2 | display: none; 3 | } 4 | label { 5 | margin-bottom: 10px; 6 | display: block; 7 | } 8 | 9 | .navbar { 10 | min-height: 115px; 11 | } 12 | -------------------------------------------------------------------------------- /01-Login/public/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0-samples/auth0-javascript-samples/9a35820af310448ca9b1dc58d2e31ca4e1065657/01-Login/public/images/logo.png -------------------------------------------------------------------------------- /01-Login/public/js/app.js: -------------------------------------------------------------------------------- 1 | // The Auth0 client, initialized in configureClient() 2 | let auth0Client = null; 3 | 4 | /** 5 | * Starts the authentication flow 6 | */ 7 | const login = async (targetUrl) => { 8 | try { 9 | console.log("Logging in", targetUrl); 10 | 11 | const options = { 12 | authorizationParams: { 13 | redirect_uri: window.location.origin 14 | } 15 | }; 16 | 17 | if (targetUrl) { 18 | options.appState = { targetUrl }; 19 | } 20 | 21 | await auth0Client.loginWithRedirect(options); 22 | } catch (err) { 23 | console.log("Log in failed", err); 24 | } 25 | }; 26 | 27 | /** 28 | * Executes the logout flow 29 | */ 30 | const logout = async () => { 31 | try { 32 | console.log("Logging out"); 33 | await auth0Client.logout({ 34 | logoutParams: { 35 | returnTo: window.location.origin 36 | } 37 | }); 38 | } catch (err) { 39 | console.log("Log out failed", err); 40 | } 41 | }; 42 | 43 | /** 44 | * Retrieves the auth configuration from the server 45 | */ 46 | const fetchAuthConfig = () => fetch("/auth_config.json"); 47 | 48 | /** 49 | * Initializes the Auth0 client 50 | */ 51 | const configureClient = async () => { 52 | const response = await fetchAuthConfig(); 53 | const config = await response.json(); 54 | 55 | auth0Client = await auth0.createAuth0Client({ 56 | domain: config.domain, 57 | clientId: config.clientId 58 | }); 59 | }; 60 | 61 | /** 62 | * Checks to see if the user is authenticated. If so, `fn` is executed. Otherwise, the user 63 | * is prompted to log in 64 | * @param {*} fn The function to execute if the user is logged in 65 | */ 66 | const requireAuth = async (fn, targetUrl) => { 67 | const isAuthenticated = await auth0Client.isAuthenticated(); 68 | 69 | if (isAuthenticated) { 70 | return fn(); 71 | } 72 | 73 | return login(targetUrl); 74 | }; 75 | 76 | // Will run when page finishes loading 77 | window.onload = async () => { 78 | await configureClient(); 79 | 80 | // If unable to parse the history hash, default to the root URL 81 | if (!showContentFromUrl(window.location.pathname)) { 82 | showContentFromUrl("/"); 83 | window.history.replaceState({ url: "/" }, {}, "/"); 84 | } 85 | 86 | const bodyElement = document.getElementsByTagName("body")[0]; 87 | 88 | // Listen out for clicks on any hyperlink that navigates to a #/ URL 89 | bodyElement.addEventListener("click", (e) => { 90 | if (isRouteLink(e.target)) { 91 | const url = e.target.getAttribute("href"); 92 | 93 | if (showContentFromUrl(url)) { 94 | e.preventDefault(); 95 | window.history.pushState({ url }, {}, url); 96 | } 97 | } 98 | }); 99 | 100 | const isAuthenticated = await auth0Client.isAuthenticated(); 101 | 102 | if (isAuthenticated) { 103 | console.log("> User is authenticated"); 104 | window.history.replaceState({}, document.title, window.location.pathname); 105 | updateUI(); 106 | return; 107 | } 108 | 109 | console.log("> User not authenticated"); 110 | 111 | const query = window.location.search; 112 | const shouldParseResult = query.includes("code=") && query.includes("state="); 113 | 114 | if (shouldParseResult) { 115 | console.log("> Parsing redirect"); 116 | try { 117 | const result = await auth0Client.handleRedirectCallback(); 118 | 119 | if (result.appState && result.appState.targetUrl) { 120 | showContentFromUrl(result.appState.targetUrl); 121 | } 122 | 123 | console.log("Logged in!"); 124 | } catch (err) { 125 | console.log("Error parsing redirect:", err); 126 | } 127 | 128 | window.history.replaceState({}, document.title, "/"); 129 | } 130 | 131 | updateUI(); 132 | }; 133 | -------------------------------------------------------------------------------- /01-Login/public/js/ui.js: -------------------------------------------------------------------------------- 1 | // URL mapping, from hash to a function that responds to that URL action 2 | const router = { 3 | "/": () => showContent("content-home"), 4 | "/profile": () => 5 | requireAuth(() => showContent("content-profile"), "/profile"), 6 | "/login": () => login() 7 | }; 8 | 9 | //Declare helper functions 10 | 11 | /** 12 | * Iterates over the elements matching 'selector' and passes them 13 | * to 'fn' 14 | * @param {*} selector The CSS selector to find 15 | * @param {*} fn The function to execute for every element 16 | */ 17 | const eachElement = (selector, fn) => { 18 | for (let e of document.querySelectorAll(selector)) { 19 | fn(e); 20 | } 21 | }; 22 | 23 | /** 24 | * Tries to display a content panel that is referenced 25 | * by the specified route URL. These are matched using the 26 | * router, defined above. 27 | * @param {*} url The route URL 28 | */ 29 | const showContentFromUrl = (url) => { 30 | if (router[url]) { 31 | router[url](); 32 | return true; 33 | } 34 | 35 | return false; 36 | }; 37 | 38 | /** 39 | * Returns true if `element` is a hyperlink that can be considered a link to another SPA route 40 | * @param {*} element The element to check 41 | */ 42 | const isRouteLink = (element) => 43 | element.tagName === "A" && element.classList.contains("route-link"); 44 | 45 | /** 46 | * Displays a content panel specified by the given element id. 47 | * All the panels that participate in this flow should have the 'page' class applied, 48 | * so that it can be correctly hidden before the requested content is shown. 49 | * @param {*} id The id of the content to show 50 | */ 51 | const showContent = (id) => { 52 | eachElement(".page", (p) => p.classList.add("hidden")); 53 | document.getElementById(id).classList.remove("hidden"); 54 | }; 55 | 56 | /** 57 | * Updates the user interface 58 | */ 59 | const updateUI = async () => { 60 | try { 61 | const isAuthenticated = await auth0Client.isAuthenticated(); 62 | 63 | if (isAuthenticated) { 64 | const user = await auth0Client.getUser(); 65 | 66 | document.getElementById("profile-data").innerText = JSON.stringify( 67 | user, 68 | null, 69 | 2 70 | ); 71 | 72 | document.querySelectorAll("pre code").forEach(hljs.highlightBlock); 73 | 74 | eachElement(".profile-image", (e) => (e.src = user.picture)); 75 | eachElement(".user-name", (e) => (e.innerText = user.name)); 76 | eachElement(".user-email", (e) => (e.innerText = user.email)); 77 | eachElement(".auth-invisible", (e) => e.classList.add("hidden")); 78 | eachElement(".auth-visible", (e) => e.classList.remove("hidden")); 79 | } else { 80 | eachElement(".auth-invisible", (e) => e.classList.remove("hidden")); 81 | eachElement(".auth-visible", (e) => e.classList.add("hidden")); 82 | } 83 | } catch (err) { 84 | console.log("Error updating UI!", err); 85 | return; 86 | } 87 | 88 | console.log("UI updated"); 89 | }; 90 | 91 | window.onpopstate = (e) => { 92 | if (e.state && e.state.url && router[e.state.url]) { 93 | showContentFromUrl(e.state.url); 94 | } 95 | }; 96 | -------------------------------------------------------------------------------- /01-Login/server.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const { join } = require("path"); 3 | const morgan = require("morgan"); 4 | const helmet = require("helmet"); 5 | const app = express(); 6 | 7 | app.use(morgan("dev")); 8 | app.use(helmet()); 9 | app.use(express.static(join(__dirname, "public"))); 10 | 11 | app.get("/auth_config.json", (req, res) => { 12 | res.sendFile(join(__dirname, "auth_config.json")); 13 | }); 14 | 15 | app.get("/*", (_, res) => { 16 | res.sendFile(join(__dirname, "index.html")); 17 | }); 18 | 19 | process.on("SIGINT", function() { 20 | process.exit(); 21 | }); 22 | 23 | module.exports = app; 24 | -------------------------------------------------------------------------------- /02-Calling-an-API/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .git 3 | .gitignore 4 | README.md 5 | start.* -------------------------------------------------------------------------------- /02-Calling-an-API/.gitignore: -------------------------------------------------------------------------------- 1 | a0-variables.js 2 | auth_config.json 3 | -------------------------------------------------------------------------------- /02-Calling-an-API/.prettierrc.yaml: -------------------------------------------------------------------------------- 1 | semi: true 2 | arrowParens: always 3 | -------------------------------------------------------------------------------- /02-Calling-an-API/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12 2 | 3 | RUN mkdir /app 4 | 5 | WORKDIR /app 6 | 7 | COPY package.json . 8 | 9 | RUN npm install --production 10 | 11 | COPY . . 12 | 13 | EXPOSE 3000 14 | 15 | CMD ["node", "bin/www"] 16 | -------------------------------------------------------------------------------- /02-Calling-an-API/README.md: -------------------------------------------------------------------------------- 1 | # Sample 02 - Calling an API 2 | 3 | This app demonstrates how to log in using the Auth0 Universal Page, and call a backend API using an access token. 4 | 5 | ## Installation 6 | 7 | After cloning the repository, run: 8 | 9 | ```bash 10 | $ npm install 11 | ``` 12 | 13 | This will install all of the necessary packages in order for the sample to run. 14 | 15 | ## Running the Application 16 | 17 | To start the app from the terminal, run: 18 | 19 | ```bash 20 | $ npm run dev 21 | ``` 22 | 23 | Open the application in the browser at [http://localhost:3000](http://localhost:3000). 24 | 25 | ## Frequently Asked Questions 26 | 27 | We are compiling a list of questions and answers regarding the new JavaScript SDK - if you're having issues running the sample applications, [check the FAQ](https://github.com/auth0/auth0-spa-js/blob/master/FAQ.md)! 28 | 29 | ## What is Auth0? 30 | 31 | Auth0 helps you to: 32 | 33 | - Add authentication with [multiple authentication sources](https://docs.auth0.com/identityproviders), either social like **Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, among others**, or enterprise identity systems like **Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider**. 34 | - Add authentication through more traditional **[username/password databases](https://docs.auth0.com/mysql-connection-tutorial)**. 35 | - Add support for **[linking different user accounts](https://docs.auth0.com/link-accounts)** with the same user. 36 | - Support for generating signed [Json Web Tokens](https://docs.auth0.com/jwt) to call your APIs and **flow the user identity** securely. 37 | - Analytics of how, when and where users are logging in. 38 | - Pull data from other sources and add it to the user profile, through [JavaScript rules](https://docs.auth0.com/rules). 39 | 40 | ## Create a free Auth0 account 41 | 42 | 1. Go to [Auth0](https://auth0.com/signup) and click Sign Up. 43 | 2. Use Google, GitHub or Microsoft Account to login. 44 | 45 | ## Issue Reporting 46 | 47 | If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues. 48 | 49 | ## Author 50 | 51 | [Auth0](auth0.com) 52 | 53 | ## License 54 | 55 | This project is licensed under the MIT license. See the [LICENSE](LICENSE.txt) file for more info. 56 | -------------------------------------------------------------------------------- /02-Calling-an-API/auth_config.json.example: -------------------------------------------------------------------------------- 1 | { 2 | "domain": "{DOMAIN}", 3 | "clientId": "{CLIENT_ID}", 4 | "audience": "{API_IDENTIFIER}" 5 | } -------------------------------------------------------------------------------- /02-Calling-an-API/bin/www: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | const app = require("../server"); 4 | const port = process.env.PORT || 3000; 5 | 6 | app.listen(port, () => console.log(`Server listening on port ${port}`)); 7 | -------------------------------------------------------------------------------- /02-Calling-an-API/exec.ps1: -------------------------------------------------------------------------------- 1 | docker build --rm -t auth0-javascript-sample-02-api . 2 | docker run -p 3000:3000 -it auth0-javascript-sample-02-api 3 | -------------------------------------------------------------------------------- /02-Calling-an-API/exec.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | docker build -t auth0-javascript-sample-02-api . 3 | docker run --init -p 3000:3000 -it auth0-javascript-sample-02-api -------------------------------------------------------------------------------- /02-Calling-an-API/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SPA SDK Sample 6 | 10 | 11 | 15 | 21 | 27 | 28 | 32 | 33 | 34 | 35 |
36 | 170 | 171 |
172 |
173 |
174 | 180 |

JavaScript Sample Project

181 | 182 |

183 | This is a sample application that demonstrates an authentication 184 | flow for an SPA, using plain JavaScript 185 |

186 |
187 | 188 |
189 |

What can I do next?

190 | 191 |
192 |
193 |
194 | 195 | Configure other identity 196 | providers 197 | 198 |
199 |

200 | Auth0 supports social providers as Facebook, Twitter, 201 | Instagram and 100+, Enterprise providers as Microsoft Office 202 | 365, Google Apps, Azure, and more. You can also use any OAuth2 203 | Authorization Server. 204 |

205 |
206 | 207 |
208 | 209 |
210 |
211 | 212 | Enable Multifactor 213 | Authentication 214 | 215 |
216 |

217 | Add an extra layer of security by enabling Multi-factor 218 | Authentication, requiring your users to provide more than one 219 | piece of identifying information. Push notifications, 220 | authenticator apps, SMS, and DUO Security are supported. 221 |

222 |
223 |
224 | 225 |
226 |
227 |
228 | 229 | Anomaly Detection 230 | 231 |
232 |

233 | Auth0 can detect anomalies and stop malicious attempts to 234 | access your application. Anomaly detection can alert you and 235 | your users of suspicious activity, as well as block further 236 | login attempts. 237 |

238 |
239 | 240 |
241 | 242 |
243 |
244 | 245 | Learn About Rules 246 | 247 |
248 |

249 | Rules are JavaScript functions that execute when a user 250 | authenticates to your application. They run once the 251 | authentication process is complete, and you can use them to 252 | customize and extend Auth0's capabilities. 253 |

254 |
255 |
256 |
257 |
258 | 259 |
260 |
261 |
262 |
263 | User's profile picture 267 |
268 |
269 |

270 |

271 |
272 |
273 | 274 |
275 |
276 |                 
277 |
278 |
279 |
280 | 281 |
282 |

External API

283 |

284 | Ping an external API by clicking the button below. This will call 285 | the external API using an access token, and the API will validate it 286 | using the API's audience value. 287 |

288 | 289 |

290 | Ping API 291 |

292 | 293 |
294 |
295 |
Result
296 |
297 |                 JSON.stringify(apiMessage, null, 2)
298 |               
299 |
300 |
301 |
302 |
303 | 304 | 311 |
312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | -------------------------------------------------------------------------------- /02-Calling-an-API/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "02-calling-an-api", 3 | "version": "1.0.0", 4 | "description": "The purpose of this article is to demonstrate how to call a backend API using an access token", 5 | "main": "server.js", 6 | "dependencies": { 7 | "express": "^4.18.2", 8 | "express-oauth2-jwt-bearer": "^1.6.0", 9 | "helmet": "^3.23.3", 10 | "morgan": "^1.10.0" 11 | }, 12 | "devDependencies": { 13 | "nodemon": "^2.0.19", 14 | "npm-run-all": "^4.1.5" 15 | }, 16 | "scripts": { 17 | "start": "node bin/www", 18 | "dev": "nodemon bin/www" 19 | }, 20 | "author": "", 21 | "license": "MIT" 22 | } 23 | -------------------------------------------------------------------------------- /02-Calling-an-API/public/css/main.css: -------------------------------------------------------------------------------- 1 | .hidden { 2 | display: none; 3 | } 4 | 5 | label { 6 | margin-bottom: 10px; 7 | display: block; 8 | } 9 | 10 | .navbar { 11 | min-height: 115px; 12 | } 13 | 14 | .result-block-container .result-block { 15 | opacity: 0; 16 | } 17 | 18 | .result-block-container .result-block.show { 19 | opacity: 1; 20 | } 21 | -------------------------------------------------------------------------------- /02-Calling-an-API/public/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/auth0-samples/auth0-javascript-samples/9a35820af310448ca9b1dc58d2e31ca4e1065657/02-Calling-an-API/public/images/logo.png -------------------------------------------------------------------------------- /02-Calling-an-API/public/js/app.js: -------------------------------------------------------------------------------- 1 | // The Auth0 client, initialized in configureClient() 2 | let auth0Client = null; 3 | 4 | /** 5 | * Starts the authentication flow 6 | */ 7 | const login = async (targetUrl) => { 8 | try { 9 | console.log("Logging in", targetUrl); 10 | 11 | const options = { 12 | authorizationParams: { 13 | redirect_uri: window.location.origin 14 | } 15 | }; 16 | 17 | if (targetUrl) { 18 | options.appState = { targetUrl }; 19 | } 20 | 21 | await auth0Client.loginWithRedirect(options); 22 | } catch (err) { 23 | console.log("Log in failed", err); 24 | } 25 | }; 26 | 27 | /** 28 | * Executes the logout flow 29 | */ 30 | const logout = async () => { 31 | try { 32 | console.log("Logging out"); 33 | await auth0Client.logout({ 34 | logoutParams: { 35 | returnTo: window.location.origin 36 | } 37 | }); 38 | } catch (err) { 39 | console.log("Log out failed", err); 40 | } 41 | }; 42 | 43 | /** 44 | * Retrieves the auth configuration from the server 45 | */ 46 | const fetchAuthConfig = () => fetch("/auth_config.json"); 47 | 48 | /** 49 | * Initializes the Auth0 client 50 | */ 51 | const configureClient = async () => { 52 | const response = await fetchAuthConfig(); 53 | const config = await response.json(); 54 | 55 | auth0Client = await auth0.createAuth0Client({ 56 | domain: config.domain, 57 | clientId: config.clientId, 58 | authorizationParams: { 59 | audience: config.audience 60 | } 61 | }); 62 | }; 63 | 64 | /** 65 | * Checks to see if the user is authenticated. If so, `fn` is executed. Otherwise, the user 66 | * is prompted to log in 67 | * @param {*} fn The function to execute if the user is logged in 68 | */ 69 | const requireAuth = async (fn, targetUrl) => { 70 | const isAuthenticated = await auth0Client.isAuthenticated(); 71 | 72 | if (isAuthenticated) { 73 | return fn(); 74 | } 75 | 76 | return login(targetUrl); 77 | }; 78 | 79 | /** 80 | * Calls the API endpoint with an authorization token 81 | */ 82 | const callApi = async () => { 83 | try { 84 | const token = await auth0Client.getTokenSilently(); 85 | 86 | const response = await fetch("/api/external", { 87 | headers: { 88 | Authorization: `Bearer ${token}` 89 | } 90 | }); 91 | 92 | const responseData = await response.json(); 93 | const responseElement = document.getElementById("api-call-result"); 94 | 95 | responseElement.innerText = JSON.stringify(responseData, {}, 2); 96 | 97 | document.querySelectorAll("pre code").forEach(hljs.highlightBlock); 98 | 99 | eachElement(".result-block", (c) => c.classList.add("show")); 100 | } catch (e) { 101 | console.error(e); 102 | } 103 | }; 104 | 105 | // Will run when page finishes loading 106 | window.onload = async () => { 107 | await configureClient(); 108 | 109 | // If unable to parse the history hash, default to the root URL 110 | if (!showContentFromUrl(window.location.pathname)) { 111 | showContentFromUrl("/"); 112 | window.history.replaceState({ url: "/" }, {}, "/"); 113 | } 114 | 115 | const bodyElement = document.getElementsByTagName("body")[0]; 116 | 117 | // Listen out for clicks on any hyperlink that navigates to a #/ URL 118 | bodyElement.addEventListener("click", (e) => { 119 | if (isRouteLink(e.target)) { 120 | const url = e.target.getAttribute("href"); 121 | 122 | if (showContentFromUrl(url)) { 123 | e.preventDefault(); 124 | window.history.pushState({ url }, {}, url); 125 | } 126 | } else if (e.target.getAttribute("id") === "call-api") { 127 | e.preventDefault(); 128 | callApi(); 129 | } 130 | }); 131 | 132 | const isAuthenticated = await auth0Client.isAuthenticated(); 133 | 134 | if (isAuthenticated) { 135 | console.log("> User is authenticated"); 136 | window.history.replaceState({}, document.title, window.location.pathname); 137 | updateUI(); 138 | return; 139 | } 140 | 141 | console.log("> User not authenticated"); 142 | 143 | const query = window.location.search; 144 | const shouldParseResult = query.includes("code=") && query.includes("state="); 145 | 146 | if (shouldParseResult) { 147 | console.log("> Parsing redirect"); 148 | try { 149 | const result = await auth0Client.handleRedirectCallback(); 150 | 151 | if (result.appState && result.appState.targetUrl) { 152 | showContentFromUrl(result.appState.targetUrl); 153 | } 154 | 155 | console.log("Logged in!"); 156 | } catch (err) { 157 | console.log("Error parsing redirect:", err); 158 | } 159 | 160 | window.history.replaceState({}, document.title, "/"); 161 | } 162 | 163 | updateUI(); 164 | }; 165 | -------------------------------------------------------------------------------- /02-Calling-an-API/public/js/ui.js: -------------------------------------------------------------------------------- 1 | // URL mapping, from hash to a function that responds to that URL action 2 | const router = { 3 | "/": () => showContent("content-home"), 4 | "/login": () => login(), 5 | "/profile": () => 6 | requireAuth(() => showContent("content-profile"), "/profile"), 7 | "/external-api": () => 8 | requireAuth(() => showContent("content-external-api"), "/external-api"), 9 | "/login": () => login() 10 | }; 11 | 12 | //Declare helper functions 13 | 14 | /** 15 | * Iterates over the elements matching 'selector' and passes them 16 | * to 'fn' 17 | * @param {*} selector The CSS selector to find 18 | * @param {*} fn The function to execute for every element 19 | */ 20 | const eachElement = (selector, fn) => { 21 | for (let e of document.querySelectorAll(selector)) { 22 | fn(e); 23 | } 24 | }; 25 | 26 | /** 27 | * Tries to display a content panel that is referenced 28 | * by the specified route URL. These are matched using the 29 | * router, defined above. 30 | * @param {*} url The route URL 31 | */ 32 | const showContentFromUrl = (url) => { 33 | if (router[url]) { 34 | router[url](); 35 | return true; 36 | } 37 | 38 | return false; 39 | }; 40 | 41 | /** 42 | * Returns true if `element` is a hyperlink that can be considered a link to another SPA route 43 | * @param {*} element The element to check 44 | */ 45 | const isRouteLink = (element) => 46 | element.tagName === "A" && element.classList.contains("route-link"); 47 | 48 | /** 49 | * Displays a content panel specified by the given element id. 50 | * All the panels that participate in this flow should have the 'page' class applied, 51 | * so that it can be correctly hidden before the requested content is shown. 52 | * @param {*} id The id of the content to show 53 | */ 54 | const showContent = (id) => { 55 | eachElement(".reset-on-nav", (e) => e.classList.remove("show")); 56 | eachElement(".page", (p) => p.classList.add("hidden")); 57 | document.getElementById(id).classList.remove("hidden"); 58 | }; 59 | 60 | /** 61 | * Updates the user interface 62 | */ 63 | const updateUI = async () => { 64 | try { 65 | const isAuthenticated = await auth0Client.isAuthenticated(); 66 | 67 | if (isAuthenticated) { 68 | const user = await auth0Client.getUser(); 69 | 70 | document.getElementById("profile-data").innerText = JSON.stringify( 71 | user, 72 | null, 73 | 2 74 | ); 75 | 76 | document.querySelectorAll("pre code").forEach(hljs.highlightBlock); 77 | 78 | eachElement(".profile-image", (e) => (e.src = user.picture)); 79 | eachElement(".user-name", (e) => (e.innerText = user.name)); 80 | eachElement(".user-email", (e) => (e.innerText = user.email)); 81 | eachElement(".auth-invisible", (e) => e.classList.add("hidden")); 82 | eachElement(".auth-visible", (e) => e.classList.remove("hidden")); 83 | } else { 84 | eachElement(".auth-invisible", (e) => e.classList.remove("hidden")); 85 | eachElement(".auth-visible", (e) => e.classList.add("hidden")); 86 | } 87 | } catch (err) { 88 | console.log("Error updating UI!", err); 89 | return; 90 | } 91 | 92 | console.log("UI updated"); 93 | }; 94 | 95 | window.onpopstate = (e) => { 96 | if (e.state && e.state.url && router[e.state.url]) { 97 | showContentFromUrl(e.state.url); 98 | } 99 | }; 100 | -------------------------------------------------------------------------------- /02-Calling-an-API/server.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const morgan = require("morgan"); 3 | const helmet = require("helmet"); 4 | const { auth } = require("express-oauth2-jwt-bearer"); 5 | const { join } = require("path"); 6 | const authConfig = require("./auth_config.json"); 7 | 8 | const app = express(); 9 | 10 | if (!authConfig.domain || !authConfig.audience) { 11 | throw "Please make sure that auth_config.json is in place and populated"; 12 | } 13 | 14 | app.use(morgan("dev")); 15 | app.use(helmet()); 16 | app.use(express.static(join(__dirname, "public"))); 17 | 18 | const checkJwt = auth({ 19 | audience: authConfig.audience, 20 | issuerBaseURL: `https://${authConfig.domain}`, 21 | }); 22 | 23 | app.get("/api/external", checkJwt, (req, res) => { 24 | res.send({ 25 | msg: "Your access token was successfully validated!" 26 | }); 27 | }); 28 | 29 | app.get("/auth_config.json", (req, res) => { 30 | res.sendFile(join(__dirname, "auth_config.json")); 31 | }); 32 | 33 | app.get("/*", (req, res) => { 34 | res.sendFile(join(__dirname, "index.html")); 35 | }); 36 | 37 | app.use(function(err, req, res, next) { 38 | if (err.name === "UnauthorizedError") { 39 | return res.status(401).send({ msg: "Invalid token" }); 40 | } 41 | 42 | next(err, req, res); 43 | }); 44 | 45 | process.on("SIGINT", function() { 46 | process.exit(); 47 | }); 48 | 49 | module.exports = app; 50 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Luciano Balmaceda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Auth0 JavaScript Samples 2 | 3 | This repository holds the quickstart samples using [auth0-spa-js](https://github.com/auth0/auth0-spa-js). 4 | 5 | Read the [full tutorials on Auth0.com](https://auth0.com/docs/quickstart/spa/vanillajs). 6 | 7 | [![CircleCI](https://circleci.com/gh/auth0-samples/auth0-javascript-samples.svg?style=svg)](https://circleci.com/gh/auth0-samples/auth0-javascript-samples) 8 | 9 | 10 | ### Index 11 | 12 | List of available quickstarts 13 | 14 | - [01 - Login](/01-Login/) 15 | - [02 - Calling an API](/02-Calling-an-API/) 16 | 17 | ## What is Auth0? 18 | 19 | Auth0 helps you to: 20 | 21 | - Add authentication with [multiple authentication sources](https://docs.auth0.com/identityproviders), either social like **Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, among others**, or enterprise identity systems like **Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider**. 22 | - Add authentication through more traditional **[username/password databases](https://docs.auth0.com/mysql-connection-tutorial)**. 23 | - Add support for **[linking different user accounts](https://docs.auth0.com/link-accounts)** with the same user. 24 | - Support for generating signed [Json Web Tokens](https://docs.auth0.com/jwt) to call your APIs and **flow the user identity** securely. 25 | - Analytics of how, when and where users are logging in. 26 | - Pull data from other sources and add it to the user profile, through [JavaScript rules](https://docs.auth0.com/rules). 27 | 28 | ## Create a free Auth0 account 29 | 30 | 1. Go to [Auth0](https://auth0.com/signup) and click Sign Up. 31 | 2. Use Google, GitHub or Microsoft Account to login. 32 | 33 | ## Issue Reporting 34 | 35 | If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues. 36 | 37 | ## Author 38 | 39 | [Auth0](auth0.com) 40 | 41 | ## Deploy to Netlify 42 | You can deploy this example as a site on your own to explore and experiment with, by clicking this button. 43 | After deploy, install Auth0 by Okta extension in Netlify and follow the steps to create an App. 44 | 45 | Deploy to Netlify 46 | 47 | 48 | 49 | 50 | 51 | ## License 52 | 53 | This project is licensed under the MIT license. See the [LICENSE](LICENSE.txt) file for more info. 54 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | base = "01-Login" 3 | command = """if [ -z "${AUTH0_DOMAIN}" ] || [ -z "${AUTH0_CLIENT_ID}" ]; then 4 | echo "Error: One or both environment variables (AUTH0_DOMAIN, AUTH0_CLIENT_ID) are not set or are empty." 5 | exit 1 6 | fi 7 | printf '{\"domain\":\"%s\", \"clientId\":\"%s\"}' "${AUTH0_DOMAIN}" "${AUTH0_CLIENT_ID}" > public/auth_config.json 8 | cp index.html public 9 | """ 10 | publish = "public" 11 | 12 | --------------------------------------------------------------------------------