diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000000..1cd9745822 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,4 @@ +/articles/quickstart @auth0/dx-sdks-engineer +/articles/libraries @auth0/dx-sdks-engineer +/articles/cms @auth0/dx-sdks-engineer +/articles/quickstart/webapp/express @pdillon diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 49861ab9d9..bd61ed03a3 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,8 +1,3 @@ diff --git a/.github/workflows/check-content-version.yml b/.github/workflows/check-content-version.yml new file mode 100644 index 0000000000..8d471da8b9 --- /dev/null +++ b/.github/workflows/check-content-version.yml @@ -0,0 +1,22 @@ +name: Check Content Version + +on: + schedule: + - cron: '0 * * * *' # Runs every hour + workflow_dispatch: # Allows manual trigger from GitHub Actions tab + +jobs: + run-script: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Make script executable + run: chmod +x scripts/check-version.sh + shell: bash + + - name: Run check-version.sh script + run: scripts/check-version.sh + shell: bash \ No newline at end of file diff --git a/.github/workflows/clean-redirects-pr.yml b/.github/workflows/clean-redirects-pr.yml new file mode 100644 index 0000000000..06b704805c --- /dev/null +++ b/.github/workflows/clean-redirects-pr.yml @@ -0,0 +1,34 @@ +# Cleanup redirects config file. +name: Redirects cleanup PR + +on: + schedule: + - cron: '0 7 * * 1' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Get current date + id: date + run: echo "current_date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV + - name: Checkout + uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14.17' + cache: 'yarn' + - run: yarn + - run: yarn run clean-redirects + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v3 + with: + commit-message: Redirects config cleanup ${{ env.current_date }} + committer: GitHub + author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> + signoff: false + branch: clean_redirects_action_${{ env.current_date }} + delete-branch: true + title: 'Redirects config cleanup ${{ env.current_date }}' \ No newline at end of file diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml new file mode 100644 index 0000000000..3c1be5f76d --- /dev/null +++ b/.github/workflows/integration-tests.yml @@ -0,0 +1,34 @@ +name: Integration Tests +on: + pull_request: + branches: master + +concurrency: + group: pr-integration-tests-${{ github.event.pull_request.id }} + cancel-in-progress: true + +jobs: + tests: + name: Trigger Tests + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Get branch name + id: branch-name + uses: tj-actions/branch-names@6c999acf206f5561e19f46301bb310e9e70d8815 # v7.0.7 on 2025-03-20 + - name: Wait for Tests Results + uses: convictional/trigger-workflow-and-wait@v1.6.1 + with: + owner: ${{ secrets.NOTIFY_ORG }} + repo: ${{ secrets.NOTIFY_REPO }} + github_token: ${{ secrets.NOTIFY_PAT_TOKEN }} + workflow_file_name: integration-tests.yml + ref: master + wait_interval: 90 + client_payload: '{ "docsBranch": "${{ steps.branch-name.outputs.current_branch }}", "pullRequest": "${{ github.event.pull_request.number }}", "postStatus": "true" }' + propagate_failure: true + trigger_workflow: true + wait_workflow: true diff --git a/.github/workflows/push-notify.yml b/.github/workflows/push-notify.yml new file mode 100644 index 0000000000..a47e96380d --- /dev/null +++ b/.github/workflows/push-notify.yml @@ -0,0 +1,21 @@ +name: Push Notify +on: + workflow_dispatch: + push: + branches: + - main + - master +jobs: + dispatch: + runs-on: ubuntu-latest + steps: + - name: Webhook Notify + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.NOTIFY_PAT_TOKEN }} + script: | + await github.rest.repos.createDispatchEvent({ + owner: '${{ secrets.NOTIFY_ORG }}', + repo: '${{ secrets.NOTIFY_REPO }}', + event_type: 'docs_repo_webhook' + }) \ No newline at end of file diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml new file mode 100644 index 0000000000..19d6073644 --- /dev/null +++ b/.github/workflows/semgrep.yml @@ -0,0 +1,15 @@ +name: Semgrep +on: + pull_request: {} +jobs: + semgrep: + name: Scan + runs-on: ubuntu-latest + container: + image: returntocorp/semgrep + if: (github.actor != 'dependabot[bot]' && github.actor != 'snyk-bot') + steps: + - uses: actions/checkout@v3 + - run: semgrep ci + env: + SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3cc3b832ec..58ce0eb185 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,17 @@ config.json # IDE .idea + +# Visual Studio Code +.vscode + +# Sublime Text +*.sublime-project +*.sublime-workspace + +# Vim +*.swp +*.swo +Session.vim +.netrwhist +.vscode \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000..6e01ce3ba0 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "arrowParens": "always", + "printWidth": 120, + "trailingComma": "es5" +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 0aa52fd8a6..0000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -// Place your settings in this file to overwrite default and user settings. -{ - "editor.formatOnSave": false -} diff --git a/.vscode/spell.json b/.vscode/spell.json deleted file mode 100644 index e5133a8669..0000000000 --- a/.vscode/spell.json +++ /dev/null @@ -1 +0,0 @@ -{"language":"en","ignoreWordsList":["NuGet","RS256","Auth0","GitHub"],"mistakeTypeToStatus":{"Passive voice":"Hint","Spelling":"Error","Complex Expression":"Disable","Hidden Verbs":"Information","Hyphen Required":"Disable","Redundant Expression":"Disable","Did you mean...":"Disable","Repeated Word":"Warning","Missing apostrophe":"Warning","Cliches":"Disable","Missing Word":"Disable","Make I uppercase":"Warning"},"languageIDs":["markdown","text"],"ignoreRegExp":["/\\(.*\\.(jpg|jpeg|png|md|gif|JPG|JPEG|PNG|MD|GIF)\\)/g","/((http|https|ftp|git)\\S*)/g"]} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d6866c05e4..0418e709cf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,7 +42,7 @@ The following is a set of guidelines for contributing to the Auth0 documentation * Read and follow the [Style Guide](STYLEGUIDE.md). * Consult the [Words](WORDS.md) document for Auth0 specific spellings and definitions. * Always use relative URLs for internal `auth0.com/docs` links. For example, if the absolute path to the document is `https://auth0.com/docs/identityproviders`, use `/identityproviders`. These links will be correctly formatted in the build process. -* Do not hard code links to Auth0 sites like `docs.auth0.com` or `manage.auth0.com`. Instead, use [Parameter Aliases](#parameter-aliases), such as `${manage_url}`. +* Do not hard code links to Auth0 sites like `docs.auth0.com` or `manage.auth0.com`. Instead, use [Document Variables](#document-variables), such as `${manage_url}`. * Name files with all lowercase using dashes (-) to separate words. If using a date in the file name, it should be in the format YYYY-MM-DD. For example, `this-is-my-file.md` or `this-is-a-title-2015-10-01.md`. * Do not store images in external locations like Dropbox, CloudUp, or the Auth0 CDN. Link to images in this repo using a relative path `![ALT_TEXT](/media/folder/image-name.png)`. The image will be uploaded to the CDN and the link will be formatted during the build process. Do not forget to set the alternate text for each image. * Keep images to no more than 750 pixels wide. @@ -69,11 +69,33 @@ Additionally, you can send variables to the included document: ## Markdown -Markdown on this site conforms to the [CommonMark](http://commonmark.org/) spec. Additionally, there are a few custom markdown features available as described below. +Markdown on this site conforms to the [CommonMark](http://commonmark.org/) spec. Additionally, there are a few custom Markdown features available as described below. + +You should [test your Markdown](http://markdownlivepreview.com) to ensure the formatting is correct. ### Headings -One common mistake with formatting of headings is to not include a space between the hashes and the text. Some markdown processors allow this, but we do not. You must put a space as shown below. +Add one to six `#` symbols before your heading text to create your header. The number of # you use determines the size of the heading. + +``` +# H1 +## H2 +### H3 +#### H4 +##### H5 +###### H6 +``` + +The header text above renders as follows: + +# H1 +## H2 +### H3 +#### H4 +##### H5 +###### H6 + +One common mistake with formatting of headings is to not include a space between the hashes and the text. Some Markdown processors allow this, but we do not. You must put a space as shown below. INVALID: `#My Heading` @@ -82,8 +104,8 @@ VALID: `# My Heading` ### UI Components General advice: -- Don't add custom UI components with HTML unless it's really necessary. -- Don't add any element before the main title. If you want to show some general information for the whole doc put the element after the main title. +- Do not add custom UI components with HTML unless it's really necessary. +- Do not add any element before the main title. If you want to show some general information for the whole doc put the element after the main title. - Try to keep the amount of UI components on your docs to a minimum. They make the documentation more difficult to read and cut the reading flow. - Only use the `blockquote` element (`>` in markdown) to represent actual quotes. Use a `note` or a `panel` if you want to highlight the information. @@ -95,7 +117,7 @@ Only use this if the content is brief (one to four lines), if not use the `panel ```markdown ::: note - If you need a refresher on the OAuth 2.0 protocol, you can go through our OAuth 2.0 article. +If you need a refresher on the OAuth 2.0 protocol, you can go through our OAuth 2.0 article. ::: ``` @@ -145,7 +167,7 @@ Description ::: ::: panel-warning Security Warning -It is important to understand that the Authorization Code flow should only be used in cases such as a Regular Web Application where the Client Secret can be safely stored. In cases such as a Single Page Application, the Client Secret is available to the client (in the web browser), so the integrity of the Client Secret cannot be maintained. That is why the [Implicit Grant flow](/api-auth/grant/implicit) is more appropriate in that case. +It is important to understand that the Authorization Code flow should only be used in cases such as a Regular Web Application where the Client Secret can be safely stored. In cases such as a Single-Page Application, the Client Secret is available to the client (in the web browser), so the integrity of the Client Secret cannot be maintained. That is why the [Implicit Flow](/flows/concepts/implicit) is more appropriate in that case. ::: ``` @@ -168,7 +190,7 @@ Try to keep the list length to a minimum (up to 5 links). ![Next steps list](https://user-images.githubusercontent.com/6318057/27233085-b116f28a-528e-11e7-9ac3-4463a9c5db3d.png) ### HTTP Request Snippets -You can add a [HAR request format](http://www.softwareishard.com/blog/har-12-spec/#request) snippet to make an example HTTP request availible in a variety of languages. This will generate a tab view showing the HTTP request in various languages. +You can add a [HAR request format](http://www.softwareishard.com/blog/har-12-spec/#request) snippet to make an example HTTP request available in a variety of languages. This will generate a tab view showing the HTTP request in various languages. The library we use is [HTTP Snippet](https://github.com/Kong/httpsnippet). @@ -266,7 +288,7 @@ For close-ups and other screenshots that do not include the browser window, appl You can set various properties of articles in the front matter of the document. Each document should have the `title` and `description` properties set. You can set other variables depending on the document. -`toc` adds a table of content dropdown at the top of the document, that lists all the paragraphs of the doc. By default it's disabled. Set it to `true` to display the dropdown. +`toc` adds a table of content dropdown at the top of the document, that lists all the paragraphs of the doc. By default it is disabled. Set it to `true` to display the dropdown. Example front matter: @@ -280,7 +302,7 @@ toc: true #### URLs -Document urls are by default in the same format as the forlder structure after the `articles` folder. So for example if you document is stored at `articles/my-folder/document.md`, the url would be `/docs/my-folder/document`. +Document urls are by default in the same format as the folder structure after the `articles` folder. So for example if you document is stored at `articles/my-folder/document.md`, the url would be `/docs/my-folder/document`. If you create a folder that will have multiple articles, the best practice is to set the default document as `index.md`. However, the url must be set in that document to a friendly url. For example, if you have a document `/articles/my-folder/index.md`, you should set the url to be `/my-folder`. @@ -297,14 +319,14 @@ url: /path/to/document We use a pre-commit hook that lints the edited files to ensure a consistent style in the docs. We use [markdownlint](https://github.com/DavidAnson/markdownlint) with the rules specified in the `.markdownlint.json` file in the root of the repo to do this. You can [check more about the linting rules](https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md). -You won't be able to commit if your edited file don't follow these guidelines. +You will not be able to commit if your edited file does not follow these guidelines. -If you are using VS Code as your code editor, it's highly recommended to install the [MarkdownLint VS Code Extension](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint). +If you are using VS Code as your code editor, it is highly recommended to install the [MarkdownLint VS Code Extension](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint). ## Sidebar When you are adding a new article you should always add a link to it in the `config/sidebar.yml` file. -It's really important to represent all our articles in the sidebar because this will help the user see where they are inside the documentation. +It is really important to represent all our articles in the sidebar because this will help the user see where they are inside the documentation. You can add titles to the sidebar using the attribute `category`: @@ -368,11 +390,11 @@ To create and submit a job to Wordy: You will need to provide the following pieces of information: * **Language**: Set to *English (US)*. -* **Content rewrite**: Select this option if you are okay with your editor rewriting your text for improved flow and natural use of langauge. If this option is *not* selected, your editor will simply check for spelling, grammar, punctuation, consistency, and structure. -* **Brief to editor**: Provide any information you'd like your editor to keep in mind when editing your work. For a starter snippet, please see our sample on [Notes to Wordy Editors](wordy-guide.md) +* **Content rewrite**: Select this option if you are okay with your editor rewriting your text for improved flow and natural use of language. If this option is *not* selected, your editor will simply check for spelling, grammar, punctuation, consistency, and structure. +* **Brief to editor**: Provide any information you would like your editor to keep in mind when editing your work. For a starter snippet, please see our sample on [Notes to Wordy Editors](wordy-guide.md) * **Save my brief and language settings for future jobs**: Select this box to persist your chosen settings. 5. Upload files. You may choose to upload external files containing your text or paste in the text you want edited. -6. After you've completed the above steps, you'll get an instant price quote and an approximate delivery time for your job. If this is acceptable to you, click on **Create Job** to begin the editing process. +6. After you have completed the above steps, you will get an instant price quote and an approximate delivery time for your job. If this is acceptable to you, click on **Create Job** to begin the editing process. ### Word Count and Wordy Submissions @@ -386,7 +408,7 @@ It is helpful to include some instructions for the Wordy editors to let them kno ### Notes -* You can cancel a job if it hasn’t been picked up by an editor. If the job has been picked up, you can contact the editor and request a cancellation, though it is at the editor's discretion whether or not to cancel the job. +* You can cancel a job if it has not been picked up by an editor. If the job has been picked up, you can contact the editor and request a cancellation, though it is at the editor's discretion whether or not to cancel the job. * During the editing process, you can contact your editor from the job's page. You can include last-minute instructions, corrections, and so on. Conversely, your editor can contact you during the process if they have any questions about your text. You will be notified by email if you receive any messages. * If you are unsatisfied with the work completed by your editor, you can send your work back. This includes issues where you find errors in the text or the instructions in your brief haven't been followed. You can contact your editor by using the **Conversation History** feature on the job's page. @@ -474,7 +496,7 @@ hidden_articles: ### Quickstart Guidelines -Each framework will have a set of articles that comprise the quickstarts. The set of articles each framework will have depends on the function of each. Below is an outline of the documentats that should be created for each framework. +Each framework will have a set of articles that comprise the quickstarts. The set of articles each framework will have depends on the function of each. Below is an outline of the documents that should be created for each framework. #### Library References @@ -484,19 +506,19 @@ Additionally, many libraries may also need manual documentation showing more sop #### Quickstarts Articles -Each framework will have a set of articles that comprise the quickstarts. The set of articles each framework will have depends on the function of each. Below is an outline of the documentats that should be created for each framework. +Each framework will have a set of articles that comprise the quickstarts. The set of articles each framework will have depends on the function of each. Below is an outline of the documents that should be created for each framework. ##### Native 0. Intro - Introduction and summary of what the quickstart is about and a Table of Contents 1. Login - Shows how to create an auth0 application, add the login widget to your code, setup everything, and perform a login. 2. Login with Custom UI - Using head-less library to do login without Lock -3. Session Handling - How to store tokens, refresh tokens, and logout +3. Session Handling - How to store tokens, Refresh Tokens, and logout 4. User Profile - How to access the user profile from within the app. The core concepts of this are how to retrieve profile data as well as any claims that are present in the token. 5. Linking Accounts - How to link two accounts using both the lock widget or using the API manually. 6. Rules - Using rules to change what is in the token. This document is likely shared with all quickstarts[a]. 7. Authorization - How to pull scope or other access control claims from the token and use those claims to authorize a user to perform certain actions in the application.[b] -8. Calling Your API - How to take the access token from +8. Calling Your API - How to take the Access Token from 9. MFA - how to add MFA to your app. This should probably be a single document that is shared with all native apps[c]. 10. Customizing Lock - Document explaining the basics of how to custom lock. There are full documents about this as well that show the complete details. @@ -510,7 +532,7 @@ Each framework will have a set of articles that comprise the quickstarts. The se 5. Linking Accounts - How to link two accounts using both the lock widget or using the API manually. 6. Rules - Using rules to change what is in the token. This document is likely shared with all quickstarts. 7. Authorization - How to pull scope or other access control claims from the token and use those claims to authorize a user to perform certain actions in the application. -8. Multifactor Authentication - how to add MFA to your app. This should probably be a single document that is shared with all native apps. +8. Multi-factor Authentication - how to add MFA to your app. This should probably be a single document that is shared with all native apps. 9. Customizing Lock - Document explaining the basics of how to custom lock. There are full documents about this as well that show the complete details. ##### SPA @@ -523,7 +545,7 @@ Each framework will have a set of articles that comprise the quickstarts. The se 5. Linking Accounts - How to link two accounts using both the lock widget or using the API manually. 6. Rules - Using rules to change what is in the token. This document is likely shared with all quickstarts. 7. Authorization - How to pull scope or other access control claims from the token and use those claims to authorize a user to perform certain actions in the application. This section will include information on how to use rules and authorization together. -8. Calling Your API - How to take the access token from +8. Calling Your API - How to take the Access Token from 9. MFA - how to add MFA to your app. This should probably be a single document that is shared with all native apps. 10. Customizing Lock - Document explaining the basics of how to customize lock. There are full documents about this as well that show the complete details. @@ -534,7 +556,7 @@ Each framework will have a set of articles that comprise the quickstarts. The se #### Libraries -As appropriate every framework/language should have libraries to help with common functions. THese libraries will include things like: +As appropriate, every framework/language should have libraries to help with common functions. These libraries will include things like: * Management API Libraries * Authentication API Libraries @@ -563,7 +585,7 @@ In this way, each section of the quickstart has a sample showing the appropriate ##### Sample README’s -The README for each sample folder should be written to reflect the objectives of the sample and should also show some important code snippets. The goal is to give the reader context in a quick and concise way while outlining exactly what learning outcomes can be expected. It’s important to make content within each README specific to the subject sample. +The README for each sample folder should be written to reflect the objectives of the sample and should also show some important code snippets. The goal is to give the reader context in a quick and concise way while outlining exactly what learning outcomes can be expected. It is important to make content within each README specific to the subject sample. * **Example**: 02-User-Profile * **Title**: “User Profile” @@ -587,18 +609,18 @@ Each sample repo should have appropriate CI setup. You should use the appropriat In the case of things like iOS and Android samples, we should build with multiple version of Android/Xcode, etc. You can see an example here: 1. No need to write code or specialized guide for mobile -2. We don't have a lot of stuff finished to be doing this one in mobile. +2. We do not have a lot of stuff finished to be doing this one in mobile. 3. No need to write code or specialized guide for mobile until we allow users to enroll mfa from mobile apps. Currently is web only ### Seed Projects -Each quickstart should have a seed project. The seed projects are hosted in github in the `auth0-samples` organization. In order to add a seed project to a quickstart simply use the `_package` include. +Each quickstart should have a seed project. The seed projects are hosted on github in the `auth0-samples` organization. In order to add a seed project to a quickstart simply use the `_package` include. The seed project packager service replaces placeholder configuration values with the values of the user's real application. This means the sample is ready to use without additional configuration. The strings that get set are shown below. These values can be replaced in any file in the repo. Common examples of where you would include these values are in a `.env` file or `auth0-variables.js` file. In addition to replacement in the file directly, you can also include a template file in the form of `filename.ext.example` such as `auth0-variables.js.example`. The packager will do the replacement and remove the `.example` extension from the file. -**NOTE:** It is a best practice to use the `.example` method and include the 'real' file in the '.gitignore' so that if the end-user turns the sample into a git repo, the Auth0 keys wont get checked into source control. You should include the `.gitignore` file in the actual seed project folder, not at the repo root. This way it is included in the seed package. +**NOTE:** It is a best practice to use the `.example` method and include the 'real' file in the '.gitignore' so that if the end-user turns the sample into a git repo, the Auth0 keys won't get checked into source control. You should include the `.gitignore` file in the actual seed project folder, not at the repo root. This way it is included in the seed package. | Key Name | Replace Value | Description | | :------| :-----------| :-----------| @@ -608,7 +630,7 @@ These values can be replaced in any file in the repo. Common examples of where y | `TENANT` | `{TENANT}` | The tenant name of the currentAuth0 account. | `CALLBACK_URL` | `{CALLBACK_URL}` | This sets the callback url for the application. | | `MOBILE_CUSTOM_SCHEME` | `{MOBILE_CUSTOM_SCHEME}` | This a unique ID for mobile apps. The string is `a0` + the value of the client ID. | -| `RANDOM_STRING_64` | `{RANDOM_STRING_64}` | This is a random string. Typically used for things like encryption keys, etc. For security reasons we set this with a reasonable default so if end-users forget to change them, they wont all be something like `YOUR_ENCRYPTION_KEY`. | +| `RANDOM_STRING_64` | `{RANDOM_STRING_64}` | This is a random string. Typically used for things like encryption keys, etc. For security reasons, we set this with a reasonable default so if end-users forget to change them, they won't all be something like `YOUR_ENCRYPTION_KEY`. | Example `.env` file: @@ -757,10 +779,9 @@ When writing docs you can use the following variables instead of hard-coding the | Variable | Description | Default Value | | :---------------------------- | :----------------------------------------- | :-------------------------------------- | | `manage_url` | The url to the management portal. | `https://manage.auth0.com` | -| `auth0js_url` | The url to the auth0.js v7 CDN location. | | +| `auth0js_url` | The url to the auth0.js CDN location. | | | `auth0js_urlv8` | The url to the auth0.js v8 CDN location. | | | `lock_url` | The url to the Lock script CDN location. | | -| `lock_passwordless_url` | The url to the Passwordless Lock script CDN location. | | | `env.DOMAIN_URL_SUPPORT` | Support Center URL | `https://support.auth0.com` | ### User Specific Variables @@ -867,7 +888,7 @@ example/ index.yml ``` -This limitation is a result of the implementation of `AutoVersionPlugin`, and how the paths are calculated for the different versions. Fixing this is possible, but makes things a little more tricky, so I decided to cut it from the first version of the feature. If it's a desired behavior we can always add it later. +This limitation is a result of the implementation of `AutoVersionPlugin`, and how the paths are calculated for the different versions. Fixing this is possible, but makes things a little more tricky, so I decided to cut it from the first version of the feature. If it is a desired behavior we can always add it later. #### Case Sensitive diff --git a/LICENSE b/LICENSE index 0d651713af..9595798aa0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 Auth0, Inc. (http://auth0.com) +Copyright (c) 2015-present Auth0, Inc. (http://auth0.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 46ec9f5e12..1388ddcc84 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,29 @@ # Auth0 Documentation -This is the repository for the Auth0 documentation. + +This repository contains the Auth0 Quickstarts, but most other documentation content in this repository is no longer up to date, and is not the source of content at https://auth0.com/docs. Pull requests and issues for Quickstarts can still be submitted here, but most other content is no longer hosted on GitHub and therefore no longer open-source. If you are an Auth0 employee trying to make a change to other documentation, please [submit a ticket](https://auth0team.atlassian.net/servicedesk/customer/portal/9) or contact the Documentation Team to request access to our content management system. + **Please review the [Contributing Guidelines](CONTRIBUTING.md) before sending a PR or opening an issue.** -## Running the Docs Site -You can run and test the docs site locally (you will need access - only employees). For instructions on running the site and testing see the [README](https://github.com/auth0/auth0-docs/blob/master/README.md) (requires Auth0 team access). +* If you are looking for the application that *hosts* the Docs content, see [auth0-docs](https://github.com/auth0/auth0-docs). +* If you would like to modify the Management API v2 API docs, they are generated from the [api2](https://github.com/auth0/api2) repository. + +Both of the above repositories require team access. + +## Editing Docs Content +Auth0 Docs are no longer maintained in this Github repository. Employees can request access to our content management system to update Docs directly. Outside contributors can submit requests under the [Issues](https://github.com/auth0/docs/issues) section in this repository. + +## Editing Quickstart Content + +* You can edit the Quickstarts by using the GitHub web editor and editing a file. This is best suited for typos and small changes. +* You can also pull down the `/docs` repo to your computer via Git and edit files in your local editor before pushing a new branch (or a branch to your own fork of the project). You can then go to GitHub.com and start a PR. We will be able to review the changes in a Heroku test application prior to merging. +* Lastly, you can [run and test the docs site locally](https://github.com/auth0/auth0-docs/blob/master/README.md) (access available to Auth0 employees only). This option is best suited for repeat contributors or for complex contributions. You gain the benefit of locally testing and viewing your changed or added pages, navigation, and config, but you also gain the complexity of dealing with the local docs app, setting it up, and keeping it updated. + +Regardless of which option you use, please review any relevant sections of the [Contributing Guidelines](CONTRIBUTING.md) before sending a PR. ## Issue Reporting -If you found a bug or have a feature request, please report it in this repository's [issues](https://github.com/auth0/docs/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. +If you find a bug or inaccuracy in the documentation content, please report it in this repository's [issues](https://github.com/auth0/docs/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. ## Author diff --git a/STYLEGUIDE.md b/STYLEGUIDE.md index 65e8b094e0..12a59bbc8c 100644 --- a/STYLEGUIDE.md +++ b/STYLEGUIDE.md @@ -2,59 +2,59 @@ This style guide covers the terminology and content specific to Auth0, along with some comments on common writing issues. -For general software-industry styles and terminology, see the [Microsoft Manual of Style](https://eucalyptus.atlassian.net/wiki/download/attachments/76611622/microsoft_manual_of_style_fourth_edition.pdf?version=2&modificationDate=1424379604164&api=v2). +For general software-industry styles and terminology, see the [Microsoft Writing Style Guide](https://docs.microsoft.com/en-us/style-guide/welcome/). ## Voice -* Address the reader directly: "you". Use "we" only for Auth0's recommendations. -* Use active voice. -* For instructions, use imperative mood. +* Address the reader directly: "you". Use "we" only for Auth0's recommendations. +* Use the active voice. +* For instructions, use the imperative mood. | **Incorrect** | **Correct** | | --- | --- | | User authentication data should be saved.| Save user authentication data. | -| Saving user authentication data is recommended. | We recommend that you save user authentication data. | +| Saving user authentication data is recommended. | We recommend that you save user authentication data. | -* Use gender-neutral pronouns: "they", "their". +* Use gender-neutral pronouns: "they", "their". | **Incorrect** | **Correct** | | --- | --- | | The user enters his password. | The user enters their password. | -* Avoid gerunds in headings and main body. +* Avoid gerunds in headings and the main body. | **Incorrect** | **Correct** | | --- | --- | -| Saving User Authentication Data | Save User Authentication Data | -| Setting up the authorization process requires an ID token and a valid access token. | To set up the authorization process, you need an ID token and a valid access token. | +| Saving User Authentication Data. | Save User Authentication Data. | +| Setting up the authorization process requires an ID Token and a valid Access Token. | To set up the authorization process, you need an ID Token and a valid Access Token. | ## Body text -* Keep paragraphs short for internet reading. +* Keep paragraphs short for internet reading. * Provide only the information necessary to understand and perform the steps. | **Incorrect** | **Correct** | | --- | --- | | Authentication using JSON Web Tokens is stateless by nature, meaning that there is no information about the user's session stored on your server.| Authentication using JSON Web Tokens is stateless. This means that when you use it, no information about user session is stored on your server. | -| In this way, setting up a session for the user on the client side is simply a matter of saving the `access_token`, `id_token`, and a time that the `access_token` expires at in browser storage. | To set up a session for the user on the client side, save the following information in browser storage: `access_token`, `id_token`, `expires_in`. | +| In this way, setting up a session for the user on the client side is simply a matter of saving the Access Token, ID Token, and a time that the Access Token expires at in browser storage. | To set up a session for the user on the client side, save the following information in browser storage: `access_token`, `id_token`, `expires_in`. | -* When mentioning several elements, use bulleted lists. -* Subheads are not independent statements. Repeat the information from the subhead in the paragraph. +* When mentioning several elements, use bulleted lists. +* Subheads are not independent statements. Repeat the information from the subhead in the paragraph. * Avoid abbreviations. | **Incorrect** | **Correct** | | --- | --- | | Don't hardcode paths in your application, e.g., the callback URL. | Don't hardcode paths in your application, for example, the callback URL. | -| Save all the important credentials: the access token, the refresh token, etc. in a safe location. | Save all the important credentials, such as the access and refresh token, in a safe location. | +| Save all the important credentials: the Access Token, the Refresh Token, etc. in a safe location. | Save all the important credentials, such as the Access and Refresh Token, in a safe location. | -* Avoid contractions. Use complete words to be more authoritative. +* Avoid contractions. Use complete words to be more authoritative. | **Incorrect** | **Correct** | | --- | --- | | Can't | Cannot | * Don't overuse adjectives. Never use more than two in a sentence. -* Don't overuse adverbs. +* Don't overuse adverbs. | **Incorrect** | **Correct** | | --- | --- | @@ -64,21 +64,21 @@ For general software-industry styles and terminology, see the [Microsoft Manual ## Punctuation * Use colons to introduce code or examples: "Install the dependencies using yarn: `code_snippet`" -* Use hyphens between adjectives and the verbs they modify. Don't use a hyphen if the adjective ends with "ly". +* Use hyphens between adjectives and the verbs they modify. Don't use a hyphen if the adjective ends with "ly". | **Incorrect** | **Correct** | | --- | --- | | "an easy to remember rule" | "an easy-to-remember rule" | | "commonly-used adjectives" | "commonly used adjectives" | -* When you are quoting something in a sentence, keep the punctuation inside the quotation marks. -* When you are quoting code, do not add any punctuation inside the quotation marks. +* When you are quoting something in a sentence, keep the punctuation inside the quotation marks. +* When you are quoting code, do not add any punctuation inside the quotation marks. ## Formatting * Use title case for first-level headings: "Log In with a Social Identity" * Use sentence case for subheads: "About the login process" -* Use **Bold** for UI elements, such as menu items and field names. +* Use **Bold** for UI elements, such as menu items and field names. | **Incorrect** | **Correct** | | --- | --- | @@ -90,17 +90,17 @@ For general software-industry styles and terminology, see the [Microsoft Manual | **Incorrect** | **Correct** | | --- | --- | | Save the "idToken" value in your client properties. | Save the `idToken` value in your client properties. | -| An `idToken` helps you identify the user. | An ID token helps you identify the user. | +| An `idToken` helps you identify the user. | An ID Token helps you identify the user. | -* The text of a link must include the title of the linked page. This helps the reader decide if they want to click on the link. +* The text of a link must include the title of the linked page. This helps the reader decide if they want to click on the link. | **Incorrect** | **Correct** | | --- | --- | | You can read more about this feature [here](/rules). | Read more about this feature in the [Rules documentation](/rules). | * Use blockquotes only for quotes. Don't use them for component styles. -* When you are referring to specific dates, abbreviate the following months: January (Jan.), February (Feb.), August (Aug.), September (Sept.), October (Oct.), November (Nov.), December (Dec.). -* When you are referring to a month alone or a month and a year, don't abbreviate the month. +* When you are referring to specific dates, abbreviate the following months: January (Jan.), February (Feb.), August (Aug.), September (Sept.), October (Oct.), November (Nov.), December (Dec.). +* When you are referring to a month alone or a month and a year, don't abbreviate the month. | **Incorrect** | **Correct** | | --- | --- | @@ -110,10 +110,20 @@ For general software-industry styles and terminology, see the [Microsoft Manual | Mar. 15 | March 15 | | 15 March 2048 | March 15, 2048 | -* Spell out whole numbers from zero to nine. -* Write numerically numbers from 10 up and fractions. -* Spell out any number that starts a sentence. -* If one number follows another immediately, spell out the first number. +* Endpoint names should be capitalized when used in-text: Discovery endpoint, Authorization endpoint, Token endpoint. +* Endpoints with names longer than one or two words should also be capitalized with the exception of prepositions and articles (i.e. with, to, the, a, an) such as Update a Hook endpoint. +* Endpoint names denoted as a path should not be capitalized but should be in monospace font: `/authorize,` `/post_user_import,` `/clients.` + +| **Incorrect** | **Correct** | +| --- | --- | +| You will need to access the discovery endpoint. | You will need to access the Discovery endpoint.| +| The get user endpoint allows you to search based on a variety of criteria. | The Get User endpoint allows you to search based on a variety of criteria. | +| The POST /login/callback endpoint can accept a sing-on SAML request from an identity provider. | The POST '/login/callback' endpoint can accept a sing-on SAML request from an identity provider. | + +* Spell out whole numbers from zero to nine. +* Write numerically numbers from 10 up and fractions. +* Spell out any number that starts a sentence. +* If one number follows another immediately, spell out the first number. | **Incorrect** | **Correct** | | --- | --- | @@ -122,16 +132,16 @@ For general software-industry styles and terminology, see the [Microsoft Manual | 14 plugins are available. | Fourteen plugins are available. | | Configure 12 50GB drives | Configure twelve 50GB drives. | -* For additional information that is up to four lines long, use [notes](/blob/master/CONTRIBUTING.md#note). -* For additional information that is longer than four lines, use [panels](https://github.com/auth0/docs/blob/master/CONTRIBUTING.md#panels). -* For critical security information up to four lines long, use [warnings](https://github.com/auth0/docs/blob/master/CONTRIBUTING.md#warning). -* For critical security information longer than four lines, use [panel warnings](https://github.com/auth0/docs/blob/master/CONTRIBUTING.md#panel-warning). +* For additional information that is up to four lines long, use [notes](CONTRIBUTING.md#note). +* For additional information that is longer than four lines, use [panels](CONTRIBUTING.md#panels). +* For critical security information up to four lines long, use [warnings](CONTRIBUTING.md#warning). +* For critical security information longer than four lines, use [panel warnings](CONTRIBUTING.md#panel-warning). ## Vocabulary -* If an action is required, use "must". -* If an action is available, use "can". -* If an action is optional, use "may". +* If an action is required, use "must". +* If an action is available, use "can". +* If an action is optional, use "may". | **Incorrect** | **Correct** | | --- | --- | @@ -139,8 +149,8 @@ For general software-industry styles and terminology, see the [Microsoft Manual | You might want to use scopes to limit access to your resources. | To limit access to your resources, use scopes. | | Creating more access roles is possible. | You may want to create more access roles. | -* Use "log in" and "log out" as verbs. Do not use "log into". -* Use "login" and "logout" as nouns. Do not use "login to". +* Use "log in" and "log out" as verbs. Do not use "log into". +* Use "login" and "logout" as nouns. Do not use "login to". | **Incorrect** | **Correct** | | --- | --- | @@ -155,8 +165,8 @@ For general software-industry styles and terminology, see the [Microsoft Manual | Setup the login screen. | Set up the login screen. | | Edit the login screen set-up to display the **Log in** button. | Edit the login screen setup to display the **Log in** button. | -* Use "multifactor authentication" instead of "multi-factor authentication". -* Use "email address" instead of "e-mail address". +* Use "multi-factor authentication" instead of "multifactor authentication". +* Use "email address" instead of "e-mail address". * Use "website" instead of "web site". * Use "click on" when referring to text links in a webpage or UI. Use "click" when referring to a button. @@ -166,7 +176,7 @@ For general software-industry styles and terminology, see the [Microsoft Manual | Click **Go to Settings** at the bottom of the page to access the settings section. | Click on **Go to Settings** at the bottom of the page to access the settings section. | * Depending on the situation, the reader can "gain access", "grant access", or "allow access". -* Refer to the developer's customer as the "user". +* Refer to the developer's customer as the "user". * If you need to use the name of a fictional company, use "ExampleCo". * When you use a group of nouns as an adjective, use a hyphen. @@ -176,13 +186,13 @@ For general software-industry styles and terminology, see the [Microsoft Manual | The run-time engine must be running to execute the application. | The runtime engine must be running to execute the application. | | Write code for the client-side. | Write code for the client side. | | Write the client side code. | Write the client-side code. | -| Save the logged in user's access token. | Save the logged-in user's access token. | +| Save the logged in user's Access Token. | Save the logged-in user's Access Token. | ### The dashboard -* Dashboard: the [Auth0 management console](${manage_url}) -* The dashboard elements are called "section", "tab", "field". -* Dashboard-related terminology: +* Dashboard: the [Auth0 management console](${manage_url}). +* The dashboard elements are called "section", "tab", "field". +* Dashboard-related terminology: ![](/media/readme/structure.png) ### The application @@ -191,4 +201,4 @@ For general software-industry styles and terminology, see the [Microsoft Manual * Tenant: a logical isolation unit of the products we offer. Examples of Auth0 tenants: `foo.auth0.com`, `bar.auth0.com` * Auth0 tenants: regular cloud tenants * Subscription: a contract or service plan. Examples of subscriptions: trial, free, developer or developer-pro -* Private instances: appliance instances \ No newline at end of file +* Private Cloud/Managed Private Cloud: single-tenant deployment diff --git a/WORDS.md b/WORDS.md index 6e754976ff..4764298894 100644 --- a/WORDS.md +++ b/WORDS.md @@ -4,7 +4,7 @@ This document contains spellings and definitions as they are to be used in the A - **Login / Log in**: Use *log in* as a verb, or *login* as a noun. Do NOT use *log into* or *login to*. - **Logout / Log out**: Use *log out* as a verb, or *logout* as a noun. - **Setup / Set up**: Use *set up* as a verb, or *setup* as a noun. -- **Multifactor**: Use instead of multi-factor in the case of multifactor authentication. +- **Multi-factor**: Use *multi-factor* instead of *multifactor* in the case of multi-factor authentication. - **Rollout / Roll out**: Use *rollout* as a noun and *roll out* as a verb. Do not use `roll-out`. - **Email**: Use the un-hyphenated "email" to refer to an email address. - **Click**: Use "Click on" when referring to text links in a webpage or UI, "Click" when referring to a button. For example: Click **Save**. Click on **This link**. @@ -39,10 +39,10 @@ When writing about tokens, capitalize specific token names as follows: * Access Token * Refresh Token -#### Within Appliance subscriptions +#### Within Private Cloud subscriptions * **Auth0 tenants** refers to regular cloud tenants -* **Private instances** refers to appliance instances +* **Private Cloud** or **Managed Private Cloud** refers to a single-tenant deployment ### TL;DR diff --git a/app.json b/app.json index 0b45ad2eb6..838727dbce 100644 --- a/app.json +++ b/app.json @@ -2,6 +2,12 @@ "name": "auth0-docs-content", "scripts": { }, + "formation": { + "web": { + "quantity": 1, + "size": "standard-2x" + } + }, "env": { "NPM_CONFIG_PRODUCTION": { "required": true @@ -15,6 +21,9 @@ "HEROKU_APP_NAME": { "required": true }, + "HEROKU_PARENT_APP_NAME": { + "required": true + }, "GIT_SSH_KEY": { "required": true } diff --git a/articles/_includes/_api-auth-customize-tokens.md b/articles/_includes/_api-auth-customize-tokens.md index 460c8a3a61..0c5ca2a2e3 100644 --- a/articles/_includes/_api-auth-customize-tokens.md +++ b/articles/_includes/_api-auth-customize-tokens.md @@ -15,5 +15,5 @@ function(user, context, callback) { ``` ::: panel-warning Namespacing Custom Claims -Auth0 returns profile information in a [structured claim format as defined by the OIDC specification](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims). This means that in order to add custom claims to ID Tokens or Access Tokens, they must [conform to a namespaced format](/api-auth/tutorials/adoption/scope-custom-claims) to avoid possible collisions with standard OIDC claims. For example, if you choose the namespace `https://foo.com/` and you want to add a custom claim named `myclaim`, you would name the claim `https://foo.com/myclaim`, instead of `myclaim`. You can [add namespaced claims using Rules](#optional-customize-the-tokens). +Auth0 returns profile information in a [structured claim format as defined by the OpenID Connect (OIDC) specification](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims). This means that in order to add custom claims to ID Tokens or Access Tokens, they must [conform to a namespaced format](/tokens/guides/create-namespaced-custom-claims) to avoid possible collisions with standard OIDC claims. You can [add namespaced claims using Rules](#optional-customize-the-tokens). ::: diff --git a/articles/_includes/_api_auth_intro.md b/articles/_includes/_api_auth_intro.md index ede006191a..c7b3365570 100644 --- a/articles/_includes/_api_auth_intro.md +++ b/articles/_includes/_api_auth_intro.md @@ -1,2 +1,3 @@ -This tutorial shows you how to use the authorization features in the OAuth 2.0 framework to limit access to your or third-party applications. -For more information, read the [API authorization](/api-auth) documentation. \ No newline at end of file +::: note +**New to Auth0?** Learn how Auth0 works and read about implementing API authentication and authorization using the OAuth 2.0 framework. +::: diff --git a/articles/_includes/_callback_url.md b/articles/_includes/_callback_url.md index 662815992b..3d4851c568 100644 --- a/articles/_includes/_callback_url.md +++ b/articles/_includes/_callback_url.md @@ -1,5 +1,5 @@ -## Configure Callback URLs + -A callback URL is a URL in your application where Auth0 redirects the user after they have authenticated. +### Configure Callback URLs -You need to whitelist the callback URL for your app in the **Allowed Callback URLs** field in your [Application Settings](${manage_url}/#/applications/${account.clientId}/settings). If you do not set any callback URL, your users will see a mismatch error when they log in. \ No newline at end of file +A callback URL is a URL in your application where Auth0 redirects the user after they have authenticated. The callback URL for your app must be added to the **Allowed Callback URLs** field in your Application Settings. If this field is not set, users will be unable to log in to the application and will get an error. diff --git a/articles/_includes/_checksession_polling.md b/articles/_includes/_checksession_polling.md new file mode 100644 index 0000000000..9030fb5770 --- /dev/null +++ b/articles/_includes/_checksession_polling.md @@ -0,0 +1,3 @@ +In some multi-application scenarios, where Single Logout is desired (a user logging out of one application needs to be logged out of other applications), an application can be set up to periodically poll Auth0 using `checkSession()` to see if a session exists. If the session does not exist, you can then log the user out of the application. The same polling method can be used to implement silent authentication for a Single Sign-on (SSO) scenario. + +The poll interval between checks to `checkSession()` should be at least 15 minutes between calls to avoid any issues in the future with rate limiting of this call. diff --git a/articles/_includes/_co_authenticate_errors.md b/articles/_includes/_co_authenticate_errors.md index 3f0ba837a4..af87d27465 100644 --- a/articles/_includes/_co_authenticate_errors.md +++ b/articles/_includes/_co_authenticate_errors.md @@ -12,7 +12,6 @@ The error description is human readable. It **should not be parsed by any code** | 401 | unauthorized_client | Cross origin login not allowed. | | 400 | unsupported_credential_type | Unknown credential type parameter. | | 400 | invalid_request | Unknown realm non-existent-connection. | -| 403 | access_denied | Invalid user credentials. | | 403 | access_denied | Wrong email or password. | | 403 | access_denied | Authentication error | | 403 | blocked_user | Blocked user | diff --git a/articles/_includes/_contact-sales.md b/articles/_includes/_contact-sales.md index 5cbeffc9e2..b5a08e1e82 100644 --- a/articles/_includes/_contact-sales.md +++ b/articles/_includes/_contact-sales.md @@ -1,3 +1,3 @@ ## More Information -If you have specific support requirements or need more information on the Professional Services we offer, please [contact sales](https://auth0.com/?contact=true). +If you have specific support requirements or need more information about the Professional Services we offer, please [contact Auth0 Sales](https://auth0.com/get-started?place=documentation%20post&type=link&text=contact%20auth0%20sales). diff --git a/articles/_includes/_create_resource_server.md b/articles/_includes/_create_resource_server.md index 95ca7cf19e..e879837b6a 100644 --- a/articles/_includes/_create_resource_server.md +++ b/articles/_includes/_create_resource_server.md @@ -1,10 +1,10 @@ ## Create the API -Your resource server (API) needs to be configured to verify the `access_token` and any claims contained within it. When you create a resource server in your Auth0 dashboard, it utilizes the RS256 signature method by default, meaning that Access Tokens are signed using Auth0's private key for your account. Verification is done using the corresponding public key. You can read more about the [JSON Web Key Set (JWKS)](/jwks) standard and also view the [public key](https://${account.namespace}/.well-known/jwks.json) for your Auth0 account (https://${account.namespace}/.well-known/jwks.json). +Your resource server (API) needs to be configured to verify the Access Token and any claims contained within it. When you create a resource server in your Auth0 dashboard, it utilizes the RS256 signature method by default, meaning that Access Tokens are signed using Auth0's private key for your account. Verification is done using the corresponding public key. You can read more about the [JSON Web Key Set (JWKS)](/tokens/concepts/jwks) standard and also view the [public key(s)](https://${account.namespace}/.well-known/jwks.json) for your Auth0 account (https://${account.namespace}/.well-known/jwks.json). You can also learn how to [manage your signing keys](/tokens/guides/manage-signing-keys). You can use any [recommended JWT library](https://jwt.io) to validate the standard claims returned in the token. The following example will demonstrate how to create a resource server API with Node. You can find more information about resource server implementations in the [Access Token documentation](https://auth0.com/docs/api-auth/config/asking-for-access-tokens). -The `access_token` for your API must be verified against your JSON Web Key Set (JWKS) endpoint. This can be done easily with the **jwks-rsa** library available on npm. +The Access Token for your API must be verified against your JSON Web Key Set (JWKS) endpoint. This can be done easily with the **jwks-rsa** library available on npm. Install the dependencies. @@ -12,7 +12,7 @@ Install the dependencies. npm install express express-jwt jwks-rsa ``` -Create a middleware which uses **express-jwt** and **jwks-rsa** to verify the `access_token` against your JWKS endpoint. +Create a middleware which uses **express-jwt** and **jwks-rsa** to verify the Access Token against your JWKS endpoint. ```js const express = require('express'); @@ -21,7 +21,7 @@ const jwt = require('express-jwt'); const jwksRsa = require('jwks-rsa'); const authenticate = jwt({ - // Dynamically provide a signing key based on the kid in the header and the singing keys provided by the JWKS endpoint. + // Dynamically provide a signing key based on the kid in the header and the signing keys provided by the JWKS endpoint. secret: jwksRsa.expressJwtSecret({ cache: true, rateLimit: true, @@ -47,4 +47,4 @@ app.listen(3001); console.log('Listening on http://localhost:3001'); ``` -Note that you **must** provide the `audience` for your API. This is the identifier you set for it when you create an API in your Auth0 dashboard. \ No newline at end of file +Note that you **must** provide the `audience` for your API. This is the identifier you set for it when you create an API in your Auth0 dashboard. diff --git a/articles/_includes/_deprecate-delegation.md b/articles/_includes/_deprecate-delegation.md new file mode 100644 index 0000000000..7317d51f14 --- /dev/null +++ b/articles/_includes/_deprecate-delegation.md @@ -0,0 +1,3 @@ +::: warning +By default, delegation is disabled for tenants without an add-on in use as of 8 June 2017. Legacy tenants who currently use an add-on that requires delegation may continue to use this feature. If delegation functionality is changed or removed from service at some point, customers who currently use it will be notified beforehand and given ample time to migrate. +::: \ No newline at end of file diff --git a/articles/_includes/_deprecate-impersonation.md b/articles/_includes/_deprecate-impersonation.md index 616d8c4284..4f58b1bb31 100644 --- a/articles/_includes/_deprecate-impersonation.md +++ b/articles/_includes/_deprecate-impersonation.md @@ -1,3 +1,3 @@ -:::warning -Impersonation has been deprecated and will not be enabled for customers any longer. The functionality will continue to work for the customers that have it already enabled. If this changes customers will be notified beforehand and given ample time to migrate. -::: \ No newline at end of file +::: warning +Impersonation has been deprecated and will not be enabled for new customers. The functionality will continue to work for existing customers who currently have it enabled. If at some point the impersonation feature is changed or removed from service, customers who currently use it will be notified beforehand and given ample time to migrate. +::: diff --git a/articles/_includes/_email-domain-blacklist.md b/articles/_includes/_email-domain-blacklist.md new file mode 100644 index 0000000000..1fdcdd1fc2 --- /dev/null +++ b/articles/_includes/_email-domain-blacklist.md @@ -0,0 +1,3 @@ +::: warning +Auth0 blacklists certain "false" domains commonly used during testing. Use real email addresses to avoid disruption or `domain is blacklisted` errors. +::: diff --git a/articles/_includes/_embedded_login_warning.md b/articles/_includes/_embedded_login_warning.md new file mode 100644 index 0000000000..f37d242c2d --- /dev/null +++ b/articles/_includes/_embedded_login_warning.md @@ -0,0 +1,3 @@ +::: warning +Embedded login for web uses Cross Origin Authentication. In some browsers [this can be unreliable](/cross-origin-authentication#limitations) if you do not set up a [Custom Domain](/custom-domains) **and host your app on the same domain**. Using Custom Domains with Auth0 is a paid feature. If you cannot use Custom Domains, consider [migrating to Universal Login](/guides/login/migration-embedded-universal). +::: \ No newline at end of file diff --git a/articles/_includes/_enable-third-party-apps-info.md b/articles/_includes/_enable-third-party-apps-info.md new file mode 100644 index 0000000000..e540021871 --- /dev/null +++ b/articles/_includes/_enable-third-party-apps-info.md @@ -0,0 +1,3 @@ +::: note +To use this feature, you must [enable third-party applications for your Auth0 tenant](/applications/guides/enable-third-party-apps). +::: diff --git a/articles/_includes/_enforce-claim-namespacing.md b/articles/_includes/_enforce-claim-namespacing.md new file mode 100644 index 0000000000..3b593d6ccf --- /dev/null +++ b/articles/_includes/_enforce-claim-namespacing.md @@ -0,0 +1,5 @@ +::: warning +By default, Auth0 always enforces namespacing; any custom claims with non-namespaced identifiers will be silently excluded from tokens. + +We do allow non-OIDC claims without a namespace for legacy tenants using a non-OIDC-conformant pipeline with the **Legacy User Profile** enabled, but we strongly recommend that legacy tenants migrate to an OIDC-conformant flow. +::: \ No newline at end of file diff --git a/articles/_includes/_http-method.html b/articles/_includes/_http-method.html index 42cf02bee8..cacd38d8f0 100644 --- a/articles/_includes/_http-method.html +++ b/articles/_includes/_http-method.html @@ -1,4 +1,4 @@ -
+

${http_method} ${path} -

\ No newline at end of file + \ No newline at end of file diff --git a/articles/_includes/_ip_whitelist.md b/articles/_includes/_ip_whitelist.md new file mode 100644 index 0000000000..a3d9ad21b8 --- /dev/null +++ b/articles/_includes/_ip_whitelist.md @@ -0,0 +1,3 @@ +::: note Network Firewall +If you are behind a firewall, this feature may require [whitelisting of the appropriate Auth0 IP addresses](/guides/ip-whitelist) to work properly. +::: diff --git a/articles/_includes/_libraries_support_frameworks.html b/articles/_includes/_libraries_support_frameworks.html index f9a1dccec6..b14527fae5 100644 --- a/articles/_includes/_libraries_support_frameworks.html +++ b/articles/_includes/_libraries_support_frameworks.html @@ -23,27 +23,7 @@
Supported
- Auth0 Spring MVC - v1 -
Supported
- - - Auth0 Spring Security MVC - v1 -
Supported
- - - Auth0 Spring Security API - v1 -
Supported
- - - Auth0 ASP.NET 4.5 Owin - v2 -
Supported
- - - Auth0 ASP.NET + Auth0 Java MVC Common v1
Supported
@@ -57,15 +37,5 @@ v3
Supported
- - Auth0 with UWP applications - v1 -
Community
- - - Auth0 application for Winforms and WPF - v0.9 -
Community
- diff --git a/articles/_includes/_libraries_support_lock.html b/articles/_includes/_libraries_support_lock.html index 54a62fd2f9..b23b2b155f 100644 --- a/articles/_includes/_libraries_support_lock.html +++ b/articles/_includes/_libraries_support_lock.html @@ -18,7 +18,7 @@
Supported
- + Lock.Android v1
Bug fixes
@@ -27,7 +27,7 @@ v2
Supported
- + Lock for iOS v1 v1
Bug fixes
diff --git a/articles/_includes/_libraries_support_sdks.html b/articles/_includes/_libraries_support_sdks.html index 662bb4932a..9fae1bad76 100644 --- a/articles/_includes/_libraries_support_sdks.html +++ b/articles/_includes/_libraries_support_sdks.html @@ -7,6 +7,16 @@ + + Auth0 Single Page Application SDK + v1 +
Supported
+ + + Auth0 React SDK + v1 +
Supported
+ Auth0.js v9 @@ -27,11 +37,6 @@ v4
Supported
- - - v3 -
Supported
- Auth0 Java v1 @@ -49,7 +54,7 @@ Auth0 PHP - v5 + v7.3
Supported
diff --git a/articles/_includes/_linking_accounts.md b/articles/_includes/_linking_accounts.md index 0ad13c36e4..547909a2a2 100644 --- a/articles/_includes/_linking_accounts.md +++ b/articles/_includes/_linking_accounts.md @@ -1,11 +1,11 @@ -There may be situations when your users want to log in with multiple accounts that they own. In these cases, you may want to link these accounts together so that they are all reflected in the user's Auth0 profile. For example, if a user has signed up with an email and password (which provides very little information about them), you can ask them to link their account to an OAuth provider like Facebook or Google to gain access to their social profile. For a detailed description of linking accounts, see the [full documentation](https://auth0.com/docs/link-accounts). +There may be situations when your users want to log in with multiple accounts that they own. In these cases, you may want to link these accounts together so that they are all reflected in the user's Auth0 profile. For example, if a user has signed up with an email and password (which provides very little information about them), you can ask them to link their account to an OAuth provider like Facebook or Google to gain access to their social profile. See [User Account Linking](/users/concepts/overview-user-account-linking) for details. ## Linking Accounts -To link accounts, call the [link a user account](/api/management/v2#!/Users/post_identities) endpoint. You will need the `id_token` and `user_id` of the primary account and the `id_token` of the secondary account. +To link accounts, call the [link a user account](/api/management/v2#!/Users/post_identities) endpoint. You will need the ID Token and `user_id` of the primary account and the ID Token of the secondary account. -To differentiate the login from the linking login, you will need to create a second instance of `Auth0Lock` to obtain the `id_token` of the secondary account. +To differentiate the login from the linking login, you will need to create a second instance of `Auth0Lock` to obtain the ID Token of the secondary account. Since all instances of `Auth0Lock` will receive the `authenticated` event, you will need a way to determine if authentication came from the primary login or the linking login. -You can use the `auth.params` property of the [options object](https://github.com/auth0/lock#authentication-options) of `Auth0Lock` to add a `state` property with the value `'linking'`. \ No newline at end of file +You can use the `auth.params` property of the [options object](https://github.com/auth0/lock#authentication-options) of `Auth0Lock` to add a `state` property with the value `'linking'`. diff --git a/articles/_includes/_lock_auth0js_deprecations_notice.md b/articles/_includes/_lock_auth0js_deprecations_notice.md index f989f7af01..9e03f9bb98 100644 --- a/articles/_includes/_lock_auth0js_deprecations_notice.md +++ b/articles/_includes/_lock_auth0js_deprecations_notice.md @@ -1,3 +1,3 @@ ::: panel-warning Lock and Auth0.js Deprecations -The Lock v8, v9, and v10 widgets as well as the Auth0.js v6, v7, and v8 SDKs are deprecated and should be migrated away from prior to their removal from service on July 16, 2018. The [Deprecation Guidance](/migrations/guides/legacy-lock-api-deprecation) page provides details about update recommendations. +The Lock v8, v9, and v10 widgets as well as the Auth0.js v6, v7, and v8 SDKs are deprecated and should be migrated away from prior to their removal from service on July 16, 2018. ::: \ No newline at end of file diff --git a/articles/_includes/_login_auth0_hosted_login_page.md b/articles/_includes/_login_auth0_hosted_login_page.md index f4b21646f3..78c16d5875 100644 --- a/articles/_includes/_login_auth0_hosted_login_page.md +++ b/articles/_includes/_login_auth0_hosted_login_page.md @@ -1 +1 @@ -Auth0's [universal login](/hosted-pages/login) is the easiest way to set up authentication in your application. \ No newline at end of file +Auth0's [Universal Login](/hosted-pages/login) is the easiest way to set up authentication in your application. diff --git a/articles/_includes/_logout_url.md b/articles/_includes/_logout_url.md new file mode 100644 index 0000000000..ed3e9ac189 --- /dev/null +++ b/articles/_includes/_logout_url.md @@ -0,0 +1,11 @@ + + +### Configure Logout URLs + +A logout URL is a URL in your application that Auth0 can return to after the user has been logged out of the authorization server. This is specified in the `returnTo` query parameter. The logout URL for your app must be added to the **Allowed Logout URLs** field in your Application Settings. If this field is not set, users will be unable to log out from the application and will get an error. + +<% if (typeof(returnTo) !== "undefined") { %> + ::: note + If you are following along with the sample project you downloaded from the top of this page, the logout URL you need to add to the **Allowed Logout URLs** field is `${returnTo}`. + ::: +<% } %> diff --git a/articles/_includes/_metadata_on_signup_warning.md b/articles/_includes/_metadata_on_signup_warning.md new file mode 100644 index 0000000000..1af9aab000 --- /dev/null +++ b/articles/_includes/_metadata_on_signup_warning.md @@ -0,0 +1,3 @@ +::: note +When setting the `user_metadata` field using the Authentication API's [Signup endpoint](/api/authentication?javascript#signup), you are limited to a maximum of 10 `String` fields and 500 characters. +::: diff --git a/articles/_includes/_native_passwordless_warning.md b/articles/_includes/_native_passwordless_warning.md index 1465cf3fa5..04eaae8300 100644 --- a/articles/_includes/_native_passwordless_warning.md +++ b/articles/_includes/_native_passwordless_warning.md @@ -1,3 +1,3 @@ ::: warning -Passwordless functionality should not be embedded in native apps until Auth0 libraries can be updated to properly support it. Until that time, passwordless authentication can still be achieved by using [universal login](/connections/passwordless/native-passwordless-universal) via the web. +This functionality has been deprecated in native. After June 2017, tenants cannot use the native passwordless flow. The functionality will continue to work for tenants that currently have it enabled. If at some point the passwordless mode feature is changed or removed from service, customers who currently use it will be notified beforehand and given ample time to migrate. ::: diff --git a/articles/_includes/_new_api.html b/articles/_includes/_new_api.html index 5ef9d7f6ff..924a36341f 100644 --- a/articles/_includes/_new_api.html +++ b/articles/_includes/_new_api.html @@ -1,5 +1,5 @@ <% if (account.userName) { %> -

In the APIs section in dashboard, click the Create API button. Provide a Name and Identifier for your API. You must choose the RS256 signing algorithm. Once it is created, navigate to the Scopes tab and create the applicable scopes for your API.

+

In the APIs section in dashboard, click the Create API button. Provide a Name and Identifier for your API. You must choose the RS256 signing algorithm. Once it is created, navigate to the Scopes tab and create the applicable scopes for your API.

<% } else { %> -

Create an Auth0 account (or login) navigate to the APIs section in Dashboard. Click the Create API button and provide a Name and Identifier for your API. You must choose the RS256 signing algorithm. Once it is created, navigate to the Scopes tab and create the applicable scopes for your API.

+

Create an Auth0 account (or login) navigate to the APIs section in Dashboard. Click the Create API button and provide a Name and Identifier for your API. You must choose the RS256 signing algorithm. Once it is created, navigate to the Scopes tab and create the applicable scopes for your API.

<% } %> \ No newline at end of file diff --git a/articles/_includes/_new_app.md b/articles/_includes/_new_app.md index 16b5983caf..4d390027eb 100644 --- a/articles/_includes/_new_app.md +++ b/articles/_includes/_new_app.md @@ -1,20 +1,28 @@ -## Get Your Application Keys +## Configure Auth0 +### Get Your Application Keys -<% if (!account.userName) { %> -The first step for integrating Auth0 in your app is to create an [account](${manage_url}/login). When you sign up for Auth0, you will be invited to create a new application. +When you signed up for Auth0, a new application was created for you, or you could have created a new one. You will need some details about that application to communicate with Auth0. You can get these details from the Application Settings section in the Auth0 dashboard. -<% } else { %> -When you signed up for Auth0, you created a new application. +<% if(typeof hideDashboardScreenshot === 'undefined' || hideDashboardScreenshot !== true) { %> +![App Dashboard](/media/articles/dashboard/client_settings.png) +<% } %> +<% if(typeof isPublicClient === 'undefined' || isPublicClient === true) { %> +::: note +When using the Default App with a Native or Single Page Application, ensure to update the **Token Endpoint Authentication Method** to `None` and set the **Application Type** to either `SPA` or `Native`. +::: <% } %> -You will need some details about this application to communicate with Auth0. You can get them from the [Application Settings](${manage_url}/#/applications/${account.clientId}/settings) in the Auth0 dashboard. - + You need the following information: -* **Client ID** + * **Domain** +* **Client ID** +<% if(typeof showClientSecret !== 'undefined' && showClientSecret === true) { %> +* **Client Secret** +<% } %> +<% if(typeof hideDownloadSample === 'undefined' || hideDownloadSample !== true) { %> ::: note -If you download the sample from the top of this page, these details are filled out for you. If you have more than one application in your account, the sample comes with the values for your **Default App**. +If you download the sample from the top of this page, these details are filled out for you. ::: - -![App Dashboard](/media/articles/dashboard/client_settings.png) +<% } %> diff --git a/articles/_includes/_parental-consent.md b/articles/_includes/_parental-consent.md new file mode 100644 index 0000000000..eaa0337c61 --- /dev/null +++ b/articles/_includes/_parental-consent.md @@ -0,0 +1,3 @@ +::: note +If you require a specialized consent prompt, for example a parental consent, you need to build your own custom consent form. Be aware that laws vary according to country. +::: \ No newline at end of file diff --git a/articles/_includes/_rbac_methods.md b/articles/_includes/_rbac_methods.md new file mode 100644 index 0000000000..57feb5baa3 --- /dev/null +++ b/articles/_includes/_rbac_methods.md @@ -0,0 +1,8 @@ +Currently, we provide two ways of implementing [role-based access control (RBAC)](/authorization/concepts/rbac), which you can use in place of or in combination with your API's own internal access control system: + +* [Authorization Core](/authorization/guides/how-to) +* [Authorization Extension](/extensions/authorization-extension) + +We are expanding our Authorization Core feature set to match the functionality of the Authorization Extension. Our new core RBAC implementation improves performance and scalability and will eventually provide a more flexible RBAC system than the Authorization Extension. + +For now, both implement the key features of RBAC and allow you to restrict the custom scopes defined for an API to those that have been assigned to the user as permissions. For a comparison, see [Authorization Core vs. Authorization Extension](/authorization/concepts/core-vs-extension). \ No newline at end of file diff --git a/articles/_includes/_rbac_vs_extensions.md b/articles/_includes/_rbac_vs_extensions.md new file mode 100644 index 0000000000..58e7c0af76 --- /dev/null +++ b/articles/_includes/_rbac_vs_extensions.md @@ -0,0 +1,5 @@ +::: warning +The [Authorization Core](/authorization/guides/how-to) feature set and [Authorization Extension](/extensions/authorization-extension) are completely separate features. To manage groups, roles, or permissions, you will need to use the feature they were originally created in. + +Although the [Delegated Administration Extension](/extensions/delegated-admin) and the [Authorization Core](/authorization/guides/how-to) feature set are completely separate features, you can use the Authorization Core feature set to create and manage roles for the DAE if you use a rule. To learn how, see [Sample Use Cases: Rules with Authorization](/authorization/concepts/sample-use-cases-rules#manage-delegated-administration-extension-roles-using-the-authorization-core-feature-set). +::: \ No newline at end of file diff --git a/articles/_includes/_refresh_token_rotation_panel.md b/articles/_includes/_refresh_token_rotation_panel.md new file mode 100644 index 0000000000..bb3221d0ff --- /dev/null +++ b/articles/_includes/_refresh_token_rotation_panel.md @@ -0,0 +1,3 @@ +::: note +If you have [Refresh Token Rotation](/tokens/concepts/refresh-token-rotation) enabled, a new Refresh Token is generated with each request and issued along with the Access Token. When a Refresh Token is exchanged, the previous Refresh Token is invalidated but information about the relationship is retained by the authorization server. +::: diff --git a/articles/_includes/_refresh_token_rotation_recommended.md b/articles/_includes/_refresh_token_rotation_recommended.md new file mode 100644 index 0000000000..5f52feeac1 --- /dev/null +++ b/articles/_includes/_refresh_token_rotation_recommended.md @@ -0,0 +1,3 @@ +::: panel Refresh Token Rotation +Recent advancements in user privacy controls in browsers adversely impact the user experience by preventing access to third-party cookies. Auth0 recommends using [Refresh Token Rotation](/tokens/concepts/refresh-token-rotation), which provides a secure method for using refresh tokens in SPAs while providing end-users with seamless access to resources without the disruption in UX caused by browser privacy technology like ITP. +::: diff --git a/articles/_includes/_samesite_none.md b/articles/_includes/_samesite_none.md new file mode 100644 index 0000000000..9449a343c0 --- /dev/null +++ b/articles/_includes/_samesite_none.md @@ -0,0 +1,10 @@ +::: note +Previously in Auth0, the [`samesite` cookie attribute](/sessions/concepts/cookie-attributes) options were `true`, `false`, `strict` or `lax`. If you didn't set the attribute manually, Auth0 would use the default value of `false`. + +Effective February 2020, Google Chrome v80 will change the way it handles cookies. To that end, Auth0 plans on implementing the following changes to how it handles cookies: + +* Cookies without the `samesite` attribute set will be set to `lax` +* Cookies with `sameSite=none` must be secured, otherwise they cannot be saved in the browser's cookie jar + +The goal of these changes are to improve security and help mitigate CSRF attacks. +::: diff --git a/articles/_includes/_test-this-endpoint.md b/articles/_includes/_test-this-endpoint.md index a6c6a1ff29..e2d873ea5d 100644 --- a/articles/_includes/_test-this-endpoint.md +++ b/articles/_includes/_test-this-endpoint.md @@ -1,5 +1,4 @@ -You can use our **Authentication API Debugger** extension to test this endpoint. In order to do so you need to be logged in and have installed the [Authentication API Debugger extension](/extensions/authentication-api-debugger). - + Click on **Install Debugger** to go to the article that explains how (you only have to do this once). <% diff --git a/articles/_includes/_token_signature.md b/articles/_includes/_token_signature.md new file mode 100644 index 0000000000..6af09f7685 --- /dev/null +++ b/articles/_includes/_token_signature.md @@ -0,0 +1,9 @@ + + +### Verify JWT Token Signature setting + +JSON Web Tokens (JWTs) should be signed using the RS256 signing algorithm where possible, as it provides [enhanced security over HS256](https://auth0.com/docs/tokens/concepts/signing-algorithms#our-recommendation). + +RS256 is the default, but if you are [running into errors](https://auth0.com/docs/errors/libraries/auth0-js/invalid-token#parsing-an-hs256-signed-id-token-without-an-access-token) you can verify your settings by clicking on **Show Advanced Settings** at the bottom of your Auth0 Application settings screen in the dashboard. Click the **OAuth** tab to show the signature algorithm configuration. **JsonWebToken Signature Algorithm** should be set to **RS256**, and the **OIDC Conformant** setting should be enabled. + +![Token Signature Algorithm configuration](/media/articles/applications/token-signature-algorithm.png) diff --git a/articles/_includes/_users_update_normalized_profile_attributes.md b/articles/_includes/_users_update_normalized_profile_attributes.md new file mode 100644 index 0000000000..822a2e3d50 --- /dev/null +++ b/articles/_includes/_users_update_normalized_profile_attributes.md @@ -0,0 +1,3 @@ +By default, user profile attributes provided by identity providers other than Auth0 (such as Google, Facebook, Twitter) are not directly editable because they are updated from the identity provider each time the user logs in. + +To be able to edit the `name`, `nickname`, `given_name`, `family_name`, or `picture` root attributes on the normalized user profile, you must [configure your connection sync with Auth0](/dashboard/guides/connections/configure-connection-sync) so that user attributes will be updated from the identity provider only on user profile creation. These root attributes will then be available to be [edited individually](/api/management/guides/users/update-root-attributes-users) or [by bulk import](/api/management/guides/users/set-root-attributes-user-import) using the Management API. diff --git a/articles/_includes/_uses-delegation.md b/articles/_includes/_uses-delegation.md new file mode 100644 index 0000000000..2a157656f4 --- /dev/null +++ b/articles/_includes/_uses-delegation.md @@ -0,0 +1,3 @@ +::: warning +This feature uses delegation. By default, delegation is disabled for tenants without an add-on in use as of 8 June 2017. Legacy tenants who currently use an add-on that requires delegation may continue to use this feature. If delegation functionality is changed or removed from service at some point, customers who currently use it will be notified beforehand and given ample time to migrate. In addition, note that delegation does not support the use of custom domains so any features depending on it may not be fully functional alongside a custom domain. +::: diff --git a/articles/_includes/_version_warning_api.md b/articles/_includes/_version_warning_api.md new file mode 100644 index 0000000000..bf86f5773c --- /dev/null +++ b/articles/_includes/_version_warning_api.md @@ -0,0 +1,3 @@ +::: warning +This version of the Management API has been deprecated. We recommend that you use the [new version](/api/management/v2) instead. Please refer to the [Migration Guide](/migrations/guides/management-api-v1-v2) for more information. +::: diff --git a/articles/_includes/_version_warning_auth0js.md b/articles/_includes/_version_warning_auth0js.md index e8dab61d10..3c6104e535 100644 --- a/articles/_includes/_version_warning_auth0js.md +++ b/articles/_includes/_version_warning_auth0js.md @@ -1,3 +1,3 @@ ::: version-warning -This document covers a deprecated version of Auth0.js. We recommend that you [migrate to Auth0.js v9](/libraries/auth0js/v9/migration-guide) as soon as possible. +This document covers a deprecated version of Auth0.js which uses endpoints that have been removed from service. It will no longer function as expected. We recommend that you [migrate to Auth0.js v9](/libraries/auth0js/v9/migration-guide) as soon as possible. ::: \ No newline at end of file diff --git a/articles/_includes/_version_warning_lock.md b/articles/_includes/_version_warning_lock.md index ed25f1ef8c..707490b682 100644 --- a/articles/_includes/_version_warning_lock.md +++ b/articles/_includes/_version_warning_lock.md @@ -1,3 +1,3 @@ ::: version-warning -This document covers a deprecated version of Lock. We recommend that you [migrate to Lock v11](/libraries/lock/v11/migration-guide) as soon as possible. +This document covers a deprecated version of Lock which uses endpoints that have been removed from service. It will no longer function as expected. We recommend that you migrate to Lock v11 as soon as possible. ::: \ No newline at end of file diff --git a/articles/_includes/_web_origins.md b/articles/_includes/_web_origins.md new file mode 100644 index 0000000000..27ba7150f1 --- /dev/null +++ b/articles/_includes/_web_origins.md @@ -0,0 +1,5 @@ + + +### Configure Allowed Web Origins + +You need to add the URL for your app to the **Allowed Web Origins** field in your Application Settings. If you don't register your application URL here, the application will be unable to silently refresh the authentication tokens and your users will be logged out the next time they visit the application, or refresh the page. \ No newline at end of file diff --git a/articles/_includes/_webtask.md b/articles/_includes/_webtask.md new file mode 100644 index 0000000000..71356fc124 --- /dev/null +++ b/articles/_includes/_webtask.md @@ -0,0 +1,3 @@ +::: warning +Only tenants created prior to 17 July 2018 have access to Webtask.io and the Webtask CLI. If you are an enterprise customer with a newer tenant, please contact your account representative to request access. Other requests can be made through the [Auth0 Contact Form](https://auth0.com/get-started?place=documentation%20post&type=link&text=auth0%20contact%20form) and will be evaluated on a case-by-case basis. +::: diff --git a/articles/addons/azure-blob-storage.md b/articles/addons/azure-blob-storage.md index 87b5cd1634..fa945a5c8b 100644 --- a/articles/addons/azure-blob-storage.md +++ b/articles/addons/azure-blob-storage.md @@ -1,21 +1,29 @@ --- addon: Azure Blob Storage +title: Azure Blob Storage Add-on thirdParty: true +public: false url: /addons/azure-blob-storage alias: - azure blob storage - azblob image: /media/platforms/azure.png -tags: +topics: - quickstart + - azure + - addons articles: - authenticate -description: This tutorial will show you how to use the Auth0 to authenticate and authorize Azure Blob Storage. +contentType: how-to +description: Learn how to use Auth0 to authenticate and authorize Azure Blob Storage. +useCase: integrate-third-party-apps --- -# Azure Blob Storage Addon +# Azure Blob Storage Add-on -Here's a sample call to the delegation endpoint to get the SAS: +<%= include('../_includes/_uses-delegation') %> + +Here's a sample call to the delegation endpoint to get the Shared Access Signature (SAS): ```text POST https://${account.namespace}/delegation @@ -43,7 +51,7 @@ The result of calling the delegation endpoint will be something like: } ``` -You can use the blob SAS token either by appending it to a url directly or by passing it to one of the Azure Storage SDKs. +You can use the blob SAS token either by appending it to a URL directly or by passing it to one of the Azure Storage SDKs. ```text GET https://{STORAGEACCOUNT}.blob.core.windows.net/mycontainer/myblob.txt?st=2015-01-08T18%3A45%3A14Z&se=2015-01-08T18%3A50%3A14Z&sp=r&sv=2014-02-14&sr=b&sig=13ABC456... diff --git a/articles/addons/azure-mobile-services.md b/articles/addons/azure-mobile-services.md index 3e5f8dbbf0..2d88dd226a 100644 --- a/articles/addons/azure-mobile-services.md +++ b/articles/addons/azure-mobile-services.md @@ -1,6 +1,8 @@ --- -addon: Azure Mobile Services +addon: Windows Azure Mobile Services +title: Windows Azure Mobile Services Add-on thirdParty: true +public: false url: /addons/azure-mobile-services image: /media/platforms/azure.png snippets: @@ -12,14 +14,28 @@ alias: - windows-azure-vm - azure-websites - azure-vm -description: This tutorial will show you how to use the Auth0 to authenticate and authorize Azure Mobile Services. +topics: + - azure + - mobile + - addons +contentType: how-to +useCase: integrate-third-party-apps +description: Learn how to use Auth0 to authenticate and authorize Windows Azure Mobile Services (WAMS). --- -# Azure Mobile Services Addon +# Windows Azure Mobile Services Add-on + +<%= include('../_includes/_uses-delegation') %> ## 1. Create an application -WAMS endpoints can be used from anywhere. For example: [Android](/native-platforms/android), [iOS](/native-platforms/ios-objc), [Windows UWP C#](/native-platforms/windows-uwp-csharp), [JavaScript](/application-platforms/vanillajs) or [Windows Phone](/native-platforms/windowsphone). You can use any of these tutorials for configuring an app that interacts with WAMS. +Windows Azure Mobile Services (WAMS) endpoints can be used from anywhere. To configure an app that interacts with WAMS, you can use any of the following tutorials: + +- [Android](/quickstart/native/android) +- [iOS](/quickstart/native/ios-objc) +- [Windows UWP C#](/quickstart/native/windows-uwp-csharp) +- [JavaScript](/quickstart/spa/vanillajs) +- [Windows Phone](/quickstart/native/wpf-winforms) The samples that you can download from the Azure Portal are a good starting point. @@ -37,7 +53,7 @@ The important aspects of these lines are: 1. The `Auth0Client` class takes 2 parameters: your `namespace` and the `clientId` of the application. 2. There are various overloads for the `LoginAsync` method. In the example above, all options will be presented to the user. You can use other versions of `LoginAsync` to direct login to a specific provider. For example: `LoginAsync("github")` will have users login exclusively with GitHub. -3. The `GetDelegationToken` call exchanges the application token (received in step #2) for another token to be used for with WAMS. +3. The `GetDelegationToken` call exchanges the application token (received in step #2) for another token to be used with WAMS. 4. The input for the `GetDelegationToken` method is the `clientID` of your WAMS enabled app. 5. A new `MobileServiceUser` object is created with the new information. @@ -45,7 +61,7 @@ The `GetDelegationToken` call allows your app to interact with multiple WAMS API For example, you can login a user with GitHub, then connect them to WAMS and also interact with an AWS hosted endpoint. The delegation call allows you to flow the identity of the user securely across multiple environments. -## 3. Using the user identity in the WAMS backend +## 3. Use the user identity in the WAMS backend The final step is to use the information in the token in the server code. Most likely you will have to do the following two things: diff --git a/articles/addons/azure-sb.md b/articles/addons/azure-sb.md index b2f233a130..da89208289 100644 --- a/articles/addons/azure-sb.md +++ b/articles/addons/azure-sb.md @@ -1,20 +1,28 @@ --- addon: Azure Service Bus +title: Azure Service Bus Add-on thirdParty: true +public: false url: /addons/azure-sb alias: - Azure Service Bus image: /media/platforms/azure.png -tags: +topics: - quickstart + - azure + - addons articles: - authenticate -description: This tutorial will show you how to use the Auth0 to authenticate and authorize Azure Service Bus. +contentType: how-to +useCase: integrate-third-party-apps +description: Learn how to use Auth0 to authenticate and authorize Azure Service Bus. --- -# Azure Service Bus Addon +# Azure Service Bus Add-on -Here's a sample call to the delegation endpoint to get the SAS: +<%= include('../_includes/_uses-delegation') %> + +Here's a sample call to the delegation endpoint to get the Shared Access Signature (SAS): ```text POST https://${account.namespace}/delegation diff --git a/articles/addons/index.md b/articles/addons/index.md index 2e30ba35c6..bd86928457 100644 --- a/articles/addons/index.md +++ b/articles/addons/index.md @@ -1,26 +1,48 @@ --- url: /addons -description: How to setup Application Addons, like Amazon Web Services and Azure Blob Storage, with your Auth0 app. +title: Add-ons +description: Learn about add-ons and how they are related to Auth0-registered Applications. +public: false +topics: + - applications + - add-ons +contentType: + - concept + - index +useCase: + - build-an-app + - integrate-third-party-apps --- -# Auth0 Application Addons +# Add-ons -Addons are plugins associated with an Application in Auth0. Usually, they are 3rd party APIs used by the application that Auth0 generates Access Tokens for (such as Salesforce, Azure Service Bus, Azure Mobile Services, SAP, and so on). +<%= include('../_includes/_uses-delegation') %> -## How to configure an Addon +Add-ons are plugins associated with an application registered with Auth0. Usually, they are third-party APIs used by application(s) for which Auth0 generates Access Tokens (e.g., Salesforce, Azure Service Bus, Windows Azure Mobile Services, SAP). -Go to [Dashboard > Applications > Settings > Addons](${manage_url}/#/applications/${account.clientId}/addons) page and use the toggle to enable the add-on you want to configure. +Some typical scenarios for using add-ons include: -![Application Addons](/media/addons/manage-addons.png) +* **Accessing External APIs**: Using the Delegation endpoint, you can exchange your application's Access Token for a third-party service's (e.g., Salesforce, Amazon) Access Token. -Each integration is different and requires different parameters and configuration. Once the addon is activated, you will see tailored instructions with details on how to integrate with it in the dashboard. +* **Integrating with Applications using SAML2/WS-Federation**: Since Add-ons allow you to configure every aspect of the SAML2/WS-Federation integration, they allow you to integrate with any custom or Single Sign-on (SSO) integration that does not currently enjoy built-in Auth0 support. -## Additional information for specific Addons +![Addons Example Diagram](/media/articles/applications/applications-addon-types.png) -- Amazon Web Services: For more info on how to use delegation with the AWS API Gateway, see the [AWS API Gateway](/integrations/aws-api-gateway/delegation) Tutorial -- [Azure Blob Storage](/addons/azure-blob-storage) -- [Azure Mobile Services](/addons/azure-mobile-services) -- [Azure Service Bus](/addons/azure-sb) -- [Salesforce (sandbox)](/addons/salesforce-sandbox) -- [Salesforce](/addons/salesforce) -- [SAP OData](/addons/sap-odata) +## Available Add-ons + +- Amazon Web Services +- Firebase +- Layer +- Salesforce +- Salesforce (Sandbox) +- SAP +- Azure Mobile Services +- Azure Service Bus +- Azure Blob Storage +- SAML2 +- WS-Fed + +## Keep reading + +- [View Add-ons](/dashboard/guides/applications/view-addons) +- [Set Up Add-Ons](/dashboard/guides/applications/set-up-addons) \ No newline at end of file diff --git a/articles/addons/salesforce-sandbox.md b/articles/addons/salesforce-sandbox.md index b6a21106ce..79bd815fe1 100644 --- a/articles/addons/salesforce-sandbox.md +++ b/articles/addons/salesforce-sandbox.md @@ -1,19 +1,28 @@ --- addon: Salesforce (sandbox) +title: Salesforce (Sandbox) Add-on thirdParty: true +public: false url: /addons/salesforce-sandbox alias: - salesforce image: /media/addons/salesforce_sandbox_api.svg -description: This tutorial will show you how to use the Auth0 to authenticate and authorize your Salesforce (Sandbox) services. +description: Learn how to use Auth0 to authenticate and authorize your Salesforce (Sandbox) services. +topics: + - salesforce + - addons +useCase: integrate-third-party-apps +contentType: how-to --- -# Salesforce (Sandbox) Addon +# Salesforce (Sandbox) Add-on + +<%= include('../_includes/_uses-delegation') %> -Auth0 supports both the __production__ connection to Salesforce and the __Sandbox__, the only difference being the endpoints hosted by Salesforce: `https://login.salesforce.com` and `https://test.salesforce.com` respectively. +Auth0 supports both the __production__ connection to Salesforce and the __Sandbox__, the only difference being the endpoints hosted by Salesforce: `https://login.salesforce.com` and `https://test.salesforce.com`, respectively. ::: note - Under the hood, Auth0 uses OAuth 2.0 JWT Bearer Token Flow to obtain an access_token. All details of construction of the right JWT are taken care of by Auth0. + Under the hood, Auth0 uses OAuth 2.0 JWT Bearer Token Flow to obtain an Access Token. All details of construction of the right JWT are taken care of by Auth0. ::: ![](/media/articles/server-apis/salesforce-data-flow.png) diff --git a/articles/addons/salesforce.md b/articles/addons/salesforce.md index 4ecd389fa9..54aa6bb93e 100644 --- a/articles/addons/salesforce.md +++ b/articles/addons/salesforce.md @@ -1,16 +1,25 @@ --- addon: Salesforce +title: Salesforce Add-on alias: - salesforce url: addons/salesforce thirdParty: true +public: false image: /media/addons/salesforce.svg -description: This tutorial will show you how to use the Auth0 to authenticate and authorize your Salesforce services. +description: Learn how to use Auth0 to authenticate and authorize your Salesforce services. +topics: + - salesforce + - addons +useCase: integrate-third-party-apps +contentType: how-to --- -# Salesforce Addon +# Salesforce Add-on + +<%= include('../_includes/_uses-delegation') %> -Auth0 supports both the __production__ connection to Salesforce and the __Sandbox__, the only difference being the endpoints hosted by Salesforce: `https://login.salesforce.com` and `https://test.salesforce.com` respectively. +Auth0 supports both the __production__ connection to Salesforce and the __Sandbox__, the only difference being the endpoints hosted by Salesforce: `https://login.salesforce.com` and `https://test.salesforce.com`, respectively. The integration also supports getting tokens for __Salesforce Community Sites__. For this to work, you need to pass two additional parameters: @@ -23,7 +32,7 @@ community_url_section: 'members' ``` ::: note - Under the hood, Auth0 uses OAuth 2.0 JWT Bearer Token Flow to obtain an access_token. All details of construction of the right JWT are taken care of by Auth0. + Under the hood, Auth0 uses OAuth 2.0 JWT Bearer Token Flow to obtain an Access Token. All details of construction of the right JWT are taken care of by Auth0. ::: ![Salesforce data flow](/media/articles/server-apis/salesforce-data-flow.png) diff --git a/articles/addons/sap-odata.md b/articles/addons/sap-odata.md index b86909de42..4c5db1bcce 100644 --- a/articles/addons/sap-odata.md +++ b/articles/addons/sap-odata.md @@ -1,20 +1,30 @@ --- addon: SAP OData +title: SAP OData Add-on alias: - sap url: /addons/sap-odata image: /media/addons/sap_api.svg -description: This tutorial will show you how to use the Auth0 to authenticate and authorize your SAP OData services. +description: Learn how to use Auth0 to authenticate and authorize your SAP OData services. +public: false +topics: + - sap + - addons + - odata +useCase: integrate-third-party-apps +contentType: how-to --- -# SAP OData Addon +# SAP OData Add-on + +<%= include('../_includes/_uses-delegation') %> ::: warning This integration is in experimental mode. Contact us if you have questions. ::: ::: note - Under the hood, Auth0 uses SAML 2.0 Bearer Assertion Flow for OAuth 2.0 to obtain an access_token. All details of construction of the right SAML token are taken care of by Auth0. + Under the hood, Auth0 uses SAML 2.0 Bearer Assertion Flow for OAuth 2.0 to obtain an Access Token. All details of construction of the right SAML token are taken care of by Auth0. ::: ![](/media/articles/server-apis/sap-data-flow.png) diff --git a/articles/analytics/_includes/_install.md b/articles/analytics/_includes/_install.md new file mode 100755 index 0000000000..4e86feb323 --- /dev/null +++ b/articles/analytics/_includes/_install.md @@ -0,0 +1,20 @@ +## Install + +To add the <%- name %> integration to your app, include a reference to the `Auth0 Analytics.js` script on any pages with Auth0 Lock. Include the script reference **after**** Lock *and* set the configuration options before the script reference. + +``` + + + +``` + +::: note +The script version above uses a placeholder version `X.Y.Z`. For example, to reference release, 1.3.1 use `https://cdn.auth0.com/js/analytics/1.3.1/analytics.min.js`. You can [find the latest release's version number](https://github.com/auth0/auth0-analytics.js/releases/) on GitHub. +::: diff --git a/articles/analytics/_includes/_usage.md b/articles/analytics/_includes/_usage.md new file mode 100755 index 0000000000..9d4a7485c2 --- /dev/null +++ b/articles/analytics/_includes/_usage.md @@ -0,0 +1,20 @@ +## Usage + +After installation on your site, you will start collecting data. Auth0 Analytics will immediately begin sending events to <%- name %>. + +You will see the following events being logged: + +* Auth0 Lock show +* Auth0 Lock hide +* Auth0 Lock unrecoverable_error +* Auth0 Lock authenticated +* Auth0 Lock authorization_error +* Auth0 Lock forgot_password ready +* Auth0 Lock forgot_password submit +* Auth0 Lock signin submit +* Auth0 Lock signup submit +* Auth0 Lock federated login + +Note that some events that Lock emits like `hash_parsed` are not used for analytics purposes. Also, be aware that some events are only available in newer versions of Lock. If you are using an older version of Lock you will only see some of these events. We suggest upgrading to the latest version of Lock to get the most of the Auth0 Analytics integration. + +For more information on the events that are sent see the [Lock API documentation](/libraries/lock/v11/api#on-). diff --git a/articles/analytics/guides/facebook-analytics.md b/articles/analytics/guides/facebook-analytics.md new file mode 100644 index 0000000000..bc4093476f --- /dev/null +++ b/articles/analytics/guides/facebook-analytics.md @@ -0,0 +1,69 @@ +--- +description: Learn how to install and configure the Facebook Analytics for Auth0 integration. +topics: + - facebook + - analytics +public: false +contentType: how-to +useCase: + - manage-analytics + - analyze-external-analytics +--- +# Integrate Facebook Analytics with Auth0 + +Install and configure the **Facebook Analytics for Auth0** integration on your own page that is using [Lock](/libraries/lock) or the [hosted Lock pages](/universal-login). You can configure funnels and reports inside of Facebook Analytics to get the most out of this integration. + +<%= include('../_includes/_install', { name: "Facebook Analytics" }) %> + +## Setup + +If you already have either the Facebook Tracking Pixel or the Facebook Javascript SDK referenced on your site, configure Auth0 Analytics with the `preload` option as shown below. If you don't have either script loaded you need to set your Facebook Analytics App ID using the Facebook Javascript SDK configuration below. + +We recommend [creating funnels](https://www.facebook.com/help/analytics/935921203105136) to measure the success of your acquisition and registration flows using these new events. + +### Configure Facebook Javascript SDK (Recommended) + +The simplest configuration is to let the Analytics script load the Facebook Javascript SDK. You can do this by providing your Facebook Analytics App ID to the analytics options as shown below. + +``` + +``` + +If you have already loaded the Facebook Javascript SDK on your site, configure Auth0 Analytics to not load it again as shown below. + +``` + +``` + +### Configure Facebook Pixel + +If you already have the Facebook Pixel installed on your site you can use that configuration mode. Note that with the Facebook Pixel, certain features of Facebook Analytics are not available. The configuration for using the pixel is shown below. + +``` + +``` + +<%= include('../_includes/_usage', { name: "Facebook Analytics" }) %> + +## Keep reading + +[Facebook Analytics documentation](https://www.facebook.com/help/analytics/1710582659188030) + diff --git a/articles/analytics/guides/google-analytics.md b/articles/analytics/guides/google-analytics.md new file mode 100644 index 0000000000..4367921202 --- /dev/null +++ b/articles/analytics/guides/google-analytics.md @@ -0,0 +1,46 @@ +--- +description: Learn how to install and configure the Google Analytics for Auth0 integration. +topics: + - google + - analytics +public: false +contentType: how-to +useCase: + - manage-analytics + - analyze-external-analytics +--- +# Integrate Google Analytics with Auth0 + +This article explains how to install and configure the **Google Analytics for Auth0** integration. You can use this integration on your own page that is using Lock. You can configure funnels and reports inside of Google Analytics to get the most out of this integration. + +## Setup + +1. Set analytics configuration options *before* you include the references to the Lock and Auth0 Analytics libraries. + + ```javascript + + ``` + +2. Include the script reference to the `auth0-analytics.js`. This needs to be included *after* the call to Lock. + + ```javascript + + + ``` + +::: note +The script version above uses a placeholder version `X.Y.Z`. For example, to reference release 1.3.1 use `https://cdn.auth0.com/js/analytics/1.3.1/analytics.min.js`. You can [find the latest release's version number](https://github.com/auth0/auth0-analytics.js/releases/) on GitHub. +::: + +<%= include('../_includes/_usage', { name: "Google Analytics" }) %> + +## Keep reading + +[Google Analytics documentation](https://support.google.com/analytics) diff --git a/articles/analytics/index.md b/articles/analytics/index.md new file mode 100755 index 0000000000..b40e0508b0 --- /dev/null +++ b/articles/analytics/index.md @@ -0,0 +1,38 @@ +--- +url: /analytics +section: articles +classes: topic-page +title: Analytics Integrations +topics: + - analytics +public: false +contentType: index +useCase: + - manage-analytics + - analyze-external-analytics +--- + +
+
+

Analytics Integrations

+

+ Setup and configure analytics integrations with Auth0. +

+
+ +Analytics tools help you track users on your site or application. Integrating third-party analytics tools with Auth0 enables you to capture and measure identity specific events. You can use this data to create funnels, measure user retention, and improve your sign up flow. + + diff --git a/articles/analytics/integrations/_install.md b/articles/analytics/integrations/_install.md deleted file mode 100644 index a89abef1c4..0000000000 --- a/articles/analytics/integrations/_install.md +++ /dev/null @@ -1,17 +0,0 @@ -## Install - -To add the <%- name %> integration to your app, include a reference to the `Auth0 Analytics.js` script on any pages with Auth0 Lock. Include the script reference after Lock and set the configuration options before the script reference. - -``` - - - -``` - -::: note -The script version above uses a placeholder version `X.Y.Z`. For example, to reference release 1.2.0 use `https://cdn.auth0.com/js/analytics/1.2.0/analytics.min.js`. To find the latest release, see the [releases on github](https://github.com/auth0/auth0-analytics.js/releases/). -::: \ No newline at end of file diff --git a/articles/analytics/integrations/_usage.md b/articles/analytics/integrations/_usage.md deleted file mode 100644 index 756e06685b..0000000000 --- a/articles/analytics/integrations/_usage.md +++ /dev/null @@ -1,19 +0,0 @@ -## Usage -After installation on your site there is nothing else you need to do to start collecting data. Auth0 Analytics will immedately begin sending events to <%- name %>. - -You will see the following events being logged: - -* Auth0 Lock show -* Auth0 Lock hide -* Auth0 Lock unrecoverable_error -* Auth0 Lock authenticated -* Auth0 Lock authorization_error -* Auth0 Lock forgot_password ready -* Auth0 Lock forgot_password submit -* Auth0 Lock signin submit -* Auth0 Lock signup submit -* Auth0 Lock federated login - -Note that some events that Lock emits like `hash_parsed` are not used for analytics purposes. Also, be aware that some events are only availible in newer versions of Lock. If you are using an older version of Lock you will only see some of these events. We suggest upgrading to the latest version of Lock to get the most of the Auth0 Analytics integration. - -For more information on the events that are sent see the [Lock API documentation](/libraries/lock/v10/api). diff --git a/articles/analytics/integrations/facebook-analytics/index.md b/articles/analytics/integrations/facebook-analytics/index.md deleted file mode 100644 index 73c4463346..0000000000 --- a/articles/analytics/integrations/facebook-analytics/index.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -description: This article explains how to install and configure the Facebook Analytics for Auth0 integration. ---- -# Facebook Analytics for Auth0 - -This article explains how to install and configure the **Facebook Analytics for Auth0** integration. You can use this integration on your own page that is using [Lock](/libraries/lock) or you can use this on the [hosted Lock pages](/hosted-pages/login). Additionally, you will find instructions on how to configure funnels and reports inside of Facebook Analytics to get the most out of this integration. - -<%= include('../_install', { name: "Facebook Analytics" }) %> - -## Setup - -There are several ways you can use the Facebook Analytics integration. If you already have either the Facebook Tracking Pixel or the Facebook Javascript SDK referenced on your site, configure Auth0 Analytics with the `preload` option as shown below. If you don't have either script loaded you need to set your Facebook Analytics App ID using the Facebook Javascript SDK configuration below. - -### Using Facebook Javascript SDK (Recommended) - -The simplest configuration is to let the Analytics script load the Facebook Javascript SDK. You can do this by providing your Facebook Analytics App ID to the analytics options as shown below. - -``` - -``` - -If you have already loaded the Facebook Javascript SDK on your site, configure Auth0 Analytics to not load it again as shown below. - -``` - -``` - -### Using Facebook Pixel - -If you already have the Facebook Pixel installed on your site you can use that configuration mode. Note that with the Facebook Pixel, certain features of Facebook Analytics are not availible. The configuration for using the pixel is shown below. - -``` - -``` - -<%= include('../_usage', { name: "Facebook Analytics" }) %> - -## Reporting - -For the most up to date information on using Facebook Analytics, check out the [Facebook Analytics documentation](https://www.facebook.com/help/analytics/1710582659188030). - -We recommend [creating funnels](https://www.facebook.com/help/analytics/935921203105136) to measure the success of your aquistion and registration flows using these new events. diff --git a/articles/analytics/integrations/google-analytics/index.md b/articles/analytics/integrations/google-analytics/index.md deleted file mode 100644 index ab2a5a414e..0000000000 --- a/articles/analytics/integrations/google-analytics/index.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -description: This article explains how to install and configure the Google Analytics for Auth0 integration. ---- -# Google Analytics for Auth0 - -This article explains how to install and configure the **Google Analytics for Auth0** integration. You can use this integration on your own page that is using Lock or you can use this on the hosted Lock pages. Additionally, you will find instructions on how to configure funnels and reports inside of Google Analytics to get the most out of this integration. - -<%= include('../_install', { name: "Google Analytics" }) %> - -## Setup - -There are several ways you can use the Google Analytics integration. If you already have the Google Analytics Script on your site, configure Auth0 Analytics with the `preload` option as shown below. If you don't have Google Analytics loaded you need to set your Google Analytics ID using the Google Analytics configuration below. - -### Google Analytics Script Already Loaded (Recommended) - -If you have already loaded the Google Analytics script loaded on your site, configure Auth0 Analytics to not load it again as shown below. - -``` - -``` - -### No Google Analytics Script - -If you are not using Google Analytics already you can have the Auth0 Analytics script load Google Analytics for you. To do this you need to set your Google Analytics ID in the options as shown below. - -``` - -``` - -<%= include('../_usage', { name: "Google Analytics" }) %> - -## Reporting - -For the most up to date information on using Google Analytics, check out the [Google Analytics documentation](https://support.google.com/analytics). diff --git a/articles/analytics/integrations/index.md b/articles/analytics/integrations/index.md deleted file mode 100644 index 34325341e5..0000000000 --- a/articles/analytics/integrations/index.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -url: /analytics/integrations -section: articles -classes: topic-page -title: Analytics Integrations ---- - -
-
-

Analytics Integrations

-

- How to setup and configure analytics integrations with Auth0. -

-
- -Analytics tools help you track users on your site or application. The Auth0 Analytics integrations enable you to capture and measure identity specific events. You can use this data to create funnels, measure user retention, and improve your sign up flow. - - diff --git a/articles/anomaly-detection/breached-passwords.md b/articles/anomaly-detection/breached-passwords.md deleted file mode 100644 index 21e8182710..0000000000 --- a/articles/anomaly-detection/breached-passwords.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -description: Explains why a user received a breached password email and general web security tips. ---- - -# Breached Password Security - -## What happened that I received an email saying "Please change your password immediately"? - -Your account could have possibly been hacked, compromised or stolen by a third party application that experienced a security breach. This breach did not happen to this account, but based on available data, your credentials may have been released. Since many people reuse passwords, we wanted to make sure you stay protected. - -You may also want to change your password at any other sites that you suspect you used a shared password. -Here are links for password resets on commonly used sites: -* [Google](https://www.google.com/accounts/recovery/) -* [Facebook](https://www.facebook.com/settings) -* [Twitter](https://twitter.com/settings/password) - -## General Security Tips - -You can't prevent certain sites from security breaches, but there are some things you can do to help keep your accounts safe. - -* **Check your emails carefully** -Make sure to check where an email is coming from, and the links that they provide. Often phishing emails do not include your name but something generic such as "Dear Customer". Always do a password reset through the actual site itself. -* **Never enter personal or financial information in an email** -Emails in general are not very secure, so this is not a good way to communicate sensitive information. A trusted company/application would not ask for your information in this way. Also watch out to make sure you are not entering confidential information through false the links provided in emails. A secure website always starts with “https”. -* **Never download files from unreliable sources** -Most web browsers detect suspicious sites, when you try to access a malicious site, an alert message will appear. Never download files from suspicious emails or websites. -* **Do not reuse passwords** -When one site has a breach of user data, if you use the same credentials elsewhere, your information in other sites can also be accessed. There are many password tools out there to help you keep track of passwords. -* **Use strong passwords** -The longer a password is, the harder it becomes to guess. Try to make passwords long and use a mix of special characters, numbers and upper and lowercase letters. -* **Keep software current** -Applications release patches and updates when they find security vulnerabilities in their systems. Keeping your applications, web browsers and operating system up to date can help prevent security breaches. \ No newline at end of file diff --git a/articles/anomaly-detection/concepts/breached-passwords.md b/articles/anomaly-detection/concepts/breached-passwords.md new file mode 100644 index 0000000000..92f077dc01 --- /dev/null +++ b/articles/anomaly-detection/concepts/breached-passwords.md @@ -0,0 +1,64 @@ +--- +title: Breached Password Security +description: Understand why a user receives a breached password email and general web security tips. +topics: + - security + - passwords +contentType: concept +useCase: customize-anomaly-detection +v2: true +--- + +# Breached Password Security + +When a user receives an email requesting that they change their password immediately, it is because their account could be the victim of a security breach. This may be the result of a compromise by a third-party application that experienced a security breach. The breach may not have happened to this account, but based on available data, the user's credentials may have been released. Since many people reuse passwords, the request to change passwords is a precaution to make sure the user stays protected. + +Users may also want to change their password at any other sites where they suspect they used a shared password. + +## General security tips + +Users can't usually prevent certain sites from experiencing security breaches, but there are some things they can do to help keep their accounts safe. + +### Check emails carefully + +Check where an email is coming from and the links that they provide. Often phishing emails do not include a user's name but something generic such as "Dear Customer." + +### Reset passwords directly from sites + +Always do a password reset through the actual site itself not via potentially false links in emails. Also note that secure website URL always starts with `https`. + +Here are some links for password resets on commonly used sites: +* [Google](https://www.google.com/accounts/recovery/) +* [Facebook](https://www.facebook.com/settings) +* [Twitter](https://twitter.com/settings/password) + +### Never enter personal or financial information in email + +Emails in general are not very secure and are not a good way to communicate sensitive information. A trusted company/application would not ask for information in this way. Make sure not to enter confidential information through false links in emails. + +### Never download files from unreliable sources + +Most web browsers detect suspicious sites. An alert should appear when you try to access a malicious site. Never download files from suspicious emails or websites. + +### Do not reuse passwords + +When one site has a breach of user data, if a user uses the same credentials elsewhere, information in other sites can also be accessed. The only way to prevent this is by not reusing passwords for multiple sites. The problem is that remembering countless passwords is frustrating and often impossible. One solution to this problem is the use of a password manager. There are many password managers available which can help users to use separate and secure passwords for each account, but at the same time not be responsible for remembering all of them. + +### Use strong passwords + +The longer a password is, the harder it becomes to be guessed via brute force methods. Many sites allow the use of pass-phrases (a phrase or sentence instead of just a complicate word.) Try to make passwords long and use a mix of special characters, numbers, and upper- and lowercase letters. + +### Keep software current + +Applications release patches and updates when they find security vulnerabilities in their systems. Keeping applications, web browsers, and operating systems up to date can help prevent security breaches. + +### Check the security of your email inbox + +If you use Gmail, Google offers the [Security Checkup](https://myaccount.google.com/security-checkup) tool to let you know if there are any security issues related to your inbox. + +You can also use third-party tools, such as websites like [HaveIBeenPwned](https://haveibeenpwned.com/PwnedWebsites) to see if there might be security issues associated with your email address. + +## Keep reading + +* [Anomaly Detection](/anomaly-detection) +* [Customize Blocked Account Emails](/anomaly-detection/guides/customize-blocked-account-emails) diff --git a/articles/anomaly-detection/guides/customize-blocked-account-emails.md b/articles/anomaly-detection/guides/customize-blocked-account-emails.md new file mode 100644 index 0000000000..1347250973 --- /dev/null +++ b/articles/anomaly-detection/guides/customize-blocked-account-emails.md @@ -0,0 +1,30 @@ +--- +title: Customize Blocked Account Emails +description: Learn how to customize blocked account emails. +topics: + - security + - anomaly-detection + - brute-force-protection + - breached-password-detection +contentType: how-to +useCase: customize-anomaly-detection +v2: true +--- +# Customize Blocked Account Emails + +When Auth0 sends an email to a user to notify them of the [breached password block action](/anomaly-detection/references/breached-password-detection-triggers-actions), the message contains a link to re-enable the origin of the request. + +::: note +Auth0 never blocks the user itself, just the attempts from the suspicious origin. +::: + +The email sent to the user looks like this: + +![Email Example](/media/articles/brute-force-protection/bfp-2015-12-29_1832.png) + +You can customize the template used for this message on the [Dashboard](${manage_url}/#/emails) under __Emails > Templates > Blocked Account Email__. + +## Keep reading + +* Learn more about [email templates](/email/templates). +* Understand [why a user receives a breached password email](/anomaly-detection/concepts/breached-passwords) and general web security tips. diff --git a/articles/anomaly-detection/guides/enable-disable-brute-force-protection.md b/articles/anomaly-detection/guides/enable-disable-brute-force-protection.md new file mode 100644 index 0000000000..e40844c3be --- /dev/null +++ b/articles/anomaly-detection/guides/enable-disable-brute-force-protection.md @@ -0,0 +1,29 @@ +--- +title: Enable and Disable Brute-Force Protection +description: Learn how to disable and enable brute-force protection. +topics: + - security + - anomaly-detection + - brute-force-protection +contentType: how-to +useCase: customize-anomaly-detection +v2: true +--- +# Enable and Disable Brute-Force Protection + +Brute-force protection is enabled by default for all connections. + +![Brute-Force Protection Shield](/media/articles/anomaly-detection/anomaly-detection-overview.png) + +::: warning +Auth0 strongly recommends that you **do not** set the `brute_force_protection` flag to `false` (effectively disabling brute-force protection for the connection), however if you do, you can change it back in the [Dashboard](${manage_url}/#/anomaly). +::: + +Once enabled, you can [customize](/anomaly-detection/guides/set-anomaly-detection-preferences#brute-force-protection-preferences) your brute-force protection settings. + +![Brute-Force Protection Shield](/media/articles/anomaly-detection/brute-force-shield.png) + +## Keep reading + +* [Brute-Force Protection Triggers and Actions](/anomaly-detection/references/brute-force-protection-triggers-actions) +* [Set Anomaly Detection Preferences](/anomaly-detection/guides/set-anomaly-detection-preferences) \ No newline at end of file diff --git a/articles/anomaly-detection/guides/prevent-credential-stuffing-attacks.md b/articles/anomaly-detection/guides/prevent-credential-stuffing-attacks.md new file mode 100644 index 0000000000..c4d5d0b291 --- /dev/null +++ b/articles/anomaly-detection/guides/prevent-credential-stuffing-attacks.md @@ -0,0 +1,91 @@ +--- +title: Prevent Credential Stuffing Attacks +description: Learn how to prevent credential stuffing attacks on your system. +beta: true +topics: + - anomaly-detection + - credential-stuffing +contentType: how-to +useCase: + - prevent-credential-stuffing +--- +# Prevent Credential Stuffing Attacks + +Credential stuffing attacks (also known as *list validation attacks*) occur when bad actors automate the process of trying username and password combinations (usually stolen from another site) for many accounts in a short period of time. According to recent statistics, as many as 71% of accounts use the same password across multiple sites so a credential stuffing attack has the potential to successfully log into your system. + +Consider, for example, the number of errors caused by an incorrect email or username (identified in the logs as type `fu`) for a particular tenant, which suggests an attack occurred November 20, with some abuse patterns afterwards: + +![Credential Stuffing Attack Example](/media/articles/anomaly-detection/credential-stuffing-attack.png) + +Auth0 provides a number of tools to combat credential stuffing attacks: + +* [Brute Force Protection](/anomaly-detection/guides/enable-disable-brute-force-protection) blocks login attempts after a number of consecutive failed logins. + +* [Breached Password Protection](/anomaly-detection/concepts/breached-passwords) identifies credentials that are known to be stolen. + +* [Multi-factor Authentication](/mfa) can be effective in preventing unauthorized logins, but it adds friction to the user experience. + +If you do not want to turn on additional features such as MFA, you can add **Automated Credential Stuffing Attack Protection** to provide a standard level of protection against credential stuffing attacks that does not add any friction to legitimate users. + +## How it works + +Auth0 uses a large amount of data to identify patterns that signal that a credential stuffing attack is taking place. Auth0 uses sophisticated algorithms to determine when bursts of traffic are likely to be from a bot or script. Users attempting to sign in from IPs which are determined to have a high likelihood of being a credential stuffing attack will see a Captcha step. The algorithms are designed so that this only happens for bad traffic; the objective is to not show any friction to legitimate users. + +![Captcha Login Screen Example](/media/articles/anomaly-detection/captcha-login-screen.png) + +## Enable automated credential stuffing attack protection + +### Prerequisites + +* Please read Auth0’s [Beta Service Terms](https://cdn.auth0.com/website/legal/terms/beta-service-terms-11-18-19.pdf) and acknowledge you have read and agreed to the terms by emailing **Antonio Fuentes** at **antonio.fuentes@auth0.com**. + +* Determine which type of login experience you have configured: + + - Go to [Dashboard](${manage_url}/#). + - Navigate to **Universal Login**. + - Determine which login experience is selected (Classic or New). + +### If you are using New Universal Login + +No further configuration is required. If you are part of the Beta program, the Early Access features will work for your tenant immediately. + +### If you are using Classic Universal Login + +Determine if your page is customized. + +1. Select the **Login** tab. + +2. Verify the status of the toggle **Customize Login Page**. + +3. If it is on, you have a customized login page. + +### If you are using customized Classic Universal Login + +Upgrade your version of Lock. + +1. Navigate to the **Universal Login** section in the Dashboard. + +2. Select the **Login** tab. + +3. Update your version of Auth0’s Lock to version v11.20 by replacing the script tag with the tag for version v11.20. + +For example, replace this tag: +```html + +``` + +With the following: +```html + +``` + +## Performance impact + +This feature is intended to reduce the number of login attempts associated with automated or scripted credential stuffing attacks. It is not expected to cause a degradation in the latency or performance of the login flows. Auth0 monitors the impact on these metrics and will share them with you. + +In addition, you can look at the [tenant logs](/anomaly-detection/guides/use-tenant-data-for-anomaly-detection). Events that indicate a credential stuffing attack is happening. + +- `f`: failed login +- `fu`: failed login due to invalid email/username + +If you have questions, you can contact Auth0 through your TAM or contact **antonio.fuentes@auth0.com**. diff --git a/articles/anomaly-detection/guides/set-anomaly-detection-preferences.md b/articles/anomaly-detection/guides/set-anomaly-detection-preferences.md new file mode 100644 index 0000000000..7096901ab2 --- /dev/null +++ b/articles/anomaly-detection/guides/set-anomaly-detection-preferences.md @@ -0,0 +1,70 @@ +--- +title: Set Anomaly Detection Preferences +description: Learn how to set anomaly detection preferences in the Dashboard. +topics: + - security + - anomaly-detection + - brute-force-protection + - breached-password-detection +contentType: how-to +useCase: customize-anomaly-detection +v2: true +--- +# Set Anomaly Detection Preferences + +Customize the actions that occur after the triggers in the **Anomaly Detection** section on the [Dashboard](${manage_url}/#/anomaly). + +::: warning +Auth0 recommends that you **do not** make changes to your anomaly detection features with the Management API. +::: + +![Anomaly Detection Dashboard](/media/articles/anomaly-detection/anomaly-detection-overview.png) + +## Brute-force protection preferences + +Brute-force protection is enabled by default for all connections. For more information, see [Enable and Disable Brute-Force Protection](/anomaly-detection/guides/enable-disable-brute-force-protection). + +::: warning +Auth0 strongly recommends that you **do not** set the `brute_force_protection` flag to `false` (effectively disabling brute-force protection for the connection), however if you do, you can change it back in the [Dashboard](${manage_url}/#/anomaly). +::: + +Limit the amount of signups and failed logins from a suspicious IP address. For more information, see [Brute-Force Protection Triggers and Actions](/anomaly-detection/references/brute-force-protection-triggers-actions). + +1. Click on the **Brute-force Protection** shield. + +![Brute-Force Protection Shield](/media/articles/anomaly-detection/brute-force-shield.png) + +2. Use the toggles to enable or disable actions for single or multiple user accounts. + +3. Add any IP addresses to the **Whitelist** field to avoid erroneously triggering the protection action. + +4. Click **Save** when you are finished. + +## Breached password detection preferences + +Set preferences for breached password detection actions. For more information, see [Breached Password Detection Triggers and Actions](/anomaly-detection/references/breached-password-detection-triggers-actions). + +1. Click on the **Breached-password Detection** shield. + +![Breached Password Detection Shield](/media/articles/anomaly-detection/breached-password-shield.png) + +2. Use the toggles to enable or disable actions when login security breaches are detected. + +3. Determine how administrators are notified. + +4. Click **Save** when you are finished. + +## Restrictions and limitations + +Both brute-force protection and breached password detection depend on the IP address of the user. Because of this, the following use cases are *not* supported: + +* **Using the [Resource Owner](/api/authentication#resource-owner) from the backend of the application.** Using this call does not get the IP address of the user. See point 2 below as an alternative. + +* **Using [Resource Owner Password Grant](/api-auth/grant/password) from the backend of the application.** Using this call does not get the IP address of the user, however, you can [configure your application and send the IP address of the user as part of the request](/api-auth/tutorials/using-resource-owner-password-from-server-side) to make brute-force protection work correctly. + +* **Authenticating many users from the same IP address.** For example, users that are behind a proxy are more likely to reach these limits and trigger the associated protection. It is possible to configure a whitelist for the proxy's IP and CIDR range and avoid erroneously triggering the protection. + +## Keep reading + +* [Anomaly Detection](/anomaly-detection) +* [Breached Password Security](/anomaly-detection/concepts/breached-passwords) \ No newline at end of file diff --git a/articles/anomaly-detection/guides/use-tenant-data-for-anomaly-detection.md b/articles/anomaly-detection/guides/use-tenant-data-for-anomaly-detection.md new file mode 100644 index 0000000000..fd88341413 --- /dev/null +++ b/articles/anomaly-detection/guides/use-tenant-data-for-anomaly-detection.md @@ -0,0 +1,57 @@ +--- +description: Learn how to use tenant traffic log data to view anomaly detection events. +topics: + - security + - anomaly-detection +contentType: how-to +useCase: tenant-logs +--- + +# View Anomaly Detection Events + +The tenant logs contain useful data that you can use to build charts to look at the profile of the traffic going through your tenant. This is helpful when evaluating anomaly detection activity. + +## Authentication failure events + +You can use the log data `event` field to view the tenant traffic data. We recommend building a daily histogram of failure events of the following types: + +| Event Code | Event | +| -- | -- | +| `f` | Failed login | +| `fcoa` | Failed cross-origin authentication | +| `feccft` | Failed exchange | +| `fepft` | Failed exchange | +| `fsa` | Failed silent authentication | +| `fu` | Failed login (invalid email/username) | +| `sepft` | Success exchange | + +These failure events depend on the flow you have set up with Auth0. + +The following example shows a credential stuffing attack on 11/20, with a large surge of events of type `fu` which is a failed username (typical of a credential stuffing attack). + +![Traffic Failure Trends](/media/articles/anomaly-detection/traffic-failure-trends.png) + +## Authenticaton failure events from distinct IPs + +You can use the `ip` event to see the number of distinct IPs that your failure traffic is coming from, in this case, the number of distinct IPs that correspond to your `fu` event traffic. + +## Anomaly detection events + +You can perform the same type of analysis with the events corresponding to anomaly detection events to see how many times they are triggered. Use the following log events which correspond to brute force detection with many accounts, one account, and breached password detection: + +| Event Code | Event | +| -- | -- | +| `limit_mu` | Blocked IP address | +| `limit_wc` | Blocked account | +| `pwd_leak` | Breached password | + +Here's an example of what that data might look like. + +![Anomaly Detection Data](/media/articles/anomaly-detection/anomaly-detection-features.png) + +## Keep reading + +* [Log Event Data](/logs/references/log-events-data) +* [Log Search Query Syntax](/logs/references/query-syntax) +* [Export Log Data to External Services](/extensions#Monitor) +* [Retrieve Logs Using the Management API](/logs/guides/retrieve-logs-mgmt-api) diff --git a/articles/anomaly-detection/index.md b/articles/anomaly-detection/index.md index c2dbc44f3d..9dc98e5ece 100644 --- a/articles/anomaly-detection/index.md +++ b/articles/anomaly-detection/index.md @@ -1,113 +1,73 @@ --- -toc: true -description: Explains all the types of Anomaly Detection provided by Auth0 and how to enable them. -url: /anomaly-detection +title: Anomaly Detection +description: Understand how Auth0 detects anomalies to stop malicious attempts to access your application, alert you and your users of suspicious activity, and block further login attempts. +toc: true +topics: + - security + - anomaly-detection + - brute-force-protection + - breached-password-detection +contentType: concept +useCase: customize-anomaly-detection +v2: true --- - # Anomaly Detection -Auth0 provides built-in tools to detect anomalies and stop malicious attempts to access your application. Anomaly detection can alert you and your users of suspicious activity, as well as block further login attempts. You can set your preferences on the notifications that get sent and you can decide whether to block a suspicious IP address or not. - -## What Anomaly Detection Provides - -Currently Auth0 has three types of **shields** you can enable to handle anomalies and attacks. A **shield** specifies the **action** you wish to take given a specific **trigger**. - -A **trigger** is a suspicious event that is detected when someone is trying to login to your system, or there may have been a breached password with another 3rd party service. +Auth0 can detect anomalies and stop malicious attempts to access your application. Anomaly detection can alert you and your users of suspicious activity, as well as block further login attempts. You can [set preferences](/anomaly-detection/guides/set-anomaly-detection-preferences) for notifications and decide whether to block a suspicious IP address or not. -## Shields +Auth0 has two types of **shields** to handle anomalies and attacks. -### Brute-Force Protection -There are two different triggers for the brute-force protection shield, for two slightly different attack scenarios. +* [Brute-force protection](#brute-force-protection) +* [Breached password detection](#breached-password-detection) -**Trigger:** *10* failed login attempts into a single account from the same IP address. +A **shield** specifies the **action** you wish to take given a specific **trigger**. A **trigger** is a suspicious event that is detected when someone is trying to login to your system, or there may have been a breached password with another third party service. -**Actions**: -* Send an email to the affected user (The email can be [customized](#customize-the-blocked-account-email)) -* Block the suspicious IP address +Customize the actions in the **Anomaly Detection** section on the [Dashboard](${manage_url}/#/anomaly). -::: panel Note -The way this anomaly protection works is that if user with "user_id1" signs in from IP1 and fails to login consecutively for 10 attempts their login from this IP - IP1 will be blocked. Another user, say "user_id2" signing in from the same IP (IP1) will not be blocked. The mechanism to clear this block is described below. - -Currently the default trigger amount of 10 cannot be changed. +::: note +Auth0 recommends that you [create reports using tenant traffic data to see anomaly detection events](/anomaly-detection/guides/use-tenant-data-for-anomaly-detection). ::: -If this block is triggered, it can be cleared the following ways: - -* An administrator removes the block via the [Dashboard](${manage_url}) (by clicking **unblock for all IPs** under the **ACTIONS** button when viewing the user's details) or by using the [Management API](/api/management/v2#!/User_Blocks/delete_user_blocks) ; -* The User clicks on the "unblock" link provided in the email sent when the block went into effect; -* The User changes their password. - - -**Trigger:** *100* failed login attempts from a single IP address using different usernames, all with incorrect passwords in 24 hours. Or *50* sign ups attempts per minute from the same IP address. - -**Actions:** -* Notify dashboard administrator(s) -* Block suspicious addresses - -If this block is triggered, additional access attempts are released one at a time over the course of 24 hours until 100 attempts are allocated. More specifically, you will gain 100 attempts / 24 hours * 60 minutes = 1 additional attempt every 25 minutes. - -Auth0 does email the dashboard administrator(s) when this block is triggered. Within this email there's a link the owner can click on to remove the block. - -#### Restrictions Regarding Brute-Force Protection - -Both of these anomaly types depend on the IP address of the user. Because of this, the following use cases are *not* supported: - -1. Using the [Resource Owner](/api/authentication#resource-owner) from the backend of the application. Using this call does not get the IP address of the user. See point 2 below as an alternative. -2. Using [Resource Owner Password Grant](/api-auth/grant/password) from the backend of the application. Using this call does not get the IP address of the user, however, you can [configure your application and send the IP address of the user as part of the request](/api-auth/tutorials/using-resource-owner-password-from-server-side) to make brute-force protection work correctly. -3. Authenticating many users from the same IP address. For example, users that are behind a proxy are more likely to reach these limits and trigger the associated protection. It is possible to configure a whitelist for the proxy's IP and CIDR range and avoid erroneously triggering the protection. - -### Breached Password Detection - -Every day malicious hackers penetrate websites and applications, exposing thousands of email and passwords. Given that it's quite common for users to use the same password to login to multiples sites, this poses a problem, not only for the hacked system, but to any application that shares those credentials. - -Auth0 tracks large security breaches that are happening on major third party sites to help keep your users and system secure. By enabling Breached Password Detection, your users can be notified and/or blocked from logging in if we suspect their credentials were part of a published security breach. - -**Trigger:** Auth0 suspects that a specific user's credentials were included in a major public security breach. - -**Actions:** -* Send an email to the affected user -* Send an email to dashboard owners immediately, and/or have a daily/weekly/monthly summary -* Block login attempts for suspected user accounts using that username and password combination - -This block remains in place until the user changes their password. - -:::note -Watch our [Breached Password Detection 101 video tutorial](https://auth0.com/resources/videos/learn-about-breached-password-detection). -::: - -## Setting Your Preferences - -To customize the **actions** that get taken from the **triggers**, go to the [Anomaly Detection](${manage_url}/#/anomaly) section on the dashboard. - -![](/media/articles/anomaly-detection/anomaly-detection-overview.png) +## Brute-force protection -You can use the toggle to disable all the actions of a certain shield. Or to enable/disable certain actions, click on the shield that has the action in it that you wish to change. +Brute-force protection is [enabled by default](/anomaly-detection/guides/enable-disable-brute-force-protection) for all connections. There are two different [triggers](/anomaly-detection/references/brute-force-protection-triggers-actions) for the brute-force protection shield, for two slightly different attack scenarios. -Then you can use the toggle to enable/disable an action. +* 10 consecutive failed login attempts for the same user and from the same IP address +* 100 failed login attempts from the same IP address in 24 hours *or* 50 sign up attempts per minute from the same IP address -### Brute-force Protection +For example, if a user with *user_id1* signs in from *IP1* and fails to login consecutively for 10 attempts, their log in attempt from this *IP1* will be blocked. Another user, *user_id2*, signing in from *IP1* will not be blocked. -![](/media/articles/anomaly-detection/brute-force-shield.png) +## Breached password detection -Here you can also add any IP addresses to the **Whitelist** field to avoid erroneously triggering the protection. +Every day, malicious hackers penetrate websites and applications, exposing thousands of email and passwords. Because it's common for users to use the same password to login to multiples sites, this poses a problem, not only for the hacked system, but to any application that shares those [breached passwords](/anomaly-detection/concepts/breached-passwords). -Click **Save** when you have finished. +Auth0 tracks large security breaches that are happening on major third party sites to help keep your users and system secure. By [enabling breached password detection](/anomaly-detection/guides/set-anomaly-detection-preferences), when a [trigger](/anomaly-detection/references/breached-password-detection-triggers-actions) occurs, your users can be notified and/or blocked from logging in if we suspect their credentials were part of a published security breach. You can [customize blocked account emails](/anomaly-detection/guides/customize-blocked-account-emails). -### Breached-password Detection +## Frequently asked questions -![](/media/articles/anomaly-detection/breached-password-shield.png) +* **Is the user notified at every login?** +We send one email every hour, regardless of the number of logins. For example, if a user tries to log in 200 times in 1 hour and 30 minutes, we will send 2 emails. -Click **Save** when you have finished. +* **Is there a limit to the number of times a user will be notified?** +Users will only be notified once per hour. -### Customize the Blocked Account Email +* **How often does Auth0 email administrators when traffic is blocked using Brute Force Protection for multiple accounts?** +In the event of an ongoing attack, traffic can be blocked from thousands of IP addresses at a time. Auth0 will send a single email to each administrator every hour that traffic is blocked, regardless of the number of IPs involved in the attack. -When Auth0 sends an email to a user to notify them of the block, the message contains a link to re-enable the origin of the request. Notice that Auth0 never blocks the user itself, just the attempts from the suspicious origin. +* **For how long is the reset password link, included in the breached password email, valid?** +Password reset links are valid for 5 days. -The email sent to the user looks like this: +* **Is there a test dataset of breached passwords?** +You can test with **leak-test@example.com** as the email and **Paaf213XXYYZZ** as the password. -![Email Example](/media/articles/brute-force-protection/bfp-2015-12-29_1832.png) +* **Does the breached password detection work when logging in using the Resource Owner password grant?** +Yes. -The template used for this message can be customized on the [Dashboard](${manage_url}/#/emails) under __Emails > Templates > Blocked Account Email__. +* **Does the breached password detection feature work with a custom database?** +Yes. -[Learn more about Customizing your Emails](/email/templates) +* **What Redirect URL applies to the *Change password* link included in the breached password notification email?** +The **RedirectTo** URL is the URL listed in the Dashboard in [Emails > Templates > Change Password Template](${manage_url}/#/emails). +* **Is there a way to configure the Redirect URL and the length of time that the change password link is valid?** +You can configure the **URL Lifetime** and **Redirect To** values in the Dashboard by going to [Emails > Templates > Change Password Template](${manage_url}/#/emails). \ No newline at end of file diff --git a/articles/anomaly-detection/references/breached-password-detection-triggers-actions.md b/articles/anomaly-detection/references/breached-password-detection-triggers-actions.md new file mode 100644 index 0000000000..c7e0e93b8b --- /dev/null +++ b/articles/anomaly-detection/references/breached-password-detection-triggers-actions.md @@ -0,0 +1,35 @@ +--- +title: Breached Password Detection Triggers and Actions +description: Breached password detection triggers and actions taken upon anomaly detection and how blocks are cleared. +topics: + - security + - anomaly-detection + - breached-password-detection +contentType: reference +useCase: customize-anomaly-detection +v2: true +--- +# Breached Password Detection Triggers and Actions + +## Trigger + +A trigger occurs when Auth0 suspects that a specific user's credentials were included in a major public security breach. + +::: panel Video Tutorial +Watch our [Breached Password Detection 101 video tutorial](https://auth0.com/resources/videos/learn-about-breached-password-detection). +::: + +## Actions + +* Send an email to the affected user. +* Send an email to dashboard owners immediately, and/or have a daily/weekly/monthly summary. +* Block login attempts for suspected user accounts using that username and password combination. + +## Remove block + +This block remains in place until the user changes their password. + +## Keep reading + +* [Anomaly Detection](/anomaly-detection) +* [Breached Password Security](/anomaly-detection/concepts/breached-passwords) \ No newline at end of file diff --git a/articles/anomaly-detection/references/brute-force-protection-triggers-actions.md b/articles/anomaly-detection/references/brute-force-protection-triggers-actions.md new file mode 100644 index 0000000000..3342464d8f --- /dev/null +++ b/articles/anomaly-detection/references/brute-force-protection-triggers-actions.md @@ -0,0 +1,64 @@ +--- +title: Brute-Force Protection Triggers and Actions +description: Brute-force protection triggers and actions taken upon anomaly detection and how blocks are cleared. +topics: + - security + - anomaly-detection + - brute-force-protection +contentType: reference +useCase: customize-anomaly-detection +v2: true +--- +# Brute-Force Protection Triggers and Actions + +## 10 failed login attempts + +### Trigger + +This trigger occurs when there are 10 failed login attempts into a single account from the same IP address. + +::: note +The default trigger amount of 10 cannot be changed. +::: + +### Actions + +* Send an email to the affected user. (You can [customize the email](/anomaly-detection/guides/customize-blocked-account-emails).) +* Block the suspicious IP address for that user. + +### Remove block + +If this block is triggered, it can be cleared the following ways: + +* An administrator removes the block via the [Dashboard](${manage_url}) (by clicking **unblock for all IPs** under the **ACTIONS** button when viewing the user's details) or by using the [Management API](/api/management/v2#!/User_Blocks/delete_user_blocks). +* The user clicks on the **unblock** link provided in the email sent when the block went into effect. +* The user changes their password. + +## 100 failed login attempts *or* 50 sign up attempts + +### Triggers + +A trigger occurs when there are 100 failed login attempts from one IP address using different usernames with incorrect passwords in 24 hours. + +Another trigger occurs if there are 50 sign up attempts per minute from the same IP address. + +### Actions + +* Notify dashboard administrator(s). +* Block suspicious addresses for 15 minutes. + +If this block is triggered, additional access attempts are released one-at-a-time over the course of 24 hours until 100 attempts are allocated. This results in approximately 1 additional attempt every 15 minutes. + +### Remove block + +Auth0 emails the dashboard administrator(s) when this block is triggered. The email contains a link that the owner can click to navigate to tenant logs to examine which IPs have been blocked. Recent blocks can be found using this query: +``` +type:limit_mu +``` +Blocks can then be removed using the [Management API](/api/management/v2#!/Anomaly/delete_ips_by_id). + +## Keep reading + +* [Anomaly Detection](/anomaly-detection) +* [Set Anomaly Detection Preferences](/anomaly-detection/guides/set-anomaly-detection-preferences) +* [Enable and Disable Brute-Force Protection](/anomaly-detection/guides/enable-disable-brute-force-protection) diff --git a/articles/api-auth/_includes/_ropg-warning.md b/articles/api-auth/_includes/_ropg-warning.md new file mode 100644 index 0000000000..c19c5320ac --- /dev/null +++ b/articles/api-auth/_includes/_ropg-warning.md @@ -0,0 +1,9 @@ +::: warning +Since the Resource Owner Password Grant (ROPG) flow involves the client handling the user's password, it **must not be used by third-party clients**. In this flow, the user's username and password are exchanged directly for an Access Token. + +Only consider using it when there is a high degree of trust between the user and the application and when other authorization flows (such as redirect-based flows) are not available. + +Instead, Auth0 recommends: +* For confidential clients, like Regular Web Applications, use the [Authorization Code Flow](/flows/concepts/auth-code). +* For public clients, like Native/Mobile Apps and Single-Page Applications, use the [Authorization Code Flow with PKCE](/flows/concepts/auth-code-pkce). +::: diff --git a/articles/api-auth/apis.md b/articles/api-auth/apis.md index efde495062..da33b407f4 100644 --- a/articles/api-auth/apis.md +++ b/articles/api-auth/apis.md @@ -4,24 +4,24 @@ toc: true title: APIs Overview description: Learn the basics of APIs, their role in OAuth and how to configure an API in Auth0 Dashboard. crews: crew-2 +topics: + - api-authentication + - oidc + - apis +contentType: concept +useCase: + - secure-api + - call-api --- # APIs -<%= include('../_includes/_pipeline2') %> - -## Overview - An API is an entity that represents an external resource, capable of accepting and responding to protected resource requests made by applications. At the [OAuth2 spec](https://tools.ietf.org/html/rfc6749) an API maps to the **Resource Server**. -When an application wants to access an API's protected resources it must provide an [Access Token](/tokens/access-token). The same Access Token can be used to access the API's resources without having to authenticate again, until it expires. +When an application wants to access an API's protected resources it must provide an Access Token. The same Access Token can be used to access the API's resources without having to authenticate again, until it expires. -Each API has a set of defined permissions. Applications can request a subset of those defined permissions when they execute the authorization flow, and include them in the Access Token as part of the **scope** request parameter. +Each API has a set of defined permissions. Applications can request a subset of those defined permissions when they execute the authorization flow, and include them in the Access Token as part of the **scope** request parameter. -For example, an API that holds a user's appointments, may accept two different levels of authorization: read only (scope `read:appointments`) or write (scope `write:appointments`). When an application asks the API to list a user's appointments, then the Access Token should contain the `read:appointments` scope. In order to edit an existing appointment or create a new one, the Access Token should contain the `write:appointments` scope. - -::: note -For more information on tokens please refer to: [Tokens used by Auth0](/tokens). -::: +For example, an API that holds a user's appointments, may accept two different levels of authorization: read only (scope `read:appointments`) or write (scope `write:appointments`). When an application asks the API to list a user's appointments, then the Access Token should contain the `read:appointments` scope. In order to edit an existing appointment or create a new one, the Access Token should contain the `write:appointments` scope. See [Tokens](/tokens) for more information. ## How to configure an API in Auth0 @@ -39,9 +39,9 @@ You need to provide the following information for your API: - **Name**: a friendly name for the API. Does not affect any functionality. -- **Identifier**: a unique identifier for the API. We recommend using a URL but note that this doesn't have to be a publicly available URL, Auth0 will not call your API at all. This value **cannot be modified** afterwards. +- **Identifier**: a unique identifier for the API. Auth0 recommends using a URL. Auth0 does differentiate between URLs that include the last forward slash. For example, https://example.com and https://example.com/ are two different identifiers. The URL does not have to be a publicly available URL. Auth0 will not call your API. This value **cannot** be modified afterwards. -- **Signing Algorithm**: the algorithm to sign the tokens with. The available values are `HS256` and `RS256`. When selecting `RS256` the token will be signed with the tenant's private key. For more details on the signing algorithms go to the [Signing Algorithms paragraph](#signing-algorithms). +- **Signing Algorithm**: the algorithm to sign the tokens with. The available values are `HS256` and `RS256`. When selecting `RS256` the token will be signed with the tenant's private key. To learn more about signing algorithms, see [Signing Algorithms paragraph](/tokens/concepts/signing-algorithms). Fill in the required information and click the **Create** button. @@ -49,19 +49,16 @@ Once you do so you will be navigated to the *Quick Start* of your API. Here you ![API Quick Starts](/media/articles/api/overview/quickstarts-view.png) -::: note -Keep in mind that we are working on building quickstarts for more stacks, apart from those currently available. -::: The other available views for your API are: -- **Settings**: lists the settings for your API. Some are editable. Here you can change the token expiration time and enable offline access (this way Auth0 will allow your applications to ask for Refresh Tokens for this API). For details refer to the [API Settings paragraph](#api-settings). +- **Settings**: lists the settings for your API. Some are editable. Here you can change the token expiration time and enable offline access (this way Auth0 will allow your applications to ask for Refresh Tokens for this API). For details refer to the [API Settings paragraph](#api-settings). - **Scopes**: here you can define the scopes for this API, by setting a name and a description. -- **Machine to Machine Applications**: lists your Machine to Machine Applications. You can authorize which Machine to Machine Applications can request Access Tokens for your API. You can optionally select a subset of the defined scopes to further limit the access that an authorized your application has. Only Machine to Machine Applications require explicit permission. That is because, when you authorize a Machine to Machine Applications to access an API, Auth0 is creating an Application Grant for that application. For more details on this case refer to: [Setting up a Client Credentials Grant using the Management Dashboard](/api-auth/config/using-the-auth0-dashboard). +- **Machine to Machine Applications**: lists all applications for which the **Client Credentials** grant is **enabled**. By default, this grant is **enabled** for [Regular Web Applications and Machine to Machine Applications](/applications). You can authorize any of these applications to request Access Tokens for your API. Optionally, you can select a subset of the defined scopes to limit your authorized application's access. -- **Test**: from this view you can execute a sample Client Credentials flow with any of your Authorized Machine to Machine Applications to check that everything is working as expected. +- **Test**: from this view, you can execute a sample Client Credentials flow with any of your authorized applications to check that everything is working as expected. ### API Settings @@ -73,52 +70,16 @@ Click on the *Settings* tab of your [API](${manage_url}/#/apis) to review the av - **Identifier**: A unique identifier for your API. This value is set upon API creation and cannot be modified afterwards. We recommend using a URL but note that this doesn't have to be a publicly available URL, Auth0 will not call your API at all. -- **Token Expiration (Seconds)**: The amount of time (in seconds) before the Auth0 `access_token` expires. +- **Token Expiration (Seconds)**: The amount of time (in seconds) before the Auth0 Access Token expires. The default value is 86400 seconds (24 hours). The maximum value you can set is 2592000 seconds (30 days). -- **Allow Skipping User Consent**: When a first party application requests authorized access against an API with the *Allow Skipping User Consent* flag set, the User Consent dialog will not be shown to the final user. Note that if the hostname of your application's **callbackURL** is `localhost` or `127.0.0.1` the consent dialog will always be displayed. +- **Allow Skipping User Consent**: When a first party application requests authorized access against an API with the *Allow Skipping User Consent* flag set, the User Consent dialog will not be shown to the final user. Note that if the hostname of your application's **callback URL** is `localhost` or `127.0.0.1` the consent dialog will always be displayed. - **Allow Offline Access**: If this setting is enabled, Auth0 will allow applications to ask for Refresh Tokens for this API. -- **Signing Algorithm**: The algorithm to sign the tokens with. The available values are `HS256` and `RS256`. When selecting `RS256` (recommended) the token will be signed with the tenant's private key. This value is set upon API creation and cannot be modified afterwards. For more details on the signing algorithms see the [Signing Algorithms paragraph](#signing-algorithms) below. - -### Signing Algorithms - -When you create an API you have to select the algorithm your tokens will be signed with. The signature is used to verify that the sender of the JWT is who it says it is and to ensure that the message wasn't changed along the way. - -::: note -The signature is part of a JWT. If you are not familiar with the JWT structure please refer to: [JSON Web Tokens (JWTs) in Auth0](/jwt#what-is-the-json-web-token-structure-). -::: - -To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that. That algorithm, which is part of the JWT header, is the one you select for your API: `HS256` or `RS256`. +- **Signing Algorithm**: The algorithm to sign the tokens with. The available values are `HS256` and `RS256`. When selecting `RS256` (recommended) the token will be signed with the tenant's private key. This value is set upon API creation and cannot be modified afterwards. To learn more about signing algorithms, see [Signing Algorithms](/tokens/concepts/signing-algorithms). -- **RS256** is an [asymmetric algorithm](https://en.wikipedia.org/wiki/Public-key_cryptography) which means that there are two keys: one public and one private (secret). Auth0 has the secret key, which is used to generate the signature, and the consumer of the JWT has the public key, which is used to validate the signature. +## Keep reading -- **HS256** is a [symmetric algorithm](https://en.wikipedia.org/wiki/Symmetric-key_algorithm) which means that there is only one secret key, shared between the two parties. The same key is used both to generate the signature and to validate it. Special care should be taken in order for the key to remain confidential. - -The most secure practice, and our recommendation, is to use **RS256**. Some of the reasons are: - -- With RS256 you are sure that only the holder of the private key (Auth0) can sign tokens, while anyone can check if the token is valid using the public key. - -- Under HS256, if the secret key is compromised (e.g. by the application) you would have to re-deploy the API with the new secret. - -- With RS256 you can request a token that is valid for multiple audiences. - -- With RS256 you can implement key rotation without having to re-deploy the API with the new secret. - -::: panel Verify an RS256 signed token -Go to [Dashboard > Applications](${manage_url}/#/applications). Open the **Settings** of your applications, scroll down and open **Advanced Settings**. Open the **Certificates** tab and you will find the Public Key in the **Signing Certificate** field. - -If you want to use the Public Key to verify a JWT signature on [JWT.io](https://jwt.io/), you can copy the Public Key and paste it in the **Public Key or Certificate** field under the **Verify Signature** section on the [JWT.io](https://jwt.io/) website. - -If you want to verify the signature of a token from one of your applications, we recommend that you get the Public Key from your tenant's [JSON Web Key Set (JWKS)](/jwks). Your tenant's JWKS is `https://${account.namespace}/.well-known/jwks.json`. -::: - -For a more detailed overview of the JWT signing algorithms refer to: [JSON Web Token (JWT) Signing Algorithms Overview](https://auth0.com/blog/json-web-token-signing-algorithms-overview/). - -## Keep Reading - -::: next-steps - [API Authorization landing page](/api-auth) - [Identify the proper OAuth 2.0 flow for your use case](/api-auth/which-oauth-flow-to-use) -- [Why you should always use Access Tokens to secure an API](/api-auth/why-use-access-tokens-to-secure-apis) -::: +- [Tokens](/tokens) diff --git a/articles/api-auth/blacklists-vs-grants.md b/articles/api-auth/blacklists-vs-grants.md index 11b22821aa..8a8fbedf29 100644 --- a/articles/api-auth/blacklists-vs-grants.md +++ b/articles/api-auth/blacklists-vs-grants.md @@ -1,10 +1,20 @@ --- -description: This document covers blacklists vs. grants when it comes handling tokens. +description: Understand blacklists vs. grants when it comes handling tokens. +topics: + - api-authentication + - oidc + - security + - blacklists + - application-grants +contentType: concept +useCase: + - secure-api + - call-api --- # Blacklists and Application Grants -Let's say that you're using a non-interactive [application](/application) to access your API. You have a partner that calls your API, and at the end of your existing contract, you and your partner decide not to renew your partnership. As such, you now want to remove your partner's access to your API. The issue, however, is that you've given your partner an [Access Token](/tokens/access-token) that lasts for a month. +Let's say that you're using a machine to machine [application](/application) to access your API. You have a partner that calls your API, and at the end of your existing contract, you and your partner decide not to renew your partnership. As such, you now want to remove your partner's access to your API. The issue, however, is that you've given your partner an Access Token that lasts for a month. * What can you do in this situation? * How might you configure your Auth0 environment to make such situations easier to handle in the future? @@ -20,14 +30,10 @@ We will then compare the two methods and provide our recommendations. Let's say that you grant access to your API to anyone in possession of the appropriate Access Token. One method of revoking access to a user is to blacklist their token so that it can no longer be used. -::: note -Please see the Auth0 blog for an in-depth treatment on [Blacklisting JSON Web Token API Keys](https://auth0.com/blog/blacklist-json-web-token-api-keys/). -::: - -Auth0-issued tokens are [JWTs](/jwt), so you can set the JWT ID, or `jti`, for the token by including it in the token payload's `jwtid` field. With the `jti` in hand, you can make the appropriate `POST` call to the Management API's [blacklist a token endpoint](/api/management/v2#!/Blacklists/post_tokens). You'll need to provide the JWT's `aud` and `jti` claims. +Auth0-issued tokens are [JWTs](/tokens/concepts/jwts), so you can set the JWT ID, or `jti`, for the token by including it in the token payload's `jwtid` field. With the `jti` in hand, you can make the appropriate `POST` call to the Management API's [blacklist a token endpoint](/api/management/v2#!/Blacklists/post_tokens). You'll need to provide the JWT's `aud` and `jti` claims. ::: panel Add a JWT ID -You can add `jti` via a [rule](/rule). Here's a simple example using UUID: +You can add `jti` via a [rule](/rules). Here's a simple example using UUID: ```js function (user, context, callback) { diff --git a/articles/api-auth/config/using-the-auth0-dashboard.md b/articles/api-auth/config/using-the-auth0-dashboard.md index e459277d3a..dde2b216f6 100644 --- a/articles/api-auth/config/using-the-auth0-dashboard.md +++ b/articles/api-auth/config/using-the-auth0-dashboard.md @@ -1,46 +1,33 @@ --- -description: How to set up a Client Credentials Grant using the Auth0 Dashboard +description: How to set up a Client Grant using the Auth0 Dashboard crews: crew-2 +topics: + - client-credentials + - api-authorization +contentType: how-to +useCase: secure-api --- -# Set up a Client Credentials Grant using the Dashboard +# Set Up Client Credentials Grants Using the Dashboard -<%= include('../../_includes/_pipeline2') %> +Auth0 lets you authorize applications that have the **Client Credentials** grant type enabled to call APIs using the [Client Credentials Flow](/flows/concepts/client-credentials). -1. Open the Auth0 Management Dashboard and browse to the [Applications section](${manage_url}/#/applications). +By default, the **Client Credentials** grant is enabled for all Machine-to-Machine Applications and Regular Web Applications, but they are _not yet_ authorized to call any API. -2. Click on **Create Application** to begin creating a new application (if you have multiple applications needing access to the API, you'll need to create an Auth0 app for *each*). You'll be asked what type of application you'd like to create, so select **Machine to Machine Application**. Click **Create** to proceed. +To authorize the applications to call an API: -![Create an Application](/media/articles/api-auth/create-client.png) +1. Open the Auth0 Management Dashboard and browse to the [API section](${manage_url}/#/apis). -3. Navigate to the [API section](${manage_url}/#/apis) and create a new API. +2. Select the API you want to invoke using the **Client Credentials** Grant. -Enter a friendly name and an identifier. Ideally, this identifier should be the public endpoint of the API, but any valid URN is acceptable. This API will be represented by your **Resource Server**. +3. Under the **Authorized Application** tab, look for the application you want to authorize, click the Authorize button, and optionally, select the list of scopes that will be granted in the Access Token. This will create a 'client grant' in Auth0, which will allow the application to call the API. -The selection of the **Signing Algorithm** will dictate how the API will validate the Access Tokens it receives: -* HS256 (symmetric): signed using the resource server's signing secret -* RS256 (asymmetric): signed using Auth0's private key for your account. Verification is done using the corresponding public key, which can be found at the following standard [JWKS (JSON Web Key set)](/jwks) URL: [https://${account.namespace}/.well-known/jwks.json](https://${account.namespace}/.well-known/jwks.json) +![Authorize the Application](/media/articles/api-auth/apis-authorize-client-tab.png) -![Create an API](/media/articles/api-auth/apis-create.png) - -::: note -There will already be an `Auth0 Management API` that represents Auth0's APIv2. You can authorize applications to request tokens from this API as well. -::: - -4. (Optional) Define some scopes by browsing to the **Scopes** tab. A scope is a claim that may be issued as part of the Access Token. With this information, the API can enforce fine-grained authorization. - - ![Define Scopes](/media/articles/api-auth/apis-scope-tab.png) - -5. Authorize a consumer application. Under the **Machine to Machine Application** tab, you can authorize your applications that will be the consumers of the API. This will create a `client grant` for each application and will allow you to generate Access Tokens for these applications to call your API. Optionally, you can select a subset of scopes to be granted to this application as part of the Access Token. Scopes allow the API to enforce fine-grained authorization. - - ![Authorize the Application](/media/articles/api-auth/apis-authorize-client-tab.png) - -6. Setup your API to accept Access Tokens. The **Quickstart** tab provides you with code snippets for different languages and will guide you through bootstrapping your API, depending on the selected **Signing Algorithm**. +4. In the Test tab, you can select the application to which you granted access, and see the Access Tokens that will be generated for it. ## Keep reading -:::next-steps -* [How to implement the Client Credentials Grant](/api-auth/tutorials/client-credentials) -* [How to change the scopes and add custom claims to a token using Hooks](/api-auth/tutorials/client-credentials/customize-with-hooks) -* [How to add custom claims to a token using Rules](/scopes#custom-claims) -::: +* [Call API using the Client Credentials Flow](/flows/guides/client-credentials/call-api-client-credentials) +* [Use Hooks with Client Credentials Grant](/api-auth/tutorials/client-credentials/customize-with-hooks) +* [Add Custom Claims Tokens Using Rules](/scopes/current/sample-use-cases#add-custom-claims-to-a-token) diff --git a/articles/api-auth/config/using-the-management-api.md b/articles/api-auth/config/using-the-management-api.md index f27b638dda..fc9e75f35a 100644 --- a/articles/api-auth/config/using-the-management-api.md +++ b/articles/api-auth/config/using-the-management-api.md @@ -1,86 +1,34 @@ --- -title: Set up a Client Credentials Grant using the Management API -description: How to set up a Client Credentials Grant using the Management API. +description: Learn how to set up a Client Credentials Grant using the Management API. crews: crew-2 +topics: + - client-credentials + - api-authorization +contentType: how-to +useCase: secure-api --- -# Set up a Client Credentials Grant using the Management API +# Set Up Client Credentials Grants Using the Management API -<%= include('../../_includes/_pipeline2') %> +Auth0 lets you authorize applications that have the Client Credentials grant type enabled to call APIs using the [Client Credentials Flow](/flows/concepts/client-credentials). -If you do not want to use the Auth0 Dashboard to create a Resource Server or you need to create one programmatically, you can use our Management API v2. +By default, all Machine-to-Machine Applications and Regular Web Applications have the 'Client Credentials' grant enabled, but they are not authorized to call any API. -You will need the following: - -- A Management APIv2 token with the appropriate scopes. For details on how to get one refer to [The Auth0 Management APIv2 Token](/api/management/v2/tokens). -- The Application information (`Client_Id` and `Client_Secret`) for the Machine to Machine Application that should already be created and visible in your [Auth0 dashboard](${manage_url}/#/applications). - -## 1. Create your Resource Server - -Let's start by creating the Resource Server. This is the entity that represents the API that you want to issue Access Tokens for, identified by a friendly name and a URN identifier. - -The following restrictions apply to the identifier: -- It must be a valid URN. -- It cannot be modified after creation. -- It must be unique throughout your tenant. - -We recommend using your public API endpoint as an identifier. - -To create a Resource Server send a `POST` request to the [/resource-servers endpoint of the Management APIv2](/api/management/v2#!/Resource_Servers/post_resource_servers) with an `access_token` that has the resource server scope (`scope:resource_server`). - -The following example uses _"My Sample API"_ as the name and _"https://my-api-uri"_ as the identifier. +If you want to call an API from these applications, you first need to authorize the application to call the API and specify the scopes that will be granted. You can do that [using the Dashboard](/api-auth/config/using-the-auth0-dashboard), or follow the steps below to use the API. -```har -{ - "method": "POST", - "url": "https://${account.namespace}/api/v2/resource-servers", - "headers": [ - { "name": "Content-Type", "value": "application/json" }, - { "name": "authorization", "value": "Bearer Auth0_MGMT_API_ACCESS_TOKEN" } - ], - "postData": { - "mimeType": "application/json", - "text": "{\"name\":\"My Sample API\",\"identifier\": \"https://my-api-urn\",\"signing_alg\": \"RS256\",\"scopes\": [{ \"value\": \"sample-scope\", \"description\": \"Description for Sample Scope\"}]}" - } -} -``` - -::: note - You can include multiple scopes. This array represents the universe of scopes your API will support. You can modify this later by issuing a PATCH operation. -::: - -Sample response: +You will need the following: -```json -{ - "id": "56f0131ffdf1c311694f4cc7", - "name": "My Sample API", - "identifier": "https://my-api-urn", - "scopes": [ - { - "value": "sample-scope", - "description": "Description for Sample Scope" - } - ], - "signing_alg": "RS256", - "signing_secret": "FF1prn9UxZotnolsDVwEJhqqyRmwdSu5", - "token_lifetime": 86400 -} -``` +- A Management API Access Token with the `create:client_grants` scopes. For details on how to get one, refer to [Access Tokens for the Management API](/api/management/v2/tokens). -Note the following: -- The `identifier` value (`https://my-api-urn`) will be used from now on as the `audience` for any OAuth 2.0 grant, that wants to access this API. -- The algorithm that your API will use to sign tokens will be the __RS256__ (`signing_alg`). -- The secret used to sign the tokens will be `FF1prn9UxZotnolsDVwEJhqqyRmwdSu5` (`signing_secret`). -- The generated tokens will expire after `86400` seconds (`token_lifetime`). +- The application information (`Client_Id` and `Client_Secret`) for the application you want to authorize [Auth0 dashboard](${manage_url}/#/applications). -## 2. Authorize the Application +- The API identifier for the API you want to invoke (${manage_url}/#/apis). -Now that the API and the Application are defined in Auth0, you can create a trust relationship between them. To do so, authorize the Application to access the API, while defining the scopes that should be given to the Application (meaning the actions the Application will be able to perform on the API). +## Authorize the Application -To authorize your Application send a `POST` request to the [/client-grants endpoint of the Management APIv2](/api/management/v2#!/Client_Grants/post_client_grants) with an `access_token` that has the create application grants scope (`create:client_grantss`). +To authorize your Application, send a `POST` request to the [/client-grants endpoint of the Management APIv2](/api/management/v2#!/Client_Grants/post_client_grants) with the Management API Access Token. -The following example authorizes the Application with Id `${account.clientId}`, to access the API with Identifier `https://my-api-urn`, while granting the scope `sample-scope`. +The following example authorizes the application with Id `${account.clientId}`, to access the API with Identifier `https://my-api-urn`, while granting the scope `sample-scope`. ```har { @@ -110,12 +58,12 @@ Sample response: } ``` -That's it, you are done! Now that all the elements are in place, you can request Access Tokens for your API from Auth0. +That's it, you are done! Now that all the elements are in place, you can request Access Tokens for your API from Auth0 using the Client Credentials Flow. ## Keep reading :::next-steps -* [How to implement the Client Credentials Grant](/api-auth/tutorials/client-credentials) +* [Call API using the Client Credentials Flow](/flows/guides/client-credentials/call-api-client-credentials) * [How to change the scopes and add custom claims to a token using Hooks](/api-auth/tutorials/client-credentials/customize-with-hooks) -* [How to add custom claims to a token using Rules](/scopes#custom-claims) +* [How to add custom claims to a token using Rules](/scopes/current/sample-use-cases#add-custom-claims-to-a-token) ::: diff --git a/articles/api-auth/dynamic-client-registration.md b/articles/api-auth/dynamic-client-registration.md index 06f3be5a3f..6bac759f08 100644 --- a/articles/api-auth/dynamic-client-registration.md +++ b/articles/api-auth/dynamic-client-registration.md @@ -1,35 +1,30 @@ --- -title: Dynamic Client Registration -description: How to dynamically register clients with Auth0 using the Management API +description: Learn how to dynamically register applications with Auth0 using the Management API. crews: crew-2 toc: true +topics: + - applications +contentType: how-to +useCase: + - secure-api + - call-api --- # Dynamic Client Registration -<%= include('../_includes/_pipeline2') %> - -Dynamic Client Registration enables you to register clients dynamically. These clients can be either [first-party or third-party clients](/clients/client-types#first-vs-third-party-clients). +Dynamic Client Registration enables you to register [third-party applications](/applications/guides/enable-third-party-apps) dynamically. This feature is based on the [OpenID Connect Dynamic Client Registration specification](https://openid.net/specs/openid-connect-registration-1_0.html) and in this article we will see how you can enable and use it. ## Enable dynamic registration -By default, the feature is disabled for all tenants. To change this, you have to: - -- update your tenant settings -- promote the connections you will use with your dynamic clients to **domain connections**, and -- update your client's login page (if you use [Lock](/libraries/lock/v11)) - ::: warning -Auth0 supports **Open Dynamic Registration**, which means that if you enable this feature, **anyone** will be able to create clients in your tenant without a token. +Auth0 supports **Open Dynamic Registration**, which means that if you enable this feature, **anyone** will be able to create applications in your tenant without a token. ::: -### Update tenant settings - -Set the `enable_dynamic_client_registration` flag to `true` in your tenant's settings. +By default, the feature is disabled for all tenants. To change this, you have to set the `enable_dynamic_client_registration` flag to `true` in your tenant's settings. -This can be done by enabling the **OIDC Dynamic Client Registration** toggle on your tenant's [Advanced Settings page](${manage_url}/#/tenant/advanced). +This can be done by enabling the **OIDC Dynamic Application Registration** toggle on your tenant's [Advanced Settings page](${manage_url}/#/tenant/advanced). Alternatively, you can update this flag using the [Update tenant settings endpoint](/api/management/v2#!/Tenants/patch_settings). @@ -38,130 +33,61 @@ Alternatively, you can update this flag using the [Update tenant settings endpoi "method": "PATCH", "url": "https://${account.namespace}/api/v2/tenants/settings", "headers": [ - { "name": "Content-Type", "value": "client/json" }, + { "name": "Content-Type", "value": "application/json" }, { "name": "Authorization", "value": "Bearer API2_ACCESS_TOKEN" }, { "name": "Cache-Control", "value": "no-cache" } ], "postData": { - "mimeType": "client/json", + "mimeType": "application/json", "text" : "{ \"flags\": { \"enable_dynamic_client_registration\": true } }" } } ``` -You need to update the `API2_ACCESS_TOKEN` with a valid token with the scope `update:tenant_settings`. See [How to get a Management APIv2 Token](/api/management/v2/tokens#how-to-get-a-management-apiv2-token) for details on how to do so. - -### Promote connections - -Clients registered via the [Dynamic Client Registration Endpoint](#register-your-client) can only authenticate users using connections flagged as **Domain Connections**. These connections will be open for any dynamic client to allow users to authenticate. - -You can promote a connection to domain level using the [Update a Connection endpoint](/api/management/v2#!/Connections/patch_connections_by_id). - -```har -{ - "method": "PATCH", - "url": "https://${account.namespace}/api/v2/connections/CONNECTION_ID", - "headers": [ - { "name": "Content-Type", "value": "client/json" }, - { "name": "Authorization", "value": "Bearer API2_ACCESS_TOKEN" }, - { "name": "Cache-Control", "value": "no-cache" } - ], - "postData": { - "mimeType": "client/json", - "text" : "{ \"is_domain_connection\": true }" - } -} -``` - -Where: -- `API2_ACCESS_TOKEN`: [Α valid Auth0 API2 token](/api/management/v2/tokens#how-to-get-a-management-apiv2-token) with the scope `update:connections` -- `CONNECTION_ID`: Τhe Id of the connection to be promoted - - -### Update the login page - -To use the Auth0's [Universal Login](/hosted-pages/login) with the Dynamic Client feature, you need to use at least version `10.7.x` of Lock, and set `__useTenantInfo: config.isThirdPartyClient` when instantiating Lock. - -Sample script: - -```html - -... - -``` +You need to update the `API2_ACCESS_TOKEN` with a valid token with the scope `update:tenant_settings`. See [Access Tokens for the Management API](/api/management/v2/tokens) for details on how to do so. ## Use dynamic registration -In this section we will see how you can dynamically register and configure an client. +In this section we will see how you can dynamically register and configure an application. -### Register your client +### Register your application -In order to dynamically register an client with Auth0, you need to send an HTTP `POST` message to the Client Registration endpoint: `https://${account.namespace}/oidc/register`. Note that Auth0 supports **Open Dynamic Registration**, which means that the endpoint will accept a registration request without an [Access Token](/tokens/access-token). +To dynamically register an application with Auth0, you need to send an HTTP `POST` message to the Application Registration endpoint: `https://${account.namespace}/oidc/register`. Note that Auth0 supports **Open Dynamic Registration**, which means that the endpoint will accept a registration request without an Access Token. -To create an client with the name `My Dynamic Client` and the callback URLs `https://client.example.com/callback` and `https://client.example.com/callback2`, use the following snippet. +To create an application with the name `My Dynamic application` and the callback URLs `https://application.example.com/callback` and `https://application.example.com/callback2`, use the following snippet. ```har { "method": "POST", "url": "https://${account.namespace}/oidc/register", "headers": [ - { "name": "Content-Type", "value": "client/json" } + { "name": "Content-Type", "value": "application/json" } ], "postData": { - "mimeType": "client/json", - "text": "{\"client_name\":\"My Dynamic Client\",\"redirect_uris\": [\"https://client.example.com/callback\", \"https://client.example.com/callback2\"]}" + "mimeType": "application/json", + "text": "{\"client_name\":\"My Dynamic Application\",\"redirect_uris\": [\"https://application.example.com/callback\", \"https://application.example.com/callback2\"]}" } } ``` Where: -- **client_name**: The name of the Dynamic Client to be created +- **client_name**: The name of the Dynamic Application to be created - **redirect_uris** (required): An array of URLs that Auth0 will deem valid to call at the end of an authentication flow -Optionally, you can set a value for `token_endpoint_auth_method`, which can be `none` or `client_secret_post` (default value). +Optionally, you can set a value for `token_endpoint_auth_method`, which can be `none` or `client_secret_post` (default value). Use `token_endpoint_auth_method: none` in the request payload if creating a SPA. -The response includes the basic client information. +The response includes the basic application information. ```json HTTP/1.1 201 Created -Content-Type: client/json +Content-Type: application/json { - "client_name": "My Dynamic Client", + "client_name": "My Dynamic Application", "client_id": "8SXWY6j3afl2CP5ntwEOpMdPxxy49Gt2", "client_secret": "Q5O...33P", "redirect_uris": [ - "https://client.example.com/callback", - "https://client.example.com/callback2" + "https://application.example.com/callback", + "https://application.example.com/callback2" ], "client_secret_expires_at": 0 } @@ -169,20 +95,20 @@ Content-Type: client/json Where: - **client_id**: Unique client identifier. This is the ID you will use while configuring your apps to use Auth0. It is generated by the system and it cannot be modified. -- **client_secret**: Alphanumeric 64-bit client secret. This value is used by clients to authenticate to the [token endpoint](/api/authentication#get-token) and for signing and validating [ID Tokens](/tokens/id-token). -- **client_secret_expires_at**: Time at which the `client_secret` will expire. For Auth0 this value will always be zero (`0`) which means that the client never expires. +- **client_secret**: Alphanumeric 64-bit client secret. This value is used by applications to authenticate to the [token endpoint](/api/authentication#get-token) and for signing and validating [ID Tokens](/tokens/concepts/id-tokens). +- **client_secret_expires_at**: Time at which the `client_secret` will expire. For Auth0 this value will always be zero (`0`) which means that the application never expires. -Make a note of the Client ID and Secret, as these are the most important pieces for executing [authentication](/client-auth) and [authorization](/api-auth) flows. +Make a note of the Client ID and Secret, as these are the most important pieces for executing [authentication](/application-auth) and [authorization](/api-auth) flows. -Also, keep in mind that third-party developers are not allowed to modify the client settings. In case this is necessary, they need to contact the tenant owner with their request. +Also, keep in mind that third-party developers are not allowed to modify the application settings. In case this is necessary, they need to contact the tenant owner with their request. -### Configure your client +### Configure your application -Now that you have a Client ID and Secret, you can configure your client to authenticate users with Auth0. +Now that you have a Client ID and Secret, you can configure your application to authenticate users with Auth0. -We will go through a simple example, that shows how to call an API from a client-side web app, using the [Implicit Grant](/api-auth/tutorials/implicit-grant). For a list of tutorials on how to authenticate and authorize users, based on your client type, see the [API Authorization](/api-auth) page. +We will go through a simple example, that shows how to call an API from a client-side web app, using the [Implicit Flow](/flows/guides/implicit/call-api-implicit). For a list of tutorials on how to authenticate and authorize users, based on your application type, see the [API Authorization](/api-auth) page. -First, you need to configure your client to send the user to the authorization URL: +First, you need to configure your application to send the user to the authorization URL: ```text https://${account.namespace}/authorize? @@ -191,22 +117,22 @@ https://${account.namespace}/authorize? response_type={RESPONSE_TYPE}& client_id=${account.clientId}& redirect_uri=${account.callback}& - nonce={CRYPTOGRAPHIC_NONCE} + nonce={NONCE} state={OPAQUE_VALUE} ``` Where: -- **audience** (optional): The target API for which the Client Client is requesting access on behalf of the user. Set this parameter if you need API access. +- **audience** (optional): The target API for which the Application is requesting access on behalf of the user. Set this parameter if you need API access. - **scope** (optional): The scopes which you want to request authorization for. These must be separated by a space. You can request any of the [standard OIDC scopes](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) about users, such as `profile` and `email`, custom claims that must conform to a namespaced format (see panel below for more info), or any scopes supported by the target API (for example, `read:contacts`). Set this parameter if you need API access. ::: panel Custom claims namespaced format In order to add custom claims to ID Tokens or Access Tokens, they must [conform to a namespaced format](/api-auth/tutorials/adoption/scope-custom-claims) to avoid possible collisions with standard OpenID Connect claims. For example, if you choose the namespace `https://foo.com/` and you want to add a custom claim named `myclaim`, you would name the claim `https://foo.com/myclaim`, instead of `myclaim`. ::: -- **response_type**: The response type. For Implicit Grant you can either use `token` or `id_token token`. This will specify the type of token you will receive at the end of the flow. Use `token` to get only an `access_token`, or `id_token token` to get both an `id_token` and an `access_token`. -- **client_id**: Your client's Client ID. -- **redirect_uri**: The URL to which the Authorization Server (Auth0) will redirect the User Agent (Browser) after authorization has been granted by the User. The `access_token` (and optionally an `id_token`) will be available in the hash fragment of this URL. This URL must be specified as a valid callback URL under the Client Settings of your client. -- **state**: An opaque value the clients add to the initial request that the authorization server includes when redirecting the back to the client. This value must be used by the client to prevent CSRF attacks. +- **response_type**: The response type. For Implicit Grant you can either use `token` or `id_token token`. This will specify the type of token you will receive at the end of the flow. Use `token` to get only an Access Token, or `id_token token` to get both an ID Token and an Access Token. +- **client_id**: Your application's Client ID. +- **redirect_uri**: The URL to which the Authorization Server (Auth0) will redirect the User Agent (Browser) after authorization has been granted by the User. The Access Token (and optionally an ID Token) will be available in the hash fragment of this URL. This URL must be specified as a valid callback URL under the Application Settings of your application. +- **state**: An opaque value the applications add to the initial request that the authorization server includes when redirecting the back to the application. This value must be used by the application to prevent CSRF attacks. - **nonce**: A string value which will be included in the ID Token response from Auth0, [used to prevent token replay attacks](/api-auth/tutorials/nonce). It is required for `response_type=id_token token`. For example: @@ -217,6 +143,6 @@ For example: ``` -This call will redirect the user to Auth0, and upon successful authentication, back to your client (specifically to the **redirect_uri**). +This call will redirect the user to Auth0, and upon successful authentication, back to your application (specifically to the **redirect_uri**). -If you need API access, then following the authentication, you need to [extract the Access Token](/api-auth/tutorials/implicit-grant#2-extract-the-access-token) from the hash fragment of the URL, and use it to make calls to the API, by passing it as a `Bearer` token in the `Authorization` header of the HTTP request. +If you need API access, then following the authentication, you need to extract the Access Token from the hash fragment of the URL, and use it to make calls to the API, by passing it as a `Bearer` token in the `Authorization` header of the HTTP request. diff --git a/articles/api-auth/faq.md b/articles/api-auth/faq.md index cf2c3592ba..d5fea1d7e6 100644 --- a/articles/api-auth/faq.md +++ b/articles/api-auth/faq.md @@ -1,22 +1,28 @@ --- description: API Authentication and Authorization FAQ +topics: + - api-authentication + - oidc + - user-consent + - resource-servers + - applications +contentType: concept +useCase: + - secure-api + - call-api --- # API Authentication and Authorization FAQ -## Can I execute a user consent flow? - -Yes! We are working on creating documentation and tutorials for implementing this flow. In the meantime, if you need assistance or more information please contact our [Support Center](${env.DOMAIN_URL_SUPPORT}). - ## I have an Application that needs to talk to different Resource Servers -If a single Application needs Access Tokens for different resource servers, then multiple calls to `/authorize` (that is, multiple executions of the same or different Authorization Flow) needs to be performed. Each authorization will use a different value for `audience`, which will result in a different Access Token at the end of the flow. +If a single Application needs Access Tokens for different resource servers, then multiple calls to `/authorize` (that is, multiple executions of the same or different Authorization Flow) needs to be performed. Each authorization will use a different value for `audience`, which will result in a different Access Token at the end of the flow. For more information, see the [OAuth 2.0: Audience Information Specification](https://tools.ietf.org/html/draft-tschofenig-oauth-audience-00#section-3). ## Can I try the endpoints before I implement my application? -**A** Sure! You have two options: +Sure! You have two options: - [Download our Postman collection](https://app.getpostman.com/run-collection/2a9bc47495ab00cda178). For more information on how to use our Postman collection refer to [Using the Auth0 API with our Postman Collections](/api/postman). - Use our [Authentication API Debugger Extension](/extensions/authentication-api-debugger). You can find detailed instructions per endpoint/grant at our [Authentication API Reference](/api/authentication). diff --git a/articles/api-auth/grant/authorization-code-pkce.md b/articles/api-auth/grant/authorization-code-pkce.md index 770fbfe1c2..fb575ab2c1 100644 --- a/articles/api-auth/grant/authorization-code-pkce.md +++ b/articles/api-auth/grant/authorization-code-pkce.md @@ -1,11 +1,17 @@ --- -description: Describes the call APIs from mobile apps using the Authentication Code Grant (PKCE). +description: Describes the call APIs from mobile apps using the Authentication Code Grant (PKCE). +topics: + - authorization-code + - pkce + - api-authorization +contentType: concept +useCase: + - secure-api + - call-api --- -# Calling APIs from Mobile Apps +# Call APIs from Mobile Apps -<%= include('../../_includes/_pipeline2') %> - -In order to access an API from a [mobile app](/quickstart/native), you need to implement the **Authorization Code using Proof Key for Code Exchange (PKCE)** OAuth 2.0 grant. In this document we will see how this flow works. +To access an API from a [mobile app](/quickstart/native), you need to implement the **Authorization Code using Proof Key for Code Exchange (PKCE)** OAuth 2.0 grant. In this document, we will see how this flow works. ::: note If you need a refresher on the OAuth 2.0 protocol, you can go through our [OAuth 2.0](/protocols/oauth2) article. @@ -13,7 +19,7 @@ If you need a refresher on the OAuth 2.0 protocol, you can go through our [OAuth ## Overview of the flow -The [Authorization Code Grant](/api-auth/grant/authorization-code) has some security issues, when implemented on native applications. For instance, a malicious attacker can intercept the `authorization_code` returned by Auth0 and exchange it for an [Access Token](/tokens/access-token) (and possibly a [Refresh Token](/tokens/refresh-token)). +The [Authorization Code Grant](/api-auth/grant/authorization-code) has some security issues when implemented on native applications. For instance, a malicious attacker can intercept the `authorization_code` returned by Auth0 and exchange it for an Access Token (and possibly a Refresh Token). The **Proof Key for Code Exchange (PKCE)** (defined in [RFC 7636](https://tools.ietf.org/html/rfc7636)) is a technique used to mitigate this authorization code interception attack. @@ -21,18 +27,18 @@ With PKCE, the application creates, for every authorization request, a cryptogra ![Authorization Code Grant using PKCE](/media/articles/api-auth/authorization-code-grant-pkce.png) - 1. The native app initiates the flow and redirects the user to Auth0 (specifically to the [/authorize endpoint](/api/authentication#authorization-code-grant-pkce-)), sending the `code_challenge` and `code_challenge_method` parameters. + 1. The native application initiates the flow and redirects the user to Auth0 (specifically to the [/authorize endpoint](/api/authentication#authorization-code-grant-pkce-)), sending the `code_challenge` and `code_challenge_method` parameters. - 2. Auth0 redirects the user to the native app with an `authorization_code` in the querystring. + 2. Auth0 redirects the user to the native application with an `authorization_code` in the querystring. - 3. The native app sends the `authorization_code` and `code_verifier` together with the `redirect_uri` and the `client_id` to Auth0. This is done using the [/oauth/token endpoint](/api/authentication?http#authorization-code-pkce-). + 3. The native application sends the `authorization_code` and `code_verifier` together with the `redirect_uri` and the `client_id` to Auth0. This is done using the [/oauth/token endpoint](/api/authentication?http#authorization-code-pkce-). - 4. Auth0 validates this information and returns an `access_token` (and optionally a `refresh_token`). + 4. Auth0 validates this information and returns an Access Token (and optionally a Refresh Token). - 5. The native app can use the `access_token` to call the API on behalf of the user. + 5. The native application can use the Access Token to call the API on behalf of the user. ::: note -In OAuth 2.0 terms, the native app is the Client, the end user the Resource Owner, the API the Resource Server, the browser the User Agent, and Auth0 the Authorization Server. +In OAuth 2.0 terms, the native application is the Client, the end user the Resource Owner, the API the Resource Server, the browser the User Agent, and Auth0 the Authorization Server. ::: ## How to implement the flow @@ -50,7 +56,6 @@ For details on how to implement this, refer to [Execute an Authorization Code Gr ::: next-steps - [Execute an Authorization Code Grant Flow with PKCE](/api-auth/tutorials/authorization-code-grant-pkce) - [How to configure an API in Auth0](/apis) -- [Why you should always use Access Tokens to secure an API](/api-auth/why-use-access-tokens-to-secure-apis) +- [Tokens](/tokens) - [Application Authentication for Mobile & Desktop Apps](/application-auth/mobile-desktop) -- [Tokens used by Auth0](/tokens) ::: diff --git a/articles/api-auth/grant/authorization-code.md b/articles/api-auth/grant/authorization-code.md index 031086debd..45412c6e0b 100644 --- a/articles/api-auth/grant/authorization-code.md +++ b/articles/api-auth/grant/authorization-code.md @@ -1,9 +1,14 @@ --- -description: Describes how to call APIs from regular web apps using the Authentication Code Grant. +description: Describes how to call APIs from regular web apps using the Authentication Code Grant. +topics: + - authorization-code + - api-authorization +contentType: concept +useCase: + - secure-api + - call-api --- -# Calling APIs from Server-side Web Apps - -<%= include('../../_includes/_pipeline2') %> +# Call APIs from Server-side Web Apps In order to access an API from a [regular web app](/quickstart/webapp), you need to implement the **Authorization Code** OAuth 2.0 grant. In this document we will see how this flow works. @@ -13,21 +18,21 @@ If you need a refresher on the OAuth 2.0 protocol, you can go through our [OAuth ## Overview of the flow -The **Authorization Code Grant** (defined in [RFC 6749, section 4.1](https://tools.ietf.org/html/rfc6749#section-4.1)) is a flow where the browser receives an Authorization Code from Auth0 and sends this to the web app. The web app will then interact with Auth0 and exchange the Authorization Code for an [access_token](/tokens/access-token), and optionally an [id_token](/tokens/id-token) and a [refresh_token](/tokens/refresh_token). The web app can now use this `access_token` to call the API on behalf of the user. +The **Authorization Code Grant** (defined in [RFC 6749, section 4.1](https://tools.ietf.org/html/rfc6749#section-4.1)) is a flow where the browser receives an Authorization Code from Auth0 and sends this to the web app. The web app will then interact with Auth0 and exchange the Authorization Code for an [Access Token](/tokens/concepts/access-tokens), and optionally an [ID Token](/tokens/concepts/id-tokens) and a Refresh Token. The web app can now use this Access Token to call the API on behalf of the user. ![Authorization Code Grant](/media/articles/api-auth/authorization-code-grant.png) 1. The web app initiates the flow and redirects the browser to Auth0 (specifically to the [/authorize endpoint](/api/authentication#authorization-code-grant)), so the user can authenticate. -1. Auth0 authenticates the user (via the browser). The first time the user goes through this flow a consent page will be shown where the permissions are listed that will be given to the applicaion (for example: post messages, list contacts, and so forth). +1. Auth0 authenticates the user (via the browser). The first time the user goes through this flow a consent page will be shown where the permissions are listed that will be given to the application (for example: post messages, list contacts, and so forth). 1. Auth0 redirects the user to the web app (specifically to the `redirect_uri`, as specified in the [/authorize request](/api/authentication#authorization-code-grant)) with an Authorization Code in the querystring (`code`). -1. The web app sends the Authorization Code to Auth0 and asks to exchange it with an `access_token` (and optionally an `id_token` and a `refresh_token`). This is done using the [/oauth/token endpoint](/api/authentication?http#authorization-code). When making this request, the web app authenticates with Auth0, using the Client Id and Client Secret. +1. The web app sends the Authorization Code to Auth0 and asks to exchange it with an Access Token (and optionally an ID Token and a Refresh Token). This is done using the [/oauth/token endpoint](/api/authentication?http#authorization-code). When making this request, the web app authenticates with Auth0, using the Client Id and Client Secret. 1. Auth0 authenticates the web app, validates the Authorization Code and responds back with the token. -1. The web app can use the `access_token` to call the API on behalf of the user. +1. The web app can use the Access Token to call the API on behalf of the user. ::: note In OAuth 2.0 terms, the web app is the application, the end user the Resource Owner, the API the Resource Server, the browser the User Agent, and Auth0 the Authorization Server. @@ -49,7 +54,6 @@ For details on how to implement this, refer to [Execute an Authorization Code Gr ::: next-steps - [How to implement an Authorization Code Grant flow](/api-auth/tutorials/authorization-code-grant) - [How to configure an API in Auth0](/apis) -- [Why you should always use Access Tokens to secure an API](/api-auth/why-use-access-tokens-to-secure-apis) +- [Tokens](/tokens) - [Application Authentication for Server-side Web Apps](/application-auth/server-side-web) -- [Tokens used by Auth0](/tokens) ::: diff --git a/articles/api-auth/grant/client-credentials.md b/articles/api-auth/grant/client-credentials.md index fe6b1df851..8fa8cd26d3 100644 --- a/articles/api-auth/grant/client-credentials.md +++ b/articles/api-auth/grant/client-credentials.md @@ -1,42 +1,42 @@ --- description: Describes how to call APIs from server processes using the Client Credentials Grant. +topics: + - client-credentials + - api-authorization +contentType: concept +useCase: + - secure-api + - call-api --- -# Calling APIs from a Service +# Client Credentials Grant -<%= include('../../_includes/_pipeline2') %> +The **Client Credentials Grant** (defined in [RFC 6749, section 4.4](https://tools.ietf.org/html/rfc6749#section-4.4)) allows an application to request an Access Token using its __Client Id__ and __Client Secret__. It is used for non interactive applications (a CLI, a daemon, or a Service running on your backend) where the token is issued to the application itself, instead of an end user. -The OAuth 2.0 grant that machine-to-machine interfaces utilize in order to access an API, is the **Client Credentials Grant**. In this document we will see how this flow works. +In order to be able to perform the Client Credentials Grant, the Application needs to have the [Client Credentials grant type](/applications/concepts/application-grant-types) enabled. Machine to Machine Applications and Regular Web Applications have it enabled by default. -::: note -If you need a refresher on the OAuth 2.0 protocol, you can go through our [OAuth 2.0](/protocols/oauth2) article. -::: - -## Overview of the flow - -With **Client Credentials Grant** (defined in [RFC 6749, section 4.4](https://tools.ietf.org/html/rfc6749#section-4.4)) a Non Interactive Client (a CLI, a daemon, or a Service running on your backend), can directly ask Auth0 for an `access_token`, by using its Client Credentials (__Client Id__ and __Client Secret__) to authenticate. In this case the token represents the Non Interactive Client itself, instead of an end user. +## Client Credentials Grant Flow ![Client Credentials Grant Flow](/media/articles/api-auth/client-credentials-grant.png) 1. The application authenticates with Auth0 using its __Client Id__ and __Client Secret__. -1. Auth0 validates this information and returns an `access_token`. +1. Auth0 validates this information and returns an Access Token. -1. The application can use the `access_token` to call the API on behalf of itself. +1. The application can use the Access Token to call the API on behalf of itself. ::: note -In OAuth 2.0 terms, the non interactive app is the Client, the end user the Resource Owner, the API the Resource Server, the browser the User Agent, and Auth0 the Authorization Server. +In OAuth 2.0 terms, the application is the Client, the end user the Resource Owner, the API the Resource Server, the browser the User Agent, and Auth0 the Authorization Server. ::: ## How to implement the flow -For details on how to implement this using Auth0, refer to [Execute a Client Credentials Grant](/api-auth/tutorials/client-credentials). Before you do so, you have to set up the Grant first either [using the Dashboard](/api-auth/config/using-the-auth0-dashboard) or [using the Management API](/api-auth/config/using-the-management-api). +For details on how to implement this using Auth0, refer to [Execute a Client Credentials Grant](/api-auth/tutorials/client-credentials). ## Keep reading ::: next-steps - [How to implement a Client Credentials flow](/api-auth/tutorials/client-credentials) - [How to configure an API in Auth0](/apis) -- [Why you should always use Access Tokens to secure an API](/api-auth/why-use-access-tokens-to-secure-apis) +- [Tokens](/tokens) - [How to change the scopes and add custom claims to the tokens using Hooks](/api-auth/tutorials/client-credentials/customize-with-hooks) -- [Tokens used by Auth0](/tokens) ::: diff --git a/articles/api-auth/grant/hybrid.md b/articles/api-auth/grant/hybrid.md new file mode 100644 index 0000000000..496e658d8b --- /dev/null +++ b/articles/api-auth/grant/hybrid.md @@ -0,0 +1,66 @@ +--- +description: Describes how to call APIs from applications using the Hybrid Flow +public: false +topics: + - authorization-code + - api-authorization + - implicit +contentType: concept +useCase: + - secure-api + - call-api +--- +# Call APIs Using the Hybrid Flow + +The Hybrid Flow is an OpenID Connect (OIDC) flow that draws from the following: + +1. [Authorization Code Flow](/flows/concepts/auth-code) +2. [Implicit Flow](/flows/concepts/implicit) + +The Hybrid Flow enables use cases where your application can immediately use an ID token to access information about the user while obtaining an authorization code that can be exchanged for an Access Token (therefore gaining access to protected resources for an extended period of time). + +## Background + +With the [Authorization Code Flow](/flows/concepts/auth-code), Auth0 sends you an authorization code, which your app then sends in to retrieve tokens. Your application authenticates itself with a Client ID and Client Secret stored securely on your server. + +On the other hand, the [Implicit Flow](/flows/concepts/implicit) allows you to request Access Tokens without needing to authenticate your application. Auth0 verifies your app's identity based on the provided redirect URI. Because of this, you shouldn't utilize long-lived Access Tokens, and you cannot use Refresh Tokens. + +## The Hybrid Flow + +The Hybrid Flow allows you to take advantage of aspects of both the Authorization Code and Implicit Grants. For each interaction with Auth0, you will receive two (sometimes three) items in response: + +1. An authorization code and an Access Token +1. An authorization code and an ID Token +1. An authorization code, an Access Token, and an ID Token + +In this article, we will take a closer look at how this flow works. + +## Overview of the flow + +1. The web application initiates the authorization flow and redirects the browser to Auth0 (specifically, the [Authorization Endpoint](/api/authentication#authorization-code-grant)) so that the user can authenticate. + +1. Auth0 authenticates the user via the browser. If this is the first time the user does this, they will see a consent page listing the permissions that Auth0 will give to the application. + +1. Auth0 redirects the user to the app with an [Access Token](/tokens/access-token) and (optionally) an [ID Token](/tokens/concepts/id-tokens) in the hash fragment of the URI. The app can now extract the tokens from the hash fragment. + +1. The application parses out the Authorization Code, sends it to Auth0's [token endpoint](/api/authentication?http#authorization-code), and requests that Auth0 return (in exchange) the Access Token. The application identifies itself during this request using its assigned Client ID and Client Secret. + +1. If the request sent to the token endpoint is valid, Auth0 responds to the application's request with an ID Token, as well as an Access Token (and possibly a Refresh Token). + +1. The application can now validate the ID Token and retrieve the end user's information. The application can also use the Access Token to call desired APIs. + + If the application received an ID Token from the Authorization endpoint already, it should have validated the token's signature, `c_hash`, and any other claims as defined. You must validate such tokens [the way you would for an Implicit Flow](https://openid.net/specs/openid-connect-core-1_0.html#ImplicitIDTValidation). + +## How to implement the flow + +For details on how to implement this using Auth0, refer to [Execute the Hybrid Flow](/api-auth/tutorials/hybrid-flow). + +## Keep reading + +::: next-steps +- [Execute the Hybrid Flow](/api-auth/tutorials/hybrid-flow) +- [How to configure an API in Auth0](/apis) +- [Tokens](/tokens) +- [Application authentication for regular web apps](/flows/concepts/auth-code) +- [Application authentication for single-page apps](/flows/concepts/implicit) +::: \ No newline at end of file diff --git a/articles/api-auth/grant/implicit.md b/articles/api-auth/grant/implicit.md index 65762fd8fd..bf1a08f84c 100644 --- a/articles/api-auth/grant/implicit.md +++ b/articles/api-auth/grant/implicit.md @@ -2,12 +2,17 @@ title: Call APIs from Client-side Web Apps description: Learn how to call APIs from client-side web apps using the OAuth 2.0 Implicit Grant. toc: true +topics: + - implicit + - api-authorization +contentType: concept +useCase: + - secure-api + - call-api --- # Call APIs from Client-side Web Apps -<%= include('../../_includes/_pipeline2') %> - -In order to access an API from a [client-side app](/quickstart/spa) (typically a Single Page Application or a Mobile Application), you need to implement the OAuth 2.0 **Implicit Grant**. In this document we will see how this flow works. +In order to access an API from a [client-side app](/quickstart/spa) (typically a Single-Page Application or a Mobile Application), you need to implement the OAuth 2.0 **Implicit Grant**. In this document we will see how this flow works. ::: note If you need a refresher on the OAuth 2.0 protocol, you can go through our [OAuth 2.0](/protocols/oauth2) article. @@ -15,9 +20,9 @@ If you need a refresher on the OAuth 2.0 protocol, you can go through our [OAuth ## Overview -The **Implicit Grant** (defined in [RFC 6749, section 4.1](https://tools.ietf.org/html/rfc6749#section-4.2)) is similar to the [Authorization Code Grant](/api-auth/grant/authorization-code), but the main difference is that the application receives an [access_token](/tokens/access-token) directly, without the need for an `authorization_code`. This happens because the application, which is typically a JavaScript app running within a browser, is less trusted than a web app running on the server, hence cannot be trusted with the `client_secret` (which is required in the [Authorization Code Grant](/api-auth/grant/authorization-code)). Also, in the Implicit Grant, no Refresh Tokens are returned for the same reason (for an alternative refer to [Silent authentication for SPAs](/api-auth/tutorials/silent-authentication)). +The **Implicit Grant** (defined in [RFC 6749, section 4.1](https://tools.ietf.org/html/rfc6749#section-4.2)) is similar to the [Authorization Code Grant](/api-auth/grant/authorization-code), but the main difference is that the application receives an [Access Token](/tokens/concepts/access-tokens) directly, without the need for an `authorization_code`. This happens because the application, which is typically a JavaScript app running within a browser, is less trusted than a web app running on the server, hence cannot be trusted with the `client_secret` (which is required in the [Authorization Code Grant](/api-auth/grant/authorization-code)). Also, in the Implicit Grant, no Refresh Tokens are returned for the same reason (for an alternative refer to [Silent authentication for SPAs](/api-auth/tutorials/silent-authentication)). -Once the user authenticates, the application receives the `access_token` in the hash fragment of the URI. The application can now use this `access_token` to call the API on behalf of the user. +Once the user authenticates, the application receives the Access Token in the hash fragment of the URI. The application can now use this Access Token to call the API on behalf of the user. ![Implicit Grant](/media/articles/api-auth/implicit-grant.png) @@ -25,9 +30,9 @@ Once the user authenticates, the application receives the `access_token` in the 1. Auth0 authenticates the user. The first time the user goes through this flow a consent page will be shown where the permissions, that will be given to the Application, are listed (for example: post messages, list contacts, and so forth). - 1. Auth0 redirects the user to the app with an [access_token](/tokens/access-token) (and optionally an [id_token](/tokens/id-token)) in the hash fragment of the URI. The app can now extract the tokens from the hash fragment. In a Single Page Application (SPA) this would be done using Javascript and in a Mobile Application this is typically handled by interacting with a Web View. + 1. Auth0 redirects the user to the app with an [Access Token](/tokens/concepts/access-tokens) (and optionally an [ID Token](/tokens/concepts/id-tokens)) in the hash fragment of the URI. The app can now extract the tokens from the hash fragment. In a Single-Page Application (SPA) this would be done using Javascript and in a Mobile Application this is typically handled by interacting with a Web View. - 1. The app can use the `access_token` to call the API on behalf of the user. + 1. The app can use the Access Token to call the API on behalf of the user. ::: note In OAuth 2.0 terms, the web app is the Application, the end user the Resource Owner, the API the Resource Server, the browser the User Agent, and Auth0 the Authorization Server. @@ -45,7 +50,7 @@ For details on how to implement this, refer to [How to implement the Implicit Gr ## Silent Authentication -If you need to authenticate your users without a login page (for example, when the user is already logged in via [SSO](/sso) scenario) or get a new `access_token` (thus simulate refreshing an expired token), you can use Silent Authentication. +If you need to authenticate your users without a login page (for example, when the user is already logged in via [Single Sign-on (SSO)](/sso) scenario) or get a new Access Token (thus simulate refreshing an expired token), you can use Silent Authentication. For details on how to implement this, refer to [Silent Authentication](/api-auth/tutorials/silent-authentication). @@ -55,6 +60,6 @@ For details on how to implement this, refer to [Silent Authentication](/api-auth * [How to implement the Implicit Grant](/api-auth/tutorials/implicit-grant) * [How to protect your SPA against replay attacks](/api-auth/tutorials/nonce) * [How to configure an API in Auth0](/apis) -* [Why you should always use Access Tokens to secure an API](/api-auth/why-use-access-tokens-to-secure-apis) +* [Tokens](/tokens) * [Application Authentication for Client-side Web Apps](/application-auth/client-side-web) ::: diff --git a/articles/api-auth/grant/password.md b/articles/api-auth/grant/password.md index 82597c5860..3da4c9a514 100644 --- a/articles/api-auth/grant/password.md +++ b/articles/api-auth/grant/password.md @@ -1,33 +1,29 @@ --- title: Call APIs from Highly Trusted Applications description: Describes how to call APIs from highly trusted applications using the Resource Owner Password Grant. +topics: + - implicit + - api-authorization + - resource-owner-password +contentType: concept +useCase: + - secure-api + - call-api --- # Call APIs from Highly Trusted Applications -<%= include('../../_includes/_pipeline2') %> +<%= include('../_includes/_ropg-warning') %> -Highly trusted applications can use this flow to access APIs. In this flow the end-user is asked to fill in credentials (username/password), typically using an interactive form. This information is sent to the backend and from there to Auth0. +You can use the ROPG flow for your highly trusted applications to access APIs. In this flow the end-user is asked to fill in credentials (username/password), typically using an interactive form. This information is sent to the backend and from there to Auth0. -You should use this flow **only if** the following apply: -- The application is absolutely trusted with the user's credentials. For [client side](/api-auth/grant/implicit) applications and [mobile apps](/api-auth/grant/authorization-code-pkce) we recommend using web flows instead. -- Using a redirect-based flow is not possible. If this is not the case and redirects are possible in your application you should use the [Authorization Code Grant](/api-auth/grant/authorization-code) instead. - -::: note -If you need a refresher on the OAuth 2.0 protocol, you can go through our [OAuth 2.0](/protocols/oauth2) article. -::: - -## Overview - -The **Resource Owner Password Grant** (defined in [RFC 6749, section 4.3](https://tools.ietf.org/html/rfc6749#section-4.3)) can be used directly as an authorization grant to obtain an Access Token, and optionally a Refresh Token. This grant should only be used when there is a high degree of trust between the user and the application and when other authorization flows are not available. - -This grant type can eliminate the need for the application to store the user credentials for future use, by exchanging the credentials with a long-lived Access Token or Refresh Token. +ROPG (defined in [RFC 6749, section 4.3](https://tools.ietf.org/html/rfc6749#section-4.3)) can be used directly as an authorization grant to store the user credentials for future use, by exchanging the credentials for an Access Token, and optionally a Refresh Token. ![Resource Owner Password Grant](/media/articles/api-auth/password-grant.png) 1. The end user enters the credentials into the application. 1. The application forwards the credentials to Auth0. - 1. Auth0 validates the information and returns an `access_token`, and optionally a `refresh_token`. - 1. The application can use the `access_token` to call the API on behalf of the end user. + 1. Auth0 validates the information and returns an Access Token, and optionally a Refresh Token. + 1. The application can use the Access Token to call the API on behalf of the end user. ::: note In OAuth 2.0 terms, the web app is the Client, the end user the Resource Owner, the API the Resource Server, the browser the User Agent, and Auth0 the Authorization Server. @@ -35,9 +31,9 @@ In OAuth 2.0 terms, the web app is the Client, the end user the Resource Owner, ## How to implement the flow -For details on how to implement this using Auth0, refer to [Execute the Resource Owner Password Grant](/api-auth/tutorials/password-grant). +For details on how to implement this using Auth0, see [Implement the Resource Owner Password Grant](/api-auth/tutorials/password-grant). -## Realm Support +## Realm support A extension grant that offers similar functionality with the **Resource Owner Password Grant**, including the ability to indicate a specific realm, is the `http://auth0.com/oauth/grant-type/password-realm`. @@ -47,7 +43,7 @@ For more information on how to implement this extension grant refer to [Executin ## Scopes -Due to the implied trust in these grants (a user providing his or her password to an application), the `access_token` returned will include all of the available scopes defined for the audience API. An application can request a restricted set of scopes by using the `scope` parameter, or you can restrict the returned scopes by using a [rule](#customize-the-returned-token). +Due to the implied trust in these grants (a user providing his or her password to an application), the Access Token returned will include all of the available scopes defined for the audience API. An application can request a restricted set of scopes by using the `scope` parameter, or you can restrict the returned scopes by using a [rule](#customize-the-returned-token). ## Rules @@ -57,17 +53,15 @@ Due to the implied trust in these grants (a user providing his or her password t If you wish to execute special logic unique to the Password exchange, you can look at the `context.protocol` property in your rule. If the value is `oauth2-password`, then the rule is running during the password exchange. -For details on how to implement this, refer to [Execute the Resource Owner Password Grant: Customize the Tokens](/api-auth/tutorials/password-grant#optional-customize-the-tokens). +For details on how to implement this, see [Customize the Tokens](/api-auth/tutorials/password-grant#optional-customize-the-tokens). -## MFA Support +## MFA support and anomaly detection -For details on how to implement multifactor authentication, refer to [Multifactor Αuthentication and Resource Owner Password](/api-auth/tutorials/multifactor-resource-owner-password). +For details on how to implement multi-factor authentication (MFA), refer to [Multi-factor Authentication and Resource Owner Password](/mfa/guides/mfa-api/multifactor-resource-owner-password). + +When using this flow from server-side applications, some anomaly detection features might fail because of the particularities of this scenario. For details on how to implement this, while avoiding some common issues, refer to [Using Resource Owner Password from Server side](/api-auth/tutorials/using-resource-owner-password-from-server-side). ## Keep reading -::: next-steps -* [How to Execute a Resource Owner Password Grant](/api-auth/tutorials/password-grant) -* [How to use MFA with Resource Owner Password Grant](/api-auth/tutorials/multifactor-resource-owner-password) -* [Why you should always use Access Tokens to secure an API](/api-auth/why-use-access-tokens-to-secure-apis) -* [How to use Resource Owner Password Grant from the server side together with Anomaly Detection](/api-auth/tutorials/using-resource-owner-password-from-server-side) -::: +* [Implement the Resource Owner Password Grant](/api-auth/tutorials/password-grant) +* [Tokens](/tokens) diff --git a/articles/api-auth/index.md b/articles/api-auth/index.md index 778f80c4b4..2c2bdf84b6 100644 --- a/articles/api-auth/index.md +++ b/articles/api-auth/index.md @@ -3,6 +3,13 @@ url: /api-auth section: articles classes: topic-page title: API Authorization +topics: + - api-authentication + - oidc +contentType: index +useCase: + - secure-api + - call-api ---
@@ -13,31 +20,13 @@ title: API Authorization

-::: note -Heads up! As part of our efforts to improve security and standards-based interoperability, we have implemented several new features in our authentication flows and made changes to existing ones. For an overview of these changes, and details on how you adopt them, refer to Introducing OIDC Conformant Authentication. -::: +At some point, your custom APIs will need to allow limited access to users, servers, or servers on behalf of users. With Auth0 you can manage the authorization requirements for server-to-server and application-to-server applications. -At some point, your APIs will need to allow limited access to users, servers, or servers on behalf of users. +By using the OAuth 2.0 authorization framework, you can give your own applications or third-party applications limited access to your APIs on behalf of the application itself. With Auth0, you can easily support different flows in your own APIs without worrying about the OAuth 2.0/OpenID Connect (OIDC) specification, or the many other technical aspects of API authorization. -Auth0's API authorization features allow you to manage the authorization requirements for server-to-server and application-to-server applications. - -By using the OAuth 2.0 authorization framework, you can give your own applications or third-party applications limited access to your APIs on behalf of the application itself. - -Using Auth0, you can easily support different flows in your own APIs without worrying about the OAuth 2.0/OpenID Connect specification, or the many other technical aspects of API authorization. +In this page you can find a list of resources that can help you secure your APIs and access them in a secure manner.
  • - Tools for Monitoring the PSaaS Appliance + Monitoring the PSaaS Appliance

    - In addition to providing tools for monitoring your PSaaS Appliance instances, Auth0 provides integration with select third-party utilities. + Learn how to monitor your PSaaS Appliance instances, so that you always know how it is performing.

    • @@ -113,12 +118,6 @@

      PSaaS Appliance Administration

      The PSaaS Appliance Command Line Interface (CLI) allows you to perform operations on your PSaaS Appliance via authorized workstations.

    • -
    • - Automatic Creation of Tenants -

      - If your business needs require you to create tenants regularly, you may automate this process in your PSaaS Appliance instances. For example, you might need to create one tenant for each customer or project that goes live. -

      -
    • Node.js Modules Available in Rules and Custom Database Connections for PSaaS Appliance

      diff --git a/articles/appliance/infrastructure/dns.md b/articles/appliance/infrastructure/dns.md index 24a8b7d1c9..2466fa2ca1 100644 --- a/articles/appliance/infrastructure/dns.md +++ b/articles/appliance/infrastructure/dns.md @@ -1,6 +1,14 @@ --- section: appliance description: PSaaS Appliance infrastructure information about DNS +topics: + - appliance + - infrastructure + - dns +contentType: reference +useCase: appliance +applianceId: appliance31 +sitemap: false --- @@ -25,11 +33,11 @@ Dedicated and non-dedicated host names must be unique. Management Dashboard - manage-project.yourdomain.com + manage.yourdomain.com Configuration - config-project.yourdomain.com + config.yourdomain.com Webtask @@ -37,30 +45,30 @@ Dedicated and non-dedicated host names must be unique. App Tenant(s) - app1-project.yourdomain.com;
      app2-project.yourdomain.com
      ...and so on + identity.yourdomain.com (for example);
      app-project.yourdomain.com (if you want more than 1 App tenant)
      ...and so on -For a dev/test non-production PSaaS Appliance a common practice is to append “-dev” to the hostname component in the domain name: +For a dev/test non-production PSaaS Appliance a common practice is to include "dev” in the domain name: - + - + - + - +
      Management Dashboard (Dev)manage-dev-project.yourdomain.commanage.dev.yourdomain.com
      Configuration (Dev)config-dev-project.yourdomain.comconfig.dev.yourdomain.com
      Webtask (Dev)webtask-dev.yourdomain.comwebtask.dev.yourdomain.com
      App Tenant(s) (Dev)app1-dev-project.yourdomain.com;
      app2-dev-project.yourdomain.com
      ...and so on
      identity.dev.yourdomain.com (for example);
      app-name.dev.yourdomain.com (if you want more than 1 App tenant)
      ...and so on
      @@ -69,7 +77,6 @@ For a dev/test non-production PSaaS Appliance a common practice is to append “ * **Configuration**: highly-privileged tenant used to do the PSaaS Appliance baseline configuration and for managing the security of other tenants; * **App**: the name of your application; -* **Project**: the name of the overarching project or department; * **yourdomain.com**: your organization's domain name. ![](/media/articles/appliance/infrastructure/appliance-dns.png) @@ -181,4 +188,4 @@ Suppose these were your standard domains: -Please note that all tenant names are derived from the base Configuration Tenant. However, you may set your custom domain to point toward any of your tenants (in the example above, `new-name.not-example.com` maps to `auth.example.com`, and the latter may be used by your applications). \ No newline at end of file +Please note that all tenant names are derived from the base Configuration Tenant. However, you may set your custom domain to point toward any of your tenants (in the example above, `new-name.not-example.com` maps to `auth.example.com`, and the latter may be used by your applications). diff --git a/articles/appliance/infrastructure/extensions.md b/articles/appliance/infrastructure/extensions.md index 04a15fb0ea..f2a2e22e74 100644 --- a/articles/appliance/infrastructure/extensions.md +++ b/articles/appliance/infrastructure/extensions.md @@ -1,64 +1,76 @@ --- section: appliance description: PSaaS Appliance infrastructure information about enabling Webtasks and Extensions +topics: + - appliance + - infrastructure + - extensions +contentType: + - Reference +useCase: appliance +applianceId: appliance32 +sitemap: false --- # Enable Webtasks, Extensions, and User Search -Beginning with version `8986`, the PSaaS Appliance supports extensions. This is in addition to support for [Webtasks](appliance/webtasks). +The PSaaS Appliance supports: -::: note -Some of the [Extensions](/extensions) available to users of the Auth0 public cloud are unavailable in the PSaaS Appliance. As such, these do not appear as options in the PSaaS Appliance's Dashboard. -::: +* Extensions +* [Webtasks](appliance/webtasks) +* User search using Elasticsearch -Beginning with version `10755`, the PSaaS Appliance supports User Search using Elasticsearch. This allows you to use extensions that require User Search, including the [Delegated Admininstration extension](/extensions/delegated-admin) +## Extensions -## Requirements for Enabling User Search +You can find a list of extensions available to you [in the Dashboard](${manage_url}/#/extensions). -To enable User Search, you must increase the amount of storage available in your Development and Production environments. +Some of the [Extensions available to users of the Auth0 public cloud](/extensions) are unavailable in the PSaaS Appliance. As such, these do not appear as options in the PSaaS Appliance's Dashboard. -* If you have a *single non-Production/Development node*, you need an additional **50 GB** drive; -* If you have a *three-node Production cluster*, you need an additional **100 GB** drive on *each* of your three Virtual Machines; -* If you have a *Geographic High-Availability implementation*, you need an additional **100 GB** drive on *each* of your data nodes in the primary and secondary data centers. +## Webtasks Requirements -For all other configuration types, please consult with your Customer Success Engineer. - -## Enabling User Search - -Once you have added the additional drive(s), submit a Support ticket to request that Auth0: - -* Enable User Search; -* Update your PSaaS Appliance to version `10755` or above. Auth0 will work with you to upgrade your Development environment first, so that you can test the changes. Auth0 will coordinate the Production upgrade after you've concluded testing in Development. - -## Requirements for Enabling Webtasks - -Your Development and/or Production environments must meet the following requirements before you can enable Webtasks and update to version `8986` or above. +Your Development and Production environments must meet the following requirements before you can enable Webtasks: * All nodes in the cluster have outbound access using **Port 443** to: * `docker.it.auth0.com` (or `52.9.124.234`) - * Please note that version 8293 required outbound access to `docker.it.auth0.com` (or `52.9.124.234`) on Port **5000**. * `cdn.auth0.com` -* All nodes are able to communicate with other nodes in the same cluster using ports **8721** and **8701**. +* All nodes can communicate with other nodes in the same cluster using ports **8721** and **8701**. * All [SSL certificates](/appliance/infrastructure/security#ssl-certificates) have the appropriate Webtask DNS entry. Examples: * `webtask..com` * `webtask-dev..com` -## Enabling Webtasks - -Once you have met the requirements for enabling Webtasks, submit a Support ticket to request that Auth0: +## Enable Webtasks -* Configure Webtasks (including switching your sandbox mode to `auth0-sandbox`) -* Update your PSaaS Appliance to version `8986`. Auth0 will work with you to upgrade your Development environment first, so that you can test the changes. Afterwards, Auth0 will coordinate the Production upgrade. +Once you have met the requirements for enabling Webtasks, submit a Support ticket to request that Auth0 configure Webtasks on your behalf. ## Dedicated Domains -Beginning with PSaaS Appliance version `13451`, you may now configure Webtask on a [dedicated domain](/appliance/webtasks/dedicated-domains). This enables you to safely use extensions in multi-tenant environments (the behavior is akin to that of the Auth0 Public Cloud Service). +You may configure Webtasks on a [dedicated domain](/appliance/webtasks/dedicated-domains). Using dedicated domains enables you to safely use extensions in multi-tenant environments (the behavior is akin to that of the Auth0 Public Cloud Service). + +If you are planning on using Extensions, you **must** implement Webtask dedicated domains. + +## User search + +The PSaaS Appliance supports User Search using Elasticsearch. This allows you to use extensions that require user search functionality, including the [Delegated Administration extension](/extensions/delegated-admin). + +### Requirements for enabling user search + +To enable User Search, you must increase the amount of storage available in your Development and Production environments. + +* If you have a *single non-Production/Development node*, you need an additional **50 GB** drive; +* If you have a *three-node Production cluster*, you need an extra **100 GB** drive on *each* of your three Virtual Machines; +* If you have a *Geographic High-Availability implementation*, you need an additional **100 GB** drive on *each* of your data nodes in the primary and secondary data centers. + +For all other configuration types, please consult with your Customer Success Engineer. + +## Enabling User Search + +Once you have added the additional drive(s), submit a Support ticket to request that Auth0 enable User Search. ## Keep reading ::: next-steps * [IP Address and Port Requirements](/appliance/infrastructure/ip-domain-port-list) * [Extensions](/extensions) -* [Delegated Admininstration extension](/extensions/delegated-admin) +* [Delegated Administration extension](/extensions/delegated-admin) * [Webtasks](/appliance/webtasks) * [Version Change Logs](https://auth0.com/changelog/appliance) ::: diff --git a/articles/appliance/infrastructure/faq.md b/articles/appliance/infrastructure/faq.md index 0286f7c2da..e9dc9fc33e 100644 --- a/articles/appliance/infrastructure/faq.md +++ b/articles/appliance/infrastructure/faq.md @@ -1,6 +1,13 @@ --- description: This page answers several common questions regarding the PSaaS Appliance infrastructure. section: appliance +topics: + - appliance + - infrastructure +contentType: reference +useCase: appliance +applianceId: appliance33 +sitemap: false --- # PSaaS Appliance Infrastructure Requirements: Frequently Asked Questions @@ -23,7 +30,9 @@ No, the PSaaS Appliance is a managed service that runs within your network. You While this is currently not supported, preinstalled anti-virus software may be included in future updates. #### Will Auth0 provide me with a CSR file for my SSL Certificate? -If Auth0 hosts the PSaaS Appliance, Auth0 will provide the required certificate(s). +No. The details of generating certificates, such as a CSR, vary among public certificate providers. Please work with your public certificate authority for these requirements. + +If Auth0 hosts the PSaaS Appliance, Auth0 will provide the required `*.auth0.com` SSL certificates. #### Why do both the DEV (non-prod) node and PROD cluster require unique certificates signed by a public Certificate Authority? Webtasks and web extensions require this due to Node.js security requirements. @@ -74,7 +83,6 @@ Auth0 requires [remote access](/appliance/remote-access-options) to your PSaaS A 1. Jumphost + Firewall Whitelist 2. Two Jumphosts -3. VPN We do not support other methods, such as VDI or Screen Sharing mechanisms. @@ -90,4 +98,4 @@ You can read the PSaaS Appliance terms [here](https://auth0.com/legal/baseline/P #### Does the PSaaS Appliance require internet access? -Please refer to [our documentation on the internet-related requirements](/appliance/infrastructure/internet-restricted-deployment) for the PSaaS Appliance. \ No newline at end of file +Please refer to [our documentation on the internet-related requirements](/appliance/infrastructure/internet-restricted-deployment) for the PSaaS Appliance. diff --git a/articles/appliance/infrastructure/index.md b/articles/appliance/infrastructure/index.md index 44b51cc621..6f2919f464 100644 --- a/articles/appliance/infrastructure/index.md +++ b/articles/appliance/infrastructure/index.md @@ -3,6 +3,15 @@ title: PSaaS Appliance Infrastructure Requirements url: /appliance/infrastructure section: appliance description: This document contains information about the PSaaS Appliance and its infrastructure requirements. +topics: + - appliance + - infrastructure +contentType: + - index + - reference +useCase: appliance +applianceId: appliance34 +sitemap: false --- # Private SaaS (PSaaS) Appliance Infrastructure Requirements diff --git a/articles/appliance/infrastructure/infrastructure-overview.md b/articles/appliance/infrastructure/infrastructure-overview.md index 2a949d7a43..b9e92e633a 100644 --- a/articles/appliance/infrastructure/infrastructure-overview.md +++ b/articles/appliance/infrastructure/infrastructure-overview.md @@ -1,6 +1,13 @@ --- section: appliance description: PSaaS Appliance infrastructure overview +topics: + - appliance + - infrastructure +contentType: concept +useCase: appliance +applianceId: appliance35 +sitemap: false --- # PSaaS Appliance Deployment Architecture diff --git a/articles/appliance/infrastructure/installation.md b/articles/appliance/infrastructure/installation.md index 36c641b829..4197c25fc8 100644 --- a/articles/appliance/infrastructure/installation.md +++ b/articles/appliance/infrastructure/installation.md @@ -1,6 +1,16 @@ --- section: appliance description: PSaaS Appliance infrastructure information about installation +topics: + - appliance + - infrastructure + - installation +contentType: + - concept + - how-to +useCase: appliance +applianceId: appliance36 +sitemap: false --- @@ -42,11 +52,10 @@ Auth0 provides a project plan methodology to help customers get up and running w The following basic steps are required to get the infrastructure up and running and the PSaaS Appliance deployed: -1. Understand the PSaaS Appliance infrastructure requirements as detailed in this document; -2. Complete and submit the [Pre-PSaaS Appliance Installation Checklist](https://docs.google.com/forms/d/e/1FAIpQLSckWRi2MWpzhBkUXoqjaEzMPGUsyL4ICbOetcGvSnn64dSM-A/viewform?c=0&w=1) to ensure that you have everything you need ready and on hand for the PSaaS Appliance deployment; -3. Access and install the PSaaS Appliance; -4. Complete and submit the Post-PSaaS Appliance Install Checklist to notify Auth0 that you have everything in place and that Auth0 can commence configuring the PSaaS Appliance; -5. Complete the steps detailed in the PSaaS Appliance Setup Guide. +1. Understand the PSaaS Appliance infrastructure requirements as detailed in this document. +2. Set up the infrastructure after the Appliance Project Manager has shared the required AMI file with you. +3. Complete and submit the [PSaaS Appliance Install Checklist](https://docs.google.com/forms/d/e/1FAIpQLSckWRi2MWpzhBkUXoqjaEzMPGUsyL4ICbOetcGvSnn64dSM-A/viewform?c=0&w=1) to notify Auth0 that you have the required infrastructure in place and that Auth0 can begin configuring the PSaaS Appliance. +4. Meet with Auth0 to deploy the DEV and PROD environments (the Appliance Project Manager will set up this meeting). ## Development/Test/Production Lifecycle diff --git a/articles/appliance/infrastructure/internet-restricted-deployment.md b/articles/appliance/infrastructure/internet-restricted-deployment.md index 0823f734c7..352e6b0e36 100644 --- a/articles/appliance/infrastructure/internet-restricted-deployment.md +++ b/articles/appliance/infrastructure/internet-restricted-deployment.md @@ -1,8 +1,12 @@ --- title: Internet-Restricted PSaaS Appliance Deployments description: Operating the PSaaS Appliance in an Internet-Restricted Environment +contentType: reference +useCase: appliance +applianceId: appliance37 +sitemap: false --- -# PSaaS Appliace Deployments with Limited Internet Connectivity +# PSaaS Appliance Deployments with Limited Internet Connectivity The Auth0 PSaaS Appliance is delivered as a managed service that can run in: @@ -14,7 +18,7 @@ The PSaaS Appliance is designed to mirror the solutions offered via the Auth0 Pu ## Internet-Restricted Environments -While we make an effort to create PSaaS Appliances that are encapsulated for normal operation, there are several features that require access to external resources for normal functionality. These resources are primarily located on the Auth0 Content Delivery Network (CDN). +While we make an effort to create PSaaS Appliances that are encapsulated for normal operation, there are several features that require access to external resources for normal functionality. These resources are primarily located on the Auth0 Content Delivery Network (CDN), which is accessed via **cdn.auth0.com**. ::: warning The PSaaS Appliance **must** have access to the internet during [update periods](https://auth0.com/docs/appliance/infrastructure/ip-domain-port-list#external-connectivity). @@ -22,29 +26,41 @@ The PSaaS Appliance **must** have access to the internet during [update periods] Operating the PSaaS Appliance in an internet-restricted environment results in the loss of the following features/functionality: -* Management Dashboard +* Analytics (including usage statistics) +* Authentication API Explorer +* [Extensions](/extensions) +* [Hooks](/hooks) * Lock * Management API Explorer -* Authentication API Explorer +* Management Dashboard * Quickstarts * Social Connections -* Analytics (including usage statistics) ### Management Dashboard -The browser that you are using to manage your PSaaS Appliance requires internet access to navigate to the Management Dashboard (located at **manage.your-domain**). +The browser that you are using to manage your PSaaS Appliance requires Internet access to navigate to the Management Dashboard (located at **manage.your-domain**). You may, however, restrict server-side access to the Management Dashboard. To properly render the Dashboard, it accesses the following sites: -* **cdn.auth0.com**: resources loaded from this CDN are well-known and include CSS, JavaScript, and images -* **fonts.googleapis.com**: resources loaded include CSS and font files -* **s.gravatar.com** and **i2.wp.com**: resources include user profile images loaded from WordPress' Gravatar service +* **cdn.auth0.com**: resources loaded from this CDN are well-known and include CSS, JavaScript, and images. +* **fonts.googleapis.com**: resources loaded include CSS and font files. +* **s.gravatar.com** and **i2.wp.com**: resources include user profile images loaded from WordPress' Gravatar service. * **fast.fonts.net**: resources include CSS files for font support. +### Multi-factor Authentication (MFA) + +When using multi-factor authentication (MFA), you will need Internet access for Push notifications, SMS, and Voice. + +For limited connectivity options, you may choose from: + +* One-time password with Google Authenticator, Authy or similar apps +* A custom MFA implementation using redirect rules +* Duo (on-premise versions only) + ## Summary The PSaaS Appliance requires access to specific external resources for normal functionality, and we do not recommend restricting access to these resources for optimal function. These resources are primarily located on the Auth0 CDN. -Currently, there are no plans to reduce the reliance of the PSaaS Appliance on the Auth0 CDN. \ No newline at end of file +Currently, there are no plans to reduce the reliance of the PSaaS Appliance on the Auth0 CDN. diff --git a/articles/appliance/infrastructure/ip-domain-port-list.md b/articles/appliance/infrastructure/ip-domain-port-list.md index 2499ee38f2..d81d3d2a2f 100644 --- a/articles/appliance/infrastructure/ip-domain-port-list.md +++ b/articles/appliance/infrastructure/ip-domain-port-list.md @@ -1,11 +1,21 @@ --- description: PSaaS Appliance infrastructure information about IP/Domain and Port Usage section: appliance +topics: + - appliance + - infrastructure + - ip-addresses + - domains + - ports +contentType: reference +useCase: appliance +applianceId: appliance38 +sitemap: false --- -# PSaaS Appliance Infrastructure: IP/Domain and Port List +# PSaaS Appliance Infrastructure Requirements: IP/Domain and Port List The PSaaS Appliance requires certain ports within the cluster to be open and able to access each other, as well as selected external sites. @@ -124,7 +134,7 @@ Auth0 strives to keep these IP addresses stable, though this is not a given. Fro Updates Outbound apt-mirror.it.auth0.com (52.8.153.197) - 80/443 + 443 Provides update packages for PSaaS Appliance instances Yes @@ -137,11 +147,11 @@ Auth0 strives to keep these IP addresses stable, though this is not a given. Fro Yes - Web extensions and Management Dashboard + Web extensions, Hooks, and Management Dashboard Outbound cdn.auth0.com 443 - Required to run web extensions; also required for admins to browse to the Management Dashboard + Required to run web extensions and Hooks; also required for admins to browse to the Management Dashboard Yes @@ -184,6 +194,14 @@ Auth0 strives to keep these IP addresses stable, though this is not a given. Fro Required by the PSaaS Appliance to resolve host names internal and external to your environment Yes + + SMTP + Outbound + SMTP Server(s) + 25/587 + Allows sending of emails from the Appliance + No + diff --git a/articles/appliance/infrastructure/network.md b/articles/appliance/infrastructure/network.md index 6185221b20..d197ad2191 100644 --- a/articles/appliance/infrastructure/network.md +++ b/articles/appliance/infrastructure/network.md @@ -1,6 +1,14 @@ --- section: appliance description: PSaaS Appliance infrastructure information about Networks +topics: + - appliance + - infrastructure + - networks +contentType: reference +useCase: appliance +applianceId: appliance39 +sitemap: false --- # PSaaS Appliance Infrastructure Requirements: Network diff --git a/articles/appliance/infrastructure/security.md b/articles/appliance/infrastructure/security.md index 88691636f4..adc6c39577 100644 --- a/articles/appliance/infrastructure/security.md +++ b/articles/appliance/infrastructure/security.md @@ -1,6 +1,14 @@ --- section: appliance description: PSaaS Appliance infrastructure information about security +topics: + - appliance + - infrastructure + - security +contentType: reference +useCase: appliance +applianceId: appliance40 +sitemap: false --- # PSaaS Appliance Infrastructure Requirements: Security and Access @@ -9,7 +17,12 @@ description: PSaaS Appliance infrastructure information about security ## SSL Certificates -You need to create and install a unique SSL certificate for each PSaaS Appliance (such as your production cluster, your development node, or your QA environment). You need additional certificates if your environments require [extensions](/extensions) or you use [custom domains](/appliance/custom-domains). If you are using extensions, please see [Webtask with Dedicated Domains](/appliance/webtasks/dedicated-domains). +When using the PSaaS Appliance, you will need to provide several SSL certificates. You must create and install a unique SSL certificate for: + +* Each PSaaS Appliance (e.g., your production cluster, your development node, your QA environment) +* [Extensions](/appliance/extensions) +* [Custom Domains](/appliance/custom-domains) +* [Webtasks](/appliance/webtasks) (with or without [Dedicated Domains](/appliance/webtasks/dedicated-domains)) ::: note If you are unsure of where to get SSL Certificates, please contact your network security team. They are usually the ones familiar with the required processes and working with the appropriate certificate authorities (CA) to generate new certificates. @@ -17,8 +30,8 @@ You need to create and install a unique SSL certificate for each PSaaS Appliance The SSL Certificate: -* must be created by a public certificate authority. They cannot be self-signed. -* may be a wildcard *or* a multi-domain (SAN) certificate; +* must be created by a public certificate authority. They cannot be self-signed; +* can be a wildcard *or* a multi-domain (SAN) certificate; * must contain all required DNS/domain names, including those for the: * Management Dashboard; * Configuration Tenant; @@ -44,6 +57,14 @@ PARENT -----END CERTIFICATE----- ``` +If you're uploading the public and private keys separately, convert the private key to RSA as follows: + +```text +-----BEGIN RSA PRIVATE KEY----- +PRIVATE-KEY +-----END RSA PRIVATE KEY----- +``` + ## Transparent Proxies If you are behind a transparent proxy, you will need to: @@ -53,11 +74,11 @@ If you are behind a transparent proxy, you will need to: ## HTTPS or TLS -Users must connect to the PSaaS Appliance using secure protocols (HTTPS or TLS). Depending on your network design, you could terminate the Secure Channel at the load balancer or at the PSaaS Appliance. In both cases your SSL/TLS certificate must be locally installed on the PSaaS Appliance. +Users must connect to the PSaaS Appliance using secure protocols (HTTPS or TLS). Depending on your network design, you could terminate the Secure Channel at the load balancer or the PSaaS Appliance. In both cases, your SSL/TLS certificate must be locally installed on the PSaaS Appliance. ## SMTP -You must configure an SMTP server in order for the PSaaS Appliance to send emails. The PSaaS Appliance requires an authentication SMTP server that has been configured with SMTP PLAIN authentication. +You must configure an SMTP server for the PSaaS Appliance to send emails. The PSaaS Appliance requires an authentication SMTP server that has been configured with SMTP PLAIN authentication. **AWS SES Users**: If your domain is not validated, you will not be able to send email with AWS SES. @@ -71,8 +92,8 @@ Auth0 requires [remote access](/appliance/remote-access-options) to your PSaaS A ### Initial Configuration -Auth0's remote access method for initial configuration requires SSH access via Jumphost (the preferred method) or via VPN. After the initial configuration, please feel free to disable this connection. +Auth0's remote access method for initial configuration requires SSH access via Jumphost. After the initial setup, please feel free to disable this connection. ### Updates, Maintenance, and Troubleshooting -Typically, updates are performed via the Auth0 Dashboard. In the event that Auth0 needs to remote in to identify and troubleshoot issues, an Auth0 Customer Success Engineer will need access to the PSaaS Appliance through SSH access via Jumphost (the preferred method) or over VPN. This connection may be enabled for and disabled after the agreed-upon time frames for work. +Typically, updates are performed via the Auth0 Dashboard. If Auth0 needs to remote in to identify and troubleshoot issues, an Auth0 Customer Success Engineer will need access to the PSaaS Appliance through SSH access via Jumphost. This connection can be enabled for and disabled after the agreed-upon time frames for work. diff --git a/articles/appliance/infrastructure/virtual-machines.md b/articles/appliance/infrastructure/virtual-machines.md index 5095b5367e..45851327f6 100644 --- a/articles/appliance/infrastructure/virtual-machines.md +++ b/articles/appliance/infrastructure/virtual-machines.md @@ -1,15 +1,19 @@ --- section: appliance description: PSaaS Appliance infrastructure information about virtual machines +topics: + - appliance + - infrastructure + - virtual-machines +contentType: reference +useCase: appliance +applianceId: appliance41 +sitemap: false --- # PSaaS Appliance Infrastructure Requirements: Virtual Machines -You may deploy the PSaaS Appliance on your premises using your own infrastructure or the infrastructure of a cloud provider. Currently, Auth0 supports the following PSaaS Appliance usage on the following virtualization environments: - -* Amazon Web Services (AWS); -* Microsoft Azure; -* VMware. +You may deploy the PSaaS Appliance on your premises using your own infrastructure or the infrastructure of a cloud provider. Currently, Auth0 supports PSaaS Appliance usage on Amazon Web Services (AWS). ## Virtual Machine Templates @@ -19,8 +23,8 @@ Auth0 provides the PSaaS Appliance via a Virtual Machine Template for you to pro When provisioning the PSaaS Appliance from the templates, Auth0 recommends the following specifications for the Virtual Machine infrastructure. For multi-node clusters, each node requires a separate VM that meet the specifications. -* **Memory**: 32 GB RAM (16 GB RAM minimum); -* **CPU**: 8 vCPU (4 vCPU minimum); +* **Memory**: 32 GB RAM (minimum); +* **CPU**: 8 vCPU (minimum); * **Storage**: * *For Non-Production Nodes*: 4 drives: 60 GB for system/operating system storage, 50 GB for data storage, 50 GB for User Search, and 50 GB for backup purposes (if you want to test the backup process). * *For three-node, high availability Production clusters*: @@ -37,7 +41,7 @@ For multi-node clusters, Auth0 recommends deploying the PSaaS Appliance virtual ## For AWS Users -* The *recommended* [instance type](https://aws.amazon.com/ec2/instance-types/) is **M4.2xlarge** (M4.xlarge minimum). +* The *recommended* [instance type](https://aws.amazon.com/ec2/instance-types/) is **m5.2xlarge** (minimum). * Auth0 will need the following pieces of information to share the AMI with you: * AWS account number; * AWS region name. The region should have at least three [availability zones](https://aws.amazon.com/about-aws/global-infrastructure) for your Production cluster. diff --git a/articles/appliance/instrumentation.md b/articles/appliance/instrumentation.md new file mode 100644 index 0000000000..1aea21eb0a --- /dev/null +++ b/articles/appliance/instrumentation.md @@ -0,0 +1,61 @@ +--- +section: appliance +description: This document covers why and how to enable instrumentation in the PSaaS Appliance. +topics: + - appliance + - instrumentation +contentType: + - how-to +useCase: appliance +applianceId: appliance45 +sitemap: false +--- +# PSaaS Appliance Monitoring: Instrumentation + +The PSaaS Appliance allows you to collect time series data about individual processes and the overall cluster. + +To collect and analyze time series data, you must: + +* Have instrumentation enabled (please contact Auth0 for assistance with this) +* Export the data collected to DataDog + +If you've chosen to host the PSaaS Appliance in your on-premise data center or in a cloud data center to which you've subscribed (e.g. AWS or Azure), you must use the instrumentation feature to monitor your PSaaS Appliance. + +If Auth0 hosts the PSaaS Appliance on your behalf, you do not have access to this feature – Auth0's Managed Service Engineering (MSE) team will use instrumentation to monitor the PSaaS Appliance for you. + +## Alerts + +The PSaaS Appliance does not come with any built-in tool for sending alerts. To remedy this, we rely on DataDog and Telegraf to help implement robust monitoring and alerting strategies for the PSaaS Appliance. + +### Signals to Monitor + +These are the signals that the PSaaS Appliance makes available to DataDog via the Telegraf agent. The Telegraf agent defines these signals automatically. + +* [CPU](https://github.com/influxdata/telegraf/blob/34b7a4c3611d1ede908ef275401544c34a4a3ba3/plugins/inputs/system/CPU_README.md) +* [Disk](https://github.com/influxdata/telegraf/blob/34b7a4c3611d1ede908ef275401544c34a4a3ba3/plugins/inputs/system/DISK_README.md) +* [Disk IO](https://github.com/influxdata/telegraf/blob/34b7a4c3611d1ede908ef275401544c34a4a3ba3/plugins/inputs/system/DISK_README.md) +* [Memory](https://github.com/influxdata/telegraf/blob/34b7a4c3611d1ede908ef275401544c34a4a3ba3/plugins/inputs/system/MEM_README.md) +* [Processes](https://github.com/influxdata/telegraf/blob/34b7a4c3611d1ede908ef275401544c34a4a3ba3/plugins/inputs/system/PROCESSES_README.md) +* [Swap](https://github.com/influxdata/telegraf/blob/34b7a4c3611d1ede908ef275401544c34a4a3ba3/plugins/inputs/system/MEM_README.md) +* [System](https://github.com/influxdata/telegraf/blob/34b7a4c3611d1ede908ef275401544c34a4a3ba3/plugins/inputs/system/SYSTEM_README.md) +* [MongoDB](https://github.com/influxdata/telegraf/blob/34b7a4c3611d1ede908ef275401544c34a4a3ba3/plugins/inputs/mongodb/README.md) +* [Net](https://github.com/influxdata/telegraf/blob/34b7a4c3611d1ede908ef275401544c34a4a3ba3/plugins/inputs/system/net.go) +* [NGINX](https://github.com/influxdata/telegraf/blob/34b7a4c3611d1ede908ef275401544c34a4a3ba3/plugins/inputs/nginx/README.md) +* [RabbitMQ](https://github.com/influxdata/telegraf/tree/34b7a4c3611d1ede908ef275401544c34a4a3ba3/plugins/inputs/rabbitmq) +* [Procstat](https://github.com/influxdata/telegraf/blob/34b7a4c3611d1ede908ef275401544c34a4a3ba3/plugins/inputs/procstat/README.md) +* [X509](https://github.com/influxdata/telegraf/blob/release-1.11/plugins/inputs/x509_cert/README.md) + +### Auth0 Signals to Monitor + +Please note that Auth0 exposes many internal metrics that will be visible in your DataDog console. The names of these metrics typically begin with `auth0_`. + +The internal metrics may change at any point, so in most cases, we do not recommend that you build monitoring strategies based on these signals (you can safely ignore these metrics, if you'd like). However, there are a few that you **should** monitor. We list the exceptions in the table below. + +| Signal | Description | +| - | - | +| auth0_http_requests_received | The total number of requests received by the PSaaS Appliance. | +| auth0_http_requests_replied | The total number of requests replied to by the PSaaS Appliance. | +| auth0_http_response_time.count | The number of responses issued by the PSaaS Appliance. This metric corresponds to `auth0_http_requests_replied`. | +| auth0_http_response_time.lower | The shortest amount of time it took for the PSaaS Appliance to respond to a request. | +| auth0_http_response_time.mean | The average time it took for the PSaaS Appliance to respond to a request. | +| auth0_http_response_time.upper | The longest amount of time it took for the PSaaS Appliance to respond to a request. | diff --git a/articles/appliance/instrumentation/add-grafana-users.md b/articles/appliance/instrumentation/add-grafana-users.md deleted file mode 100644 index 036bb40a0d..0000000000 --- a/articles/appliance/instrumentation/add-grafana-users.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -section: appliance -description: This document covers how to add new users to Grafana. ---- - -# PSaaS Appliance: Adding Users to Grafana - - -By default, each Grafana instance (every PSaaS Appliance node comes with its own instance of Grafana) includes the following users: - -* `admin` -* `root@auth0.com` - -To visualize the instrumentation page with an PSaaS Appliance administrative user *other* than `root@auth0.com`, you will need to add that user to the Grafana instances for **each** PSaaS Appliance node. - -1. Navigate to the PSaaS Appliance node's instance of Grafana (`https://.com/grafana/`), and log in using a set of valid credentials. -2. Click the **Grafana icon** located in the top left corner. Select **Admin** and then **Global Users**. - - ![Grafana Admin Menu](/media/articles/appliance/instrumentation/grafana-users-1.png) - -3. To add the user, click **+ Add new user**. - - ![Grafana Add New User Button](/media/articles/appliance/instrumentation/grafana-users-2.png) - -3. Add the user's *email address* to the **Name**, **Email**, and **Username** fields, and set the user's password. This can be any complex password of the user's choosing. Note that the user will have to enter their password only if they try to access Grafana using Basic Authentication. If the user logs in using OAuth, Grafana will select the user based on the provided email address. - - ![Grafana Add New User Screen](/media/articles/appliance/instrumentation/grafana-users-3.png) - - You can use one of two authentication methods with Grafana: - - ::: panel Grafana Authentication - * **Basic Authentication**: used by configuration scripts launched by Puppet - * **OAuth Authentication**: used by when pages when users either: - * Visualize the instrumentation page; - * Navigate to Grafana's website. - ::: - -4. Click **Create**. You will now see the user reflected in the *Users* list. - - ![Grafana Users List](/media/articles/appliance/instrumentation/grafana-users-4.png) diff --git a/articles/appliance/instrumentation/available-metrics.md b/articles/appliance/instrumentation/available-metrics.md deleted file mode 100644 index 3315b0d908..0000000000 --- a/articles/appliance/instrumentation/available-metrics.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -section: appliance -description: This document covers the metrics available when using Instrumentation. ---- - -# PSaaS Appliance: Metrics Available via Instrumentation - -The following metrics are available to you when Instrumentation is enabled on your PSaaS Appliance: - -## Metrics Regarding PSaaS Appliance Infrastructure - -* [CPU](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/system/CPU_README.md) -* [Disk](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/system/DISK_README.md) -* [Disk I/O](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/system/DISK_README.md) -* [Memory](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/system/MEM_README.md) -* [Processes](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/system/PROCESSES_README.md) -* [Swap](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/system/MEM_README.md) -* [System](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/system/SYSTEM_README.md) -* [MongoDB](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/mongodb/README.md) -* [Net](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/system/net.go) -* [NGINX](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/nginx/README.md) -* [RabbitMQ](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/rabbitmq) -* [Procstat](https://github.com/influxdata/telegraf/blob/master/plugins/inputs/procstat/README.md) - -## Metrics Regarding PSaaS Appliance Processes - -* auth0-api2_http_requests_authenticated -* auth0-api2_http_requests_received -* auth0-api2_http_requests_replied -* auth0-api2_http_response_time -* auth0-import-users-worker_event-loop_blocked -* auth0-import-users-worker_resources_cpu_usage -* auth0-import-users-worker_resources_memory_heapTotal -* auth0-import-users-worker_resources_memory_heapUsed -* auth0-import-users-worker_resources_memory_usage -* auth0-notifications_event-loop_blocked -* auth0-notifications_resources_cpu_usage -* auth0-notifications_resources_memory_heapTotal -* auth0-notifications_resources_memory_heapUsed -* auth0-notifications_resources_memory_usage -* auth0-server_auth_step_time -* auth0-server_clients_findByTenantAndClientId -* auth0-server_connections_getByName -* auth0-server_http_requests_received -* auth0-server_http_requests_replied -* auth0-server_http_response_time -* auth0-server_tenants_get -* auth0-users_bootup_time -* auth0-users_http_requests_received -* auth0-users_http_requests_replied -* auth0-users_http_requests_size -* auth0-users_http_response_time diff --git a/articles/appliance/instrumentation/components.md b/articles/appliance/instrumentation/components.md deleted file mode 100644 index 4762ae3b9f..0000000000 --- a/articles/appliance/instrumentation/components.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -section: appliance -description: This document covers the software used for Instrumentation. ---- - -# PSaaS Appliance: Instrumentation Components - -The following applications are used to implement Instrumentation within the PSaaS Appliance: - -* [Grafana](http://grafana.org/): tools for time series and metrics visualization -* [InfluxDB](https://www.influxdata.com/time-series-platform/influxdb/): time series database used to store/query collected data -* [Telegraf](https://www.influxdata.com/time-series-platform/telegraf/): tools for gathering data from the PSaaS Appliance diff --git a/articles/appliance/instrumentation/index.md b/articles/appliance/instrumentation/index.md deleted file mode 100644 index 822d009713..0000000000 --- a/articles/appliance/instrumentation/index.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -url: /appliance/instrumentation -section: appliance -description: This document covers why and how to enable instrumentation in the PSaaS Appliance. ---- - -# Private SaaS (PSaaS) Appliance: Instrumentation - -The PSaaS Appliance ships with a feature called Instrumentation, which makes it easy for your PSaaS Appliance administrators or Auth0 Customer Success Engineers to gather information about the current (or previous) state of the PSaaS Appliance. With Instrumentation, you are collecting time series data about the overall PSaaS Appliance, as well as individual processes. You can then query or visualize this data to draw conclusions about the state of your PSaaS Appliance. - -::: note -Please contact your Auth0 Customer Success Manager if you would like to enable Instrumentation for your PSaaS Appliance (please note that this feature is not available for PSaaS Appliances hosted by Auth0). -::: - -* [Software Components Utilized](/appliance/instrumentation/components) -* [Available Metrics](/appliance/instrumentation/available-metrics) -* [Access Your Data](/appliance/instrumentation/access-data) -* [Visualize Your Data](/appliance/instrumentation/visualize-data) -* [Add Users in Grafana](/appliance/instrumentation/add-grafana-users) diff --git a/articles/appliance/instrumentation/visualize-data.md b/articles/appliance/instrumentation/visualize-data.md deleted file mode 100644 index d4ed8da02a..0000000000 --- a/articles/appliance/instrumentation/visualize-data.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -section: appliance -description: This document covers how to visualize data gathered via Instrumentation. ---- - -# PSaaS Appliance: How to Visualize Your Data - -Once you have enabled Instrumentation, you can access your data in one of two places: - -* PSaaS Appliance Dashboard -* Grafana - -## View Your Data in the PSaaS Appliance Dashboard - -If you would like to see your data in the Appliance Dashboard, navigate to `https:///configuration#/instrumentation` to access the graphs created from the data collected from your PSaaS Appliance instances. - -![PSaaS Appliance Instrumentation Dashboard](/media/articles/appliance/instrumentation/general-data.png) - -## Access Your Data Directly from Grafana - -Each PSaaS Appliance node has its own instances of Grafana, InfluxDB, and Telegraph. To access a given node's Grafana instance: - -1. Obtain the node's private IP address -2. Using the private IP address, navigate to `https://.com/grafana/` - -### Add Grafana Dashboards to the Instrumentation Page in the PSaaS Appliance Dashboard - -If you need to view relationships between datasets that have yet to be graphed, you can create new (or update existing) Grafana Dashboards displayed on the PSaaS Appliance Dashboard's Instrumentation page. To create new Grafana dashboards, please view [this video](https://www.youtube.com/watch?v=sKNZMtoSHN4&index=7&list=PLDGkOdUX1Ujo3wHw9-z5Vo12YLqXRjzg2). - -Once you have created your Grafana dashboards, tag them as `instrumentation` so that they appear on the Instrumentation page. To do this: - -1. Navigate to the Grafana dashboard's *Settings > General* page. -2. Add a tag to the appropriate Grafana dashboard called `instrumentation`. - -![Grafana Dashboard Settings Screen](/media/articles/appliance/instrumentation/tag-dashboard.png) diff --git a/articles/appliance/modules.md b/articles/appliance/modules.md index 7c3b86f186..494289c92f 100644 --- a/articles/appliance/modules.md +++ b/articles/appliance/modules.md @@ -1,48 +1,49 @@ --- section: appliance description: For security reasons, rules and custom database connections for PSaaS Appliance run in a JavaScript sandbox. You can use the full power of the ECMAScript 5 language and a few selected libraries. +topics: + - appliance + - js-modules + - sandbox +contentType: reference +useCase: appliance +applianceId: appliance60 +sitemap: false --- # Node.js Modules Available in Rules and Custom Database Connections -For security reasons, rules and custom database connections for PSaaS Appliance run in a JavaScript sandbox. You can use the full power of the ECMAScript 5 language and a few selected libraries. - -The latest version of the PSaaS Appliance supports the use of three different modes: -* Webtask - This model has the same functionality as the Auth0 cloud version. It provides a balance between performance and isolation, supports a greater number of node modules, and is the recommended model for most customers; -* In process - This model executes within the Node.js process of the Auth0 service. This provides the best raw performance. The model provides no isolation between custom code and the Auth0 service, and supports only the limited set of modules listed below. The recommended approach for high scale is to allocate additional resources and use the Webtask model. In some very demanding conditions where isolation is not a concern, this model may be considered; -* Out-of-process - This is the original model that provides high isolation. It has significantly higher performance overhead compared to the other two models and supports the limited set of modules listed below. +For security reasons, you must execute rules and custom database logic for PSaaS Appliance using [the Webtask stage/sandbox](/appliance/webtasks). The sandbox offers you a performant environment running ECMAScript 6 and provides isolation for the code you've written. The current sandbox supports: -* [async](https://github.com/caolan/async) _(~0.9.0)_ -* [auth0](https://github.com/auth0/node-auth0) _(2.0.0-alpha.5)_ -* [azure_storage](https://github.com/Azure/azure-storage-node) _(~0.4.1)_ -* [bcrypt](https://github.com/ncb000gt/node.bcrypt.js) _(~0.8.3)_ -* [Buffer](http://nodejs.org/docs/v0.10.24/api/buffer.html) -* [couchbase](https://github.com/couchbase/couchnode) _(~1.2.1)_ -* [cql](https://github.com/jorgebay/node-cassandra-cql) _(~0.4.4)_ -* [crypto](http://nodejs.org/docs/v0.10.24/api/crypto.html) -* [ip](https://github.com/keverw/range_check) _(0.0.1)_ -* [jwt](https://github.com/auth0/node-jsonwebtoken) _(~0.4.1)_ -* [knex](http://knexjs.org) _(~0.6.3)_ - * The function returned by `require('knex')` is available as `Knex`. -* [lodash](https://github.com/lodash/lodash) _(~2.4.1)_ -* [mongo](https://github.com/mongodb/node-mongodb-native) _(~1.3.15)_ - * [BSON](http://mongodb.github.io/node-mongodb-native/api-bson-generated/bson.html) - * [Double](http://mongodb.github.io/node-mongodb-native/api-bson-generated/double.html) - * [Long](http://mongodb.github.io/node-mongodb-native/api-bson-generated/long.html) - * [ObjectID](http://mongodb.github.io/node-mongodb-native/api-bson-generated/objectid.html) - * [Timestamp](http://mongodb.github.io/node-mongodb-native/api-bson-generated/timestamp.html) -* [mysql](https://github.com/felixge/node-mysql) _(~2.0.0-alpha8)_ -* [pbkdf2](https://github.com/davidmurdoch/easy-pbkdf2) _(0.0.2)_ -* [pg](https://github.com/brianc/node-postgres) _(4.1.1)_ -* [pubnub](https://github.com/pubnub/javascript/tree/master/node.js) _(3.7.0)_ -* [q](https://github.com/kriskowal/q) _(~1.0.1)_ -* [querystring](http://nodejs.org/api/querystring.html) _(0.10.28)_ -* [request](https://github.com/mikeal/request) _(~2.27.0)_ -* [sqlserver](https://github.com/pekim/tedious) _(~0.1.4)_ -* [uuid](https://github.com/broofa/node-uuid) _(~2.0.1)_ -* [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) _(~0.2.8)_ -* [xmldom](https://github.com/jindw/xmldom) _(~0.1.13)_ -* [xpath](https://github.com/goto100/xpath) _(0.0.5)_ -* [xtend](https://github.com/Raynos/xtend) _(~1.0.3)_ +| Module | Version (If Applicable) | Notes | +| - | - | - | +| [async](https://github.com/caolan/async) | ~2.1.2 | | +| [auth0](https://github.com/auth0/node-auth0) | 2.13.0 | 2.13.0 | +| [bcrypt](https://github.com/ncb000gt/node.bcrypt.js) | ~3.0.0 | | +| [Buffer](http://nodejs.org/docs/v0.10.24/api/buffer.html) | | | +| [cql](https://github.com/jorgebay/node-cassandra-cql) | ~0.4.4 | | +| [crypto](http://nodejs.org/docs/v0.10.24/api/crypto.html) | | | +| [ip](https://github.com/keverw/range_check) | 0.3.2 | | +| [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) | ~7.1.9 | | +| [knex](http://knexjs.org) | ~0.8.6 | The function returned by `require('knex')` is available as `Knex`. | +| [lodash](https://github.com/lodash/lodash) | ~4.17.10 | | +| [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) | ~2.0.33 | | +| [node-mongodb-native - BSON](http://mongodb.github.io/node-mongodb-native/api-bson-generated/bson.html) | 0.3.2 | | +| [node-mongodb-native - Double](http://mongodb.github.io/node-mongodb-native/api-bson-generated/double.html) | | | +| [node-mongodb-native - Long](http://mongodb.github.io/node-mongodb-native/api-bson-generated/long.html) | | | +| [node-mongodb-native - ObjectID](http://mongodb.github.io/node-mongodb-native/api-bson-generated/objectid.html) | | | +| [node-mongodb-native - Timestamp](http://mongodb.github.io/node-mongodb-native/api-bson-generated/timestamp.html) | | | +| [mysql](https://github.com/felixge/node-mysql) | ~2.15.0 | | +| [pbkdf2](https://github.com/davidmurdoch/easy-pbkdf2) | 0.0.2 | | +| [pg](https://github.com/brianc/node-postgres) | 6.1.2 | | +| [pubnub](https://github.com/pubnub) | 3.7.11 | | +| [q](https://github.com/kriskowal/q) | ~1.4.1 | | +| [querystring](http://nodejs.org/api/querystring.html) | 0.2.0 | | +| [request](https://github.com/mikeal/request) | ~2.81.0 | | +| [uuid](https://github.com/kelektiv/node-uuid) | ~3.3.2 | | +| [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) | ~0.11.2 | | +| [xmldom](https://github.com/jindw/xmldom) | ~0.1.13 | | +| [xpath](https://github.com/goto100/xpath) | 0.0.9 | | +| [xtend](https://github.com/Raynos/xtend) | ~4.0.0 | | diff --git a/articles/appliance/monitoring/authenticated-endpoints.md b/articles/appliance/monitoring/authenticated-endpoints.md index 5a956f236a..50fa8bc069 100644 --- a/articles/appliance/monitoring/authenticated-endpoints.md +++ b/articles/appliance/monitoring/authenticated-endpoints.md @@ -1,69 +1,171 @@ --- section: appliance description: Overview of using the authenticated endpoint with the PSaaS Appliance +topics: + - appliance + - monitoring + - testing +contentType: how-to +useCase: appliance +applianceId: appliance47 +sitemap: false --- -# PSaaS Appliance: Using Authenticated Testing Endpoints +# PSaaS Appliance: Authenticated Testing Endpoints -For calls to the testing endpoints that return detailed information, Auth0 requires these requests to be authenticated using a key generated using the PSaaS Appliance Dashboard. This key is used in the request header of the call sent to the endpoint. +Auth0 offers endpoints that allow you to check the system health of a specific resource. In this article, we will cover the authenticated endpoints, which are available to those who submit requests whose header contains the appropriate credentials. -## Generating the API Key +The authenticated endpoints are similar to the Test All endpoints in that both return positive or negative status information about system resources. -To generate an API Key for use the authenticated testing endpoints, navigate to the [Settings](/appliance/dashboard/settings) page of your PSaaS Appliance Dashboard. There, you will find an [API Keys section](/appliance/dashboard/settings#api-keys) that allows you to generate new keys. +Authenticated endpoints do not provide detailed information about the system's resource utilization. Instead, they return an HTTP status reflecting the status of a given resource. Using the third-party tools of your choice, you can set up alerts that activate based on the status codes returned by Auth0's endpoints. -During the first use, you will see a that there is no key. To generate your first key, click on the "Generate" button at the far right of the row. +## How to generate an API key + +To send requests to the authenticated endpoints, you will need to generate and include an API key in the header of your request. + +Begin by navigating to the [Settings](/appliance/dashboard/settings) page of your PSaaS Appliance Dashboard. Scroll down to the [API Keys section](/appliance/dashboard/settings#api-keys). + +If this is the first time you are doing this, you'll see that there is no key. You can generate your first key by clicking the **Generate** button to the right. ![](/media/articles/appliance/api-keys/no-key.png) -You will be prompted to confirm the new key generation. If confirmed, you will see that the key now populates the previously-blank field. +You will be prompted to confirm the new key generation. + +Once confirmed, you will see that the key now populates the previously-blank field. ![](/media/articles/appliance/api-keys/key.png) +Scroll to the bottom of the page, and click Save to apply the new API Key value. + +At this point, Auth0 does a reconfiguration and restarts the health service. Once this process completes, you will be able to use your new API key. + :::panel-warning Changing Your API Key -You may only use one key at a time. If you generate a new key, all applications and services using the old key will fail. +You may only use one API key at a time. If you generate a new key, be sure to provide the new key to your existing applications and services; otherwise, they will fail. ::: -## Available Endpoints +## Authenticated API Endpoints + +The API exposes a number of endpoints that you can use to test the status of the service. -The following authenticated endpoints are available for you to use: +**Each node comes with its own set of endpoints, so you will need to make multiple calls if you are monitoring a multi-node PSaaS Appliance implementation.** The exception is the `GET /status/replicaset` endpoint, which reports on multiple nodes. -* GET /status/cpu -* GET /status/memory -* GET /status/disk -* GET /status/services -* GET /status/network -* GET /status/internet -* GET /status/email -* GET /status/db -* GET /status/replicaset +There are two ways you can call a specific API endpoint: -Your call might look something like the following: +* Submit your request to the node directly +* Issue your request through the load balancer using the manage domain + +If you're checking the status of a specific node, it's best to submit your request to the node directly: ```text -curl -v http://127.0.0.1:9110/status/cpu ---user api_keys_health:YOUR_API_KEY +curl -v https://{node-ip}/health/status/cpu --user api_keys_health:YOUR_API_KEY ``` -You may also make the call via https, though you will have to make the following modifications to your call: - * Add "health" to the URL path; - * Remove the port number from the IP address used. +Otherwise, you can issue your request through the load balancer using the **manage** domain: + +```text +curl -v https://{manage-dashboard-domain}/health/status/cpu --user api_keys_health:YOUR_API_KEY +``` + +### Response Codes + +Each endpoint will return one of three status codes to communicate the status of the resource in question: + +| Response Code | Response | +| ------------- | -------- | +| 204 | OK | +| 429 | Too many requests | +| 520 | Warning | + +Additionally, each status code conveys additional information depending on the endpoint being queried. You'll find more information on this in the following sections that cover the specific endpoints available to you. + +None of the responses will include a body. + +#### GET /status/cpu + +This endpoint returns information about the overall available CPU capacity in the last minute on the PSaaS Appliance. Overall CPU capacity means that all CPU time is aggregated and compared with the time that any core was not idle. For example, if a four-core PSaaS Appliance node had two cores completely utilized and two cores completely idle, the CPU capacity calculated will be 50%. + +| Response Code | Response | +| ------------- | -------- | +| 204 | The system had more than 20% of the total CPU capacity available in the last minute. | +| 429 | The status endpoint has been called too many times (limit: 10 requests per second). Please wait and try again. | +| 520 | The system had 20% of the total CPU capacity (or less) available in the last minute. | + +#### GET /status/memory + +This endpoint returns information on the amount of memory available on the PSaaS Appliance. + +| Response Code | Response | +| ------------- | -------- | +| 204 | The system has more than 10% of its memory available. | +| 429 | The status endpoint has been called too many times (limit: 10 requests per second). Please wait and try again. | +| 520 | The system has 10% (or less) of its memory available. | + +#### GET /status/disk + +This endpoint returns information on disk utilization. Each node has a set number of volumes; if there is at least one volume that's utilizing more than 90% of the allocated disk space, the endpoint returns a warning. + +| Response Code | Response | +| ------------- | -------- | +| 204 | No volume on the node exceeds 90% utilization. | +| 429 | The status endpoint has been called too many times (limit: 10 requests per second). Please wait and try again. | +| 520 | One or more disk(s) on the node has exceeded 90% utilization. | + +#### GET /status/services -For example, `http://10.1.0.248:9110/status/cpu` becomes `https://10.1.0.248/health/status/cpu`. +This endpoint checks to see if any of the node's core Auth0 services are down. -## Access from Outside the PSaaS Appliance +| Response Code | Response | +| ------------- | -------- | +| 204 | Every core service is running on the node. | +| 429 | The status endpoint has been called too many times (limit: 10 requests per second). Please wait and try again. | +| 520 | At least one of the core services on the node is not running. | + +#### GET /status/network + +This endpoint reports the status of the network for the node. The node issues a PING command to each node in the cluster, and if it fails to PING any node, the endpoint will return an error code. + +| Response Code | Response | +| ------------- | -------- | +| 204 | The node was able to successfully ping every other node in the cluster. | +| 429 | The status endpoint has been called too many times (limit: 10 requests per second). Please wait and try again. | +| 520 | The node was not able to ping at least one node in the cluster, indicating there's a network problem. | -If you'd like to access these endpoints from outside the PSaaS Appliance, you can do so using your `manage` domain. +#### GET /status/internet -| Internal Access | External Access | -| --------------- | --------------- | -| http://10.1.0.248:9110/status/cpu **or** https://10.1.0.248/health/status/cpu | ${manage_url}/health/status/cpu | +This endpoint tests outbound internet connectivity on the node over port 443. This endpoint issues a `HEAD` request to `https://apt-mirror.it.auth0.com`. If the request returns anything other than a 200 status code, this endpoint will return an HTTP code indicating failure. + +| Response Code | Response | +| ------------- | -------- | +| 204 | The node was able to successful issue a `HEAD` request to `https://apt-mirror.it.auth0.com`. | +| 429 | The status endpoint has been called too many times (limit: 10 requests per second). Please wait and try again. | +| 520 | The was unable to issue a `HEAD` request, or the node received an error message after sending a `HEAD` request to `https://apt-mirror.it.auth0.com`. | + +#### GET /status/email + +This endpoint tests the SMTP connection using the provided configuration settings. + +| Response Code | Response | +| ------------- | -------- | +| 204 | The node was able to use the provided configuration settings to connect to the SMTP server. | +| 429 | The status endpoint has been called too many times (limit: 10 requests per second). Please wait and try again. | +| 520 | The node was unable to connect to the SMTP server. | + +#### GET /status/db + +This endpoint checks to see if the node can run database queries and receive the results. + +| Response Code | Response | +| ------------- | -------- | +| 204 | The node was able to successfully query the database. | +| 429 | The status endpoint has been called too many times (limit: 10 requests per second). Please wait and try again. | +| 520 | The node was not able to connect and run a query against the database. | -## Endpoint Responses +#### GET /status/replicaset -Calls to authenticated endpoints will return in one of the following status codes: +This endpoint checks to see if the replica set is healthy. If there is at least one node that is down, the endpoint will return an HTTP code indicating failure. | Response Code | Response | | ------------- | -------- | -| 204 | There are no issues with the resource. | -| 429 | Too many requests have been made to the resource. | -| 520 | There is an issue with the resource. | +| 204 | All nodes in the replica set are up. | +| 429 | The status endpoint has been called too many times (limit: 10 requests per second). Please wait and try again. | +| 520 | At least one node in the replica set is down. | diff --git a/articles/appliance/monitoring/index.md b/articles/appliance/monitoring/index.md index 3d3fc5937f..a7f8f588d9 100644 --- a/articles/appliance/monitoring/index.md +++ b/articles/appliance/monitoring/index.md @@ -2,17 +2,76 @@ url: /appliance/monitoring section: appliance description: Ways to monitor the PSaaS Appliance +topics: + - appliance + - monitoring +contentType: +- index +- concept +useCase: appliance +applianceId: appliance48 +sitemap: false --- # Monitoring the Private SaaS (PSaaS) Appliance -In addition to providing tools for monitoring your PSaaS Appliance, Auth0 provides integration with select third-party utilities. +The PSaaS Appliance is a managed service, which means that Auth0 is responsible for: -Your options include: +* Installation +* Updates +* General maintenance tasks -* **Instrumentation**: If [Instrumentation](/appliance/instrumentation) has been enabled for your PSaaS Appliance instances, you can gather and visualize data about your infrastructure and processes - * If you've enabled Instrumentation, you can send your data to DataDog. You'll need to supply your DataDog API key in the configuration page to do this. When viewing your metrics in DataDog, it will *not* appear in the standard DataDog UI under Infrastructure. You'll need to add your own dashboard and search for the PSaaS Appliance data you want displayed. -* **Health Checks**: [Health Checks](/appliance/dashboard/troubleshoot#health-check) provide minute-by-minute summaries of your PSaaS Appliance infrastructure at a given point in time. These logs are available for the the previous twenty-nine days and can be found in the [Troubleshoot](/appliance/dashboard/troubleshoot) page of your PSaaS Appliance Configuration Area; -* **[Auth0's `testall` Endpoint](/appliance/monitoring/testall)**: The `testall` endpoint is an unauthenticated endpoint that is particularly useful for monitoring by load balancers; -* **[Auth0's Authenticated Testing Endpoints](/appliance/monitoring/authenticated-endpoints)**: Auth0 provides endpoints that you may, once authenticated, call to receive status codes such as *204*, *520*, or *429*; -* **Integration with Third-Party Utilities to Monitor Synthetic Transactions**: Auth0 supports integration with system monitoring tools like *Microsoft System Center* so that you can [run and monitor synthetic transactions](/monitoring#configuring-scom). \ No newline at end of file +However, the deployment option you choose affects the scope of what Auth0 can do when it comes to *monitoring* the PSaaS Appliance. Currently, Auth0 supports the following deployment options: + +* The subscriber's Amazon Web Services cloud environment +* An Auth0-controlled data center + +If you choose to deploy the PSaaS Appliance to an Auth0-controlled data center, we have control over every aspect involved (DNS, certificates, infrastructure, Auth0 software stack). This level of control allows us to assist you in monitoring the health of the PSaaS Appliance and acting to prevent or remediate issues. + +However, if you choose to deploy the PSaaS Appliance to AWS, **you are responsible for monitoring the deployment. Auth0 is unable to monitor such environments.** + +::: note +Please review [PSaaS Appliance: Roles and Responsibilities](https://auth0.com/docs/appliance/raci) for information on who is responsible for various activities related to managing and monitoring the PSaaS Appliance. +::: + +## Features Aiding Monitoring + +The PSaaS Appliance offers a number of tools to help you monitor the software that is running, as well as the infrastructure on which it runs. You can find additional information on these monitoring tools in the chart that follows: + +| Tool | Description | +| - | - | +| Service Status Check | The [`/testall` endpoint](/appliance/monitoring/testall) reports the overall status of core Auth0 services. You can call this endpoint from the load balancer or from an individual node. If called from the load balancer, you can determine if there's a system-wide service outage. If called from a specific node, you'll receive information on the status of core services running on that node alone. | +| System Health Checks | The [authenticated endpoints](/appliance/monitoring/authenticated-endpoints) provide a more granular health check than the `/testall` endpoint, allowing you to see the status of lower level system resources. With these endpoints, you can monitor the status of the PSaaS Appliance as it relates to memory, disk, network, internet, email, database, replica set, services, and the cluster.

      The authenticated endpoints return status codes indicating whether the system resource in question is healthy or not. | +| [Instrumentation](/appliance/instrumentation) | The PSaaS Appliance offers instrumentation data, which is a vital component of monitoring and detecting anomalies or problems *before* they occur. To review your PSaaS Appliance instrumentation data, you can send it to DataDog. With DataDog, you can set up robust monitoring and alerts strategies to review the health of your PSaaS Appliance. | +| Dashboards | The PSaaS Appliance's [Troubleshooting](/appliance/dashboard/troubleshoot) dashboard allows you to view [Health Check](/appliance/dashboard/troubleshoot#health-check) results for the past 29 days. Please note that this dashboard does not provide any alerts functionality and should not be used as your only monitoring strategy. | +| Audit and Tenant Events | The [Tenant Logs](https://auth0.com/docs/logs) track processed transactions and provide an overview of application activity in your tenant. | +| Synthetic Transactions | You can use any third-party service that supports synthetic transaction to monitor PSaaS Appliance service availability. | + +## Recommended Monitoring Strategy + +Because each subscriber's implementation is different, the monitoring strategy you employ should match the needs of your use case. + +With that said, Auth0 suggests the following as a starting point for monitoring the PSaaS Appliance. The signals mentioned are indicators that there might be an unhealthy scenario occurring and provide information on the appropriate action for you to take: + +| Signal | Trigger | Action | +| - | - | - | +| [/testall at load balancer level](/appliance/monitoring/testall) | Does not return 200 with body OK | [Submit a support ticket](/support/tickets) with a severity of **Urgent** | +| [/testall at node level](/appliance/monitoring/testall#monitoring-individual-nodes) | Does not return 200 with body OK | [Submit a support ticket](/support/tickets) with a severity of **High** | +| [GET /status/memory](/appliance/monitoring/authenticated-endpoints#get-status-memory) at node level | Returns a 520 status code | [Submit a support ticket](/support/tickets) with a severity of **Normal** | +| [GET /status/disk](/appliance/monitoring/authenticated-endpoints#get-status-disk) at node level | Returns a 520 status code | [Submit a support ticket](/support/tickets) with a severity of **Normal** | +| [GET /status/network](/appliance/monitoring/authenticated-endpoints#get-status-network) at node level | Returns a 520 status code | [Submit a support ticket](/support/tickets) with a severity of **Normal** | +| [GET /status/internet](/appliance/monitoring/authenticated-endpoints#get-status-internet) at node level | Returns a 520 status code | [Submit a support ticket](/support/tickets) with a severity of **Normal** | +| [GET /status/email](/appliance/monitoring/authenticated-endpoints#get-status-email) at node level | Returns a 520 status code | [Submit a support ticket](/support/tickets) with a severity of **Normal** | +| [GET /status/db](/appliance/monitoring/authenticated-endpoints#get-status-db) at node level | Returns a 520 status code | [Submit a support ticket](/support/tickets) with a severity of **Normal** | +| [GET /status/replicaset](/appliance/monitoring/authenticated-endpoints#get-status-replicaset) at node level | Returns a 520 status code | [Submit a support ticket](/support/tickets) with a severity of **Normal** | +| Synthetic Transaction: Login | Synthetic login failed | [Submit a support ticket](/support/tickets) with a severity of **Normal** | + +When building your monitoring strategy for a PSaaS Appliance implementation hosted on an environment you own or control, remember that you are responsible for using the instrumentation and tenant log data to watch for anomalies. + +## Your Responsibilities in Monitoring the Auth0-Hosted PSaaS Appliance + +If Auth0 hosts your PSaaS Appliance, you won't have access to instrumentation data. However, you are still expected to monitor your tenant logs for anomalies, since this provides you information on the health of your PSaaS Appliance-dependent applications. + +If Auth0 hosts your PSaaS Appliance implementation, Auth0's Managed Service Engineering (MSE) team is responsible for monitoring. However, the MSE team is focused on the health of the PSaaS Appliance – you are responsible for tracking the health of your applications, as well as its usage of Auth0. + +If you provide Auth0 with the appropriate email addresses, Auth0 can send a daily uptime report of your hosted PSaaS Appliance service to those email addresses. You can also specify one or more email addresses to which Auth0 will send alerts in the event that there is an issue. diff --git a/articles/appliance/monitoring/testall.md b/articles/appliance/monitoring/testall.md index e3e3b76298..442f42ee39 100644 --- a/articles/appliance/monitoring/testall.md +++ b/articles/appliance/monitoring/testall.md @@ -1,6 +1,14 @@ --- section: appliance description: Overview of using the testall endpoint with the PSaaS Appliance +topics: + - appliance + - monitoring + - testing +contentType: how-to +useCase: appliance +applianceId: appliance49 +sitemap: false --- # Using the `testall` Endpoint @@ -25,9 +33,11 @@ Alternatively, if there are any issues, `/testall` returns a `5xx` response code Typically, the above endpoint will reach the load balancer, but since a typical, highly-available deployment will have at least three nodes, Auth0 recommends monitoring those endpoints as well: -* `https://{IP Address Node 1}/testall` -* `https://{IP Address Node 2}/testall` -* `https://{IP Address Node 3}/testall` +* `http://{IP Address Node 1}/testall` +* `http://{IP Address Node 2}/testall` +* `http://{IP Address Node 3}/testall` + +Be sure to use the `http` *not* `https` in your URLs. ### Non-Responsive Nodes diff --git a/articles/appliance/private-cloud-requirements.md b/articles/appliance/private-cloud-requirements.md index 3814ccf858..58a4f080df 100644 --- a/articles/appliance/private-cloud-requirements.md +++ b/articles/appliance/private-cloud-requirements.md @@ -2,6 +2,14 @@ section: appliance description: This document details the requirements for the Auth0 Dedicated Cloud Service. toc: true +topics: + - appliance + - private-cloud + - requirements +contentType: reference +useCase: appliance +applianceId: appliance61 +sitemap: false --- # Requirements for the Auth0 Dedicated Cloud Service @@ -70,7 +78,7 @@ The Management Dashboard, Webtask, and App Tenant(s) **must** be a part of the s The hostname (such as **manage-project**.yourdomain.auth0.com) must be at least three characters long and must **not** contain any underscores(_). -The word `login` is reserved and **cannot** be used. +The word `login` is reserved and **cannot** be used. Please also refer to the [full list of reserved words](/appliance/infrastructure/dns#hostnames). The domain name you use for tenants hosted in the Dedicated Cloud Service **cannot** be the same as any you're using for tenants hosted in the Public Cloud Service. diff --git a/articles/appliance/raci.md b/articles/appliance/raci.md index e283148842..4d86c2fe93 100644 --- a/articles/appliance/raci.md +++ b/articles/appliance/raci.md @@ -1,6 +1,13 @@ --- section: appliance description: This document details who is responsible for what aspects of a given PSaaS Appliance installation. +topics: + - appliance + - raci +contentType: reference +useCase: appliance +applianceId: appliance62 +sitemap: false --- # PSaaS Appliance: Roles and Responsibilities @@ -36,14 +43,14 @@ The following RACI Matrix provides a more in-depth summary of the roles and resp |PSaaS Appliance-Related Tasks or Deliverables|Auth0|Subscriber|Notes| |---|---|---|---| |Preparing VM Infrastructure, including: memory, storage, processors, load balances, networks, SSL certificates, DNS records, SMTP servers, enabling Auth0 access via Jumphost/VPN|C|R, A (subscriber's infrastructure engineer)|The subscriber will submit the PSaaS Appliance Infrastructure Checklist when the VMs are ready and the [infrastructure requirements](/appliance/infrastructure) are met.| -|Deployment to Development and Production environments|R, A - Auth0 Customer Success Engineer|I|The Auth0 Customer Success Engineer will SSH into the VMs and deploy the Appliance.| -|Configuration of Development and Production environments|C|R|The Auth0 CSE will show the subscriber's infrastructure engineer [how to upload the SSL certificates, enter the SMTP credentials, and add administrators](/appliance/dashboard).| -|Operations Handover|R|C|Auth0 Customer Success Engineers will provide a 90-minute Operations Handover meeting to review information regarding PSaaS Appliance monitoring, backup, and updates, as well as answer questions.| +|Deployment to Development and Production environments|R, A - Auth0 Managed Service Engineer (MSE)|I|The Auth0 Managed Service Engineer will SSH into the VMs and deploy the Appliance.| +|Configuration of Development and Production environments|C|R|The Auth0 MSE will show the subscriber's infrastructure engineer [how to upload the SSL certificates, enter the SMTP credentials, and add administrators](/appliance/dashboard).| +|Operations Handover|R|C|Auth0 Managed Service Engineers will provide a 90-minute Operations Handover meeting to review information regarding PSaaS Appliance monitoring, backup, and updates, as well as answer questions.| |Monitoring|I|R, A|The subscriber is responsible for [monitoring the PSaaS Appliance](/appliance/monitoring).| |Backing Up|I (in the event that there are issues)|R, A|The subscriber is responsible for [backing up the PSaaS Appliance](/appliance/disaster-recovery) using the [Command-Line Tools](/appliance/cli).| |Code Integration into Applications|C, I (in the event that there are issues)|R, A|The subscriber is responsible for Auth0 code integration.| |User Migration (if required)|C, I (in the event that there are issues)|R, A|The subscriber is responsible for migrating users where appropriate.| -|Updates|R|R, A|Auth0 Customer Success Engineers will partner with the subscriber's infrastructure engineers to update the PSaaS Appliance on an agreed-upon basis. The subscriber is responsible for: taking VM snapshot(s) prior to the update, providing access to the PSaaS Appliance, being present as the PSaaS Appliance updates. Auth0 is responsible for: running manual scripts (if required), informing the subscriber on the status of the upgrade.| +|Updates|R|R, A|Auth0 Managed Service Engineers will partner with the subscriber's infrastructure engineers to update the PSaaS Appliance on an agreed-upon basis. The subscriber is responsible for: taking VM snapshot(s) prior to the update, providing access to the PSaaS Appliance, being present as the PSaaS Appliance updates. Auth0 is responsible for: running manual scripts (if required), informing the subscriber on the status of the upgrade.| |Testing Updates|C, I (in the event that there are questions/issues)|R, A|The subscriber will test the PSaaS Appliance after the Development node has been updated and inform Auth0 about any issues.| |Issue Identification and Support Ticket Submission|C|R, A|The subscriber is responsible for submitting issues via the [Support Center](/onboarding/enterprise-support).| |Issue Resolution|R|C|Auth0 will provide support for issues within the *core* of the PSaaS Appliance. Auth0 will *consult* on issues pertaining to integration between Auth0 APIs and Dashboards.| diff --git a/articles/appliance/remote-access-options.md b/articles/appliance/remote-access-options.md index 6b0e8b96c5..586fd59a1f 100644 --- a/articles/appliance/remote-access-options.md +++ b/articles/appliance/remote-access-options.md @@ -1,6 +1,13 @@ --- title: PSaaS Appliance Remote Access Options description: Remote Access Options Available for those with PSaaS Appliance +topics: + - appliance + - remote-access +contentType: reference +useCase: appliance +applianceId: appliance63 +sitemap: false --- # PSaaS Appliance Remote Access Options @@ -43,25 +50,7 @@ Similar to option 1, this configuration permits an external Auth0 Jumphost to co * Additional virtual Jumphost required in customer infrastructure -### Option 3: VPN - -This configuration provides VPN access to the customer’s network either to Auth0 engineers individually or a dedicated, Jumphost-like Auth0 server. - -![](/media/articles/appliance/remote-access/vpn.png) - -*Pros*: - -* Customers usually have VPN infrastructure in place -* No additional servers are required -* Auth0 access can be enabled and disabled using existing VPN account procedures - -*Cons*: - -* Inability to audit management activity on the command line -* Customer responsible for provisioning VPN accounts for Auth0 engineers and Identity Management -* Customer responsible for securing VPN traffic only to PSaaS appliance -* Customer is responsible for VPN availability (critical to allow access during support events) ### Unsupported Configurations -We do not support other methods, such as VDI or Screen Sharing mechanisms. They introduce compliance concerns, including (but not limited to) Auth0’s inability to internally audit connections and SSH sessions, enforce identity management on Auth0 employee accounts,exposure to untrusted systems on customer’s end running non-standard software (from where the connections are generated to Auth0 VMs), and inability to verify the identity of participants on the other end. \ No newline at end of file +We do not support other methods, such as VDI or Screen Sharing mechanisms. They introduce compliance concerns, including (but not limited to) Auth0’s inability to internally audit connections and SSH sessions, enforce identity management on Auth0 employee accounts, exposure to untrusted systems on customer’s end running non-standard software (from where the connections are generated to Auth0 VMs), and inability to verify the identity of participants on the other end. diff --git a/articles/appliance/webtasks/dedicated-domains.md b/articles/appliance/webtasks/dedicated-domains.md index 60008d3540..11bbe60ff3 100644 --- a/articles/appliance/webtasks/dedicated-domains.md +++ b/articles/appliance/webtasks/dedicated-domains.md @@ -3,15 +3,24 @@ section: appliance title: Configure Webtask with Dedicated Domains description: How to use dedicated domains with your PSaaS Appliance Webtask toc: true +topics: + - appliance + - webtask + - domains +contentType: + - concept + - reference + - how-to +useCase: appliance +applianceId: appliance50 +sitemap: false --- # PSaaS Appliance: Webtask with Dedicated Domains -Some extensions, such as the [Authorization Extension](/extensions/authorization-extension/v2), required us to enable full trust in your PSaaS environment to run correctly. - -Beginning with PSaaS Appliance version `13451`, you may now configure Webtask on a dedicated domain. This enables you to safely use extensions in multi-tenant environments (the behavior is akin to that of the Auth0 Public Cloud Service). +In order to use extensions, such as the [Authorization Extension](/extensions/authorization-extension/v2), you will need to configure Webtasks on a dedicated domain in PSaaS Appliance environments. This enables you to safely use extensions in multi-tenant environments (the behavior is akin to that of the Auth0 Public Cloud Service). ::: note -If you do not use Webtask or [Extensions](/appliance/extensions), you do not need to implement Webtask dedicated domains. +If you are planning on using [Extensions](/appliance/extensions), you must implement Webtask dedicated domains. ::: ## Background @@ -81,7 +90,7 @@ No. Because the tenant name is used in the first part of the domains for the Aut **Do I have to enable Webtask Dedicated Domains?** -Yes, if you are planning to use extensions. If you are not planning on using extensions, you do not have to enable dedicated domains. +Yes, if you are planning on using Extensions, you must implement Webtask dedicated domains. **Can the Webtask tenant names differ from the one used by the Auth0 tenant?** diff --git a/articles/appliance/webtasks/index.md b/articles/appliance/webtasks/index.md index 7260e6488c..c390c9c027 100644 --- a/articles/appliance/webtasks/index.md +++ b/articles/appliance/webtasks/index.md @@ -1,6 +1,15 @@ --- section: appliance description: How to use Webtasks on the PSaaS Appliance +topics: + - appliance + - webtask +contentType: + - concept + - index +useCase: appliance +applianceId: appliance51 +sitemap: false --- # PSaaS Appliance: Webtasks @@ -14,23 +23,7 @@ Prior to working with Webtasks, please ensure that you have configured the: * [Webtask Command Line Interface (`wt-cli`)](https://webtask.io/docs/101) ::: -## Sandboxes - -Auth0 provides different stages (which are known as sandboxes) on which you may run your rules and custom database logic: - -* `node_sandbox` (default): while more secure than `eval`, `node_sandbox` is more resource intensive; -* `eval`: provides the best performance, but is the least secure of the three available modes; -* `auth0-sandbox`: provides better performance that `node_sandbox`, improved isolation over `eval`, and offers a greater number of Node.js modules for use with your custom code. - -::: note -Only one sandbox mode may be selected at any given time (for example, you may not run selected rules in one sandbox and other rules in another sandbox). If you would like to change the sandbox mode, please discuss this with your Auth0 Customer Success Engineer. -::: - -## Code Compatibility - -Code that you have written for use with `node-sandbox` or `eval` will work in `auth0-sandbox`. However, code that is written for `auth0-sandbox` may not be compatible with `node-sandbox` or `eval`, especially if your code uses modules. - -The `auth0-sandbox` is the recommended method for running your custom code. +Auth0 provides `auth0-sandbox`, a stage (sometimes referred to as a *sandbox*) on which you may run your rules and custom database logic. ## Working with Webtasks @@ -38,11 +31,13 @@ You may use Webtasks by calling its endpoints directly. This can be done using t ### Node.js Modules -Currently, not all of the [Node.js modules available for the Auth0 Cloud Environment](https://tehsis.github.io/webtaskio-canirequire/) are available for the PSaaS Appliance. +Currently, not all of the [Node.js modules available for the Auth0 Cloud Environment](https://auth0-extensions.github.io/canirequire/) are available for the PSaaS Appliance. -To see which modules are available for Webtasks running on PSaaS Appliance instances, execute the [`List Modules` Webtask](https://github.com/tehsis/webtaskio-canirequire/blob/gh-pages/tasks/list_modules.js) using the appropriate sandbox on your PSaaS Appliance instance. +To see which modules are available for Webtasks running on PSaaS Appliance instances, execute the [`List Modules` Webtask](https://github.com/auth0-extensions/canirequire/blob/gh-pages/tasks/list_modules.js) on your PSaaS Appliance instance. -First, copy locally the [`List Modules` Webtask](https://github.com/tehsis/webtaskio-canirequire/blob/gh-pages/tasks/list_modules.js), either by downloading the file or by copying this code: +#### Set up the List Modules Webtask + +First, copy locally the [`List Modules` Webtask](https://github.com/auth0-extensions/canirequire/blob/gh-pages/tasks/list_modules.js), either by downloading the file from GitHub or by copying this code: ```js 'use npm'; @@ -88,13 +83,13 @@ module.exports = cb => { }; ``` -Afterwards, create a webtask profile using `wt-cli`, if you don't already have one. +Next, create a Webtask profile using `wt-cli` (if you don't already have one): ```bash wt init --container "YOUR_TENANT_NAME" --url "WEBTASK_URL" --token "eyJhbGci..." -p "a``YOUR_TENANT_NAME-default" ``` -Now you are ready to register your webtask, using the `wt create` command. This command receives as input a path or URL of the webtasks's code and provides as output the URL where the webtask is available. +Finally, you are ready to register your Webtask using the `wt create` command. This command receives as input a path or URL of the ebtask's code and provides as output the URL where the Webtask is available. If you saved the file under a `my-webtasks` directory as `list_modules.js` you would use the following: @@ -102,8 +97,7 @@ If you saved the file under a `my-webtasks` directory as `list_modules.js` you w wt create ./my-webtasks/list_modules.js ``` -You should get a message that the webtask was created, alongside with the URL to access it. The response is a JSON object. - +You should get a message that the Webtask was created, alongside with the URL to access it. The response is a JSON object. ```json { diff --git a/articles/application-auth/current/client-side-web.md b/articles/application-auth/current/client-side-web.md index 94be5c6b0e..8d504faa5c 100644 --- a/articles/application-auth/current/client-side-web.md +++ b/articles/application-auth/current/client-side-web.md @@ -2,15 +2,25 @@ title: Authentication for Client-side Web Apps description: Explains how to authenticate users in a Client-side Web application. toc: true +topics: + - spa + - authentication + - oauth2 + - implicit +contentType: + - concept + - how-to +useCase: + - add-login --- # Authentication for Client-side Web Apps -The Auth0 OAuth 2.0 authentication endpoints support Client-side Web Applications. These applications are also referred to as JavaScript or Single Page Applications. +You can use the Auth0 Authentication API to create client-side web applications that use [OpenID Connect](/protocols/oidc) and [OAuth 2.0](/protocols/oauth2) to authenticate users and get their authorization to access protected resources. ## Overview -Auth0 exposes OAuth 2.0 endpoints for authenticating any user. You can redirect the user from your JavaScript application to these endpoints in the web browser. Auth0 will handle the authentication of the user, and then redirect the user back to the Callback URL, returning an [ID Token](/tokens/id-token) and [Access Token](/tokens/access-token) in the hash fragment of the request. +Auth0 exposes endpoints that you can use to authenticate users and get their authorization. You can redirect the user from your JavaScript application to these endpoints in the web browser. Auth0 will handle the authentication of the user, get their authorization for the resources your app wants to access, and then redirect the user back to a pre-configured callback URL, returning an [ID Token](/tokens/concepts/id-tokens) and [Access Token](/tokens/concepts/access-tokens) in the hash fragment of the request. ## The Authentication Flow @@ -18,12 +28,12 @@ The OAuth 2.0 Authorization Framework allows for different kinds of authorizatio The Implicit Grant flow is initiated by redirecting the user in the web browser to the Auth0 `/authorize` endpoint. Auth0 will then display the Auth0 Lock dialog, allowing the user to enter their credentials or alternatively sign in with any other configured [Identity Provider](/identityproviders). -After the user has authenticated, Auth0 will redirect the browser back to the **Redirect URI** (also called **Callback URL**), passing along the [ID Token](/tokens/id-token) as parameter in the [hash fragment](https://en.wikipedia.org/wiki/Fragment_identifier). The [ID Token](/tokens/id-token) is a [JSON Web Token (JWT)](/jwt) and contains various attributes (referred to as Claims) regarding the user, such as the user's name, email address, profile picture and so on. +After the user has authenticated, Auth0 will redirect the browser back to the **Redirect URI** (also called **Callback URL**), passing along the [ID Token](/tokens/concepts/id-tokens) as parameter in the [hash fragment](https://en.wikipedia.org/wiki/Fragment_identifier). The [ID Token](/tokens/concepts/id-tokens) is a [JSON Web Token (JWT)](/tokens/concepts/jwts) and contains various attributes (referred to as Claims) regarding the user, such as the user's name, email address, profile picture and so on. -The [ID Token](/tokens/id-token) can be decoded to extract the claims and you are free to use these inside of your application, to display a user's name and profile image for example. +The [ID Token](/tokens/concepts/id-tokens) can be decoded to extract the claims and you are free to use these inside of your application, to display a user's name and profile image for example. ::: note -You can potentially also receive an `access_token` which can be used to call the [Authentication API's `/userinfo` endpoint](/api/authentication#get-user-info) or your own APIs. +You can potentially also receive an Access Token which can be used to call the [Authentication API's `/userinfo` endpoint](/api/authentication#get-user-info) or your own APIs. For more information on calling APIs from Client-side Web Apps, please see [Call APIs from Client-side Web Apps](/api-auth/grant/implicit) ::: @@ -32,22 +42,22 @@ For more information on calling APIs from Client-side Web Apps, please see [Call 1. The Applications initiates the flow and redirects the user to the Authorization Server 2. The user authenticates -3. The Authorization Server redirects the user to the `redirect_uri` with an `id_token` in the hash fragment +3. The Authorization Server redirects the user to the `redirect_uri` with an ID Token in the hash fragment 4. The Applications can now extract the token from the hash fragment. ## Register your Applications -The first thing you need to do is to create a new applications in Auth0. An Auth0 applications maps to your application and allows it to use Auth0 for authentication. +The first thing you need to do is to create a new application in Auth0. An Auth0 application maps to your application and allows it to use Auth0 for authentication. -Navigate to the [Auth0 Dashboard](${manage_url}) and click on the [Applicationss](${manage_url}/#/applicationss) menu option on the left. Create a new Application by clicking on the **Create Applications** button. +Navigate to the [Auth0 Dashboard](${manage_url}) and click on the [Applications](${manage_url}/#/applications) menu option on the left. Create a new Application by clicking on the **Create Applications** button. -The **Create Applications** window will open, allowing you to enter the name of your new application. Choose **Single Page Web Applications** as the **Applications Type** and click on the **Create** button to create the new applications. +The **Create Applications** window will open, allowing you to enter the name of your new application. Choose **Single-Page Web Applications** as the **Applications Type** and click on the **Create** button to create the new applications. ![](/media/articles/client-auth/client-side-web/create-client.png) -Once the applications has been created you can navigate to the **Settings** tab of the applications and in the **Allowed Callback URLs** field add a URL where Auth0 must redirect to after the user has authenticated, such as `https://YOUR_APP/callback`. +Once the application has been created you can navigate to the **Settings** tab of the applications and in the **Allowed Callback URLs** field add a URL where Auth0 must redirect to after the user has authenticated, such as `https://YOUR_APP/callback`. -This URL must be part of your application, as your application will need to extract the `id_token` from the hash fragment of this URL. +This URL must be part of your application, as your application will need to extract the ID Token from the hash fragment of this URL. ![](/media/articles/client-auth/client-side-web/allowed-callback-url.png) @@ -59,17 +69,17 @@ Save the Settings. ## Call the Authorization URL -The URL used when authenticating a user is `https://${account.namespace}/authorize`. This is the initial endpoint to which a user must be redirected. This will handle checking whether any SSO session is active, authenticating the user and also potentially redirect the user directly to any Identity Provider to handle authentication. +The URL used when authenticating a user is `https://${account.namespace}/authorize`. This is the initial endpoint to which a user must be redirected. This will handle checking whether any Single Sign-on (SSO) session is active, authenticating the user and also potentially redirect the user directly to any Identity Provider to handle authentication. This endpoint supports the following query string parameters: | Parameter | Description | |:------------------|:---------| -| response_type | The response type specifies the Grant Type you want to use. For client-side web applications using the Implicit Grant Flow this should be `id_token`. (If you also want to receive an `access_token` it should be set to `token id_token`.) | +| response_type | The response type specifies the Grant Type you want to use. For client-side web applications using the Implicit Grant Flow, this should be `id_token`. (If you also want to receive an Access Token it should be set to `token id_token`.) | | client_id | The Client ID of the Applications you registered in Auth0. This can be found on the **Settings** tab of your Applications in the Auth0 Dashboard | -| scope | Specifies the claims (or attributes) of the user you want the be returned in the [ID Token](/tokens/id-token). To obtain an [ID Token](/tokens/id-token) you need to specify at least a scope of `openid`. If you want to return the user's full profile information, you can request `openid profile`.

      You can read up more about [scopes](/scopes). | +| scope | Specifies the claims (or attributes) of the user you want the be returned in the [ID Token](/tokens/concepts/id-tokens). To obtain an [ID Token](/tokens/concepts/id-tokens) you need to specify at least a scope of `openid`. If you want to return the user's full profile information, you can request `openid profile`.

      You can read up more about [scopes](/scopes). | | redirect_uri | The URL in your application where the user will be redirected to after they have authenticated, such as `https://YOUR_APP/callback`| -| connection | This is an optional parameter which allows you to force the user to sign in with a specific connection. You can for example pass a value of `github` to send the user directly to GitHub to log in with their GitHub account.

      If this parameter is not specified the user will be presented with the normal Auth0 Lock screen from where they can sign in with any of the available connections. You can see the list of configured connections on the **Connections** tab of your applications. | +| connection | This is an optional parameter which allows you to force the user to sign in with a specific connection. You can for example pass a value of `github` to send the user directly to GitHub to log in with their GitHub account.

      If this parameter is not specified, the user will be presented with the normal Auth0 Lock screen from where they can sign in with any of the available connections. You can see the list of configured connections on the **Connections** tab of your applications. | | state | The state parameter will be sent back should be used for CSRF and contextual information (like a return url) | | nonce | A string value which will be included in the response from Auth0, [used to prevent token replay attacks](/api-auth/tutorials/nonce). **This is required.** | @@ -79,19 +89,19 @@ This endpoint supports the following query string parameters: ## Handle the callback -After the user has authenticated, Auth0 will call back to the URL specified in the `redirect_uri` query string parameter which was passed to the `/authorize` endpoint. When calling back to this URL, Auth0 will pass along the [ID Token](/tokens/id-token) in the hash fragment of the URL, such as +After the user has authenticated, Auth0 will call back to the URL specified in the `redirect_uri` query string parameter which was passed to the `/authorize` endpoint. When calling back to this URL, Auth0 will pass along the [ID Token](/tokens/concepts/id-tokens) in the hash fragment of the URL, such as ```text https://YOUR_APP/callback#id_token=eyJ0... ``` -The [ID Token](/tokens/id-token) will be a [JSON Web Token (JWT)](/jwt) containing information about the user. You can access the hash fragment using the `window.location.hash` property and then use basic JavaScript string manipulation to access the `id_token`. +The [ID Token](/tokens/concepts/id-tokens) will be a [JSON Web Token (JWT)](/tokens/concepts/jwts) containing information about the user. You can access the hash fragment using the `window.location.hash` property and then use basic JavaScript string manipulation to access the ID Token. -You will need to decode the [ID Token](/tokens/id-token) in order to read the claims (or attributes) of the user. The [JWT section of our website](/jwt) contains more information about the structure of a JWT. +You will need to decode the [ID Token](/tokens/concepts/id-tokens) in order to read the claims (or attributes) of the user. -Once the JWT is decoded, you can extract the information about the user from the payload of the [ID Token](/tokens/id-token). This is a JSON structure and will contain the claims (attributes) about the user as well as some other metadata. +Once the JWT is decoded, you can extract the information about the user from the payload of the [ID Token](/tokens/concepts/id-tokens). This is a JSON structure and will contain the claims (attributes) about the user as well as some other metadata. -The [Auth0.js library](https://auth0.com/docs/libraries/auth0js) can assist you in decoding the JWT by calling the `parseHash` function, and then access the `id_token` values from the `idTokenPayload` property: +The [Auth0.js library](https://auth0.com/docs/libraries/auth0js) can assist you in decoding the JWT by calling the `parseHash` function, and then access the ID Token values from the `idTokenPayload` property: ```html @@ -128,7 +138,7 @@ The [Auth0.js library](https://auth0.com/docs/libraries/auth0js) can assist you if (authResult && authResult.idTokenPayload) { window.location.hash = ''; alert('your user_id is: ' + authResult.idTokenPayload.sub); - } + } }); } @@ -141,7 +151,7 @@ The [Auth0.js library](https://auth0.com/docs/libraries/auth0js) can assist you ### The ID Token payload -An example payload for an [ID Token](/tokens/id-token) may look something like this: +An example payload for an [ID Token](/tokens/concepts/id-tokens) may look something like this: ```json { @@ -165,13 +175,13 @@ The payload above contains the following claims: | email | The email address of the user which is returned from the Identity Provider. | | picture | The profile picture of the user which is returned from the Identity Provider. | | sub | The unique identifier of the user. This is guaranteed to be unique per user and will be in the format (identity provider)|(unique id in the provider), such as github|1234567890. | -| iss | The _issuer_. A case-sensitive string or URI that uniquely identifies the party that issued the JWT. For an Auth0 issued [ID Token](/tokens/id-token), this will be **the URL of your Auth0 tenant**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | -| aud | The _audience_. Either a single case-sensitive string or URI or an array of such values that uniquely identify the intended recipients of this JWT. For an Auth0 issued [ID Token](/tokens/id-token), this will be the **Client ID of your Auth0 Applications**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | +| iss | The _issuer_. A case-sensitive string or URI that uniquely identifies the party that issued the JWT. For an Auth0 issued [ID Token](/tokens/concepts/id-tokens), this will be **the URL of your Auth0 tenant**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | +| aud | The _audience_. Either a single case-sensitive string or URI or an array of such values that uniquely identify the intended recipients of this JWT. For an Auth0 issued [ID Token](/tokens/concepts/id-tokens), this will be the **Client ID of your Auth0 Applications**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | | exp | The _expiration time_. A number representing a specific date and time in the format “seconds since epoch” as [defined by POSIX6](https://en.wikipedia.org/wiki/Unix_time). This claim sets the exact moment from which this **JWT is considered invalid**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | | iat | The _issued at time_. A number representing a specific date and time (in the same format as `exp`) at which this **JWT was issued**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | | nonce | A string value which was sent with the request to the `/authorize` endpoint. This is used to [prevent token replay attacks](/api-auth/tutorials/nonce). | -The exact claims contained in the [ID Token](/tokens/id-token) will depend on the `scope` parameter you sent to the `/authorize` endpoint. In an [ID Token](/tokens/id-token) issued by Auth0, the **registered claims** and the `sub` claim will always be present, but the other claims depends on the `scope`. You can refer to the [examples below](#examples) to see examples of how the scope influences the claims being returned. +The exact claims contained in the [ID Token](/tokens/concepts/id-tokens) will depend on the `scope` parameter you sent to the `/authorize` endpoint. In an [ID Token](/tokens/concepts/id-tokens) issued by Auth0, the **registered claims** and the `sub` claim will always be present, but the other claims depends on the `scope`. You can refer to the [examples below](#examples) to see examples of how the scope influences the claims being returned. ::: note The [JWT.io website](https://jwt.io) has a handy debugger which will allow you to debug any JSON Web Token. This is useful is you quickly want to decode a JWT to see the information contained in the token. @@ -179,7 +189,7 @@ The [JWT.io website](https://jwt.io) has a handy debugger which will allow you t ### Keep the user logged in -Auth0 will assist you in authenticating a user, but it is up to you to keep track in your application of whether or not a user is logged in. You can use `localStorage` to keep track of whether a user is logged in or not, and also to store the claims of the user which was extracted from the [ID Token](/tokens/id-token). +Auth0 will assist you in authenticating a user, but it is up to you to keep track in your application of whether or not a user is logged in. You can use `localStorage` to keep track of whether a user is logged in or not, and also to store the claims of the user which was extracted from the [ID Token](/tokens/concepts/id-tokens). You can then use those claims inside of your application to display the user's information or otherwise personalize the user's experience. @@ -204,7 +214,7 @@ ${account.callback} #id_token=eyJ0... ``` -And this is an example of the decoded payload of the [ID Token](/tokens/id-token) which will be returned: +And this is an example of the decoded payload of the [ID Token](/tokens/concepts/id-tokens) which will be returned: ```json { @@ -237,7 +247,7 @@ ${account.callback} #id_token=eyJ0... ``` -The name and profile picture will be available in the `name` and `picture` claims of the returned [ID Token](/tokens/id-token): +The name and profile picture will be available in the `name` and `picture` claims of the returned [ID Token](/tokens/concepts/id-tokens): ```json { @@ -279,7 +289,7 @@ ${account.callback} #id_token=eyJ0... ``` -The user's name and profile attributes, such as the name, nickname and picture will be available in the `name`, `nickname` and `picture` claims of the returned [ID Token](/tokens/id-token). You will also notice that the `sub` claim contains the User's unique ID returned from GitHub: +The user's name and profile attributes, such as the name, nickname and picture will be available in the `name`, `nickname` and `picture` claims of the returned [ID Token](/tokens/concepts/id-tokens). You will also notice that the `sub` claim contains the User's unique ID returned from GitHub: ```json { diff --git a/articles/application-auth/current/index.md b/articles/application-auth/current/index.md index b332be79b6..685c9b3586 100644 --- a/articles/application-auth/current/index.md +++ b/articles/application-auth/current/index.md @@ -1,17 +1,35 @@ --- classes: topic-page title: Application Authentication -description: Introduction to the various application authentication flows. +description: Introduction to authentication and the various application authentication flows. +topics: + - authentication + - oauth2 +contentType: index +useCase: + - add-login --- -# Application Authentication +# Authentication -Auth0 uses the OAuth 2.0 protocol for authentication and authorization. We support common OAuth 2.0 scenarios for Mobile Applications, Desktop Applications, Server-side web applications or Client-side Web Applications. +Authentication refers to the process of confirming identity. While often used interchangeably with [authorization](/authorization), authentication represents a fundamentally different function. -You can get more details on implementing these flows by following one of the following links: +In authentication, a user or application proves they are who they say they are by providing valid credentials for verification. Authentication is often proved through a username and password, sometimes combined with other elements called _factors_, which fall into three categories: what you know, what you have, or what you are. + +* **Single-Factor Authentication** relies on a password. Example: a school website that only requires validating a password against a username. +* **Two-Factor Authentication** relies on a piece of confidential information in addition to a username and password. Example: a banking website that validates a password against a username and then requires the user to enter a PIN known to only the user. +* **Multi-Factor Authentication (MFA)** uses two or more security factors from independent categories. Example: a hospital system that requires a username and password, a security code received on the user's smartphone, and fingerprint. + +For a comparison of authentication and authorization, see [Authentication vs. Authorization](/authorization/concepts/authz-and-authn). + +# Application Authentication Flows + +Auth0 uses [OpenID Connect](/protocols/oidc) and [OAuth 2.0](/protocols/oauth2) to authenticate users and verify their identity. + +We support scenarios for mobile, desktop, server-side, or client-side applications. You can get more details on implementing these flows by exploring: <%= include('../../_includes/_topic-links', { links: [ - 'application-auth/current/mobile-desktop', - 'application-auth/current/server-side-web', - 'application-auth/current/client-side-web' + 'flows/guides/auth-code-pkce/add-login-auth-code-pkce', + 'flows/guides/implicit/add-login-implicit', + 'flows/guides/auth-code/add-login-auth-code' ] }) %> diff --git a/articles/application-auth/current/mobile-desktop.md b/articles/application-auth/current/mobile-desktop.md index 57847be51b..183b936bb5 100644 --- a/articles/application-auth/current/mobile-desktop.md +++ b/articles/application-auth/current/mobile-desktop.md @@ -2,6 +2,16 @@ title: Authentication for Mobile & Desktop Apps description: Explains how to authenticate users in a mobile or desktop application. toc: true +topics: + - authentication + - oauth2 + - mobile-apps + - desktop-apps +contentType: + - concept + - how-to +useCase: + - add-login --- # Authentication for Mobile & Desktop Apps @@ -11,7 +21,7 @@ You can authenticate users of your mobile/desktop applications by: * Using one of the [Auth0 SDKs](/libraries), which are client-side libraries that **do not** include a user interface but allow for expanded customization of the authentication behavior and appearance of the login screen; * Calling the Auth0 [Authentication API](/api/authentication) endpoints, which allows you to integrate with Auth0 without requiring the user of Auth0's libraries. -This article will cover how to call the Auth0 [Authentication API](/api/authentication) endpoints using [Proof Key for Code Exchange (PKCE)](/api-auth/grant/authorization-code-pkce) during the authentication process. +This article will cover how to call the Auth0 [Authentication API](/api/authentication) endpoints using [Proof Key for Code Exchange (PKCE)](/api-auth/grant/authorization-code-pkce) during the authentication and authorization process. If you would like to implement this functionality using either Lock or one of the Auth0 SDKs, please refer to the following resources: @@ -26,15 +36,17 @@ If you would like to implement this functionality using either Lock or one of th ## Overview -Auth0 exposes OAuth 2.0 endpoints that you can use to authenticate users. You can call these endpoints through an embedded browser in your **native** application. After authentication completes, you can return an [ID Token](/tokens/id-token) that contains the user's profile information. +Auth0 exposes endpoints that you can use to authenticate users and get their authorization. + +You can call these endpoints through an embedded browser in your **native** application. After authentication completes, you can return an [ID Token](/tokens/concepts/id-tokens) (which contains information about the identity of the user) and an [Access Token](/tokens/concepts/access-tokens). ::: note -Instead of following this tutorial, you can use any of Auth0's client libraries. These encapsulate all the logic required and make it easier for your to implement authentication. Please refer to our [Native Quickstarts](/quickstart/native) to get started. +Instead of following this tutorial, you can use any of Auth0's client libraries. They encapsulate all the logic required and make it easier for your to implement authentication. Please refer to our [Native Quickstarts](/quickstart/native) to get started. ::: -## Register Your Application +## Register your application -If you haven't already created a new [Application](/applications) in Auth0, you'll need to do so before implementing your authentication flow. The Auth0 Application maps to your application and allows your application to use Auth0 for authentication purposes. +If you haven't already created a new [application](/applications) in Auth0, you'll need to do so before implementing your authentication flow. The Auth0 Application maps to your application and allows your application to use Auth0 for authentication purposes. Go to the [Auth0 Dashboard](${manage_url}) and click on [Applications](${manage_url}/#/applications) in the left-hand navigation bar. Click **Create Application**. @@ -71,7 +83,7 @@ Once you've created the `code_verifier` and the `code_challenge`, you'll need to * Authenticating the user; * Redirecting the user to an Identity Provider to handle authentication; -* Checking for active SSO sessions. +* Checking for active Single Sign-on (SSO) [sessions](/sessions). To authorize the user, your application must send the user to the [authorization URL](/api/authentication#authorization-code-grant-pkce-) (which includes the `code_challenge` you generated in the previous step, as well as the method you used to generate the `code_challenge`). Your URL should follow this format: @@ -121,11 +133,32 @@ Using the authorization code obtained in step 2, you can obtain the ID Token by "method": "POST", "url": "https://${account.namespace}/oauth/token", "headers": [ - { "name": "Content-Type", "value": "application/json" } + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } ], "postData": { - "mimeType": "application/json", - "text": "{\"grant_type\":\"authorization_code\",\"client_id\": \"${account.clientId}\",\"code_verifier\": \"YOUR_GENERATED_CODE_VERIFIER\",\"code\": \"YOUR_AUTHORIZATION_CODE\",\"redirect_uri\": \"https://${account.namespace}/mobile\" }" + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "authorization_code" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "code_verifier", + "value": "YOUR_GENERATED_CODE_VERIFIER" + }, + { + "name": "code", + "value": "YOUR_AUTHORIZATION_CODE" + }, + { + "name": "redirect_uri", + "value": "https://${account.namespace}/mobile" + } + ] } } ``` @@ -145,7 +178,7 @@ If all goes well, you'll receive an HTTP 200 response with the following payload ``` ::: note -You can use the `access_token` to call the [Authentication API's `/userinfo` endpoint](/api/authentication#get-user-info). +You can use the Access Token to call the [Authentication API's `/userinfo` endpoint](/api/authentication#get-user-info). ::: ## The ID Token @@ -165,7 +198,7 @@ Once you've decoded the ID Token, you can extract user information from it. The } ``` -For additional details, please see our docs [on the ID Token and its claims](/tokens/id-token#id-token-payload). +For additional details, please see our docs [on the ID Token and its claims](/tokens/id-tokens#id-token-payload). ::: note For a list of libraries you can use to verify and decode tokens refer to [JWT.io](https://jwt.io/#libraries-io). @@ -202,11 +235,32 @@ Using the authorization code, you can obtain the ID Token by making a `POST` cal "method": "POST", "url": "https://${account.namespace}/oauth/token", "headers": [ - { "name": "Content-Type", "value": "application/json" } + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } ], "postData": { - "mimeType": "application/json", - "text": "{\"grant_type\":\"authorization_code\",\"client_id\": \"${account.clientId}\",\"code_verifier\": \"YOUR_GENERATED_CODE_VERIFIER\",\"code\": \"YOUR_AUTHORIZATION_CODE\",\"redirect_uri\": \"${account.namespace}/mobile\" }" + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "authorization_code" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "code_verifier", + "value": "YOUR_GENERATED_CODE_VERIFIER" + }, + { + "name": "code", + "value": "YOUR_AUTHORIZATION_CODE" + }, + { + "name": "redirect_uri", + "value": "https://${account.namespace}/mobile" + } + ] } } ``` @@ -223,7 +277,7 @@ If all goes well, you'll receive an HTTP 200 response with the following payload } ``` -By extracting the `id_token`, which now contains the additional `name` and `picture` claims you requested, you'll see something similar to the following once you've decoded the payload: +By extracting the ID Token, which now contains the additional `name` and `picture` claims you requested, you'll see something similar to the following once you've decoded the payload: ```json { @@ -272,11 +326,32 @@ Using the authorization code, you can obtain the ID Token by making a `POST` cal "method": "POST", "url": "https://${account.namespace}/oauth/token", "headers": [ - { "name": "Content-Type", "value": "application/json" } + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } ], "postData": { - "mimeType": "application/json", - "text": "{\"grant_type\":\"authorization_code\",\"client_id\": \"${account.clientId}\",\"code_verifier\": \"YOUR_GENERATED_CODE_VERIFIER\",\"code\": \"YOUR_AUTHORIZATION_CODE\",\"redirect_uri\": \"${account.namespace}/mobile\" }" + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "authorization_code" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "code_verifier", + "value": "YOUR_GENERATED_CODE_VERIFIER" + }, + { + "name": "code", + "value": "YOUR_AUTHORIZATION_CODE" + }, + { + "name": "redirect_uri", + "value": "https://${account.namespace}/mobile" + } + ] } } ``` @@ -293,7 +368,7 @@ If all goes well, you'll receive an `HTTP 200` response with the following paylo } ``` -You can pull the user's name, profile picture, and email address from the `name`, `picture`, and `email` claims of the returned `id_token`. Note that the `sub` claim contains the user's unique ID as returned from GitHub: +You can pull the user's name, profile picture, and email address from the `name`, `picture`, and `email` claims of the returned ID Token. Note that the `sub` claim contains the user's unique ID as returned from GitHub: ```json { diff --git a/articles/application-auth/current/server-side-web.md b/articles/application-auth/current/server-side-web.md index ca2980a9a2..026aa3dab9 100644 --- a/articles/application-auth/current/server-side-web.md +++ b/articles/application-auth/current/server-side-web.md @@ -2,15 +2,26 @@ title: Authentication for Server-side Web Apps description: Explains how to authenticate users in a Server-side Web application. toc: true +topics: + - oauth2 + - authentication + - server-side-apps +contentType: + - concept + - how-to +useCase: + - add-login --- # Authentication for Server-side Web Apps -You can use the Auth0 Authentication API to create server-side web applications that uses OAuth 2.0 authorization to authenticate users. +You can use the Auth0 Authentication API to create server-side web applications that uses OAuth 2.0 and OpenID Connect (OIDC) to authenticate users and get their authorization to access protected resources. ## Overview -Auth0 exposes OAuth 2.0 endpoints for authenticating any user. You can redirect the user from your web application to these endpoints in the web browser. Auth0 will handle the authentication of the user, and then redirect the user back to the `redirect_uri` (also referred to as the Callback URL), returning an authorization `code` in the query string parameters of the Callback URL. This `code` can then be exchanged for an [ID Token](/tokens/id-token) which contains the identity of the user. +Auth0 exposes endpoints that you can use to authenticate users and get their authorization. + +You can redirect the user from your web application to these endpoints in the web browser. Auth0 will handle the authentication of the user, and then redirect the user back to a pre-configured callback URL, returning an authorization code in the query string parameters of the callback URL. This code can then be exchanged for an [ID Token](/tokens/concepts/id-tokens) (which contains information about the identity of the user) and an [Access Token](/tokens/concepts/access-tokens). ## The Authentication Flow @@ -18,12 +29,12 @@ The OAuth 2.0 Authorization Framework allows for different kinds of authorizatio The Authorization Code flow is initiated by redirecting the user in the web browser to the Auth0 `/authorize` endpoint. Auth0 will then display the Auth0 Lock dialog, allowing the user to enter their credentials or alternatively sign in with any other configured [Identity Provider](/identityproviders). -After the user has authenticated, Auth0 will redirect the browser back to the **Redirect URI** (also called **Callback URL**), passing along a `code` parameter in the query string of the Callback URL. This `code` can then be exchanged for an [ID Token](/tokens/id-token) by making a request to the `/oauth/token` endpoint. +After the user has authenticated, Auth0 will redirect the browser back to the **Redirect URI** (also called **Callback URL**), passing along a `code` parameter in the query string of the Callback URL. This `code` can then be exchanged for an [ID Token](/tokens/concepts/id-tokens) by making a request to the `/oauth/token` endpoint. -The ID Token is a [JSON Web Token (JWT)](/jwt) and contains various attributes regarding the user, such as the user's name, email address, profile picture and so on. These attributes are referred to as **Claims** and they can be extracted from the ID Token and used in your application (for example, to display a user's name and profile image). +The ID Token is a [JSON Web Token (JWT)](/tokens/concepts/jwts) and contains various attributes regarding the user, such as the user's name, email address, profile picture and so on. These attributes are referred to as **Claims** and they can be extracted from the ID Token and used in your application (for example, to display a user's name and profile image). ::: note -You will also receive an [Access Token](/tokens/access-token) which you can use to call the [Authentication API's `/userinfo` endpoint](/api/authentication#get-user-info) or your own APIs. For more information on calling APIs web apps running on the server, see [Calling APIs from Server-side Web Apps](/api-auth/grant/authorization-code) +You will also receive an [Access Token](/tokens/concepts/access-tokens) which you can use to call the [Authentication API's `/userinfo` endpoint](/api/authentication#get-user-info) or your own APIs. For more information on calling APIs web apps running on the server, see [Calling APIs from Server-side Web Apps](/api-auth/grant/authorization-code) ::: ![Authentication flow for server-side web apps](/media/articles/client-auth/server-side-web/server-side-web-flow.png) @@ -58,7 +69,7 @@ Save the Settings. ## Call the Authorization URL -The URL used when authenticating a user is `https://${account.namespace}/authorize`. This is the initial endpoint to which a user must be redirected. This will handle checking whether any SSO session is active, authenticating the user and also potentially redirect the user directly to any Identity Provider to handle authentication. +The URL used when authenticating a user is `https://${account.namespace}/authorize`. This is the initial endpoint to which a user must be redirected. This will handle checking whether any Single Sign-on (SSO) [session](/sessions) is active, authenticating the user and also potentially redirect the user directly to any Identity Provider to handle authentication. This endpoint supports the following query string parameters: @@ -89,11 +100,32 @@ You application will need to handle the request to this callback URL, extract th "method": "POST", "url": "https://${account.namespace}/oauth/token", "headers": [ - { "name": "Content-Type", "value": "application/json" } + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } ], "postData": { - "mimeType": "application/json", - "text": "{\"grant_type\":\"authorization_code\",\"client_id\": \"${account.clientId}\",\"client_secret\": \"YOUR_CLIENT_SECRET\",\"code\": \"YOUR_AUTHORIZATION_CODE\",\"redirect_uri\": \"${account.callback}\"}" + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "authorization_code" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "client_secret", + "value": "YOUR_CLIENT_SECRET" + }, + { + "name": "code", + "value": "YOUR_AUTHORIZATION_CODE" + }, + { + "name": "redirect_uri", + "value": "https://${account.callback}" + } + ] } } ``` @@ -109,7 +141,7 @@ The response from `/oauth/token` contains `access_token`, `expires_in`, `id_toke } ``` -The `token_type` will be set to **Bearer** and the `id_token` will be a [JSON Web Token (JWT)](/jwt) containing information about the user. You will need to decode the `id_token` in order to read the claims (or attributes) of the user. The [JWT section of our website](/jwt) contains more information about the structure of a JWT. +The `token_type` will be set to **Bearer** and the `id_token` will be a [JSON Web Token (JWT)](/tokens/concepts/jwts) containing information about the user. You will need to decode the ID Token in order to read the claims (or attributes) of the user. The [JWT section of our website](/tokens/concepts/jwts) contains more information about the structure of a JWT. You can refer to the [libraries section on the JWT.io website](https://jwt.io/#libraries-io) in order to obtain a library for your programming language of choice which will assist you in decoding the ID Token. @@ -178,7 +210,7 @@ After the user has authenticated, they will be redirected back to the `redirect_ ${account.callback}?code=2OKj... ``` -You can then exchange the `code` for an ID Token. This is an example of the decoded payload of the `id_token` which will be returned: +You can then exchange the `code` for an ID Token. This is an example of the decoded payload of the ID Token which will be returned: ```json { @@ -208,7 +240,7 @@ After the user has authenticated, they will be redirected back to the `redirect_ ${account.callback}?code=2OKj... ``` -You can then exchange the `code` for an ID Token. The profile attributes of the user, such as the name and profile picture will be available in the `name` and `picture` claims of the returned `id_token`: +You can then exchange the `code` for an ID Token. The profile attributes of the user, such as the name and profile picture will be available in the `name` and `picture` claims of the returned ID Token: ```json { diff --git a/articles/application-auth/legacy/client-side-web.md b/articles/application-auth/legacy/client-side-web.md index 31611ec17b..da677b5d3a 100644 --- a/articles/application-auth/legacy/client-side-web.md +++ b/articles/application-auth/legacy/client-side-web.md @@ -1,6 +1,16 @@ --- description: Explains how to authenticate users in a Client-side Web application. toc: true +topics: + - spa + - authentication + - oauth2 + - implicit +contentType: + - concept + - how-to +useCase: + - add-login --- # Authentication for Client-side Web Apps @@ -8,11 +18,11 @@ toc: true This document covers an outdated version of the Auth0 authentication pipeline. We recommend you use the current version, using the dropdown. For more on the latest authentication pipeline refer to [Introducing OIDC Conformant Authentication](/api-auth/intro). ::: -The Auth0 OAuth 2.0 authentication endpoints support Client-side Web Applications. These applications are also referred to as JavaScript or Single Page Applications. +The Auth0 OAuth 2.0 authentication endpoints support Client-side Web Applications. These applications are also referred to as JavaScript or Single-Page Applications. ## Overview -Auth0 exposes OAuth 2.0 endpoints for authenticating any user. You can redirect the user from your JavaScript application to these endpoints in the web browser. Auth0 will handle the authentication of the user, and then redirect the user back to the Callback URL, returning the `id_token` in the hash fragment of the request. +Auth0 exposes OAuth 2.0 endpoints for authenticating any user. You can redirect the user from your JavaScript application to these endpoints in the web browser. Auth0 will handle the authentication of the user, and then redirect the user back to the Callback URL, returning the ID Token in the hash fragment of the request. ## The Authentication Flow @@ -20,15 +30,15 @@ The OAuth 2.0 Authorization Framework allows for different kinds of authorizatio The Implicit Grant flow is initiated by redirecting the user in the web browser to the Auth0 `/authorize` endpoint. Auth0 will then display the Auth0 Lock dialog, allowing the user to enter their credentials or alternatively sign in with any other configured [Identity Provider](/identityproviders). -After the user has authenticated, Auth0 will redirect the browser back to the **Redirect URI** (also called **Callback URL**), passing along an `id_token` parameter in the [hash fragment](https://en.wikipedia.org/wiki/Fragment_identifier). The `id_token` is a [JSON Web Token (JWT)](/jwt) and contains various attributes - referred to as _Claims_ - regarding the user, such as the user's name, email address, profile picture and so on. +After the user has authenticated, Auth0 will redirect the browser back to the **Redirect URI** (also called **Callback URL**), passing along an `id_token` parameter in the [hash fragment](https://en.wikipedia.org/wiki/Fragment_identifier). The ID Token is a [JSON Web Token (JWT)](/tokens/concepts/jwts) and contains various attributes - referred to as _Claims_ - regarding the user, such as the user's name, email address, profile picture and so on. -The `id_token` can be decoded to extract the claims and you are free to use these inside of your application, to display a user's name and profile image for example. +The ID Token can be decoded to extract the claims and you are free to use these inside of your application, to display a user's name and profile image for example. ![](/media/articles/client-auth/client-side-web/client-side-web-flow.png) 1. The Application initiates the flow and redirects the user to the Authorization Server 2. The user authenticates -3. The Authorization Server redirects the user to the `redirect_uri` with an `id_token` in the hash fragment +3. The Authorization Server redirects the user to the `redirect_uri` with an ID Token in the hash fragment 4. The Application can now extract the token from the hash fragment. ## Register your Application @@ -37,19 +47,19 @@ The first thing you need to do is to create a new application in Auth0. An Auth0 Navigate to the [Auth0 Dashboard](${manage_url}) and click on the [Applications](${manage_url}/#/applications) menu option on the left. Create a new Application by clicking on the **Create Application** button. -The **Create Application** window will open, allowing you to enter the name of your new application. Choose **Single Page Web Applications** as the **Application Type** and click on the **Create** button to create the new application. +The **Create Application** window will open, allowing you to enter the name of your new application. Choose **Single-Page Web Applications** as the **Application Type** and click on the **Create** button to create the new application. ![](/media/articles/client-auth/client-side-web/create-client.png) Once the application has been created you can navigate to the **Settings** tab of the application and in the **Allowed Callback URLs** field add a URL where Auth0 must redirect to after the user has authenticated, such as `https://YOUR_APP/callback`. -This URL must be part of your application, as your application will need to extract the `id_token` from the hash fragment of this URL. Save the Settings. +This URL must be part of your application, as your application will need to extract the ID Token from the hash fragment of this URL. Save the Settings. ![](/media/articles/client-auth/client-side-web/allowed-callback-url.png) ## Call the Authorization URL -The URL used when authenticating a user is `https://${account.namespace}/authorize`. This is the initial endpoint to which a user must be redirected. This will handle checking whether any SSO session is active, authenticating the user and also potentially redirect the user directly to any Identity Provider to handle authentication. +The URL used when authenticating a user is `https://${account.namespace}/authorize`. This is the initial endpoint to which a user must be redirected. This will handle checking whether any Single Sign-on (SSO) [session](/sessions) is active, authenticating the user and also potentially redirect the user directly to any Identity Provider to handle authentication. This endpoint supports the following query string parameters: @@ -57,7 +67,7 @@ This endpoint supports the following query string parameters: |:------------------|:---------| | response_type | The response type specifies the Grant Type you want to use. This can be either `code` or `token`. For client-side web applications using the Implicit Grant Flow this **must be set** to `token` | | client_id | The Client ID of the Application you registered in Auth0. This can be found on the **Settings** tab of your Application in the Auth0 Dashboard | -| scope | Specifies the claims (or attributes) of the user you want the be returned in the `id_token`. To obtain an `id_token` you need to specify at least a scope of `openid` (if no scope is specified then `openid` is implied). You can also request other scopes, so for example to return the user's name and profile picture you can request a scope of `openid name picture`.

      You can read up more about [scopes](/scopes). | +| scope | Specifies the claims (or attributes) of the user you want the be returned in the ID Token. To obtain an ID Token you need to specify at least a scope of `openid` (if no scope is specified then `openid` is implied). You can also request other scopes, so for example to return the user's name and profile picture you can request a scope of `openid name picture`.

      You can read up more about [scopes](/scopes). | | redirect_uri | The URL in your application where the user will be redirected to after they have authenticated, such as `${account.callback}`.| | connection | This is an optional parameter which allows you to force the user to sign in with a specific connection. You can for example pass a value of `github` to send the user directly to GitHub to log in with their GitHub account.

      If this parameter is not specified the user will be presented with the normal Auth0 Lock screen from where they can sign in with any of the available connections. You can see the list of configured connections on the **Connections** tab of your application. | | state | The state parameter will be sent back should be used for CSRF and contextual information (like a return url) | @@ -69,19 +79,19 @@ This endpoint supports the following query string parameters: ## Handle the callback -After the user has authenticated, Auth0 will call back to the URL specified in the `redirect_uri` query string parameter which was passed to the `/authorize` endpoint. When calling back to this URL, Auth0 will pass along the `id_token` and the `token_type` in the hash fragment of the URL, such as +After the user has authenticated, Auth0 will call back to the URL specified in the `redirect_uri` query string parameter which was passed to the `/authorize` endpoint. When calling back to this URL, Auth0 will pass along the ID Token and the `token_type` in the hash fragment of the URL, such as ```text https://YOUR_APP/callback#id_token=eyJ0...&token_type=Bearer ``` -The `token_type` will be set to **Bearer** and the `id_token` will be a [JSON Web Token (JWT)](/jwt) containing information about the user. You can access the hash fragment using the `window.location.hash` property and then use basic JavaScript string manipulation to access the `id_token`. +The `token_type` will be set to **Bearer** and the `id_token` will be a [JSON Web Token (JWT)](/tokens/concepts/jwts) containing information about the user. You can access the hash fragment using the `window.location.hash` property and then use basic JavaScript string manipulation to access the ID Token. -As mentioned, the `id_token` is a JWT and you will need to decode this token in order to read the claims (or attributes) of the user. The [JWT section of our website](/jwt) contains more information about the structure of a JWT. +As mentioned, the ID Token is a JWT and you will need to decode this token in order to read the claims (or attributes) of the user. The [JWT section of our website](/tokens/concepts/jwts) contains more information about the structure of a JWT. -Once the JWT is decoded, you can extract the information about the user from the Payload of the `id_token`. This is a JSON structure and will contain the claims (attributes) about the user as well as some other metadata. +Once the JWT is decoded, you can extract the information about the user from the Payload of the ID Token. This is a JSON structure and will contain the claims (attributes) about the user as well as some other metadata. -The [Auth0.js library](https://auth0.com/docs/libraries/auth0js) can assist you in decoding the JWT by calling the `parseHash` function, and then access the `id_token` values from the `idTokenPayload` property: +The [Auth0.js library](https://auth0.com/docs/libraries/auth0js) can assist you in decoding the JWT by calling the `parseHash` function, and then access the ID Token values from the `idTokenPayload` property: ``` @@ -108,9 +118,9 @@ The [Auth0.js library](https://auth0.com/docs/libraries/auth0js) can assist you ``` -### The `id_token` Payload +### The ID Token Payload -An example payload for an `id_token` may look something like this: +An example payload for an ID Token may look something like this: ```json { @@ -133,12 +143,12 @@ The payload above contains the following claims: | email | The email address of the user which is returned from the Identity Provider. | | picture | The profile picture of the user which is returned from the Identity Provider. | | sub | The unique identifier of the user. This is guaranteed to be unique per user and will be in the format (identity provider)|(unique id in the provider), such as github|1234567890. | -| iss | The _issuer_. A case-sensitive string or URI that uniquely identifies the party that issued the JWT. For an Auth0 issued `id_token`, this will be **the URL of your Auth0 tenant**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | -| aud | The _audience_. Either a single case-sensitive string or URI or an array of such values that uniquely identify the intended recipients of this JWT. For an Auth0 issued `id_token`, this will be the **Client ID of your Auth0 Application**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | +| iss | The _issuer_. A case-sensitive string or URI that uniquely identifies the party that issued the JWT. For an Auth0 issued ID Token, this will be **the URL of your Auth0 tenant**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | +| aud | The _audience_. Either a single case-sensitive string or URI or an array of such values that uniquely identify the intended recipients of this JWT. For an Auth0 issued ID Token, this will be the **Client ID of your Auth0 Application**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | | exp | The _expiration time_. A number representing a specific date and time in the format “seconds since epoch” as [defined by POSIX6](https://en.wikipedia.org/wiki/Unix_time). This claim sets the exact moment from which this **JWT is considered invalid**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | | iat | The _issued at time_. A number representing a specific date and time (in the same format as `exp`) at which this **JWT was issued**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | -The exact claims contained in the `id_token` will depend on the `scope` parameter you sent to the `/authorize` endpoint. In an `id_token` issued by Auth0, the **registered claims** and the `sub` claim will always be present, but the other claims depends on the `scope`. You can refer to the [examples below](#examples) to see examples of how the scope influences the claims being returned. +The exact claims contained in the ID Token will depend on the `scope` parameter you sent to the `/authorize` endpoint. In an ID Token issued by Auth0, the **registered claims** and the `sub` claim will always be present, but the other claims depends on the `scope`. You can refer to the [examples below](#examples) to see examples of how the scope influences the claims being returned. ::: note The [JWT.io website](https://jwt.io) has a handy debugger which will allow you to debug any JSON Web Token. This is useful is you quickly want to decode a JWT to see the information contained in the token. @@ -146,7 +156,7 @@ The [JWT.io website](https://jwt.io) has a handy debugger which will allow you t ### Keep the user logged in -Auth0 will assist you in authenticating a user, but it is up to you to keep track in your application of whether or not a user is logged in. You can use `localStorage` to keep track of whether a user is logged in or not, and also to store the claims of the user which was extracted from the `id_token`. +Auth0 will assist you in authenticating a user, but it is up to you to keep track in your application of whether or not a user is logged in. You can use `localStorage` to keep track of whether a user is logged in or not, and also to store the claims of the user which was extracted from the ID Token. You can then use those claims inside of your application to display the user's information or otherwise personalize the user's experience. @@ -163,7 +173,7 @@ https://${account.namespace}/authorize &redirect_uri=${account.callback} ``` -After the user has authenticated, they will be redirected back to the `redirect_uri` with the `id_token` and `token_type` passed as parameters in the hash fragment: +After the user has authenticated, they will be redirected back to the `redirect_uri` with the ID Token and `token_type` passed as parameters in the hash fragment: ```text ${account.callback} @@ -171,7 +181,7 @@ ${account.callback} &token_type=Bearer ``` -And this is an example of the decoded payload of the `id_token` which will be returned: +And this is an example of the decoded payload of the ID Token which will be returned: ```json { @@ -195,7 +205,7 @@ https://${account.namespace}/authorize &scope=openid%20name%20picture ``` -After the user has authenticated, they will be redirected back to the `redirect_uri` with the `id_token` and `token_type` passed as parameters in the hash fragment: +After the user has authenticated, they will be redirected back to the `redirect_uri` with the ID Token and `token_type` passed as parameters in the hash fragment: ```text ${account.callback} @@ -203,7 +213,7 @@ ${account.callback} &token_type=Bearer ``` -The name and profile picture will be available in the `name` and `picture` claims of the returned `id_token`: +The name and profile picture will be available in the `name` and `picture` claims of the returned ID Token: ```json { @@ -236,7 +246,7 @@ You can just as easily request a user log in with other social providers, like G - [Social Login using the Authentication API](/api/authentication#social) ::: -After the user has authenticated, they will be redirected back to the `redirect_uri` with the `id_token` and `token_type` passed as parameters in the hash fragment: +After the user has authenticated, they will be redirected back to the `redirect_uri` with the ID Token and `token_type` passed as parameters in the hash fragment: ```text ${account.callback} @@ -244,7 +254,7 @@ ${account.callback} &token_type=Bearer ``` -The user's name and profile picture and email address will be available in the `name`, `picture` and `email` claims of the returned `id_token`. You will also notice that the `sub` claim contains the User's unique ID returned from GitHub: +The user's name and profile picture and email address will be available in the `name`, `picture` and `email` claims of the returned ID Token. You will also notice that the `sub` claim contains the User's unique ID returned from GitHub: ```json { diff --git a/articles/application-auth/legacy/index.md b/articles/application-auth/legacy/index.md index b36f669b6d..56a74c0a5b 100644 --- a/articles/application-auth/legacy/index.md +++ b/articles/application-auth/legacy/index.md @@ -2,6 +2,12 @@ classes: topic-page title: Application Authentication description: Introduction to the various application authentication flows. +topics: + - authentication + - oauth2 +contentType: index +useCase: + - add-login --- # Application Authentication diff --git a/articles/application-auth/legacy/mobile-desktop.md b/articles/application-auth/legacy/mobile-desktop.md index bb9bb772bb..04b9497aee 100644 --- a/articles/application-auth/legacy/mobile-desktop.md +++ b/articles/application-auth/legacy/mobile-desktop.md @@ -1,6 +1,16 @@ --- -description: Explains how to authenticate users in a mobile or desktop application. +description: Explains how to authenticate users in a mobile or desktop application. toc: true +topics: + - authentication + - oauth2 + - mobile-apps + - desktop-apps +contentType: + - concept + - how-to +useCase: + - add-login --- # Authentication for Mobile & Desktop Apps @@ -8,11 +18,11 @@ toc: true This document covers an outdated version of the Auth0 authentication pipeline. We recommend you use the current version, using the dropdown. For more on the latest authentication pipeline refer to [Introducing OIDC Conformant Authentication](/api-auth/intro). ::: -You can easily authenticate users in your mobile and desktop applications by using either the Lock application libraries, or by calling the Auth0 OAuth 2.0 endpoints yourself. +You can easily authenticate users in your mobile and desktop applications by using either the Lock application libraries, or by calling the Auth0 OAuth 2.0 endpoints yourself. ## Overview -Auth0 exposes OAuth 2.0 endpoints for authenticating any user. You can call these endpoints through an embedded browser in your application, and then intercept the request to the callback URL to extract the `id_token` which contains the user's profile information. +Auth0 exposes OAuth 2.0 endpoints for authenticating any user. You can call these endpoints through an embedded browser in your application, and then intercept the request to the callback URL to extract the ID Token which contains the user's profile information. We also make a set of application libraries available which encapsulates all the logic for you and makes it much easier to implement authentication in all the popular mobile and desktop platforms. Please refer to our [Native Quickstarts](/quickstart/native) to get started with any of these. @@ -22,15 +32,15 @@ The OAuth 2.0 Authorization Framework allows for different kinds of authorizatio The Implicit Grant flow is initiated by redirecting the user in an embedded web browser inside of your application to the Auth0 `/authorize` endpoint. Auth0 will then display the Auth0 Lock dialog, allowing the user to enter their credentials or alternatively sign in with any other configured [Identity Provider](/identityproviders). -After the user has authenticated, Auth0 will redirect the browser back to the `redirect_uri` (also known as the **Callback URL**), passing along an `id_token` parameter in the [hash fragment](https://en.wikipedia.org/wiki/Fragment_identifier) or the URL. The `id_token` is a [JSON Web Token (JWT)](/jwt) and contains various attributes - referred to as _Claims_ - regarding the user, such as the user's name, email address, profile picture and so on. +After the user has authenticated, Auth0 will redirect the browser back to the `redirect_uri` (also known as the **Callback URL**), passing along an `id_token` parameter in the [hash fragment](https://en.wikipedia.org/wiki/Fragment_identifier) or the URL. The ID Token is a [JSON Web Token (JWT)](/tokens/concepts/jwts) and contains various attributes - referred to as _Claims_ - regarding the user, such as the user's name, email address, profile picture and so on. -The `id_token` can be decoded to extract the claims and you can use these inside of your application, to display a user's name and profile image for example. +The ID Token can be decoded to extract the claims and you can use these inside of your application, to display a user's name and profile image for example. ![](/media/articles/client-auth/mobile-desktop/mobile-desktop-flow.png) 1. The Application initiates the flow and redirects the user to the Authorization Server 2. The user authenticates -3. The Authorization Server redirects the user to the `redirect_uri` with an `id_token` in the hash fragment +3. The Authorization Server redirects the user to the `redirect_uri` with an ID Token in the hash fragment 4. The Application can now extract the token from the hash fragment. ## Register your Application @@ -41,7 +51,7 @@ Navigate to the [Auth0 Dashboard](${manage_url}) and click on the [Applications] The **Create Application** window will open, allowing you to enter the name of your new application. Choose **Native** as the **Application Type** and click on the **Create** button to create the new application. -![](/media/articles/client-auth/mobile-desktop/create-client.png) +![](/media/articles/client-auth/mobile-desktop/create-client.png) Once the application has been created you can navigate to the **Settings** tab of the application and in the **Allowed Callback URLs** field add the URL `https://${account.namespace}/mobile`. Save the Settings. @@ -49,7 +59,7 @@ Once the application has been created you can navigate to the **Settings** tab o ## Call the Authorization URL -The URL used when authenticating a user is `https://${account.namespace}/authorize`. This is the initial endpoint to which a user must be redirected. This will handle checking whether any SSO session is active, authenticating the user and also potentially redirect the user directly to any Identity Provider to handle authentication. +The URL used when authenticating a user is `https://${account.namespace}/authorize`. This is the initial endpoint to which a user must be redirected. This will handle checking whether any Single Sign-on (SSO) [session](/sessions) is active, authenticating the user and also potentially redirect the user directly to any Identity Provider to handle authentication. This endpoint supports the following query string parameters: @@ -57,7 +67,7 @@ This endpoint supports the following query string parameters: |:------------------|:---------| | response_type | The response type specifies the Grant Type you want to use. This can be either `code` or `token`. For mobile applications using the Implicit Grant Flow this **must be set** to `token` | | client_id | The Client ID of the Application you registered in Auth0. This can be found on the **Settings** tab of your Application in the Auth0 Dashboard | -| scope | Specifies the claims (or attributes) of the user you want the be returned in the `id_token`. To obtain an `id_token` you need to specify at least a scope of `openid` (if no scope is specified then `openid` is implied). You can also request other scopes, so for example to return the user's name and profile picture you can request a scope of `openid name picture`.

      You can read up more about [scopes](/scopes). | +| scope | Specifies the claims (or attributes) of the user you want the be returned in the ID Token. To obtain an ID Token you need to specify at least a scope of `openid` (if no scope is specified then `openid` is implied). You can also request other scopes, so for example to return the user's name and profile picture you can request a scope of `openid name picture`.

      You can read up more about [scopes](/scopes). | | redirect_uri | The URL where the user will be redirected to after they have authenticated. For mobile applications you should specify this as `https://${account.namespace}/mobile`| | connection | This is an optional parameter which allows you to force the user to sign in with a specific connection. You can for example pass a value of `google-oauth2` to send the user directly to Google to log in with their Google account.

      If this parameter is not specified the user will be presented with the normal Auth0 Lock screen from where they can sign in with any of the available connections. You can see the list of configured connections on the **Connections** tab of your application. | | state | The state parameter will be sent back should be used for CSRF and contextual information (like a return url) | @@ -74,17 +84,17 @@ After the user has authenticated, Auth0 will call back to the URL specified in t https://${account.namespace}/mobile#id_token=eyJ0...&token_type=Bearer ``` -The `token_type` will be set to **Bearer** and the `id_token` will be a [JSON Web Token (JWT)](/jwt) containing information about the user. You can extract both of these values from the URL using basic string manipulation techniques in whatever programming language you are using. +The `token_type` will be set to **Bearer** and the `id_token` will be a [JSON Web Token (JWT)](/tokens/concepts/jwts) containing information about the user. You can extract both of these values from the URL using basic string manipulation techniques in whatever programming language you are using. -As mentioned, the `id_token` is a JWT and you will need to decode this token in order to read the claims (or attributes) of the user. The [JWT section of our website](/jwt) contains more information about the structure of a JWT. +As mentioned, the ID Token is a JWT and you will need to decode this token in order to read the claims (or attributes) of the user. The [JWT section of our website](/tokens/concepts/jwts) contains more information about the structure of a JWT. -You can also refer to the [libraries section on the JWT.io website](https://jwt.io/#libraries-io) in order to obtain a library for your programming language of choice which will assist you in decoding the `id_token`. +You can also refer to the [libraries section on the JWT.io website](https://jwt.io/#libraries-io) in order to obtain a library for your programming language of choice which will assist you in decoding the ID Token. -Once the JWT is decoded, you can extract the information about the user from the Payload of the `id_token`. This is a JSON structure and will contain the claims (attributes) about the user as well as some other metadata. +Once the JWT is decoded, you can extract the information about the user from the Payload of the ID Token. This is a JSON structure and will contain the claims (attributes) about the user as well as some other metadata. -### The `id_token` Payload +### The ID Token Payload -An example payload for an `id_token` may look something like this: +An example payload for an ID Token may look something like this: ```json { @@ -107,12 +117,12 @@ The payload above contains the following claims: | email | The email address of the user which is returned from the Identity Provider. | | picture | The profile picture of the user which is returned from the Identity Provider. | | sub | The unique identifier of the user. This is guaranteed to be unique per user and will be in the format (identity provider)|(unique id in the provider), such as github|1234567890. | -| iss | The _issuer_. A case-sensitive string or URI that uniquely identifies the party that issued the JWT. For an Auth0 issued `id_token`, this will be **the URL of your Auth0 tenant**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | -| aud | The _audience_. Either a single case-sensitive string or URI or an array of such values that uniquely identify the intended recipients of this JWT. For an Auth0 issued `id_token`, this will be the **Client ID of your Auth0 Application**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | +| iss | The _issuer_. A case-sensitive string or URI that uniquely identifies the party that issued the JWT. For an Auth0 issued ID Token, this will be **the URL of your Auth0 tenant**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | +| aud | The _audience_. Either a single case-sensitive string or URI or an array of such values that uniquely identify the intended recipients of this JWT. For an Auth0 issued ID Token, this will be the **Client ID of your Auth0 Application**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | | exp | The _expiration time_. A number representing a specific date and time in the format “seconds since epoch” as [defined by POSIX6](https://en.wikipedia.org/wiki/Unix_time). This claim sets the exact moment from which this **JWT is considered invalid**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | | iat | The _issued at time_. A number representing a specific date and time (in the same format as `exp`) at which this **JWT was issued**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | -The exact claims contained in the `id_token` will depend on the `scope` parameter you sent to the `/authorize` endpoint. In an `id_token` issued by Auth0, the **registered claims** and the `sub` claim will always be present, but the other claims depends on the `scope`. You can refer to the [examples below](#examples) to see examples of how the scope influences the claims being returned. +The exact claims contained in the ID Token will depend on the `scope` parameter you sent to the `/authorize` endpoint. In an ID Token issued by Auth0, the **registered claims** and the `sub` claim will always be present, but the other claims depends on the `scope`. You can refer to the [examples below](#examples) to see examples of how the scope influences the claims being returned. ::: panel Debugging a JWT The [JWT.io website](https://jwt.io) has a handy debugger which will allow you to debug any JSON Web Token. This is useful is you quickly want to decode a JWT to see the information contained in the token. @@ -128,7 +138,7 @@ You can also use this object to store information about the user (such as name, ### A Basic Authentication Request -The following is the most basic request you can make to the `/authorize` endpoint. It will display the Lock screen and allow a user to sign in with any of the configured connections. +The following is the most basic request you can make to the `/authorize` endpoint. It will display the Lock screen and allow a user to sign in with any of the configured connections. ```text https://${account.namespace}/authorize @@ -145,7 +155,7 @@ https://${account.namespace}/mobile &token_type=Bearer ``` -And this is an example of the decoded payload of the `id_token` which will be returned: +And this is an example of the decoded payload of the ID Token which will be returned: ```json { @@ -159,7 +169,7 @@ And this is an example of the decoded payload of the `id_token` which will be re ### Request the Name and Profile Picture -You can request a user's name and profile picture by requesting the `name` and `picture` scopes. +You can request a user's name and profile picture by requesting the `name` and `picture` scopes. ```text https://${account.namespace}/authorize @@ -177,7 +187,7 @@ https://${account.namespace}/mobile &token_type=Bearer ``` -The name and profile picture will be available in the `name` and `picture` claims of the returned `id_token`: +The name and profile picture will be available in the `name` and `picture` claims of the returned ID Token: ```json { @@ -218,7 +228,7 @@ https://${account.namespace}/mobile &token_type=Bearer ``` -The user's name and profile picture and email address will be available in the `name`, `picture` and `email` claims of the returned `id_token`. You will also notice that the `sub` claim contains the User's unique ID returned from GitHub: +The user's name and profile picture and email address will be available in the `name`, `picture` and `email` claims of the returned ID Token. You will also notice that the `sub` claim contains the User's unique ID returned from GitHub: ```json { diff --git a/articles/application-auth/legacy/server-side-web.md b/articles/application-auth/legacy/server-side-web.md index 01c57db94b..5cb0b0ac58 100644 --- a/articles/application-auth/legacy/server-side-web.md +++ b/articles/application-auth/legacy/server-side-web.md @@ -2,6 +2,15 @@ title: Authentication for Server-side Web Apps description: Explains how to authenticate users in a Server-side Web application. toc: true +topics: + - oauth2 + - authentication + - server-side-apps +contentType: + - concept + - how-to +useCase: + - add-login --- # Authentication for Server-side Web Apps @@ -13,7 +22,7 @@ You can use the Auth0 Authentication API to create server-side web applications ## Overview -Auth0 exposes OAuth 2.0 endpoints for authenticating any user. You can redirect the user from your web application to these endpoints in the web browser. Auth0 will handle the authentication of the user, and then redirect the user back to the `redirect_uri` (also referred to as the Callback URL), returning an `authorization_code` in the query string parameters of the Callback URL. This `authorization_code` can then be exchanged for an `id_token` which contains the identity of the user. +Auth0 exposes OAuth 2.0 endpoints for authenticating any user. You can redirect the user from your web application to these endpoints in the web browser. Auth0 will handle the authentication of the user, and then redirect the user back to the `redirect_uri` (also referred to as the Callback URL), returning an `authorization_code` in the query string parameters of the Callback URL. This `authorization_code` can then be exchanged for an ID Token which contains the identity of the user. ## The Authentication Flow @@ -21,9 +30,9 @@ The OAuth 2.0 Authorization Framework allows for different kinds of authorizatio The Authorization Code flow is initiated by redirecting the user in the web browser to the Auth0 `/authorize` endpoint. Auth0 will then display the Auth0 Lock dialog, allowing the user to enter their credentials or alternatively sign in with any other configured [Identity Provider](/identityproviders). -After the user has authenticated, Auth0 will redirect the browser back to the **Redirect URI** (also called **Callback URL**), passing along an `authorization_code` parameter in the query string of the Callback URL. This code can then be exchanged for an `id_token` by making a request to the `/oauth/token` endpoint. +After the user has authenticated, Auth0 will redirect the browser back to the **Redirect URI** (also called **Callback URL**), passing along an `authorization_code` parameter in the query string of the Callback URL. This code can then be exchanged for an ID Token by making a request to the `/oauth/token` endpoint. -The `id_token` is a [JSON Web Token (JWT)](/jwt) and contains various attributes - referred to as _Claims_ - regarding the user, such as the user's name, email address, profile picture and so on.. The `id_token` can be decoded to extract the claims and you are free to use these inside of your application, to display a user's name and profile image for example. +The ID Token is a [JSON Web Token (JWT)](/tokens/concepts/jwts) and contains various attributes - referred to as _Claims_ - regarding the user, such as the user's name, email address, profile picture and so on.. The ID Token can be decoded to extract the claims and you are free to use these inside of your application, to display a user's name and profile image for example. ![](/media/articles/client-auth/server-side-web/server-side-web-flow.png) @@ -31,7 +40,7 @@ The `id_token` is a [JSON Web Token (JWT)](/jwt) and contains various attributes 2. The user authenticates. 3. The Authorization Server redirects to the `redirect_uri` with an `authorization_code` in the query string. 4. The Application sends the `authorization_code` together with the `redirect_uri` and the Client Id/Client Secret to the Authorization Server. -5. The Authorization Server validates this information and returns an `id_token`. +5. The Authorization Server validates this information and returns an ID Token. ## Register your Application @@ -45,13 +54,13 @@ The **Create Application** window will open, allowing you to enter the name of y Once the application has been created you can navigate to the **Settings** tab of the application and in the **Allowed Callback URLs** field add a URL where Auth0 must redirect to after the user has authenticated, such as `${account.callback}`. -This URL must be part of your application, as your application will need to retrieve the `code` and exchange it for the `id_token`. +This URL must be part of your application, as your application will need to retrieve the `code` and exchange it for the ID Token. ![](/media/articles/client-auth/server-side-web/allowed-callback-url.png) ## Call the Authorization URL -The URL used when authenticating a user is `https://${account.namespace}/authorize`. This is the initial endpoint to which a user must be redirected. This will handle checking whether any SSO session is active, authenticating the user and also potentially redirect the user directly to any Identity Provider to handle authentication. +The URL used when authenticating a user is `https://${account.namespace}/authorize`. This is the initial endpoint to which a user must be redirected. This will handle checking whether any Single Sign-on (SSO) [session](/sessions) is active, authenticating the user and also potentially redirect the user directly to any Identity Provider to handle authentication. This endpoint supports the following query string parameters: @@ -59,7 +68,7 @@ This endpoint supports the following query string parameters: |:------------------|:---------| | response_type | The response type specifies the Grant Type you want to use. This can be either `code` or `token`. For server-side web applications using the Authorization Code Flow this **must be set** to `code` | | client_id | The Client ID of the Application you registered in Auth0. This can be found on the **Settings** tab of your Application in the Auth0 Dashboard | -| scope | Specifies the claims (or attributes) of the user you want the be returned in the `id_token`. To obtain an `id_token` you need to specify at least a scope of `openid` (if no scope is specified then `openid` is implied). You can also request other scopes, so for example to return the user's name and profile picture you can request a scope of `openid name picture`.

      You can read up more about [scopes](/scopes). | +| scope | Specifies the claims (or attributes) of the user you want the be returned in the ID Token. To obtain an ID Token you need to specify at least a scope of `openid` (if no scope is specified then `openid` is implied). You can also request other scopes, so for example to return the user's name and profile picture you can request a scope of `openid name picture`.

      You can read up more about [scopes](/scopes). | | redirect_uri | The URL in your application where the user will be redirected to after they have authenticated, such as `${account.callback}`| | connection | This is an optional parameter which allows you to force the user to sign in with a specific connection. You can for example pass a value of `github` to send the user directly to GitHub to log in with their GitHub account.

      If this parameter is not specified the user will be presented with the normal Auth0 Lock screen from where they can sign in with any of the available connections. You can see the list of configured connections on the **Connections** tab of your application. | | state | The state parameter will be sent back should be used for CSRF and contextual information (like a return url) | @@ -68,7 +77,7 @@ This endpoint supports the following query string parameters: Be sure to add the **redirect_uri** URL to the list of **Allowed Callback URLs** in the **Settings** tab of your Application inside the [Auth0 Dashboard](${manage_url}). ::: -## Exhange the `access_code` for an `id_token` +## Exchange the `access_code` for an ID Token After the user has authenticated, Auth0 will call back to the URL specified in the `redirect_uri` query string parameter which was passed to the `/authorize` endpoint. When calling back to this URL, Auth0 will pass along an `access_token` in the `code` query string parameter of the URL, such as @@ -76,18 +85,39 @@ After the user has authenticated, Auth0 will call back to the URL specified in t ${account.callback}?code=2OKj... ``` -You application will need to handle the request to this callback URL, extract the `access_code` from the `code` query string parameter and call the `/oauth/token` endpoint of the Auth0 Authentication API in order to exchange the `access_code` for the `id_token`: +You application will need to handle the request to this callback URL, extract the `access_code` from the `code` query string parameter and call the `/oauth/token` endpoint of the Auth0 Authentication API in order to exchange the `access_code` for the ID Token: ```har { "method": "POST", "url": "https://${account.namespace}/oauth/token", "headers": [ - { "name": "Content-Type", "value": "application/json" } + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } ], "postData": { - "mimeType": "application/json", - "text": "{\"grant_type\":\"authorization_code\",\"client_id\": \"${account.clientId}\",\"client_secret\": \"YOUR_CLIENT_SECRET\",\"code\": \"YOUR_AUTHORIZATION_CODE\",\"redirect_uri\": \"${account.callback}\"}" + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "authorization_code" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "client_secret", + "value": "YOUR_CLIENT_SECRET" + }, + { + "name": "code", + "value": "YOUR_AUTHORIZATION_CODE" + }, + { + "name": "redirect_uri", + "value": "https://${account.callback}" + } + ] } } ``` @@ -102,15 +132,15 @@ The response from `/oauth/token` contains an `access_token`, `id_token` and `tok } ``` -The `token_type` will be set to **Bearer** and the `id_token` will be a [JSON Web Token (JWT)](/jwt) containing information about the user. You will need to decode the `id_token` in order to read the claims (or attributes) of the user. The [JWT section of our website](/jwt) contains more information about the structure of a JWT. +The `token_type` will be set to **Bearer** and the `id_token` will be a [JSON Web Token (JWT)](/tokens/concepts/jwts) containing information about the user. You will need to decode the ID Token in order to read the claims (or attributes) of the user. The [JWT section of our website](/tokens/concepts/jwts) contains more information about the structure of a JWT. -You can refer to the [libraries section on the JWT.io website](https://jwt.io/#libraries-io) in order to obtain a library for your programming language of choice which will assist you in decoding the `id_token`. +You can refer to the [libraries section on the JWT.io website](https://jwt.io/#libraries-io) in order to obtain a library for your programming language of choice which will assist you in decoding the ID Token. -Once the JWT is decoded, you can extract the information about the user from the Payload of the `id_token`. This is a JSON structure and will contain the claims (attributes) about the user as well as some other metadata. +Once the JWT is decoded, you can extract the information about the user from the Payload of the ID Token. This is a JSON structure and will contain the claims (attributes) about the user as well as some other metadata. -### The `id_token` Payload +### The ID Token Payload -An example payload for an `id_token` may look something like this: +An example payload for an ID Token may look something like this: ```json { @@ -133,12 +163,12 @@ The payload above contains the following claims: | email | The email address of the user which is returned from the Identity Provider. | | picture | The profile picture of the user which is returned from the Identity Provider. | | sub | The unique identifier of the user. This is guaranteed to be unique per user and will be in the format (identity provider)|(unique id in the provider), such as github|1234567890. | -| iss | The _issuer_. A case-sensitive string or URI that uniquely identifies the party that issued the JWT. For an Auth0 issued `id_token`, this will be **the URL of your Auth0 tenant**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | -| aud | The _audience_. Either a single case-sensitive string or URI or an array of such values that uniquely identify the intended recipients of this JWT. For an Auth0 issued `id_token`, this will be the **Client ID of your Auth0 Application**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | +| iss | The _issuer_. A case-sensitive string or URI that uniquely identifies the party that issued the JWT. For an Auth0 issued ID Token, this will be **the URL of your Auth0 tenant**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | +| aud | The _audience_. Either a single case-sensitive string or URI or an array of such values that uniquely identify the intended recipients of this JWT. For an Auth0 issued ID Token, this will be the **Client ID of your Auth0 Application**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | | exp | The _expiration time_. A number representing a specific date and time in the format “seconds since epoch” as [defined by POSIX6](https://en.wikipedia.org/wiki/Unix_time). This claim sets the exact moment from which this **JWT is considered invalid**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | | iat | The _issued at time_. A number representing a specific date and time (in the same format as `exp`) at which this **JWT was issued**.

      **This is a [registered claim](https://tools.ietf.org/html/rfc7519#section-4.1) according to the JWT Specification** | -The exact claims contained in the `id_token` will depend on the `scope` parameter you sent to the `/authorize` endpoint. In an `id_token` issued by Auth0, the **registered claims** and the `sub` claim will always be present, but the other claims depends on the `scope`. You can refer to the [examples below](#examples) to see examples of how the scope influences the claims being returned. +The exact claims contained in the ID Token will depend on the `scope` parameter you sent to the `/authorize` endpoint. In an ID Token issued by Auth0, the **registered claims** and the `sub` claim will always be present, but the other claims depends on the `scope`. You can refer to the [examples below](#examples) to see examples of how the scope influences the claims being returned. ::: note The [JWT.io website](https://jwt.io) has a handy debugger which will allow you to debug any JSON Web Token. This is useful is you quickly want to decode a JWT to see the information contained in the token. @@ -146,7 +176,7 @@ The [JWT.io website](https://jwt.io) has a handy debugger which will allow you t ### Keep the user logged in -Auth0 will assist you in authenticating a user, but it is up to you to keep track in your application of whether or not a user is logged in. You can use a cookie or other session storage to keep track of whether a user is logged in or not, and also to store the claims of the user which was extracted from the `id_token`. +Auth0 will assist you in authenticating a user, but it is up to you to keep track in your application of whether or not a user is logged in. You can use a cookie or other session storage to keep track of whether a user is logged in or not, and also to store the claims of the user which was extracted from the ID Token. You can then use those claims inside of your application to display the user's information or otherwise personalize the user's experience. @@ -169,7 +199,7 @@ After the user has authenticated, they will be redirected back to the `redirect_ ${account.callback}?code=2OKj... ``` -You can then exchange the `access_code` for an `id_token`. This is an example of the decoded payload of the `id_token` which will be returned: +You can then exchange the `access_code` for an ID Token. This is an example of the decoded payload of the ID Token which will be returned: ```json { @@ -199,7 +229,7 @@ After the user has authenticated, they will be redirected back to the `redirect_ ${account.callback}?code=2OKj... ``` -You can then exchange the `access_code` for an `id_token`. The name and profile picture will be available in the `name` and `picture` claims of the returned `id_token`: +You can then exchange the `access_code` for an ID Token. The name and profile picture will be available in the `name` and `picture` claims of the returned ID Token: ```json { @@ -232,7 +262,7 @@ You can just as easily request a user log in with other social providers, like G - [Social Login using the Authentication API](/api/authentication#social) ::: -After the user has authenticated, they will be redirected back to the `redirect_uri` with the `id_token` and `token_type` passed as parameters in the hash fragment: +After the user has authenticated, they will be redirected back to the `redirect_uri` with the ID Token and `token_type` passed as parameters in the hash fragment: After the user has authenticated, they will be redirected back to the `redirect_uri` with the `access_code` in the `code` query string parameter: @@ -240,7 +270,7 @@ After the user has authenticated, they will be redirected back to the `redirect_ ${account.callback}?code=2OKj... ``` -You can then exchange the `access_code` for an `id_token`. The user's name and profile picture and email address will be available in the `name`, `picture` and `email` claims of the returned `id_token`. You will also notice that the `sub` claim contains the User's unique ID returned from GitHub: +You can then exchange the `access_code` for an ID Token. The user's name and profile picture and email address will be available in the `name`, `picture` and `email` claims of the returned ID Token. You will also notice that the `sub` claim contains the User's unique ID returned from GitHub: ```json { diff --git a/articles/applications/addons.md b/articles/applications/addons.md deleted file mode 100644 index e9a5612132..0000000000 --- a/articles/applications/addons.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -description: Explains what Add-ons are and how they are associated with Auth0 Applications. ---- - -# Application Add-ons - -Add-ons are plugins associated with an application in Auth0. Usually, they are third-party APIs used by the application(s) that Auth0 generates Access Tokens for (for example, Salesforce, Azure Service Bus, Azure Mobile Services, SAP and more). - -To view all the available add-ons for an application navigate to [Dashboard > Applications > Addons](${manage_url}/#/applications/${account.clientId}/addons). - -![Application Addons List](/media/articles/applications/addons-dashboard-list.png) - -Some typical scenarios for using add-ons include: - -* **Accessing External APIs**: Using the Delegation endpoint, you can exchange an application's Access Token for a third-party service's (such as Salesforce or Amazon) Access Token. - -* **Integrating with Applications Using SAML2/WS-Federation**: Add-ons allow you to integrate with any custom or SSO integration that does not currently enjoy built-in Auth0 support, since they allow you to configure every aspect of the SAML2/WS-Federation integration. - -![Addons Example Diagram](/media/articles/applications/applications-addon-types.png) diff --git a/articles/applications/application-grant-types.md b/articles/applications/application-grant-types.md deleted file mode 100644 index eda69f9382..0000000000 --- a/articles/applications/application-grant-types.md +++ /dev/null @@ -1,178 +0,0 @@ ---- -description: Using the Grant Types property on Applications -toc: true ---- -# Application Grant Types - -Auth0 provides many different authentication and authorization flows to suit your needs. For example, if you are securing a mobile app, you'd use the [Authorization Code using Proof Key for Code Exchange (PKCE) OAuth 2.0 Grant](/api-auth/grant/authorization-code-pkce), or if you're securing a client-side app (such as a mobile app that's *not* native), you'd use the [Implicit Grant](api-auth/grant/implicit). - -However, you might want to limit the use of certain flows (which we'll refer to as "grant types" in this doc) depending on the type of app you're securing. You can set and manage these limitations using the `grant_types` property that each Client has. - -In this doc, we'll talk about: - -* What grant types are -* The grant types available -* How to set the Client's `grant_type` property -* What grant types are available based on the Client's `grant_type` property value - -## What Grant Types Are - -OAuth 2.0 is a protocol that allows you to grant limited access to your resources to another entity without exposing credentials. By using Auth0, you can support different OAuth 2.0 flows without worrying about the technical aspects/implementation. - -OAuth 2.0 supports several types of grants, which are methods by which you can gain Access Tokens (string values that represent the permissions granted). Different grant types allow different types of access, and based on the needs of your app, some grant types are more appropriate than others. Auth0 allows you to indicate which sets of permissions are appropriate based on the `grant_type` property. - -::: note -Not sure which non-legacy grant type is appropriate for your use case? Refer to [Which OAuth 2.0 flow should I use?](/api-auth/which-oauth-flow-to-use) for help. -::: - -## Grant Types Available - -The following is a list of grant types valid for Auth0 Applications. The grant types can be divided into three different categories: - -* Grants that conform with specifications (such as [OpenID Connect](https://openid.net/specs/openid-connect-core-1_0.html)) -* [Auth0 extension grants](https://tools.ietf.org/html/rfc6749#section-4.5) -* Auth0 legacy grants - -The following `grant_types`, are either: - -* OIDC-conformant (that is, their implementation conforms to the [OIDC specification](https://openid.net/specs/openid-connect-core-1_0.html)) -* Auth0 extension grants - -| `grant_type` | More info | -|:-----|:----| -| `implicit` | [Implicit Grant](/api-auth/grant/implicit) | -| `authorization_code` | [Authorization Code Grant](/api-auth/grant/authorization-code) | -| `client_credentials` | [Client Credentials Grant](/api-auth/grant/client-credentials) | -| `password` | [Resource Owner Password Grant](/api-auth/grant/password) | -| `refresh_token` | [Use a Refresh Token](/tokens/refresh-token/current#use-a-refresh-token) | -| `http://auth0.com/oauth/grant-type/password-realm` | [Use an extension grant similar to the Resource Owner Password Grant that includes the ability to indicate a specific realm](/api-auth/grant/password#realm-support) | -| `http://auth0.com/oauth/grant-type/mfa-oob` | [Multifactor Authentication OOB Grant Request](/api-auth/tutorials/multifactor-resource-owner-password#mfa-oob-grant-request) | -| `http://auth0.com/oauth/grant-type/mfa-otp` | [Multifactor Authentication OTP Grant Request](/api-auth/tutorials/multifactor-resource-owner-password#mfa-otp-grant-request) | -| `http://auth0.com/oauth/grant-type/mfa-recovery-code` | [Multifactor Authentication Recovery Grant Request](/api-auth/tutorials/multifactor-resource-owner-password#mfa-recovery-grant-request) | - -The following are legacy grant types: - -* `http://auth0.com/oauth/legacy/grant-type/ro` -* `http://auth0.com/oauth/legacy/grant-type/ro/jwt-bearer` -* `http://auth0.com/oauth/legacy/grant-type/delegation/refresh_token` -* `http://auth0.com/oauth/legacy/grant-type/delegation/id_token` -* `http://auth0.com/oauth/legacy/grant-type/access_token` - -## How to Edit the Client `grant_types` Property - -You can set the the `grant_types` property for your Auth0 Client using the Management Dashboard. - -::: warning -As of 8 June 2017, new Auth0 customers **cannot** add *any* of the legacy grant types to their Applications. Only customers as of 8 June 2017 can add legacy grant types to their existing Applications. -::: - -Begin by navigating to the [Applications page](${manage_url}/#/applications) of the Management Dashboard. - -![Auth0 Applications](/media/articles/clients/client-grant-types/clients.png) - -Click on the cog icon next to the Client you're interested in to launch its settings page. - -![Auth0 Client Settings](/media/articles/clients/client-grant-types/client-settings.png) - -Scroll down to the bottom of the settings page, and click **Advanced Settings**. - -![Auth0 Client Advanced Settings](/media/articles/clients/client-grant-types/client-advanced-settings.png) - -Switch to the **Grant Types** tab and enable or disable the respective grants for this client. Click **Save Changes**. - -![Auth0 Client Grant Types](/media/articles/clients/client-grant-types/grant-types.png) - -### Use the Management API - -In addition to setting the `grant_types` value using the Dasbhoard, you can make a [`PATCH` call to the Update a Client endpoint](/api/management/v2#!/Clients/patch_applications_by_id) of the Management API to update the `grant_types` field. - -### Errors - -Attempting to use any flow with a client lacking the appropriate `grant_types` for that flow (or with the field empty) will result in the following error: - -```text -Grant type `grant_type` not allowed for the client. -``` - -## Information for Existing and New Auth0 Customers - -As of 8 June 2017, all Auth0 applications have a `grant_types` property that **must** be populated. Here's how Auth0 will handle this change based on whether you're a current customer with an existing Client or a new customer. - -### Existing Applications - -To avoid changes in functionality for current Auth0 customers, we will populate the `grant_types` property for all existing Applications as of 8 June 2017 with **all** Auth0 legacy, Auth0 extension, and specification-conformant grant types. - -### New Applications - -Depending on whether a newly-created Client is [public](/applications/client-types#public-applications) or [confidential](/applications/client-types#confidential-applications), the Client will have varying access to grant types. Trusted first-party applications have access to additional grant types. - -#### Public Applications - -Public Applications, indicated by the `token_endpoint_auth_method` flag set to `none`, are those created in the Dashboard for Native and Single Page Applications. - -::: panel Token Endpoint Authentication Method -The `Token Endpoint Authentication Method` defines how a client authenticates against the [token endpoint](/api/authentication#authorization-code). Its valid values are: - -* `None`, for a public client without a client secret -* `Post`, for a client using HTTP POST parameters -* `Basic`, for a client using HTTP Basic parameters - -You can find this field at the [Client Settings page](${manage_url}/#/applications/${account.clientId}/settings) of the [Auth0 Dashboard](${manage_url}). -::: - -By default, Public Applications are created with the following `grant_types`: - -* `implicit` -* `authorization_code` -* `refresh_token` - -::: note -Public applications **cannot** utilize the `client_credentials` grant type. To add this grant type to a Client using the [Management API](/api/management/v2#!/Clients/patch_clients_by_id), set the **token_endpoint_auth_method** to `client_secret_post` or `client_secret_basic`. Either of these will indicate the Client is confidential, not public. -::: - -#### Confidential Applications - -Confidential Applications, indicated by the `token_endpoint_auth_method` flag set to anything *except* `none`, are those created in the Dashboard for Regular Web Applications or Non-Interactive Applications. Additionally, any Client where `token_endpoint_auth_method` is unspecified is confidential. By default, Confidential Applications are created with the following `grant_types`: - -* `implicit`; -* `authorization_code`; -* `refresh_token`; -* `client_credentials`. - -#### Trusted First-Party Applications - -Trusted first-party applications can additionally use the following `grant_types`: - -* `password` -* `http://auth0.com/oauth/grant-type/password-realm` -* `http://auth0.com/oauth/grant-type/mfa-oob` -* `http://auth0.com/oauth/grant-type/mfa-otp` -* `http://auth0.com/oauth/grant-type/mfa-recovery-code` - -::: note -If you are using the [Dashboard](${manage_url}) to enable or disable these grant types, note that all the Password and MFA grant types are enabled when you add the `Password` or `MFA` grant type on your client. You cannot select these individually. -::: - -## Secure Alternatives to the Legacy Grant Types - -If you're currently using a legacy grant type, refer to the chart below to see which of the secure alternatives you should use instead. - -| Legacy Grant Type | Alternative | -|:-----|:----| -|`http://auth0.com/oauth/legacy/grant-type/ro` | Use the [/oauth/token](/api/authentication#authorization-code) endpoint with a grant type of `password`. See [Resource Owner Password Credentials Exchange](/api-auth/tutorials/adoption/password) and [Executing the Resource Owner Password Grant](/api-auth/tutorials/password-grant) for additional information. | -| `http://auth0.com/oauth/legacy/grant-type/ro/jwt-bearer` | This feature is disabled by default. If you would like this feature enabled, please [contact support](https://support.auth0.com/) to discuss your use case and prevent the possibility of introducing security vulnerabilities. | -| `http://auth0.com/oauth/legacy/grant-type/delegation/refresh_token` | Use the `oauth/token` endpoint to obtain Refresh Tokens. See [OIDC-conformant Refresh Tokens](/api-auth/tutorials/adoption/refresh-tokens) for more info. | -| `http://auth0.com/oauth/legacy/grant-type/delegation/id_token` | This feature is disabled by default. If you would like this feature enabled, please [contact support](https://support.auth0.com/) to discuss your use case and prevent the possibility of introducing security vulnerabilities. | -| `http://auth0.com/oauth/legacy/grant-type/access_token` | Use browser-based social authentication. | - -::: note -Those implementing Passwordless Authentication should use [universal login](/hosted-pages/login) instead of the `oauth/ro` endpoint. -::: - -## Enable a Legacy Grant Type - -::: warning -As of 8 June 2017, new Auth0 customers cannot add any of the legacy grant types to their applications. Legacy grant types are only available for previous customers while they migrate to new flows, to avoid breaking changes. To find the secure alternative for your case refer to [Secure Alternatives to the Legacy Grant Types](#secure-alternatives-to-the-legacy-grant-types). -::: - -To enable a legacy grant type, you will need to update the `grant_types` property for you client appropriately. For details on how to do so, refer to [Edit the grant_types Property](#edit-available-grant_types). diff --git a/articles/applications/application-settings/_adv-settings-mobile.md b/articles/applications/application-settings/_adv-settings-mobile.md new file mode 100644 index 0000000000..fb14954545 --- /dev/null +++ b/articles/applications/application-settings/_adv-settings-mobile.md @@ -0,0 +1,8 @@ + +#### Device Settings + +If you're developing a mobile application, you can provide the necessary iOS/Android parameters here. + +When developing iOS apps, you'll provide your **Team ID** and **App Bundle Identifier**. + +When developing Android apps, you'll provide your **App Package Name** and your **Key Hashes**. diff --git a/articles/applications/application-settings/_adv-settings.md b/articles/applications/application-settings/_adv-settings.md index d2af38f64d..f86aa43c4a 100644 --- a/articles/applications/application-settings/_adv-settings.md +++ b/articles/applications/application-settings/_adv-settings.md @@ -14,19 +14,11 @@ Application metadata are custom string keys and values (each of which has a char You can create up to 10 sets of metadata. -#### Mobile Settings - -If you're developing a mobile application, you can provide the necessary iOS/Android parameters here. - -When developing iOS apps, you'll provide your **Team ID** and **App Bundle Identifier**. - -When developing Android apps, you'll provide your **App Package Name** and your **Key Hashes**. - #### OAuth Set the OAuth-related settings on this tab: -* By default, all apps/APIs can make a delegation request, but if you want to explicitly grant permissions to selected apps/APIs, you can do so in **Allowed APPs/APIs**. +* By default, all apps/APIs can make a delegation request, but if you want to explicitly grant permissions to selected apps/APIs, you can do so in **Allowed Apps/APIs**. * Set the algorithm used (**HS256** or **RS256**) for signing your JSON Web Tokens. diff --git a/articles/applications/application-settings/_settings-pt2.md b/articles/applications/application-settings/_settings-pt2.md index 1fcc3b475d..cbd497d7b3 100644 --- a/articles/applications/application-settings/_settings-pt2.md +++ b/articles/applications/application-settings/_settings-pt2.md @@ -1,15 +1,17 @@ - +::: note +You can provide up to 100 URLs in the **Allowed Callback URLs**, **Allowed Web Origins**, **Allowed Logout URLs**, **Allowed Origins (CORS)** fields. +::: -- **Allowed Callback URLs**: Set of URLs to which Auth0 is allowed to redirect the users after they authenticate. You can specify multiple valid URLs by comma-separating them (typically to handle different environments like QA or testing). You can use the star symbol as a wildcard for subdomains (`*.google.com`). Make sure to specify the protocol, `http://` or `https://`, otherwise the callback may fail in some cases. +- **Allowed Callback URLs**: Set of URLs to which Auth0 is allowed to redirect the users after they authenticate. You can specify multiple valid URLs by comma-separating them (typically to handle different environments like QA or testing). For production environments, verify that the URLs do not point to localhost. You can use the star symbol as a wildcard for subdomains (`*.google.com`). Make sure to specify the protocol, `http://` or `https://`, otherwise the callback may fail in some cases. -- **Allowed Web Origins**: List of URLs from where an authorization request, using [`web_message` as the response mode](/protocols/oauth2#how-response-mode-works), can originate from. You can specify multiple valid URLs by comma-separating them. +- **Allowed Web Origins**: List of URLs from where an authorization request, using [`web_message` as the response mode](/protocols/oauth2#how-response-mode-works), can originate from. You can specify multiple valid URLs by comma-separating them. For production environments, verify that the URLs do not point to localhost. -- **Allowed Logout URLs**: After a user logs out from Auth0 you can redirect them with the `returnTo` query parameter. The URL that you use in `returnTo` must be listed here. You can specify multiple valid URLs by comma-separating them. You can use the star symbol as a wildcard for subdomains (`*.google.com`). Notice that querystrings and hash information are not taken into account when validating these URLs. Read more about this at: [Logout](/logout). +- **Allowed Logout URLs**: After a user logs out from Auth0 you can redirect them with the `returnTo` query parameter. The URL that you use in `returnTo` must be listed here. You can specify multiple valid URLs by comma-separating them. For production environments, verify that the URLs do not point to localhost. You can use the star symbol as a wildcard for subdomains (`*.google.com`). Notice that querystrings and hash information are not taken into account when validating these URLs. Read more about this at: [Logout](/logout). -- **Allowed Origins (CORS)**: Set of URLs that will be allowed to make requests from JavaScript to Auth0 API (typically used with CORS). This prevents same-origin policy errors when using Auth0 from within a web browser. By default, all your callback URLs will be allowed. This field allows you to enter other origins if you need to. You can specify multiple valid URLs by comma-separating them. You can use the star symbol as a wildcard for subdomains (`*.google.com`). Notice that paths, querystrings and hash information are not taken into account when validating these URLs (and may, in fact, cause the match to fail). +- **Allowed Origins (CORS)**: Set of URLs that will be allowed to make requests from JavaScript to Auth0 API (typically used with CORS). This prevents same-origin policy errors when using Auth0 from within a web browser. By default, all your callback URLs will be allowed. This field allows you to enter other origins if you need to. You can specify multiple valid URLs by comma-separating them. For production environments, verify that the URLs do not point to localhost. You can use the star symbol as a wildcard for subdomains (`*.google.com`). Notice that paths, querystrings and hash information are not taken into account when validating these URLs (and may, in fact, cause the match to fail). -- **JWT Expiration (seconds)**: The amount of time (in seconds) before the Auth0 id_token expires. The default value is `36000`, which maps to 10 hours. +- **ID Token Expiration (seconds)**: The amount of time (in seconds) before the Auth0 ID Token expires. The default value is `36000` seconds which is 10 hours. -- **Use Auth0 instead of the IdP to do Single Sign On**: If enabled, this setting prevents Auth0 from redirecting authenticated users with valid sessions to the identity provider (such as Facebook, ADFS, and so on). +- **Use Auth0 instead of the IdP to do Single Sign-on**: If enabled, this setting prevents Auth0 from redirecting authenticated users with valid [sessions](/sessions) to the identity provider (such as Facebook, ADFS, and so on). **Legacy tenants only.** ![Application Settings Page](/media/articles/applications/settings.png) diff --git a/articles/applications/application-settings/_settings.md b/articles/applications/application-settings/_settings.md index 596a1350fb..7a276d13d1 100644 --- a/articles/applications/application-settings/_settings.md +++ b/articles/applications/application-settings/_settings.md @@ -6,7 +6,7 @@ - **Client ID**: The unique identifier for your application. This is the ID you will use with when configuring authentication with Auth0. It is generated by the system when you create a new application and it cannot be modified. -- **Client Secret**: A string used to sign and validate `id_tokens` for authentication flows and to gain access to select Auth0 API endpoints. By default, the value is hidden, so check the **Reveal Client Secret** box to see this value. +- **Client Secret**: A string used to sign and validate ID Tokens for authentication flows and to gain access to select Auth0 API endpoints. By default, the value is hidden, so check the **Reveal Client Secret** box to see this value. ::: warning While the Client ID is considered public information, the Client Secret **must be kept confidential**. If anyone can access your Client Secret they can issue tokens and access resources they shouldn't. diff --git a/articles/applications/application-settings/index.yml b/articles/applications/application-settings/index.yml deleted file mode 100644 index 12753dbc99..0000000000 --- a/articles/applications/application-settings/index.yml +++ /dev/null @@ -1,13 +0,0 @@ -versioning: - baseUrl: applications/application-settings - current: native - versions: - - native - - single-page-app - - regular-web-app - - non-interactive - defaultArticles: - native: index - single-page-app: index - regular-web-app: index - non-interactive: index diff --git a/articles/applications/application-settings/native/index.md b/articles/applications/application-settings/native/index.md deleted file mode 100644 index 0803ec041d..0000000000 --- a/articles/applications/application-settings/native/index.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -description: Application settings for Native -url: /applications/application-settings/native -toc: true ---- - -# Application Settings: Native - -::: version-warning -This document lists the settings for a Native Application; if you're using a different Application type, please use the drop-down to select the appropriate doc. -::: - -When creating an Auth0 Application, you'll be asked to indicate the *type* of Application you want to create. - -![Window for selecting application type](/media/articles/clients/create-clients.png) - -For desktop or mobile apps running natively on the device, you'll want to create a Native Application. - -## Settings - -<%= include('../_settings') %> - -- **Application Type**: The type of application you are implementing. For desktop or mobile apps running natively on the device, you'll want to create a Native Application. - -<%= include('../_settings-pt2') %> - -### Advanced Settings - -<%= include('../_adv-settings') %> - -<%= include('../_adv-settings-pt2') %> diff --git a/articles/applications/application-settings/non-interactive/index.md b/articles/applications/application-settings/non-interactive/index.md deleted file mode 100644 index 85f4277e9a..0000000000 --- a/articles/applications/application-settings/non-interactive/index.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -description: Application settings for Machine to Machine Applications -url: /applications/application-settings/non-interactive -toc: true ---- - -# Application Settings: Machine to Machine Application - -::: version-warning -This document lists the settings for a Machine to Machine Application; if you're using a different Application type, please use the drop-down to select the appropriate doc. -::: - -When creating an Auth0 Application, you'll be asked to indicate the *type* of Application you want to create. - -![Window for selecting application type](/media/articles/clients/create-clients.png) - -If your app is a CLI, daemon, or a service running on the backend, you'll want to create a **Machine to Machine Application**. - -## Settings - -<%= include('../_settings') %> - -- **Application Type**: The type of application you are implementing. If your app is a CLI, daemon, or a service running on the backend, use a **Machine to Machine Application**. - -<%= include('../_token-endpoint-auth-method') %> - -<%= include('../_settings-pt2') %> - -### Advanced Settings - -<%= include('../_adv-settings') %> - -<%= include('../_trust-token-endpoint-ip-header') %> - -<%= include('../_adv-settings-pt2') %> diff --git a/articles/applications/application-settings/regular-web-app/index.md b/articles/applications/application-settings/regular-web-app/index.md deleted file mode 100644 index aaf78fbb2c..0000000000 --- a/articles/applications/application-settings/regular-web-app/index.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -description: Application settings for Web Apps -url: /applications/application-settings/regular-web-app -toc: true ---- -# Application Settings: Regular Web Applications - -::: version-warning -This document lists the settings for a Regular Web App; if you're using a different Application type, please use the drop-down to select the appropriate doc. -::: - -When creating an Auth0 Application, you'll be asked to indicate the *type* of Application you want to create. - -![Window for selecting application type](/media/articles/clients/create-clients.png) - -If you're working with a traditional web app that has the ability to refresh its pages, you'll want to create a Regular Web Application. - -## Settings - -<%= include('../_settings') %> - -- **Application Type**: The type of application you are implementing. If you're working with a traditional web app that has the ability to refresh its pages, use a Regular Web Applications. - -<%= include('../_token-endpoint-auth-method') %> - -<%= include('../_settings-pt2') %> - -### Advanced Settings - -<%= include('../_adv-settings') %> - -<%= include('../_trust-token-endpoint-ip-header') %> - -<%= include('../_adv-settings-pt2') %> diff --git a/articles/applications/application-settings/single-page-app/index.md b/articles/applications/application-settings/single-page-app/index.md deleted file mode 100644 index 2d75ebb05f..0000000000 --- a/articles/applications/application-settings/single-page-app/index.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -description: Application settings for Single Page Apps -url: /applications/application-settings/single-page-app -toc: true ---- - -# Application Settings: Single Page Applications - -::: version-warning -This document lists the settings for an SPA Application; if you're using a different Application type, please use the drop-down to select the appropriate doc. -::: - -When creating an Auth0 Application, you'll be asked to indicate the *type* of Application you want to create. - -![Window for selecting application type](/media/articles/clients/create-clients.png) - -If your app is similar to one with a JavaScript front-end that utilizes an API, you'll want to create a SPA Application. - -## Settings - -<%= include('../_settings') %> - -- **Application Type**: The type of application you are implementing. For apps with a JavaScript front-end that utilizes an API, create an SPA. - -<%= include('../_settings-pt2') %> - -### Advanced Settings - -<%= include('../_adv-settings') %> - -<%= include('../_adv-settings-pt2') %> diff --git a/articles/applications/application-types.md b/articles/applications/application-types.md deleted file mode 100644 index 187bd858cf..0000000000 --- a/articles/applications/application-types.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -title: Application Types -description: Read about the the different applications types: public vs confidential, and first vs third-party -toc: true ---- -# Application Types - -<%= include('../_includes/_pipeline2') %> - -When working with Auth0 applications, which are used to represent your applications, there are several terms you should know in terms of how applications are classified: - -* [Confidential vs public](#confidential-vs-public-applications) -* [First vs third-party](#first-vs-third-party-applications) - -## Confidential vs public applications - -The OAuth 2.0 specification [defines two types of applications](https://tools.ietf.org/html/rfc6749#section-2.1): public and confidential. - -When creating an application through the [Dashboard](${manage_url}/#/applications), Auth0 will ask you what type of application you want the application to represent and use that information to determine the application type. - -### Check your application type - -You can use the Management API's [Get a Client endpoint](/api/management/v2#!/Clients/get_clients_by_id) to check your existing Application's type. If the application is first party, the `is_first_party` equals `true`, else `false`. Be sure to replace `CLIENT_ID` with the ID of your application. - -```har -{ - "method": "GET", - "url": "https://${account.namespace}/api/v2/clients/CLIENT_ID?fields=is_first_party&include_fields=true", - "headers": [{ - "name": "Authorization", - "value": "Bearer MGMT_API_ACCESS_TOKEN" - }] -} -``` - -::: note -See [The Auth0 Management APIv2 Token](/api/management/v2/tokens) for instructions on obtaining the Access Token required to call the Management API. -::: - -### Confidential applications - -Confidential applications are able to hold credentials (such as a client ID and secret) in a secure way without exposing them to unauthorized parties. This means that you will need a trusted backend server to store the secret(s). - -The following application types use confidential applications: - -* A web application with a secure backend using the [Authorization Code grant](/api-auth/grant/authorization-code), [Password](/api-auth/grant/password) or [Password Realm](/api-auth/tutorials/password-grant#realm-support) grants -* A machine to machine application using the [Client Credentials grant](/api-auth/grant/client-credentials) - -All of these grants require applications to authenticate by specifying their client ID and secret when calling the token endpoint. - -Since confidential applications are capable of holding secrets, you can choose to have ID Tokens issued to them that have been signed in one of two ways: - -* Symmetrically using their client secret (`HS256`) -* Asymmetrically using a private key (`RS256`) - -### Public applications - -Public applications **cannot** hold credentials securely. The following application types use public applications: - -* Native desktop or mobile applications using the [Authorization Code grant with PKCE](/api-auth/grant/authorization-code-pkce) -* JavaScript-based client-side web applications (such as single-page apps) using the [Implicit](/api-auth/grant/implicit) grant - -Since public applications are unable to hold secrets, [ID Tokens](/tokens/id-token) issued to them must be: - -* Signed asymmetrically using a private key (`RS256`) -* Verified using the public key corresponding to the private key used to sign the token - -## First vs third-party applications - -First-party and third-party refer to the ownership of the application. This has implications in terms of who has administrative access to your Auth0 domain. - -### First-party applications - -First-party applications are those controlled by the same organization or person who owns the Auth0 domain. For example, if you wanted to access the Contoso API, you'd use a first-party applications to log into `contoso.com`. - -All applications created via the [Dashboard](${manage_url}/#/applications) are first-party by default. - -### Third-party applications - -Third-party applications are controlled by someone who most likely should *not* have administrative access to your Auth0 domain. Third-party applications enable external parties or partners to access protected resources behind your API securely. For example, if you were to create a developer center that allows users to obtain credentials to integrate their apps with your API (this functionality is similar to those provided by well-known APIs such as Facebook, Twitter, and GitHub), you would use a third-party applications. - -Third-party applications must be created through the [Management API](/api/management/v2#!/Clients/post_clients) by setting `is_first_party` to `false`. - -Third party applications have the following characteristics: - -- They cannot skip user consent when consuming APIs. This is for security purposes, as anyone can create an applications, but each applications relies on the final user to provide consent. -- The [ID Tokens](/tokens/id-token) generated for these applications, hold minimum user profile information. -- They can use only tenant level connections (domain connections). These are sources of users, configured in the tenant's [dashboard](${manage_url}) as connections. These connections are enabled for every third party applications and can be also enabled for selected first party (standard) applications. -- To authenticate users using [Lock](/libraries/lock), you will have to use a version greater than `10.7`. - - [PSaaS Appliance](/appliance) users must use `https://{config.auth0Domain}/` as the value for [the `configurationBaseUrl` option](https://github.com/auth0/lock#other-options). -- They cannot use [ID Tokens](/tokens/id-token) to invoke [Management APIv2](/api/management/v2) endpoints. Instead, they should get a Management APIv2 Token (see the *How to get a Management APIv2 Token* panel for details). Note that the applications should be granted the `current_user_*` scopes, as required by each endpoint. - - `read:current_user`: [List or search users](/api/management/v2#!/Users/get_users), [Get a user](/api/management/v2#!/Users/get_users_by_id), [Get user Guardian enrollments](/api/management/v2#!/Users/get_enrollments) - - `update:current_user_metadata`: [Update a user](/api/management/v2#!/Users/patch_users_by_id), [Delete a user's multifactor provider](/api/management/v2#!/Users/delete_multifactor_by_provider) - - `create:current_user_device_credentials`: [Create a device public key](/api/management/v2#!/Device_Credentials/post_device_credentials) - - `delete:current_user_device_credentials`: [Delete a device credential](/api/management/v2#!/Device_Credentials/delete_device_credentials_by_id) - - `update:current_user_identities`: [Link a user account](/api/management/v2#!/Users/post_identities), [Unlink a user identity](/api/management/v2#!/Users/delete_provider_by_user_id) - -::: panel How to get a Management APIv2 Token -In order to access the [Management APIv2](/api/management/v2) endpoints from a third party applications, you need a Management APIv2 Token. To get one you can use any of the [API Authorization Flows](/api-auth), with the following request parameters: -- `audience=https://${account.namespace}/api/v2/` -- `scope=read:current_user update:current_user_metadata` -::: diff --git a/articles/applications/concepts/app-types-confidential-public.md b/articles/applications/concepts/app-types-confidential-public.md new file mode 100644 index 0000000000..8a5e97d787 --- /dev/null +++ b/articles/applications/concepts/app-types-confidential-public.md @@ -0,0 +1,63 @@ +--- +description: Understand the difference between confidential and public application types. +toc: true +topics: + - applications + - application-types +contentType: concept +useCase: + - build-an-app +--- +# Confidential and Public Applications + +According to the [OAuth 2.0 spec](https://tools.ietf.org/html/rfc6749#section-2.1), applications can be classified as either confidential or public. The main difference relates to whether or not the application is able to hold credentials (such as a client ID and secret) securely. + +When you create an application using the Dashboard, Auth0 will ask you what [Auth0 application type](/applications) you want to assign to the new application and use that information to determine whether the application is confidential or public. + +To check whether your application is confidential or public, see [View Application Type: Confidential or Public](/dashboard/guides/applications/view-app-type-confidential-public). + +## Confidential applications + +Confidential applications can hold credentials in a secure way without exposing them to unauthorized parties. They require a trusted backend server to store the secret(s). + +### Grant types + +Because they use a trusted backend server, confidential applications can use grant types that require them to authenticate by specifying their client ID and secret when calling the token endpoint. + +The following are considered to be confidential applications: + +* A web application with a secure backend that uses the [Authorization Code Flow](/flows/concepts/auth-code), [Password grant](/api-auth/grant/password), or [Password grant with Realm support](/api-auth/tutorials/password-grant#realm-support) +* A machine-to-machine (M2M) application that uses the [Client Credentials Flow](/flows/concepts/client-credentials) + +### ID Tokens + +Because confidential applications are capable of holding secrets, you can have ID Tokens issued to them that have been signed in one of two ways: + +* Symmetrically, using their client secret (`HS256`) +* Asymmetrically, using a private key (`RS256`) + +## Public applications + +Public applications **cannot** hold credentials securely. + +### Grant types + +Public applications can only use grant types that do not require the use of their client secret. + +The following are public applications: + +* A native desktop or mobile application that uses the [Authorization Code Flow with PKCE](/flows/concepts/auth-code-pkce) +* A JavaScript-based client-side web application (such as a single-page app) that uses the [Implicit Flow](/flows/concepts/implicit) grant + +### ID Tokens + +Because public applications are unable to hold secrets, [ID Tokens](/tokens/concepts/id-tokens) issued to them must be: + +* Signed asymmetrically using a private key (`RS256`) +* Verified using the public key corresponding to the private key used to sign the token + +## Keep reading + +* [View Application Type](/dashboard/guides/applications/view-app-type-confidential-public) +* [First-Party and Third-Party Applications](/applications/concepts/app-types-first-third-party) +* [Auth0 Grant Types Mapping](/applications/reference/grant-types-auth0-mapping) diff --git a/articles/applications/concepts/app-types-first-third-party.md b/articles/applications/concepts/app-types-first-third-party.md new file mode 100644 index 0000000000..1412c22625 --- /dev/null +++ b/articles/applications/concepts/app-types-first-third-party.md @@ -0,0 +1,43 @@ +--- +description: Understand the difference between confidential and public application types. +topics: + - applications + - application-types +contentType: concept +useCase: + - build-an-app +--- +# First-Party and Third-Party Applications + +Applications can be classified as either first-party or third-party, which refers to the ownership of the application. The main difference relates to who has administrative access to your Auth0 domain. + +## First-party applications + +First-party applications are those controlled by the same organization or person who owns the Auth0 domain. For example, let's say you created both a Contoso API and an application that logs into `contoso.com` and consumes the Contoso API. You would register both the API and application under the same Auth0 domain, and the application would be a first-party application. By default, all applications created via the [Auth0 Dashboard](${manage_url}/#/applications) are first-party applications. + +## Third-party applications + +Third-party applications are controlled by someone who most likely should *not* have administrative access to your Auth0 domain. Third-party applications enable external parties or partners to securely access protected resources behind your API. An example of this is with Facebook, let's say you created an application to get a client ID and secret to integrate with your service. That application is considered third-party because it is not owned by Facebook but a third-party that wants to integrate with Facebook APIs and services. + +::: note +All applications created through [Dynamic Client Registration](/api-auth/dynamic-client-registration) will be third-party. + +Third-party applications cannot be created using the Dashboard, but must be created through the [Auth0 Management API](/api/management/v2#!/Clients/post_clients) by setting `is_first_party` to `false`. +::: + +Third-party applications have the following unique characteristics: + +- **User Consent**: You must require user consent when consuming APIs because anyone can create an application. Requiring the user to provide consent improves security. + +- **ID Tokens**: [ID Tokens](/tokens/concepts/id-tokens) generated for third-party applications hold only minimum user profile information. + +- **Connections**: You can only use tenant-level connections or *domain connections*. For more informations, see [Enable Third-party Applications](/applications/guides/enable-third-party-apps). + +## Keep reading + +* [View Application Ownership](/api/management/guides/applications/view-ownership) +* [Applications](/applications) +* [Confidential and Public Applications](/applications/concepts/app-types-confidential-public) +* [Auth0 Grant Types Mapping](/applications/reference/grant-types-auth0-mapping) +* [User consent and third-party applications](/api-auth/user-consent) + \ No newline at end of file diff --git a/articles/applications/concepts/application-grant-types.md b/articles/applications/concepts/application-grant-types.md new file mode 100644 index 0000000000..76ced1103e --- /dev/null +++ b/articles/applications/concepts/application-grant-types.md @@ -0,0 +1,32 @@ +--- +title: Application Grant Types +description: Learn about the concept of grant types and how they relate to applications. +topics: + - applications + - grant-types +contentType: + - concept +useCase: + - build-an-app +--- +# Application Grant Types + +Application grant types (or _flows_) are methods through which applications can gain [Access Tokens](/tokens/concepts/access-tokens) and by which you grant limited access to your resources to another entity without exposing credentials. The [OAuth 2.0 protocol](/protocols/oauth2) supports several types of grants, which allow different types of access. + +Based on the needs of your application, some grant types are more appropriate than others. Auth0 provides many different authentication and authorization flows and allows you to indicate which grant types are appropriate based on the `grant_types` property of your Auth0-registered Application. + +For example, let's say you are securing a mobile app. In this case, you'd use the [Authorization Code using Proof Key for Code Exchange (PKCE) Grant](/flows/concepts/auth-code-pkce). + +Alternatively, if you were securing a client-side app (such as a single-page app), you'd use the [Implicit Grant](/flows/concepts/implicit). + +::: note +Not sure which grant type is appropriate for your use case? Refer to [Which OAuth 2.0 flow should I use?](/api-auth/which-oauth-flow-to-use) for help. +::: + +## Keep Reading + +* [Available Grant Types](/applications/reference/grant-types-available) +* [Auth0 Grant Types Mapping](/applications/reference/grant-types-auth0-mapping) +* [Update Grant Types Using the Dashboard](/dashboard/guides/applications/update-grant-types) +* [Update Grant Types Using the Management API](/api/management/guides/applications/update-grant-types) +* [Legacy Grant Types](/applications/concepts/grant-types-legacy) diff --git a/articles/applications/concepts/client-secret.md b/articles/applications/concepts/client-secret.md new file mode 100644 index 0000000000..3c97f7efa3 --- /dev/null +++ b/articles/applications/concepts/client-secret.md @@ -0,0 +1,17 @@ +--- +title: Client Secret +description: Learn about client secrets. +topics: + - applications + - client-secrets +contentType: + - concept +useCase: + - build-an-app +--- + +# Client Secret + +A client secret is a secret known only to your application and the authorization server. It protects your resources by only granting [tokens](/tokens) to authorized requestors. + +Protect your client secrets and never include them in mobile or browser-based apps. If your client secret is ever compromised, you should [rotate to a new one](/dashboard/guides/applications/rotate-client-secret) and update all authorized apps with the new client secret. \ No newline at end of file diff --git a/articles/applications/concepts/grant-types-legacy.md b/articles/applications/concepts/grant-types-legacy.md new file mode 100644 index 0000000000..795ad11152 --- /dev/null +++ b/articles/applications/concepts/grant-types-legacy.md @@ -0,0 +1,36 @@ +--- +title: Legacy Grant Types +description: Learn about legacy grant types and more secure alternatives. +topics: + - applications + - client-secrets +contentType: concept +useCase: + - build-an-app +--- + +# Legacy Grant Types + +Legacy grant types are traditional grant types supported for legacy customers only. If you are a legacy customer, we highly recommend moving to a more secure alternative. + +::: warning +As of 8 June 2017, all Auth0 Applications were given a `grant_types` property that **must** be populated. To avoid changes in functionality for Auth0 customers at that time, we populated the `grant_types` property for all existing Applications with **all** Auth0 legacy, Auth0 extension, and specification-conforming grant types. + +At this time, new Auth0 customers were no longer able to add legacy grant types to their applications. Legacy grant types are only available for previous customers while they migrate to new flows, to avoid breaking changes. If you were a customer prior to 8 June 2017, you can [use the Dashboard](/dashboard/guides/applications/update-grant-types) or [use the Management API](/api/management/guides/applications/update-grant-types) to enable a legacy grant type. +::: + +## Secure Alternatives + +If you're currently using a legacy grant type, refer to the chart below to see which of the secure alternatives you should use instead. + +| Legacy Grant Type | Alternative | +|:-----|:----| +|`http://auth0.com/oauth/legacy/grant-type/ro` | Use the [/oauth/token](/api/authentication#authorization-code) endpoint with a grant type of `password`. See [Resource Owner Password Credentials Exchange](/api-auth/tutorials/adoption/password) and [Executing the Resource Owner Password Grant](/api-auth/tutorials/password-grant) for additional information. | +| `http://auth0.com/oauth/legacy/grant-type/ro/jwt-bearer` | This feature is disabled by default. If you would like this feature enabled, please [contact support](https://support.auth0.com/) to discuss your use case and prevent the possibility of introducing security vulnerabilities. | +| `http://auth0.com/oauth/legacy/grant-type/delegation/refresh_token` | Use the `oauth/token` endpoint to obtain Refresh Tokens. See [OIDC-conformant Refresh Tokens](/api-auth/tutorials/adoption/refresh-tokens) for more info. | +| `http://auth0.com/oauth/legacy/grant-type/delegation/id_token` | This feature is disabled by default. If you would like this feature enabled, please [contact support](https://support.auth0.com/) to discuss your use case and prevent the possibility of introducing security vulnerabilities. | +| `http://auth0.com/oauth/legacy/grant-type/access_token` | Use browser-based social authentication. | + +::: note +Those implementing Passwordless Authentication should use [Universal Login](/universal-login) instead of the `oauth/ro` endpoint. +::: diff --git a/articles/applications/connections.md b/articles/applications/connections.md deleted file mode 100644 index abf585d450..0000000000 --- a/articles/applications/connections.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -description: Explains what Connections are and how they are associated with Auth0 Applications. -crews: crew-2 ---- -# Application Connections - -Connections are sources of users. They are categorized into Database, Social, Enterprise and Passwordless and can be shared among different applications. - -You can configure any number of connections for your applications to use in your Dashboard. To view all the connections that you have configured or create new ones navigate to [Dashboard](${manage_url}/#/) and select the connection type you want: -- [Database](${manage_url}/#/connections/database) -- [Social](${manage_url}/#/connections/social) -- [Enterprise](${manage_url}/#/connections/enterprise) -- [Passwordless](${manage_url}/#/connections/passwordless) - -For more details on the connections you can configure refer to: [Identity Providers Supported by Auth0](/identityproviders). - -## Example multi-tenant configuration - -If you have two separate domains (for example, public facing and internal), or two groups of connections you'd like to allow users, the best solution is to create a second Auth0 tenant via the settings menu in the top right on the [Dashboard](${manage_url}). This will allow you to have separate sets of users, applications, and connections for the two groups of users and applications you need to support. - -Let's suppose that you have two applications: an internal timesheets application and a customer portal. Users should login to the timesheets application either using their Active Directory credentials or their Google apps social connection. The customer portal on the other hand should be accessible via Facebook, Google, or LinkedIn authentication. - -You can configure this in Auth0 as follows: - -- Create a tenant `Fabrikam-Internal` for your internal domain, and an application within it `Fabrikam Employee Timesheets` for timesheets. -- Create a second tenant `Fabrikam-Public` for your public-facing domain, and an application within it `Fabrikam Customer Portal` for the customer portal. -- Configure the following [Enterprise connections](${manage_url}/#/connections/enterprise) for the `Fabrikam-Internal` tenant: Active Directory / LDAP, and Google Apps; once each is set up, check the **Applications** tab to enable them. -- Configure the following [Enterprise connection](${manage_url}/#/connections/enterprise) for the `Fabrikam-Public` tenant: Google Apps; once it is set up, check the **Applications** tab to enable it. -- Configure the following [Social connections](${manage_url}/#/connections/social) for the `Fabrikam-Public` tenant: Facebook, LinkedIn; once each is set up, check the **Applications** tab to enable it. diff --git a/articles/applications/enable-android-app-links.md b/articles/applications/enable-android-app-links.md deleted file mode 100644 index a809581a30..0000000000 --- a/articles/applications/enable-android-app-links.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -description: How to enable Android App Links support for your Auth0 application ---- - -# Enable Android App Links Support for your Auth0 Application - -The following document outlines how to configure [Android App Links](https://developer.android.com/training/app-links/index.html) for your Auth0 application. - -Android App Links allow an application to designate itself as the default handler of a given type of link. For example, clicking a URL in an email would open the link in the designated application. - -## Provide Your App's Package Name and Certificate Fingerprint - -You can establish the app link with Auth0 using [Applications](${manage_url}/#/applications) page of the [Auth0 Dashboard](${manage_url}). - -Select the Application you want to link with your Android application. You will see the **Settings** page for the Application. - -![](/media/articles/applications/settings.png) - -Scroll to the bottom of the **Settings** page and click **Show Advanced Settings.** - -![](/media/articles/applications/advanced-settings.png) - -Select the **Mobile Settings** tab, then provide the [App Package Name](https://developer.android.com/studio/build/application-id.html) and the SHA256 fingerprints of your app’s signing certificate for your Android application. - -You can generate the fingerprint using the Java keytool in your terminal: - -```bash -keytool -list -v -keystore my-release-key.keystore -``` - -::: note -For more information on signing certificates, check out the [Sign Your App](https://developer.android.com/studio/publish/app-signing.html) page of the Android developer documentation. -::: - -![](/media/articles/applications/mobile-settings.png) - -Click **Save Changes** when done. - -## Test Your App Link - -You can test your app link by navigating to the following URL using your browser: - -`https://${account.namespace}/.well-known/assetlinks.json` - -If the link is successful, you will return the following JSON (formatted for readability): - -```json -[{ - "relation": ["delegate_permission/common.handle_all_urls"], - "target": { - "namespace": "android_app", - "package_name": "com.mycompany.app1", - "sha256_cert_fingerprints": - ["14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"] - } -}] -``` - -::: note -See [Verify Android App Links](https://developer.android.com/training/app-links/verify-site-associations.html#testing) for further information on testing your app link. -::: diff --git a/articles/applications/enable-universal-links.md b/articles/applications/enable-universal-links.md deleted file mode 100644 index 7e80253de4..0000000000 --- a/articles/applications/enable-universal-links.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -description: How to enable Universal Links support for your Auth0 app in Xcode ---- - -# Enable Universal Links Support for your Auth0 Application in Xcode - -Because universal links establish a *verified relationship between domains and applications*, both your Auth0 Application settings and your iOS application need to be in sync. To do this, you need to provide Auth0 with the following information: - -* `Team ID`; -* `Bundle identifier`. - -## Find Your Apple `Team ID` and `Bundle Identifier` - -To find your Apple `Team ID`, go to your [Apple developer account summary page](https://developer.apple.com/membercenter/index.action#accountSummary). - -To find your iOS application's `Bundle identifier`, go to its [Xcode project settings](https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/ConfiguringYourApp/ConfiguringYourApp.html) page: - -![](/media/articles/applications/bundle-id.png) - -## Provide Your Apple `Team ID` and `Bundle Identifier` to Auth0 - -You can establish the universal link from the Auth0 side using [Applications](${manage_url}/#/clients) page of the [Management Dashboard](${manage_url}). - -Select the Application you want to link with your iOS application. You will see the *Settings* page for the Application. - -![](/media/articles/applications/settings.png) - -Scroll to the bottom of the *Settings* page and click *Show Advanced Settings.* - -![](/media/articles/applications/advanced-settings.png) - -Select the *Mobile Settings* tab and provide the **Team ID** and the **App bundler identifier** values for your iOS application. - -![](/media/articles/applications/mobile-settings.png) - -Click **Save Changes** when done. - -## Test Your Universal Link - -To test this, check whether the universal links apple app site association file is available for your application. Go to your browser and open: https://YOURACCOUNT.auth0.com/apple-app-site-association (replace YOURACCOUNT with your Auth0 account name). - -You can test your universal link by navigating to the following URL using your browser: - -`${account.namespace}/apple-app-site-association` - -If the link is successful, you will return the following JSON (formatted for readability): - -```json -{ - "applinks": { - "apps": [], - "details": [{ - "appID": "86WQXF56BC.com.auth0.Passwordless-Email", - "paths": ["/ios/com.auth0.Passwordless-Email/*"] - }] - } -} -``` diff --git a/articles/applications/guides/enable-third-party-apps.md b/articles/applications/guides/enable-third-party-apps.md new file mode 100644 index 0000000000..bcd3c1712c --- /dev/null +++ b/articles/applications/guides/enable-third-party-apps.md @@ -0,0 +1,91 @@ +--- +title: Enable Third-Party Applications +description: Learn how to enable third-party applications for your tenant. +topics: + - applications + - application-types + - third-party-applications +contentType: + - how-to +useCase: + - build-an-app +--- +# Enable Third-Party Applications + +You can enable third-party applications for your tenant. See [First-Party and Third-Party Applications](/applications/concepts/app-types-first-third-party) for details on the differences between the two types of applications. + +1. [Update your application's ownership to third-party](/api/management/guides/applications/update-ownership) in Auth0. + + By default, applications registered in Auth0 are first-party applications. If you want your application to be a third-party application, you must update its ownership. + +2. [Promote the connections you will use with third-party applications to domain level](/api/management/guides/connections/promote-connection-domain-level) in Auth0. + + Third-party applications can only authenticate users from [connections](/connections) flagged as domain-level connections. Domain-level connections can be enabled for selected first-party applications while also being open to all third-party application users for authentication. + +3. Update your application's login page. If you use [Lock](/libraries/lock/v11) in the [Universal Login Page](/universal-login/classic), you must also: + + - Upgrade to Lock version 11 or later + - Set the `__useTenantInfo: config.isThirdPartyClient` flag when instantiating Lock + - *For [Private Cloud](/private-cloud) users only*: Set the [`configurationBaseUrl` option](https://auth0.com/docs/libraries/lock/v11/configuration#configurationbaseurl-string-) to `https://{config.auth0Domain}/` when instantiating Lock + +## Access Token `current_user_*` scopes + +Neither first- nor third-party applications can use [ID Tokens](/tokens/concepts/id-tokens) to invoke [Management API](/api/management/v2) endpoints. Instead, they should get [Access Tokens](/api/management/v2/tokens) with the following `current_user_*` scopes required by each endpoint: + +| Scope | Endpoint | +| - | - | +| `read:current_user` | [List or search users](/api/management/v2#!/Users/get_users) | +| | [Get a user](/api/management/v2#!/Users/get_users_by_id) | +| | [Get user MFA enrollments](/api/management/v2#!/Users/get_enrollments) | +| `update:current_user_metadata` | [Update a user](/api/management/v2#!/Users/patch_users_by_id) | +| | [Delete a user's multi-factor provider](/api/management/v2#!/Users/delete_multifactor_by_provider) | +| `create:current_user_device_credentials` | [Create a device public key](/api/management/v2#!/Device_Credentials/post_device_credentials) | +| `delete:current_user_device_credentials` | [Delete a device credential](/api/management/v2#!/Device_Credentials/delete_device_credentials_by_id) | +| `update:current_user_identities` | [Link a user account](/api/management/v2#!/Users/post_identities) | +| | [Unlink a user identity](/api/management/v2#!/Users/delete_user_identity_by_user_id) | + +## Sample script + +```html + +... + +``` + +## Keep reading +* [View Application Ownership](/api/management/guides/applications/view-ownership) +* [Applications](/applications) +* [Confidential and Public Applications](/applications/concepts/app-types-confidential-public) +* [Auth0 Grant Types Mapping](/applications/reference/grant-types-auth0-mapping) +* [User consent and third-party applications](/api-auth/user-consent) diff --git a/articles/applications/how-to-rotate-client-secret.md b/articles/applications/how-to-rotate-client-secret.md deleted file mode 100644 index 608a3ba224..0000000000 --- a/articles/applications/how-to-rotate-client-secret.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -description: This page lists different ways of how to update your application's secret. -crews: crew-2 ---- - -# Rotate the Client Secret - -The client secret protects your resources by only granting tokens to requestors if they're authorized. Protect your client secrets; if any are ever compromised, you should rotate to a new one. Please remember that all authorized apps will therefore need to be updated with the new client secret. - -## Rotate the Client Secret in the Dashboard - -You can rotate your client secret under [Applications in the Dashboard](${manage_url}/#/applications). Choose the application you wish to edit by clicking on its name *or* the **Settings** gear icon associated with the application. - -![](/media/articles/clients/change-client-secret/clients.png) - -On the **Settings** page, the **Client Secret** will be the fourth parameter listed. To the right, click on the **rotation** icon to rotate your secret. You can view you your new secret by checking the box next to **Reveal client secret**. - -Scroll to the bottom of the Settings page, and click **Save Changes**. - -![](/media/articles/clients/change-client-secret/client-settings.png) - -## Rotate the Client Secret Using the Management API - -You can rotate your application's secret by making a `POST` call to the [Rotate a Client Secret endpoint](/api/management/v2#!/Clients/post_rotate_secret) of the Management API. - -Be sure to replace `YOUR_CLIENT_ID` and `MGMT_API_ACCESS_TOKEN` placeholder values with your client ID and Access Token, respectively. - -::: note -To make calls to the Management API, you must [get and use a valid Access Token](/api/management/v2/tokens). -::: - -```har -{ - "method": "POST", - "url": "https://${account.namespace}/api/v2/clients/YOUR_CLIENT_ID/rotate-secret", - "httpVersion": "HTTP/1.1", - "cookies": [], - "headers": [{ - "name": "Authorization", - "value": "Bearer MGMT_API_ACCESS_TOKEN" - }], - "queryString": [], - "postData": {}, - "headersSize": -1, - "bodySize": -1, - "comment": "" -} -``` - -## Update Authorized Applications - -Once you've rotated your client secret, you must update any authorized applications with the new value. - -To make sure that you see as little downtime as possible when connecting your apps to your Auth0 application, we suggest you store the new client secret as a fallback to the previous secret. Then, if the connection doesn't work with the old secret, your app will use the new secret. - -Secrets can be stored in a list (or similar structure) to track keys until they're no longer needed. Once you're sure that an old secret is obsolete, you can remove its value from your app. diff --git a/articles/applications/index.md b/articles/applications/index.md index 91e1e36547..2f3bf9a89a 100644 --- a/articles/applications/index.md +++ b/articles/applications/index.md @@ -1,91 +1,52 @@ --- -description: Explains the basics of creating and using Auth0 Applications. -toc: true +description: Understand the basics of creating and using Auth0 Applications. +topics: + - applications +contentType: + - concept +useCase: + - build-an-app --- -# Applications +# Applications in Auth0 -An Auth0 **application** represents your application and allows use of Auth0 for authentication. The term application does not imply any particular implementation characteristics. Your application can be a native app that executes on a mobile device, a single page app that executes on a browser, or a regular web app that executes on a server. +The term *application* or *app* in Auth0 does not imply any particular implementation characteristics. For example, it could be a native app that executes on a mobile device, a single-page app that executes on a browser, or a regular web app that executes on a server. -## Application Types +Auth0 categorizes apps based on these characteristics: -::: note -Auth0 differentiates between [public and private applications](/applications/application-types#confidential-vs-public-applications), as well as [first- vs. third-party applications](/applications/application-types#first-vs-third-party-applications). -::: - -There are four application types in Auth0. Depending on which type you choose, you'll see [different settings you can configure](/applications/application-settings). - -- **Native**: Used for mobile, desktop or hybrid apps, than run natively in a device, like Android, Ionic or iOS. For a complete listing of the SDKs Auth0 offers for mobile apps refer to: [Native SDKs](/quickstart/native). - -- **Single Page Web Applications**: Used for JavaScript front-end apps that run on a browser, like Angular, jQuery or React. For a complete listing of the SDKs Auth0 offers for SPAs refer to: [Single Page App SDKs](/quickstart/spa). - -- **Regular Web Applications**: Used for traditional web applications that run on a server, like ASP .NET, Java or Node.js. For a complete listing of the SDKs Auth0 offers for Web Apps refer to: [Web App SDKs](/quickstart/webapp). - -- **Machine to Machine Applications**: Used for server to server applications like CLIs, daemons or services running on your backend. Typically you would use this option if you have a service that requires access to an API. - -## How to configure an Application - -Navigate to the [dashboard](${manage_url}) and click on the [Applications](${manage_url}/#/applications) menu option on the left. By default, you should have one application named *Default App*. You can either configure this one or create a new one by clicking the **+ Create Application** button. - -The *Create Application* windows pops open. Set a descriptive name for your application and select the application type. The application type should match your application. - -![Create Application window](/media/articles/applications/create-client-popup.png) - -After you set the name and application type, click **Create**. +* **What type of app is it?**: To add authentication to your app, you must register it in the Auth0 Dashboard and select from one of the following app types: + - [Regular web app](/dashboard/guides/applications/register-app-regular-web): Traditional web apps that perform most of their application logic on the server (such as Express.js or ASP.NET). + - [Single-page app (SPA)](/dashboard/guides/applications/register-app-spa): JavaScript apps that perform most of their user interface logic in a web browser, communicating with a web server primarily using APIs (such as AngularJS + Node.js or React). + - [Native app](/dashboard/guides/applications/register-app-native): Mobile or Desktop apps that run natively in a device (such as iOS or Android). + - [Machine-to-machine (M2M) app](/dashboard/guides/applications/register-app-m2m): Non-interactive apps, such as command-line tools, daemons, IoT devices, or services running on your back-end. Typically, you use this option if you have a service that requires access to an API. -A new application will be created and you will be redirected to this application's view that has four tabs: +* **Can the app securely hold credentials?**: According to the [OAuth 2.0 spec](https://tools.ietf.org/html/rfc6749#section-2.1), apps can be classified as either *public* or *confidential*; confidential apps can hold credentials securely, while public apps cannot. See [Confidential and Public Applications](/applications/concepts/app-types-confidential-public) for details. -- [Quick Start](${manage_url}/#/applications/${account.clientId}/quickstart): Lists all available Quick Starts, filtered by your application's type. +* **Who owns the app?**: Whether an app is classified as first- or third-party depends on the app ownership and control. First-party apps are controlled by the same organization or person that owns the Auth0 domain. Third-party apps enable external parties or partners to securely access protected resources behind your API. See [First-Party and Third-Party Applications](/applications/concepts/app-types-first-third-party) for details. -- [Settings](${manage_url}/#/applications/${account.clientId}/settings): Lists all the available settings for your application. +## Manage app settings - ::: note - Please see [Application Settings](/applications/application-settings) for detailed information. - ::: +You register apps on the [Dashboard > Applications > Settings](${manage_url}/#/applications/${account.clientId}/settings) page. See [Application Settings](/dashboard/reference/settings-application) for details. -- [Addons](${manage_url}/#/applications/${account.clientId}/addons): Add-ons are extensions associated with applications. They are typically third-party APIs used by the application(s) for which Auth0 generates Access Tokens. For more details refer to: [Addons](/applications/addons). +In addition to setting up apps in the Dashboard, you can also set up apps programmatically as described in the [OpenID Connect (OIDC) Dynamic Client Registration 1.0 ](https://openid.net/specs/openid-connect-registration-1_0.html) specification. See [Dynamic Client Registration](/api-auth/dynamic-client-registration) for details. -- [Connections](${manage_url}/#/applications/${account.clientId}/connections): Connections are sources of users. They are categorized into Database, Social and Enterprise and can be shared among different applications. For more details refer to: [Connections](/applications/connections). For a detailed list on the supported Identity Providers refer to: [Identity Providers Supported by Auth0](/identityproviders). - -::: note -After creating your first application, set the environment for your tenant to: development, staging, or production. For more information refer to [Set Up Multiple Environments](/dev-lifecycle/setting-up-env#set-the-environment). -::: - -## How to Delete an Application - -Navigate to the [Application Settings](${manage_url}/#/applications/${account.clientId}/settings) and scroll to the end of the page. Under the *Danger Zone* section you can find the **Delete Application** button. This operation cannot be undone. - -Once you click on the button a pop-up window will ask you to confirm the action. Click **Yes, delete application** to permanently remove the application. - -::: note -You can also delete an application using the [DELETE /api/v2/clients/{id} endpoint](/api/management/v2#!/Clients/delete_clients_by_id) of the Management API. +::: panel Multi-Tenancy +You can set up up a more complex configuration that allows users to log in differently for different apps. See [Using Auth0 to Secure Your Multi-Tenant Applications](/design/using-auth0-with-multi-tenant-apps) and [Create Multiple Tenants](/dashboard/guides/tenants/create-multiple-tenants). ::: -## Application Auditing - -Auth0 stores log data of both actions taken in the dashboard by the administrators, as well as authentications made by your users. The logs include many of the actions performed by the user like failing to login to an application or requesting a password change. For more details refer to: [Logs](/logs). - -If you use a third-party application for log management, like Sumo Logic, Splunk or Loggly, you can use Auth0 Extensions to export your logs there. For details on the available extensions and how to configure them refer to: [Extensions](/extensions). - -## Dynamic Client Registration - -You can use the Auth0 to programmatically create applications, as described in the [OIDC Dynamic Client Registration 1.0 specification](https://openid.net/specs/openid-connect-registration-1_0.html). For more details please refer to [Dynamic Client Registration](/api-auth/dynamic-client-registration). - -## Next Steps +By default, Auth0 enables all connections associated with your tenant when you create a new application. To change this, [update application connections](/dashboard/guides/applications/update-app-connections) in the Application Settings in the Dashboard. -Once you have configured your Application, some common next steps to take are: +## Monitor apps -- **Configure a Connection** and enable it for your Application. For details refer to [Application Connections](/applications/connections). For a list of the supported Identity Providers refer to [Identity Providers Supported by Auth0](/identityproviders). +You can [monitor apps](/monitoring/guides/monitor-applications) and perform end-to-end testing using your own tests. Auth0 stores [log data](/logs) including Dashboard administrator actions, successful and failed user authentications, and password change requests. You can use Auth0 [Extensions](/extensions) to export your log data and use tools like Sumo Logic, Splunk, or Loggly to analyze and store your log data. -- **Configure your app** to use your Auth0 Application. For detailed instructions and samples for a variety of technologies, refer to our [quickstarts](/quickstarts). There you can find information on how to implement login and logout (using [Lock](/libraries/lock) or [Auth0.js](/libraries/auth0js)), handle your user sessions, retrieve and display user profile information, add [Rules](/rules) to customize your flow, and more. +## Remove apps - ::: note - For background theory on application authentication flows, refer to [Application Authentication](/application-auth). - ::: +You can [remove an application using the Auth0 Dashboard](/dashboard/guides/applications/remove-app) or the [Management API](/api/management/guides/applications/remove-app). -- Use our latest [API Authorization](/api-auth) features to **call an API**. +## Manage client secrets -- **Use [our APIs](/api/info)**. +You can [rotate an app's Client Secret](/dashboard/guides/applications/rotate-client-secret) using the Auth0 Dashboard or the [Management API](/api/management/guides/applications/rotate-client-secret). - - The [Authentication API](/api/authentication) handles all the primary identity related functions (login, logout, get user profile, and so forth). Most users consume this API through our [Quickstarts](/quickstarts), the [Auth0.js library](/libraries/auth0js) or the [Lock widget](/libraries/lock). However, if you are building all of your authentication UI manually you will have to interact with this API directly. +## Grant types - - The [Management API](/api/management/v2) can be used to automate various tasks in Auth0 such as creating users. +Auth0 provides many different authentication and authorization grant types or *flows* and allows you to indicate which grant types are appropriate based on the `grant_types` property of your Auth0-registered app. See [Application Grant Types](/applications/concepts/application-grant-types) for more details. diff --git a/articles/applications/reference/grant-types-auth0-mapping.md b/articles/applications/reference/grant-types-auth0-mapping.md new file mode 100644 index 0000000000..d0808c59d3 --- /dev/null +++ b/articles/applications/reference/grant-types-auth0-mapping.md @@ -0,0 +1,61 @@ +--- +title: Auth0 Grant Types Mapping +description: Learn which grant types are available to which application types with Auth0. +toc: true +topics: + - applications + - application-types + - grant-types +contentType: reference +useCase: + - build-an-app +--- + +# Auth0 Grant Types Mapping + +When registered, Auth0 Applications have access to different grant types based on [application](/applications) type. The biggest deciding factor is whether the application is [confidential or public](/applications/concepts/app-types-confidential-public). + +Additionally, trusted first-party applications have access to additional grant types. + +## Public applications + +When a **Native App** or **Single-Page App** is registered in the Dashboard, it is automatically flagged as a public application, which is indicated by a `token_endpoint_auth_method` flag set to `none`. + +By default, Auth0 creates public applications with the following `grant_types` enabled: + +* `implicit` +* `authorization_code` +* `refresh_token` + +**Native Apps** can also use the `device_code` grant type. + +::: note +Public applications **cannot** use the `client_credentials` grant type. To use this grant type, you must indicate that the application is confidential rather than public. Use the [Management API](/api/management/v2#!/Clients/patch_clients_by_id) to set the **token_endpoint_auth_method** to `client_secret_post` or `client_secret_basic`. +::: + +## Confidential applications + +When a **Regular Web App** or **Machine-to-Machine (M2M) App** is registered in the Dashboard, it is automatically flagged as a confidential application, which is indicated by a `token_endpoint_auth_method` flag set to anything *except* `none`. + +By default, Auth0 creates confidential applications with the following `grant_types` enabled: + +* `implicit` +* `authorization_code` +* `refresh_token` +* `client_credentials` + +## Trusted first-party applications + +Trusted first-party applications have the same `grant_types` enabled as confidential applications, plus the following: + +* `password` +* `http://auth0.com/oauth/grant-type/password-realm` +* `http://auth0.com/oauth/grant-type/mfa-oob` +* `http://auth0.com/oauth/grant-type/mfa-otp` +* `http://auth0.com/oauth/grant-type/mfa-recovery-code` + +::: note +If you are using the [Dashboard](${manage_url}) to enable or disable these grant types, be aware that all the Password and MFA grant types are enabled when you add the `Password` or `MFA` grant type to your Application. You cannot select them individually. +::: + +For more info about first-party and third-party applications, see [First-Party and Third-Party Applications](/applications/concepts/app-types-first-third-party). diff --git a/articles/applications/reference/grant-types-available.md b/articles/applications/reference/grant-types-available.md new file mode 100644 index 0000000000..f4f2946b74 --- /dev/null +++ b/articles/applications/reference/grant-types-available.md @@ -0,0 +1,55 @@ +--- +title: Available Grant Types +description: Learn which grant types are available with Auth0. +toc: true +topics: + - applications + - grant-types +contentType: reference +useCase: + - build-an-app +--- +# Available Grant Types + +Various grant types are valid when registering Auth0 Applications. These can be divided into the following categories: + +* **[Spec-conforming grants](#spec-conforming-grants)**: Grants defined by and conforming to external specifications (such as OpenID Connect (OIDC)). +* **[Auth0 extension grants](#auth0-extension-grants)**: Auth0-specific grants that conform to the [OAuth extension mechanism](https://tools.ietf.org/html/rfc6749#section-4.5) to support additional clients or to provide a bridge between OAuth and other trust frameworks. +* **[Auth0 legacy grants](#auth0-legacy-grants)**: Traditional grant types supported for legacy customers only. If you are a legacy customer, we highly recommend moving to a more secure alternative. For info on working with legacy grant types and their alternatives, see [Legacy Grant Types](/applications/concepts/grant-types-legacy). + +## Spec-conforming grants + +| `grant_type` | More info | +|:-----|:----| +| `implicit` | [Implicit Grant](/flows/concepts/implicit) | +| `authorization_code` | [Authorization Code Grant](/flows/concepts/auth-code) | +| `client_credentials` | [Client Credentials Grant](/flows/concepts/client-credentials) | +| `password` | [Resource Owner Password Grant](/api-auth/grant/password) | +| `refresh_token` | [Use Refresh Tokens](/tokens/guides/use-refresh-tokens) | +| `urn:ietf:params:oauth:grant-type:device_code` | [Device Authorization Grant](/flows/concepts/device-auth) | + +## Auth0 extension grants + +| `grant_type` | More info | +|:-----|:----| +| `http://auth0.com/oauth/grant-type/password-realm` | [Use an extension grant similar to the Resource Owner Password Grant that includes the ability to indicate a specific realm](/api-auth/grant/password#realm-support) | +| `http://auth0.com/oauth/grant-type/mfa-oob` | [Multi-factor Authentication OOB Grant Request](/mfa/guides/mfa-api/multifactor-resource-owner-password#mfa-oob-grant-request) | +| `http://auth0.com/oauth/grant-type/mfa-otp` | [Multi-factor Authentication OTP Grant Request](/mfa/guides/mfa-api/multifactor-resource-owner-password#mfa-otp-grant-request) | +| `http://auth0.com/oauth/grant-type/mfa-recovery-code` | [Multi-factor Authentication Recovery Grant Request](/mfa/guides/mfa-api/multifactor-resource-owner-password#mfa-recovery-grant-request) | +| `http://auth0.com/oauth/grant-type/passwordless/otp` | [Embedded Passwordless Login Grant Request](/connections/passwordless#implementing-login) | + +## Auth0 legacy grants + +Legacy grants include: + +* `http://auth0.com/oauth/legacy/grant-type/ro` +* `http://auth0.com/oauth/legacy/grant-type/ro/jwt-bearer` +* `http://auth0.com/oauth/legacy/grant-type/delegation/refresh_token` +* `http://auth0.com/oauth/legacy/grant-type/delegation/id_token` +* `http://auth0.com/oauth/legacy/grant-type/access_token` + +For info on working with legacy grant types and their alternatives, see [Legacy Grant Types](/applications/concepts/grant-types-legacy). + +## Keep reading + +* To learn which grant types are enabled for different application types, see [Auth0 Grant Types Mapping](/applications/reference/grant-types-auth0-mapping). diff --git a/articles/applications/reference/wildcard-subdomains.md b/articles/applications/reference/wildcard-subdomains.md new file mode 100644 index 0000000000..74f968b6d1 --- /dev/null +++ b/articles/applications/reference/wildcard-subdomains.md @@ -0,0 +1,35 @@ +--- +title: Wildcards for Subdomains +description: Describes wildcards for subdomains function in application configuration. +toc: true +topics: + - applications +contentType: reference +useCase: + - build-an-app +--- +# Wildcards for Subdomains + +You can use wildcards for subdomain URL registration in your application configuration in the Dashboard with these fields: + +* **Allowed Callback URLs**: Set of URLs to which Auth0 is allowed to redirect users after they authenticate. +* **Allowed Logout URLs**: List of URLs to which you can redirect users after they log out from Auth0. +* **Allowed Origins (CORS)**: Set of URLs that will be allowed to make requests from JavaScript to Auth0 API (typically used with CORS). + +::: warning +Avoid using wildcards for subdomains in application callbacks and allowed origins as it can make your application vulnerable to attacks. See [Application Settings Best Practices](/best-practices/application-settings) for this and other recommended settings. +::: + +You can use the star symbol (`*`) as a wildcard for subdomains, but it must be used in accordance with the following rules in order to properly function: + +* The protocol of the URL **must** be `http:` or `https:`. `com.example.app://*.example.com` will not work. + +* The wildcard **must** be located in a subdomain within the hostname component. `https://*.com` will not work. + +* The wildcard **must** be located in the subdomain furthest from the root domain. `https://sub.*.example.com` will not work. + +* The URL **must not** contain more than one wildcard. `https://*.*.example.com` will not work. + +* A wildcard **may** be prefixed and/or suffixed with additional valid hostname characters. `https://prefix-*-suffix.example.com` will work. + +* A URL with a valid wildcard **will not** match a URL more than one subdomain level in place of the wildcard. `https://*.example.com` will not work with `https://sub1.sub2.example.com`. diff --git a/articles/architecture-scenarios/_includes/_api-authentication-and-authorization.md b/articles/architecture-scenarios/_includes/_api-authentication-and-authorization.md index ae0e6718bb..7c95f9b91b 100644 --- a/articles/architecture-scenarios/_includes/_api-authentication-and-authorization.md +++ b/articles/architecture-scenarios/_includes/_api-authentication-and-authorization.md @@ -9,9 +9,9 @@ An Access Token is obtained by authenticating the user with an Authorization Ser ::: panel What is an Access Token? An Access Token (also referred to as `access_token`) is an opaque string representing an authorization issued to the application. It may denote an identifier used to retrieve the authorization information or may self-contain the authorization information (for example, the user's identity, permissions, and so forth) in a verifiable manner. -It is quite common for Access Tokens to be implemented as [JSON Web Tokens](/jwt). +It is quite common for Access Tokens to be implemented as [JSON Web Tokens](/tokens/concepts/jwts). -For more information on Auth0 Access Tokens refer to [Access Token](/tokens/access-token). +For more information on Auth0 Access Tokens refer to [Access Token](/tokens/concepts/access-tokens). ::: An API can enforce fine-grained control over who can access the various endpoints exposed by the API. These permissions are expressed as scopes. @@ -30,7 +30,7 @@ When a client asks the API to create a new timesheet entry, then the Access Toke For more information on scopes refer to [Scopes](/scopes). ::: -By using the OAuth 2.0 authorization framework, you can give your own applications or third-party applications limited access to your APIs on behalf of the application itself. Using Auth0, you can easily support different flows in your own APIs without worrying about the OAuth 2.0/OpenID Connect specification, or the many other technical aspects of API authorization. +By using the OAuth 2.0 authorization framework, you can give your own applications or third-party applications limited access to your APIs on behalf of the application itself. Using Auth0, you can easily support different flows in your own APIs without worrying about the OAuth 2.0/OpenID Connect (OIDC) specification, or the many other technical aspects of API authorization. ::: panel OAuth Roles In any OAuth 2.0 flow we can identify the following roles: @@ -40,5 +40,5 @@ In any OAuth 2.0 flow we can identify the following roles: - __Client__: an application requesting access to a protected resource on behalf of the Resource Owner. - __Authorization Server__: the server that authenticates the Resource Owner, and issues Access Tokens after getting proper authorization. In this case, Auth0. -Using [different grants types (or flows)](/api-auth/which-oauth-flow-to-use), these participants will interact to grant to the client apps limited access to the APIs you are building. As a result, the client app will obtain an `access_token` that can be used to call the API on behalf of the user. +Using [different grants types (or flows)](/api-auth/which-oauth-flow-to-use), these participants will interact to grant to the client apps limited access to the APIs you are building. As a result, the client app will obtain an Access Token that can be used to call the API on behalf of the user. ::: diff --git a/articles/architecture-scenarios/_includes/_api-configure-scopes.md b/articles/architecture-scenarios/_includes/_api-configure-scopes.md index 571c464d01..148a374c9a 100644 --- a/articles/architecture-scenarios/_includes/_api-configure-scopes.md +++ b/articles/architecture-scenarios/_includes/_api-configure-scopes.md @@ -1,7 +1,7 @@ -### Configure the Scopes +### Configure the Permissions -Once the application has been created you will need to configure the Scopes which applications can request during authorization. +Once the application has been created you will need to configure the Permissions which applications can request during authorization. -In the settings for your API, go to the **Scopes** tab. In this section you can add all four of the scopes which were discussed before, namely `read:timesheets`, `create:timesheets`, `delete:timesheets`, `approve:timesheets`. +In the settings for your API, go to the **Permissions** tab. In this section you can add all four of the scopes which were discussed before, namely `read:timesheets`, `create:timesheets`, `delete:timesheets`, `approve:timesheets`. -![Add Scopes](/media/articles/architecture-scenarios/mobile-api/add-scopes.png) \ No newline at end of file +![Add Scopes](/media/articles/architecture-scenarios/mobile-api/add-permissions.png) \ No newline at end of file diff --git a/articles/architecture-scenarios/_includes/_api-implement.md b/articles/architecture-scenarios/_includes/_api-implement.md index 70206c28f4..3a217a0af4 100644 --- a/articles/architecture-scenarios/_includes/_api-implement.md +++ b/articles/architecture-scenarios/_includes/_api-implement.md @@ -36,7 +36,7 @@ The validations that the API should perform are: Part of the validation process is to also check the Client permissions (scopes), but we will address this separately in the next paragraph of this document. -For more information on validating Access Tokens, refer to [Verify Access Tokens](/api-auth/tutorials/verify-access-token). +For more information on validating Access Tokens, see [Validate Access Tokens](/tokens/guides/validate-access-tokens). ::: note See the implementation in [Node.js](/architecture-scenarios/application/mobile-api/api-implementation-nodejs#2-secure-the-api-endpoints) @@ -60,8 +60,8 @@ For retrieving the list of timesheets this is to ensure that we only return the One of the standard JWT claims is the `sub` claim which identifies the principal that is the subject to the claim. In the case of the Implicit Grant flow this claim will contain the user's identity, which will be the unique identifier for the Auth0 user. You can use this to associate any information in external systems with a particular user. -You can also use a custom claim to add another attribute of the user - such as their email address - to the `access_token` and use that to uniquely identify the user. +You can also use a custom claim to add another attribute of the user - such as their email address - to the Access Token and use that to uniquely identify the user. ::: note See the implementation in [Node.js](/architecture-scenarios/application/mobile-api/api-implementation-nodejs#4-determine-the-user-identity) -::: \ No newline at end of file +::: diff --git a/articles/architecture-scenarios/_includes/_api-signing-algorithms.md b/articles/architecture-scenarios/_includes/_api-signing-algorithms.md index 9860ac274f..26c06a5eaf 100644 --- a/articles/architecture-scenarios/_includes/_api-signing-algorithms.md +++ b/articles/architecture-scenarios/_includes/_api-signing-algorithms.md @@ -3,7 +3,7 @@ When you create an API you have to select the algorithm your tokens will be signed with. The signature is used to verify that the sender of the JWT is who it says it is and to ensure that the message wasn't changed along the way. ::: note -The signature is part of a JWT. If you are not familiar with the JWT structure please refer to: [JSON Web Tokens (JWTs) in Auth0](/jwt#what-is-the-json-web-token-structure-). +The signature is part of a JWT. If you are not familiar with the JWT structure please refer to: [JSON Web Token Structure](/tokens/references/jwt-structure). ::: To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that. That algorithm, which is part of the JWT header, is the one you select for your API: `HS256` or `RS256`. @@ -17,6 +17,3 @@ The most secure practice, and our recommendation, is to use __RS256__. Some of t - Under HS256, If the private key is compromised you would have to re-deploy the API with the new secret. With RS256 you can request a token that is valid for multiple audiences. - With RS256 you can implement key rotation without having to re-deploy the API with the new secret. -::: note -For a more detailed overview of the JWT signing algorithms refer to: [JSON Web Token (JWT) Signing Algorithms Overview](https://auth0.com/blog/json-web-token-signing-algorithms-overview/). -::: \ No newline at end of file diff --git a/articles/architecture-scenarios/_includes/_architecture/_custom-domains.md b/articles/architecture-scenarios/_includes/_architecture/_custom-domains.md new file mode 100644 index 0000000000..0f2d1ea2a4 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_architecture/_custom-domains.md @@ -0,0 +1,16 @@ +When you setup your Auth0 tenant, the URL for accessing that tenant will be of the form `https://${account.tenant}.auth0.com`. Providing a [Custom Domain](/custom-domains) (also known as a vanity URL), for your Auth0 tenant is not only an important factor for supporting your Branding requirements, but more importantly will also provide you with security benefits too: + +* Some browsers will, by default, make it [difficult to communicate in an iFrame if you don't have a shared domain](/api-auth/token-renewal-in-safari). +* A vanity URL makes phishing more difficult as the phisher must also create a vanity URL to mimic yours. For example, with a custom domain you can use your own certificate to get an "Extended Validation", making phishing even harder. + +::: note +You are allowed only one custom domain per Auth0 Tenant. This is because a tenant in Auth0 is intended to represent a “domain” of users. If you need more than one vanity URL, then you likely have more than one domain of users and should be using multiple tenants. +::: + +Your custom domain name should also give the user confidence that this is the appropriate place to enter their credentials, and we recommend that you create your custom domain in all environments early on to ensure that you are testing consistently between environments. **It's extremely important to train your users to to look for suspicious URLs when entering their credentials!** + +::: panel Best Practice +Create a custom domain (a.k.a. `CNAME`) for your Auth0 tenant, and also create one in development too so you can ensure you have managed the `CNAME` correctly. For example, you could create a `CNAME` which maps `login.mycompany.com` to `mycompany-prod.auth0.com`. +::: + +In almost all cases, customers have been most successful when adopting a strategy of a centralised domain for authentication across multiple product or service brands. This strategy provides users with a consistent UX, and also mitigates the complexity of deploying and maintaining multiple Auth0 tenants in a production environment. If you are considering having multiple domains for different brands, please refer to the [Branding](/architecture-scenarios/implementation/${platform}/${platform}-branding) guidance before you begin implementing. diff --git a/articles/architecture-scenarios/_includes/_architecture/_introduction.md b/articles/architecture-scenarios/_includes/_architecture/_introduction.md new file mode 100644 index 0000000000..ab22539da6 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_architecture/_introduction.md @@ -0,0 +1,37 @@ +Understanding your application is key to understanding how Auth0 can be leveraged to meet your needs. From experience, our most successful customers start with a visualization of their proposed - or in many cases existing - architecture and use this as a basis for reference as they progress. Understanding where your application fits within your organization is also important; Auth0 [Accounts and Tenants](/getting-started/the-basics#account-and-tenants) form the basis for the grouping and structuring of Auth0 assets, and it may be that you’ll need to leverage an existing Auth0 deployment in order to integrate with [Single Sign-on (SSO)](/sso/current/introduction), centralized user [Profile Management](/architecture-scenarios/implementation/${platform}/${platform}-profile-mgmt), consolidated billing, or the like. + +::: panel Best Practice +If you do have multiple applications, and you need to leverage SSO, then we recommend you check out our [How to Implement Single Sign-On](https://auth0.com/learn/how-to-implement-single-sign-on/) training guidance before continuing. +::: + +The value of investing time on the landscape of the architecture up-front is something that we have found pays dividends in the long run, and there are a number of things you will want to consider when looking at functionality and workflow: + +* What should the URL look like when Auth0 needs to present a web page to a user? +* How can Auth0 be structured to support your SDLC (Software Development Lifecycle)? +* How can you ensure that your Auth0 tenants are appropriately associated with your contract? +* What do you need to consider if there are other projects in your organization integrating with Auth0? Particularly projects that target their own, or a different domain of users (for example, applications that only employees will use)? +<% if (platform === "b2b") { %> +* How can you align the structure and domain of your customers’ organization with your Auth0 deployment? +<% } %> + +Organizations often service more than one domain of user - customers, employees, and affiliates being the most frequently encountered, with typically little to no cross-over: employees, say, don’t use the same applications as customers and vice-versa. In some cases there can also be a need to partition further within a domain - separate groups of customers, say, who use different and unconnected products. Auth0 provides a way to segregate your users and the associated collateral, and [tenant provision](#tenant-provision) covers this in more detail. If you need to provision an independent tenant then you’ll also want to [associate this with your existing Auth0 account](#tenant-association), so that you can take full advantage of the benefits provided at your organization’s contracted subscription level. + +::: panel Best Practice +It’s not uncommon for companies to have identity requirements that address multiple user communities: customers, partners, employees, etc. So be sure to consider other projects or future requirements when designing your architecture. +::: + +In addition, you’ll undoubtedly have an established set of processes and procedures as part of your Software Development Lifecycle (SDLC). So you’ll want to check out our [SDLC support](#sdlc-support) guidance regarding Auth0 Tenant provision in support of that too. + +For customer-facing applications, we typically see [OpenID Connect (OIDC)](/protocols/oidc) as being the most frequently used protocol. OIDC makes use of web based workflows with browser URLs that are presented to the user. Out-of-the-box, client facing URLs as part of Auth0 OIDC support are Auth0 branded, however we recommend using the Auth0 [custom domain](#custom-domains) capability to provide for consistent corporate identity and to also address potential user confidence concerns before they arise. + +::: panel Best Practice +Other groups within your organization may also be working with Auth0; it’s not uncommon for our customers to have disparate departments that serve different user communities. Identifying these will potentially influence your design choices, and doing so early could mitigate decisions that might prove costly later on. +::: + +<% if (platform === "b2b") { %> +If your customers' organizations support the use of multiple IdPs, then we recommend that you can create separate Auth0 tenants for that organization; see [Tenant provision for complex organizations](#tenant-provision-for-complex-organizations) for further details. This allows you to keep the rest of your setup much simpler by maintaining a one-to-one connection relationship between your organization and all your customer organizations within your main tenant. +<% } %> + +::: panel Get Started with Auth0 Video +Watch this short video [Architecture: Your Tenant](/videos/get-started/01-architecture-your-tenant) to learn what an Auth0 tenant is and how to configure it in the Auth0 Dashboard. Understand why you may want more than one tenant if you have different user communities, and also how you can use more than one tenant to support your Software Development Life Cycle (SDLC). Understand the importance of tenant naming and custom domain usage best practices. Also learn how to set up additional tenant administrators and how to associate tenants with your Auth0 account. +::: \ No newline at end of file diff --git a/articles/architecture-scenarios/_includes/_architecture/_sdlc-support.md b/articles/architecture-scenarios/_includes/_architecture/_sdlc-support.md new file mode 100644 index 0000000000..bddb0fea0d --- /dev/null +++ b/articles/architecture-scenarios/_includes/_architecture/_sdlc-support.md @@ -0,0 +1,17 @@ +Every company has some form of Software Development Life Cycle (SDLC), and throughout the development process you will want to align with that strategy. For instance, you need to be able to test your integration with Auth0 in a similar fashion as you test the applications themselves. It is therefore important to [structure Auth0 tenants to support your SDLC](/dev-lifecycle/setting-up-env), and there is a consistent pattern which our customers typically follow when it comes to the best practices associated with tenant layout for doing so: + +| Environment | Sample Tenant Name | Description | +| - | - | - | +| Development | **company-dev** | A shared environment where most of your development work occurs | +| QA/Testing | **company-qa** or **company-uat** | An environment for formal testing of the changes you've made | +| Production | **company-prod** | The production tenant | + +In some cases you may also want to create one or more sandboxes (e.g., **company-sandbox1**, **company-sandbox2**) so that you can test changes without compromising your development environment. This might be where you test deployment scripts and the like. + +::: panel Best Practice +You can also take advantage of our [Implementation Checklists](/architecture-scenarios/checklists) that you can download and customize to meet your implementation project needs. +::: + +::: warning +Though Auth0 allows you to create as many free tenants as you'd like, you may be limited for the number of tenants where all paid features are enabled. If elegible, you can be provided with up to **three** tenants where all features are shared. +::: diff --git a/articles/architecture-scenarios/_includes/_architecture/_tenant-association.md b/articles/architecture-scenarios/_includes/_architecture/_tenant-association.md new file mode 100644 index 0000000000..dc2739a4cf --- /dev/null +++ b/articles/architecture-scenarios/_includes/_architecture/_tenant-association.md @@ -0,0 +1 @@ +To ensure that your [tenants are all associated with your Auth0 contractual agreement](/dev-lifecycle/child-tenants) and have the same features, ensure all your tenants are associated with your company account. If you have individual developers that want to create their own sandboxes for testing, make sure they get associated with your account so they have the same permissions too. To do this you should contact your Auth0 representative or the Auth0 Support Center at ${env.DOMAIN_URL_SUPPORT}. diff --git a/articles/architecture-scenarios/_includes/_architecture/_tenant-provision.md b/articles/architecture-scenarios/_includes/_architecture/_tenant-provision.md new file mode 100644 index 0000000000..f502ca08a7 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_architecture/_tenant-provision.md @@ -0,0 +1,7 @@ +Everything starts with an Auth0 tenant. This is where you will be configuring your use of Auth0, and the where Auth0 assets - such as [Applications](/applications), [Connections](/connections) and [user profiles](/architecture-scenarios/implementation/${platform}/${platform}-profile-mgmt) are defined, managed and stored. Access to an Auth0 tenant is performed via the Auth0 [Dashboard](/dashboard), and via the Dashboard you can also create additional, associated tenants; you’re allowed to create more than one Auth0 tenant so that you can structure your tenants in a way that will isolate different domains of users and also support your [Software Development Life Cycle](#sdlc-support) (SDLC). + +::: warning +Tenant names cannot be changed, nor reused once deleted. So, make sure you're happy with your name(s) before you create your Auth0 tenants. +::: + +Determining the level of isolation you require when it comes to your user domains is an important step, and together with your branding requirements will subsequently help you determine the number of Auth0 tenants that will be required in your production environment. As we recommend you create a full suite of [SDLC supporting tenants](#sdlc-support) for every Auth0 tenant you will run in a production environment, the number of Auth0 tenants you will need to manage can quickly grow. Therefore you should consider carefully before creating multiple Auth0 tenants for production, and should consult our guidance on [Branding](/architecture-scenarios/implementation/${platform}/${platform}-branding) before making your final decision. diff --git a/articles/architecture-scenarios/_includes/_authentication/_application-integration.md b/articles/architecture-scenarios/_includes/_authentication/_application-integration.md new file mode 100644 index 0000000000..8580bb8809 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_authentication/_application-integration.md @@ -0,0 +1,60 @@ +Once you've figured out how you want to authenticate your users, the next step is to determine how you will initiate that authentication. Each application will typically have its own starting point. + +::: warning +Native mobile applications (and desktop applications) should use the system browser for authentication, or they open themselves up to additional security risks. See [Native vs. Browser Login on Mobile](/design/browser-based-vs-native-experience-on-mobile) for more information. +::: + +As discussed, we've found that most of our customers use [OpenID Connect (OIDC)](/protocols/oidc) as the industry-standard protocol when it comes to their customer-facing applications. Figuring out which [OIDC flow](/api-auth/intro) to use is your first task, and you will want to start by reviewing the our [grant mapping](/applications/reference/grant-types-auth0-mapping) guidance in the first instance. + +If you want to allow anonymous users access to any part of our application then you need to determine if you will be redirecting right away or prompting your users to redirect only when required (or perhaps some combination of both; see [Redirect Users After Login Authentication](/users/guides/redirect-users-after-login) for further discussion). If users can [deep link](#deep-linking-to-protected-endpoints) to a protected version (or area) of your site then you will need to determine the links to your application that will result in an automatic redirect to Auth0. + +### Anonymous access + +It is important to consider the user experience when someone first comes to your application. If your application supports anonymous user access (quite common for eCommerce applications) there are different scenarios to consider: + +* Are they returning to the application after having already logged in, or +* If this is the first time they are accessing the application: + * Have they already accessed a different application that uses the same Auth0 tenant, + * Have they ever (or perhaps not in a long time) authenticated on this device or browser. + +When an anonymous user accesses your application, it can often be desirable for the application to discover if the user has already logged into a different application in the same family, or to remember this user even if the application is a [SPA](/quickstart/spa) with no state. For example, if you can determine that the user is already logged in, you might decide to have the UI header in the application skip displaying a login button and instead have an account or profile menu for the user. To accomplish this you will want to utilize "[silent authentication](/api-auth/tutorials/silent-authentication)". Silent authentication will allow you to check to see if the user is logged in without prompting them to log in if they are not. Then the application can present a login button if necessary. If the user is logged in already, however, then you will receive tokens and will not have to present the user with a login button again. + +::: warning +Checking for a login session by redirecting to Auth0 can be really helpful for your application, but if this will result in a lot of requests it is important to employ some sort of throttling mechanism to avoid latency and/or rate limiting. <%= include('../../_includes/_rate-limit-policy.md') %> +::: + +### Deep linking to protected endpoints + +There are a variety of reasons why someone might link directly to a particular page within your application that is only accessible by authenticated users. If this is possible for your application you should automatically redirect your user to Auth0 if they are not authenticated. Once they authenticate and the authorization server returns them to your application, you can [redirect them](/users/guides/redirect-users-after-login) to where they intended to go in the first place. + +::: panel Best Practice +Most modern authentication frameworks support middleware for redirecting to an authorization server such as Auth0. Ensure yours: + +* Is configurable +* Can check expirations +* Supports Refresh Tokens (for confidential clients) +::: + +### Authenticating the user + +Authentication is the process of determining user identity. The result of authentication in an OIDC context is an ID Token. This token contains information about the user and should only be able to be obtained if the user authenticates using one or more factors as defined by the authorization server (the most common form being [user ID and password](#username-and-password-authentication)). There are a few things you may also need to consider in addition to obtaining an ID Token: + +* Do we also need an [Access Token](/tokens/concepts/access-tokens) in order to call a shared API? +* Is your application a single-page application and only requires an [ID Token](/tokens/concepts/id-tokens)? See [Implicit Grant](/api-auth/tutorials/implicit-grant) for more information. +* Is your application a native application (mobile or desktop) and/or do you need a [Refresh Token](/tokens/concepts/refresh-tokens)? See [Authorization Code Grant with PKCE](/api-auth/tutorials/authorization-code-grant-pkce) for more information. + +::: warning +Before you go live, you should ensure that **only** the grants that you are using for each application are enabled in your [configuration for your Application](/dashboard/guides/applications/update-grant-types). +::: + +### Implicit grant + +If all your application needs is the ID Token and the application is browser-based, then you can always use the [implicit grant](/api-auth/tutorials/implicit-grant) to get your ID Token. This is a simple authentication flow and should be supported by your SDK (depending on the language you are developing in). + +::: warning +If you need a [Refresh Token](/tokens/concepts/refresh-tokens) so that you can obtain a new Access Token or ID Token without having to re-authenticate the user, then you must use the [authorization code grant](/api-auth/tutorials/authorization-code-grant). +::: + +### Authorization code grant (with or without PKCE) + +If your SDK only supports the Authorization Code grant, or you need an Access Token or Refresh Token, then Authorization Code grant (with or without [PKCE](/flows/concepts/auth-code-pkce)) can also be used to retrieve an ID Token. The Authorization Code grant includes an additional API call to exchange the code for a token which can result in additional unnecessary latency if all you need is the ID Token. In many cases the [hybrid flow](/api-auth/tutorials/hybrid-flow) is implemented to provide optimum access to the ID Token while still leveraging Authorization Code grant workflow for the secure and safe retrieval of Access and Refresh Tokens. diff --git a/articles/architecture-scenarios/_includes/_authentication/_attack-protection.md b/articles/architecture-scenarios/_includes/_authentication/_attack-protection.md new file mode 100644 index 0000000000..42aeb1a83b --- /dev/null +++ b/articles/architecture-scenarios/_includes/_authentication/_attack-protection.md @@ -0,0 +1,5 @@ +The reason that authentication systems are important is to prevent bad actors from accessing applications and user data that they should not. We want to place as many barriers as possible between those bad actors and access to our systems. One of the easiest ways to do this is to ensure that your [attack protection](/attack-protection) with Auth0 is configured correctly, so take a moment to read the guidance on this subject and ensure that it's working correctly for you. + +::: panel Best Practice +Attack protection is handled behind the scenes by Auth0 and provides a great security feature for your product. If you're going to utilize it, ensure that you have set up your [Email Provider](/architecture-scenarios/implementation/${platform}/${platform}-operations#email-provider-setup) and configured your [Email Templates](/architecture-scenarios/implementation/${platform}/${platform}-branding#email-template-customization) before turning on email delivery to your users. +::: diff --git a/articles/architecture-scenarios/_includes/_authentication/_introduction.md b/articles/architecture-scenarios/_includes/_authentication/_introduction.md new file mode 100644 index 0000000000..1921e46883 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_authentication/_introduction.md @@ -0,0 +1,46 @@ +In order to provide services to your users, you must be able to identify who those users are. This process is called User Authentication. There are a number of ways to perform authentication of a user - via social media accounts, username and password, passwordless - and it's often recommended that you go beyond a first factor for authenticating the user by enabling multi-factor authentication (MFA). + +::: panel Best Practice +It's important to consider both security and user experience when designing how you will authenticate your users. Providing for multiple primary factors, and/or enforcing more than one factor during authentication, are ways that you can provide both. +::: + +There are a number of things you will want to consider when looking at functionality and workflow: + +* Where will users enter their credentials? +* How will you keep user credentials safe? +* How will you maintain your authentication system? +* How can you provide password authentication for your users? +* How can you prevent hackers from trying to log in as your users? +* How will you implement authentication in different kinds of applications? +* How can you make login easy for your users when they come from different language backgrounds? +* How will you provide a good user experience as you migrate away from any legacy authentication system? +* What should you consider when integrating applications with Auth0? +<% if (platform === "b2c") { %> +* Can users log in using their existing social (e.g., Facebook or Google) accounts? +<% } %> +* Do you need to provide multi-factor authentication? +* What do you do if you have a service that doesn't have a way for the user to log in ahead of time? +* Can you pass the same user access token from one API to another? +<% if (platform === "b2b") { %> +* What do you do if you need to isolate users by organization? +* How will you handle identifying which organization users belong to? +* What’s the benefit of providing enterprise connections for your organizations? +<% } %> + +Auth0 [Universal Login](#universal-login) provides users with a safe and secure experience - no matter whether you choose to provide for user ID/password credentials sign in, or allow the so-called Bring Your Own Identity scenarios provided via [Social Login](https://auth0.com/learn/social-login/). There are also brand recognition benefits to centralizing the login experience with Universal Login, even if you feel you will also have product-specific [branding](/architecture-scenarios/implementation/${platform}/${platform}-branding) requirements. The Auth0 UI widgets typically used with Universal Login also provide out-of-the-box support with regards to [internationalization](/libraries/lock/v11/i18n) for users with different language requirements, and out-of-the-box support for Auth0 features such as [MFA](#multi-factor-authentication-mfa-) and [attack protection](#attack-protection) allow you to put barriers in place in order to prevent hackers attempting to access users' accounts. + +Allowing users to sign in via user ID/password credentials means that you're not reliant on the status of third-party identity providers for your users to access your system. You also have the means require the credentials used to align with your corporate policies. Auth0 assists with this by providing you with multiple options in support of user ID/password logins, and the [guidance provided](#username-and-password-authentication) will help you understand you can leverage these options. Adding [social](#social-authentication) support at some stage, as an additional primary authentication factor, gives you added flexibility and can help you better understand your users without the need to question them further by leveraging the information already stored by the various social login [providers](/connections/identity-providers-social). + +If you have an existing legacy identity store, you’ll also want to see [User Migration](/architecture-scenarios/implementation/${platform}/${platform}-provisioning#user-migration). This section discusses the advantages of migrating to Auth0’s managed identity storage in terms of safety and security. + +For customer facing applications, OpenID Connect ([OIDC](/protocols/oidc)) is the most frequently used industry standard protocol, and OIDC has first-class citizen support in Auth0. Auth0 provides support for various different approaches for integrating various different applications, so you'll want to see the section on [application integration](#application-integration) for the information you'll need to make an informed choice. + +When calling one API from another API, or from any situation where there is no authenticated user context - such as one or more cron jobs, report generators, or continuous integration/delivery systems - you will need a way to authorize the _application_ instead of a _user_. This is a one step process where the application is authenticated (using a client ID and secret) and then authorized in one call. You can learn more about this in our authorization workstream under [machine-to-machine (m2m) authorization](/architecture-scenarios/implementation/${platform}/${platform}-authorization#machine-to-machine-m2m-authorization). + +<% if (platform === "b2b") { %> +Often companies need to segregate their users by organization and sometimes users can have access to more than one organization. Knowing which of these scenarios is relevant to your company will help define how to determine in which connection a user exists: whether you need to do it, when you need to do it, and how to accomplish it. See [Home Realm Discovery](#home-realm-discovery) to determine if this is something relevant to your company. +<% } %> + +::: panel Get Started with Auth0 Videos +Watch these two short videos [Authenticate: How It Works](/videos/get-started/04_01-authenticate-how-it-works) and [Authenticate: SPA Example](/videos/get-started/04_01-authenticate-spa-example) to learn about the differences between authentication, authorization, and access control. Understand when and why you might use each type of authentication method: first factors, second factors, and multi-factor. Learn about the OpenID Connect (OIDC) authentication protocol. See an example using the Auth0 Quickstart for a single-page application (SPA) implementation. +::: diff --git a/articles/architecture-scenarios/_includes/_authentication/_mfa.md b/articles/architecture-scenarios/_includes/_authentication/_mfa.md new file mode 100644 index 0000000000..ec67e73549 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_authentication/_mfa.md @@ -0,0 +1,16 @@ +In an era where misuse of user credentials is at an all-time high, protecting _your_ systems when it’s so common for hackers to steal users identity information in general is a challenge. One of the most effective ways though is to provide users with the ability to configure a second factor for protecting their account. More commonly referred to as [Multi-Factor Authentication](/mfa). This will ensure that only a valid user can access their account, even if they use a username and password that may have been compromised from a different application. + +::: panel Best Practice +It's quite common for customer facing applications to provide users with an _option_ for adding a second factor rather than _forcing_ them to use a second factor. For more information regarding this, see [providing your users with an option to add MFA](https://auth0.com/learn/multifactor-authentication-customers/). +::: + +Auth0 supports a number of different options when it comes to enabling MFA for protecting user account access, and there are several practices to ensure that you will truly be providing a flexible second factor barrier to access: + +* Auth0 [Guardian](https://auth0.com/multifactor-authentication): a service that provides both _Push_ notification generation and an application for allowing or denying requests. _Push_ sends notification to a user’s pre-registered device - typically a mobile or tablet - from which a user can immediately allow or deny account access via the simple press of a button. +* Time-based One-Time Password (TOTP): allows you to register a device - such as Google Authenticator - that will generate a one-time password which changes over time and which can be entered as the second factor to validate a user’s account. +* SMS: for sending a one-time code over SMS which the user is then prompted to enter before they can finish authenticating. +* Voice: for delivering a one-time code through a phone call which the user is then prompted to enter before they can finish authenticating. +* Duo: allows you to use your Duo account for multi-factor authentication. +* Email: allows you to use your email account for multi-factor authentication. + +Whilst MFA workflow using technologies such as Guardian or Google Authenticator is typically provided via a separate application that runs on a mobile or tablet device, if you don’t want your customers to have to download a separate application Auth0 also provides you with an SDK that you can use to build second factor workflow right in your existing mobile device application(s). diff --git a/articles/architecture-scenarios/_includes/_authentication/_social-authentication.md b/articles/architecture-scenarios/_includes/_authentication/_social-authentication.md new file mode 100644 index 0000000000..262ba3477c --- /dev/null +++ b/articles/architecture-scenarios/_includes/_authentication/_social-authentication.md @@ -0,0 +1,13 @@ +The “bring your own identity” scenario offered by Facebook, Google, etc., is a valuable way of simplifying the user authentication experience without compromising security, and using [Universal Login](#universal-login) makes it easy to start adding support for [Social Connections](/connections/identity-providers-social) with minimal disruption. + +::: warning +Auth0 provides a simple way to test social connections using [pre-configured developer keys](/connections/social/devkeys). However, these have [limitations](/connections/social/devkeys#limitations-of-developer-keys), and before going into production, you’ll need to set up your own application-specific keys by following the [instructions](/connections/identity-providers-social) for your chosen social provider(s). +::: + +With [social](https://auth0.com/learn/social-login/) support, user identities and credentials are managed by the social provider, as are certain identity claims—which Auth0 will use to populate the user [profile](/architecture-scenarios/implementation/${platform}/${platform}-profile-mgmt). Auth0 can also provide access to Social Identity Providers' (Social IdPs') [Access Tokens](/tokens/overview-idp-access-tokens), so that your application can also call 3rd-party Social IdP APIs on behalf of the user. + +::: panel Best Practice +Social is a great feature to provide, but when you offer more than one way to sign in, you need to consider the possibility that your customers will actually use more than one way to sign in. By default, every user identity in Auth0 has its own user profile, so you’ll probably want to consider Auth0's capability to [link user accounts](/users/concepts/overview-user-account-linking) to provide an effective way of associating one user profile with multiple identities. +::: + +Auth0 [Custom Social Connections](/connections/social/oauth2) extend social authentication even further by allowing you to connect with any OAuth2 identity provider not supported out-of-box. For example, support for the government-issued-identity provider [SwissID](https://www.swissid.ch/) can be configured in Auth0 by using a Custom Social Connection. diff --git a/articles/architecture-scenarios/_includes/_authentication/_sso-legacy.md b/articles/architecture-scenarios/_includes/_authentication/_sso-legacy.md new file mode 100644 index 0000000000..58df288183 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_authentication/_sso-legacy.md @@ -0,0 +1,10 @@ +In a large scale re-structure it's not always possible—or practical—to update all your applications at once. In fact, our recommended best practice is to plan for an iterative-style approach when it comes to integrating with Auth0. If your applications already participate in Single Sign-on (SSO), and your legacy identity system supports protocols such as OIDC or SAML, then you have a couple of options available if you want to continue to provide SSO as you integrate with Auth0: + +* Update your existing identity provider in your legacy SSO system to redirect to Auth0 for login (e.g., using [SAML](/protocols/saml/saml-configuration/auth0-as-identity-provider)), or +* Have Auth0 redirect to your legacy SSO system to login. This requires configuring your legacy system as an IdP in Auth0 (i.e., either using [SAML](/protocols/saml/saml-configuration/auth0-as-service-provider) or [OIDC](/connections/social/oauth2)). + +::: panel Best Practice +Supporting an SSO experience with your legacy system can add complexity, but may be worth it to generate a more seamless user experience as you integrate with Auth0. If you intend to go down this path, planning for it early can help ensure that it is possible to achieve. If you don't already have SSO at a centralized service, then the complexity to add it will unlikely be worth the benefits. +::: + +This is a complex topic that will likely need some additional investigation depending on your current legacy architecture, and we recommend you only look into this if you currently have SSO support in your legacy system. Note: if you are currently redirecting from your applications to a centralized system to authenticate your users and that system only asks for credentials if you don’t already have a session with the centralized system, then you have a legacy SSO implementation. diff --git a/articles/architecture-scenarios/_includes/_authentication/_universal-login.md b/articles/architecture-scenarios/_includes/_authentication/_universal-login.md new file mode 100644 index 0000000000..57dc6a92d7 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_authentication/_universal-login.md @@ -0,0 +1,11 @@ +Do you have, or will you have, more than one application in your system? If the answer to this question is yes, then you will want a centralized sign in experience. To achieve a seamless Single Sign-on (SSO) experience between multiple applications, it is critical to have a centralized location to redirect your users for authentication. This allows you a way to provide your users with a consistent experience if you add social authentication in the future, add third party applications to your system, or add multi-factor authentication as an option (or requirement) for your users - and also allow you to take advantage of new features for improving your users’ experience with little, if any, added development effort. + +::: panel Best Practice +If you have more than one application, the best practice is to redirect to a [centralized location](/universal-login) to authenticate the user. With Auth0, this means taking advantage of [Universal Login](/universal-login), which provides many security and user experience benefits out-of-the-box, including [SSO](/sso/current). +::: + +Auth0 Universal Login makes authenticating users a short, easy process which can be accomplished in three easy steps (all of our Quickstarts demonstrate this and our SDKs hide the complexity for you too): + +1. Determine how and when you want to [redirect from your application](#application-integration). +2. Set up the appropriate [branding](/architecture-scenarios/implementation/${platform}/${platform}-branding) and/or customized HTML in your Auth0 configuration. +3. Set up your application to [receive and handle the response](#application-integration) from the Authorization Server. diff --git a/articles/architecture-scenarios/_includes/_authentication/_username-and-password-authentication.md b/articles/architecture-scenarios/_includes/_authentication/_username-and-password-authentication.md new file mode 100644 index 0000000000..6668a0c76d --- /dev/null +++ b/articles/architecture-scenarios/_includes/_authentication/_username-and-password-authentication.md @@ -0,0 +1,9 @@ +Nearly every B2C application provides the ability for their customers to create a new set of credentials. This is a common form of authentication that all users are familiar with. + +Username password authentication comes in multiple flavors at Auth0. If your application is a green-field application with no existing user base, then a simple Auth0 out-of-the-box [Database Connection](/connections/database) will give you everything you need to start authenticating your users. However, if you have a legacy user store (such as your own database of users or an existing LDAP system) you have a couple of different options for migrating your users as discussed in our guidance on [User migration](/architecture-scenarios/implementation/${platform}/${platform}-provisioning#user-migration). + +However you end up provisioning the users for your database connection, the authentication of those users is quite similar. It requires you to present users with a form to enter their username and password. As mentioned in the guidance concerning [Universal Login](#universal-login), the simplest and safest way to authenticate users with a username and password is to redirect them to a centralized login page and collect their username and password there. This allows Auth0 to determine whether they have already authenticated and skip the login form entirely when it's not needed. + +::: panel Best Practice +Collecting credentials only at the centralized login page will reduce the surface area for potential leak of user secrets. It will also reduce the need to collect credentials unnecessarily. See [Universal Login](#universal-login) for more information. +::: diff --git a/articles/architecture-scenarios/_includes/_authorization/_api-integration.md b/articles/architecture-scenarios/_includes/_authorization/_api-integration.md new file mode 100644 index 0000000000..879f473836 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_authorization/_api-integration.md @@ -0,0 +1,37 @@ +In this scenario your Auth0 tenant can provide an OAuth2 [Access Token](/tokens/concepts/access-tokens), typically expressed as a [JWT](/tokens/concepts/jwts), which [can be used by your API to restrict access to certain parties](/api-auth). In addition, Auth0 provides support for what is notionally described as both [First-Party and Third-Party Applications](/applications/concepts/app-types-first-third-party). + +Acting as the authorization server, and with the consent of the user (the resource owner), your Auth0 tenant can be used to provide an Access Token - typically expressed as a [JWT](/tokens/concepts/jwts) - to an application (client) so that it can access a protected resources hosted by a resource server on behalf of the resource owner. The issued Access Token is typically passed as the Bearer token in the HTTP Authorization header sent to an API. + +Whether you have a single API, or perhaps a suite of logically related [microservice APIs](/api-auth/tutorials/represent-multiple-apis), you can leverage the Access Tokens that Auth0 provides in order to secure access to your service(s). Though relatively easy to set this up in the [Auth0 Dashboard](/apis) or through the [Auth0 Management API](/api/management/v2#!/Resource_Servers/post_resource_servers), it's important to review the different application scenarios and API layouts to determine the best architecture for your system. + +::: note +OAuth2 Access Tokens are primarily designed for use in securing public facing APIs; when expressed as a JWT, an Access Token is a self contained entity which can be verfied without the need to make any additional 3rd party API call. If your APIs do not fall into this category - i.e they are part of an application itself (as in only called by that application) or are sat behing your firewall - then protecting them with tokens may well be overkill, and your existing cookie based (et al) workflow may well suffice. +::: + +OAuth2 was designed specifically with third-party access in mind, For example, a scenario might be that a user (resource owner) wants to use an application (a client) that does not belong to the same organization as the service that provides the user's data (the reseource server). In this case, when the application needs to access data that the user owns, it redirects to the organization where the user’s data resides, which in turn authenticates the user and then prompts the user to give the application permission to access their data. This prompting for permission is referred to as providing *[consent](/api-auth/user-consent)* and is a large part of what providing support for [third party applications](/scopes/current/api-scopes#example-an-api-called-by-a-third-party-application) entails. If you are planning to integrate third-party applications, then it's important you [mark them as third-party](/api-auth/user-consent) early on so that Auth0 will handle prompting for user consent. + +On the other hand, if your organization *owns* the application(s), the user data itself and the API(s) through which that data is accessed, then consent is not typically required as the interactions are all [first-party](/scopes/current/api-scopes#example-an-api-called-by-a-first-party-application). If you're only creating first-party applications, then you can ensure that you are not presenting your users with any unnecessary consent screen(s) by [allowing user consent to be skipped](/apis#api-settings) as part of any resource service definition. + +::: warning +Though you can configure your applications to be first-party and subsequently configure your APIs to allow first-party clients to ignore consent, if you are using `localhost` then Auth0 cannot verify that the application is truly a first-party app so your users will be prompted for consent anyway. To work around this constraint, when testing on your local machine during development, create a [fake local hostname and use that instead](https://community.auth0.com/t/how-do-i-skip-the-consent-page-for-my-api-authorization-flow/6035). +::: + +Alternatively, you may have data relating to a user for which additional [functionality is provided](/scopes/current/api-scopes#example-an-api-called-by-a-back-end-service) and for which explicit user consent cannot be obtained (i.e. there is no authenticated user who can provide it). In this scenario, a [list of applications for which Client Credentials grant is enabled](/flows/concepts/client-credentials) can be defined. + +### Access Token claims + +As is the case with ID Tokens, you can [add custom claims to Access Tokens](/scopes/current/sample-use-cases#add-custom-claims-to-a-token) using Auth0 Rule extensibility. Once added, your API can then verify an Access Token for the necessary claims and either allow or prevent access to certain functionality as required. + +::: panel Best Practice +When you are considering adding custom claims, we recommend that you store any access control data you may need to include within claims as part of the user's [`app_metadata`](/users/concepts/overview-user-metadata). Firstly, this prevents you from needing to call an external API to fetch the data, which can negatively impact performance and scalability. Secondly `app_metadata` **cannot** be modified by a user - so the user cannot directly circumvent any access control restrictions by modifying their own metadata. Also remember to check out our [metadata best practices](architecture-scenarios/implementation/${platform}/${platform}-profile-mgmt#metadata) guidance too. +::: + +### Access Token scopes + +[OAuth2 Scopes](/scopes/current/api-scopes) are typically used as the mechanism by which an API can determine what actions can be performed on behalf of a user. Scopes can be added on a per API basis to [define specific access permissions](/dashboard/guides/apis/add-permissions-apis) in the Auth0 Dashboard or through the Auth0 Management API). Scopes can also be manipulated via Auth0 extensibility (e.g. via a Rule, as in this [example](/architecture-scenarios/spa-api/part-2#create-a-rule-to-validate-token-scopes)). The scopes an application requests for accessing an API should depend on what functionality the application needs the user to give permission for the application to use. Once the requested scopes are authorized, they will be returned in the Access Token which can be subsequently verified by said [API](/tokens/guides/validate-access-tokens). A good example of this is when you log in to an application that is using a social provider for login: the social provider API requires that the application specifies whether the user will want the application to post items on your behalf. This allows the user to accept or deny this request. This example demonstrates how the user is delegating permission to the application - which is different than the API restricting access based on a user's role, and should be handled differently. + +::: panel Best Practice +Even though you have the ability to fully manipulate Access Token Scopes via Auth0 extensibility, as a security best practice you should only remove scopes which are not authorized and refrain from adding scopes that were not requested. +::: + +Though scopes are often used as a way to enforce access permissions for a user, there are situations where it can become tricky when you use them in this manner. We therefore recommend that you use scopes for their intended purpose (i.e. delegating permission to an application) and use [custom claims](#access-token-claims) for your role-based or other access control scenarios. diff --git a/articles/architecture-scenarios/_includes/_authorization/_application-integration.md b/articles/architecture-scenarios/_includes/_authorization/_application-integration.md new file mode 100644 index 0000000000..bf785f09e1 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_authorization/_application-integration.md @@ -0,0 +1,17 @@ +In this scenario, your Auth0 tenant provides a token as an indicator of authorized access to an application. For applications utilizing [OpenID Connect (OIDC)](/protocols/oidc), the industry-standard protocol we typically find most utilized when it comes to customer facing applications, this would be an ID Token expressed as a [JWT](/tokens/concepts/jwts). + +### ID Token claims + +Using Rule extensibility, Auth0 allows you to easily [add custom claims to an ID Token](/scopes/current/sample-use-cases#add-custom-claims-to-a-token) based on, for example, a user’s [Metadata](/users/concepts/overview-user-metadata) content. Your application can then verify the ID Token for the necessary claims, and either allow or prevent access to certain functionality as required. Note that though the process of adding custom claims via Rule is streamlined, the Rule engine is flexible and allows you to write custom code that may have negative effects. Therefore it’s important to follow our [rules best practice](/best-practices/rules) guidance anytime you use this extensibility feature. + +::: panel Best Practice +When you are considering adding custom claims, we recommend that you store any access control data you may need to include within claims as part of the user's [`app_metadata`](/users/concepts/overview-user-metadata). Firstly, this prevents you from needing to call an external API to fetch the data, which can negatively impact the performance and scalability of the login sequence. Secondly `app_metadata` **cannot** be modified by a user - so the user cannot directly circumvent any access control restrictions by modifying their own metadata. Also remember to check out our [metadata best practices](architecture-scenarios/implementation/${platform}/${platform}-profile-mgmt#metadata) guidance too. +::: + +<% if (platform === "b2b") { %> +If you are creating different instances of your application for your customer organizations, a common practice is to create a custom claim in your ID token to represent the user's organization. For example, `context.idToken["http://yourdomain.com/claims/organization"]= "organization A";` +<% } %> + +### ID Token scopes + +[OIDC Scopes](/scopes/current/oidc-scopes) are typically used by an application to obtain consent for authorized access to a user's details during authentication. Each of the pre-defined scopes returns the set of [standard claims](/scopes/current/oidc-scopes#standard-claims) where defined, and as described in the [OIDC specification](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims). The scopes an application requests depend on which user attributes the application needs. Once the requested scopes are authorized by the user, the claims are returned in the ID Token and are also made available via the [/userinfo](https://auth0.com/docs/api/authentication#get-user-info) endpoint. diff --git a/articles/architecture-scenarios/_includes/_authorization/_introduction.md b/articles/architecture-scenarios/_includes/_authorization/_introduction.md new file mode 100644 index 0000000000..b1720ae98f --- /dev/null +++ b/articles/architecture-scenarios/_includes/_authorization/_introduction.md @@ -0,0 +1,47 @@ +Let's start by taking a step back and talking about Access Control. There isn't one clear cut definition of Access Control in the industry, but if you spend some time searching and reading you'll see that most authoritative sources agree that it is the umbrella concept that puts all of Authentication, Authorization, Consent, and Policy Enforcement together to ensure that only the right people and services have access to your applications and APIs. Next, let's look more closely into the distinctions between Authentication, Authorization, Consent, and Policy Enforcement. Your Auth0 tenant (your Authorization Server) is typically responsible for Authentication and Consent, and some or all of Authorization and Policy Enforcement. Additionally, an Application or API itself almost always is the primary enforcer of policies, especially where contextual access is required: + +* **Authentication**: the process of determining if a principal (a user or application) is who or what they say they are. +* **Authorization**: the process of determining what is allowed, based on the principal, what permissions they have been given, and/or the set of contextually specific access criteria. +* **Consent**: what permissions the user (Resource Owner) has given permission to an application to do on its behalf. This is generally a requirement of delegated authorization. The user has to give permission to the Client to access the user's data in a different system. +* **Policy Enforcement**: The act of enforcing the policies of the application or API, rejecting or allowing access based on a user's authentication and/or authorization information. + +In general we typically group different types of access control into three distinct categories so that it's easier to understand a) which actor is responsible for storing the information, b) which actor is responsible for making decisions, and c) which is responsible for enforcing the restrictions. + +* The first category is where access is either granted or denied to an application or an API in its entirety. Both the data required to enforce this and the enforcement process is typically defined in the context of the Authorization Server For example, by using [`app_metadata`](/users/concepts/overview-user-metadata) associated with a user and a [Rule](/rules) defined in your Auth0 tenant. + +* The second category is where access is either granted or denied to a specific subset of application or API functionality. The data required to enforce this is typically stored in the Authorization Server For example, by using [`app_metadata`](/users/concepts/overview-user-metadata) on a user in your Auth0 tenant with the enforcement process performed in the application or API itself. In this scenario, the data is typically communicated as one or more custom claims in an [`id`](/tokens/concepts/id-tokens) or [`access`](/tokens/concepts/access-tokens) token. + +* The third category is where access is either granted or denied depending on what the principal (subject) can operate on within the context of an application or API. Both the data required to enforce this, and the enforcement process is typically defined in the context of the application or API. In this scenario, the data communicated as one or more custom claims in an [`id`](/tokens/concepts/id-tokens) or [`access`](/tokens/concepts/access-tokens) token may be consumed with or without data from an external source that is not Auth0. + +In addition, Role-based Access Control (RBAC) and Attribute-based Access Control (ABAC) mechanisms can be applied in any of the Access Control categories described above. Whatever your use case then, there are a number of things you will want to consider when looking at the functionality and workflow you require: + +* Are there scenarios where access to an entire application or API should be rejected? +* Will you be providing APIs that can be accessed by third-party applications? +* Will your APIs also be accessed by your own (first-party) applications? +* Will your application be calling a third-party API? +* Should your applications and/or APIs be enforcing access control based on user claims? +<% if (platform === "b2b") { %> +* What if I need to know which organization an access token or id token is associated with? +<% } %> + +Auth0 supports access restriction for either applications or APIs based on certain conditions. In certain scenarios, you may want to create a [Rule](/rules) that returns an `UnauthorizedError` when, for example, a user attempts access to an application or an API at an incorrect time (as described in this [example](/authorization/concepts/sample-use-cases-rules#allow-access-only-on-weekdays-for-a-specific-application)) - or if the user doesn’t have the right claim(s) contained in their [`app_metadata`](/users/concepts/overview-user-metadata). For an _application_ using [OpenID Connect (OIDC)](/protocols/oidc), this would prevent the allocation of the [ID Token](/tokens/concepts/id-tokens) used to authorize access. Similarly, for an _API_, allocation of any OAuth2 [Access Token](/tokens/concepts/access-tokens) (used when calling the API), could be prevented as described in this [example](/api-auth/restrict-access-api#example-deny-access-to-anyone-calling-the-api). + +::: panel Best Practice +In the main, we have found that [OIDC](/protocols/oidc) is the most commonly used industry-standard protocol used by Auth0 customers when it comes to authentication in their applications. We have also found that, even though [OAuth2](protocols/oauth2) was created as a delegation protocol, it is commonly used within first party applications when there is an API that does not have a shared session with the application. +::: + +Auth0 also can provide the information needed so that an application can enforce restrictions. For [application level integration](#application-integration), Auth0 allows you to add [custom claims](#id-token-claims) to an ID Token, which your application can then verify and subsequently use to perform policy enforcement. In this case you will need to decide what information you require for your application to make enforcement decisions. If you need to make decisions at an API instead of in your application, you will likely need to use an Access Token instead of an ID token. Continue reading for more information. + +::: warning +When deciding what data to include in your ID token and/or access token, consider token size, especially if you are passing the token in the URL. Even if you are not passing tokens in the URL, you will also need to consider the potential of exposing sensitive PII (Personally Identifiable Information). Token information is not encrypted, so although it isn't generally a security issue for an ID token to be leaked, it can become a privacy issue depending on the data that is included in the token. +::: + +For [API level integration](#api-integration), Auth0 supports both [custom claims](#access-token-claims) as well as [scope](#access-token-scopes) re-configuration, both within the context of an Access Token. Again, you will need to decide what information will be required in order for your API to make access decisions, and your API will need to enforce that by validating the contents of the Access Token. + +::: panel Best Practice +When deciding whether you should use permissions through custom claims or scopes, you should make sure you understand the nature and purpose of scopes. +::: + +<% if (platform === "b2b") { %> +For multi-organization scenarios, it can often be important to know which organization an access token (or even an ID token) applies to. Taking care to follow the [best practices](#organization-data-in-an-access-token) can save you time and effort. +<% } %> diff --git a/articles/architecture-scenarios/_includes/_authorization/_m2m.md b/articles/architecture-scenarios/_includes/_authorization/_m2m.md new file mode 100644 index 0000000000..f22d07cc27 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_authorization/_m2m.md @@ -0,0 +1,13 @@ +There are many scenarios that require an application _without_ any user-interactive session to obtain an access token in order to call an API. In such scenarios you must authenticate the client instead of the user, and OAuth 2 provides the [client credentials](/flows/concepts/client-credentials) grant type to make this easy to achieve. Some common examples of where this is required include: +* A cron job or other service that needs to communicate with your API (e.g. where a daily report needs to be generated and emailed it to an administrator). +* A separate API the supports privileged access (e.g. the API is not exposed to users directly, but instead to a backend only). +* In certain microservice architectures, where some API layers need to communicate to other API layers without a user involvement, or after a user token has expired. +* A privileged API that may need to be called before a user has authenticated (i.e. from a rule or custom DB script in your Auth0 tenant) + +::: panel best practice +Traditionally, a special "service account" would have been created in order to cater for these scenarios: a user with a username and password that was configured for services which supported non-interactive use cases. That is no longer a recommended approach for many reasons, and the current best practice is to use [OAuth 2.0 Client Credentials Grant](/flows/concepts/client-credentials) in these situations. +::: + +::: warning +Though the [Client Credentials Exchange Hook](/hooks/extensibility-points/client-credentials-exchange) in Auth0 can be used to add custom claims, it's important to consider the purpose for which a token was requested and to avoid extending use of the token beyond its intended purpose. Doing otherwise can result in the creation of unintended attack vectors for attackers to exploit. +::: diff --git a/articles/architecture-scenarios/_includes/_authorization/_rbac.md b/articles/architecture-scenarios/_includes/_authorization/_rbac.md new file mode 100644 index 0000000000..68df646d59 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_authorization/_rbac.md @@ -0,0 +1 @@ +Auth0 has out-of-box support for Role Based Access Control ([RBAC](/authorization/concepts/rbac)). RBAC refers to assigning permissions to users based on their _role_ within an organization, and provides for simpler access control by offering a more manageable approach that is less prone to error. \ No newline at end of file diff --git a/articles/architecture-scenarios/_includes/_base-intro.md b/articles/architecture-scenarios/_includes/_base-intro.md new file mode 100644 index 0000000000..2dfc169d6e --- /dev/null +++ b/articles/architecture-scenarios/_includes/_base-intro.md @@ -0,0 +1,5 @@ +Customers using Auth0 for <% if (platform === "b2c") { %>Business-to-Consumer (B2C)<% } else { %>Business-to-Business (B2B)<% } %> projects typically share a common set of goals and objectives, and in the sections that follow we'll focus on our real-world customer implementation experiences to help you deliver your solution efficiently. + +::: panel Best Practice +Auth0 provides recommendations and best practice suggestions in an *ad hoc* way throughout this guide in panels like this one. You can also obtain detailed guidance regarding specific functionality by speaking with your account representative or a member of our Auth0 [Professional Services](/services) team. +::: diff --git a/articles/architecture-scenarios/_includes/_base-ways-to-integrate.md b/articles/architecture-scenarios/_includes/_base-ways-to-integrate.md new file mode 100644 index 0000000000..7089399c48 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_base-ways-to-integrate.md @@ -0,0 +1 @@ +There are many different ways Auth0 can be integrated into the <% if (platform === "b2c") { %>CIAM<% } else { %>B2B IAM<% } %> project architecture. Auth0's flexibility comprehensively supports many different use cases however your project may not require all of the capabilities provided by Auth0. Knowing what, when, and how best to implement something will help you focus on completing the necessary tasks at the right time. \ No newline at end of file diff --git a/articles/architecture-scenarios/_includes/_branding/_custom-domain-naming.md b/articles/architecture-scenarios/_includes/_branding/_custom-domain-naming.md new file mode 100644 index 0000000000..ae02a82b67 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_branding/_custom-domain-naming.md @@ -0,0 +1,15 @@ +By default, the URL associated with your tenant will include its name and possibly a region-specific identifier. For example, tenants based in the US have the a URL similar to `https://example.auth0.com` while those based in Europe have something that is of the fashion `https://example.eu.auth0.com`. A [Custom Domain](/custom-domains) offers a way of providing your users with a consistent experience by using a name that’s consistent with your organization's brand. + +::: warning +Only one custom Domain Name can be applied per Auth0 Tenant, so if you absolutely must have independent domain name branding then you will require an [architecture](/architecture-scenarios/implementation/${platform}/${platform}-architecture) where multiple Auth0 Tenants are deployed to production. +::: + +In addition, Custom Domain functionality offers you complete control over the [certificate management](/custom-domains#certificate-management) process. By default, Auth0 provides standard SSL certificates, but if you configure a custom domain, you can use Extended Validation (EV) SSL certificates or similar to provide the visual, browser-based cues that offer your visitors additional peace of mind. + +In general, we see customers having the most success when they use a centralized domain for authentication - this is especially the case if the company offers multiple products or service brands. By using a centralized domain, you can provide end users with a consistent user experience while also minimizing the need to maintain multiple production tenants in Auth0. + +<% if (platform === "b2b") { %> +::: warning +If your customer organizations will be isolated from each other, and you require that users are presented a login page for each organization via a custom domain URL, then your only option is to create a [separate tenant for each organization](/architecture-scenarios/${platform}/${platform}-architecture#tenant-provision-for-complex-organizations). +::: +<% } %> diff --git a/articles/architecture-scenarios/_includes/_branding/_email-templates.md b/articles/architecture-scenarios/_includes/_branding/_email-templates.md new file mode 100644 index 0000000000..3b3dccdf63 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_branding/_email-templates.md @@ -0,0 +1,9 @@ +Auth0 makes extensive use of email to provide both user notifications and to drive the functionality needed for secure identity management (for example, email verification, account recovery, and brute force protections), and Auth0 provides a number of templates for these. + +::: note +Before customizing email templates, please set up your [Email Provider](/architecture-scenarios/implementation/${platform}/${platform}-operations#email-provider-setup). +::: + +Out of the box, the email templates used contain standard verbiage and Auth0 branding. However, you can configure almost every aspect of these templates to reflect the verbiage and user experience you want and make changes to things like the preferred language, accessibility options, and so forth. + +Email templates are customized using [Liquid syntax](/email/liquid-syntax). If you are interested in customizing your templates based on user preferences, you will also have access to the [metadata](/users/concepts/overview-user-metadata) located in users' profiles, as well as any specific application metadata too. diff --git a/articles/architecture-scenarios/_includes/_branding/_error-page.md b/articles/architecture-scenarios/_includes/_branding/_error-page.md new file mode 100644 index 0000000000..4f74e4757a --- /dev/null +++ b/articles/architecture-scenarios/_includes/_branding/_error-page.md @@ -0,0 +1,5 @@ +If there are issues encountered during user interactive workflow (e.g. user sign up or login), Auth0 provides error messages that indicate what the problem is under the hood. The default messages are somewhat cryptic, especially to the end user, since they will likely be missing context that only you can supply. As such, we recommend [customizing your error pages](/universal-login/custom-error-pages) to provide the missing context-specific information directly to your users. Furthermore, customizing your error pages allows you to display your branding, not Auth0's, as well as provide useful information to your users as to what should be done next. This information might include a link to a FAQ or how to get in touch with your company's support team or help desk. + +::: panel Best Practice +Out-of-the-box there is no user interface for customizing Auth0 provided error pages, but you can use the [Tenant Settings endpoint of the Management API](/api/management/v2#!/Tenants/patch_settings) to configure them. Alternatively, if you can create and host your own error page, then you can have Auth0 direct users to that page instead of using the Auth0-hosted option. +::: diff --git a/articles/architecture-scenarios/_includes/_branding/_guardian.md b/articles/architecture-scenarios/_includes/_branding/_guardian.md new file mode 100644 index 0000000000..99b6009f56 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_branding/_guardian.md @@ -0,0 +1,3 @@ +The Multi-factor Authentication pages can be customized by adjusting the Universal Login branding options in the [Universal Login Settings](${manage_url}/#/login_settings) section. + +If you need further customization, you can also customize [the full HTML content](/universal-login/multifactor-authentication#customizing-the-html-for-the-mfa-page) to reflect your organization's particular UX requirements. diff --git a/articles/architecture-scenarios/_includes/_branding/_introduction.md b/articles/architecture-scenarios/_includes/_branding/_introduction.md new file mode 100644 index 0000000000..387c2dc354 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_branding/_introduction.md @@ -0,0 +1,35 @@ +Auth0 can be customized with a look and feel that aligns with your organization's brand requirements and user expectations. Branding Auth0 collateral provides a consistent user experience for your customers, and gives them peace of mind that they’re using a product from a trusted and secure provider. + +Auth0 provides support for [internationalization (I18N)](/i18n) and localization (L10N), both of which are important if you work on branding for an international clientele. Out-of-box collateral, such as the Auth0 Lock UI widget, comes ready enabled for multiple language support, with built-in extensibility for adding more languages if what you require [doesn’t already exist](/libraries/lock/v11/i18n). + +::: panel Best Practice +Almost all applications need Internationalization and/or Localization in one form or another. Auth0 makes it easy to add, but you need to account for it up front: retro-fitting localization, for example, can be a painful process if left too late. +::: + +When considering the items you want to brand, as well as how best to brand them, there are a number of things you'll want to review: + +* Do you need to brand your login page? +* Do you need to localize your login page? +<% if (platform === "b2b") { %> +* If you are sharing an Auth0 tenant across customer organizations, should you add organization-specific branding to their login experience? +<% } %> +* How can you customize emails so that they're not just branded, but vary based on user preference? +* How will users know that they're still on your domain when they see your login page? +* What do you need to do to provide additional browser security (e.g., implement Extended Validation)? +* Where do you want to direct users in the event of errors? + +Auth0 provides tremendous flexibility when it comes to customizing and configuring Auth0 pages such as [Universal Login](#universal-login-and-login-pages) and [Password Reset](#password-reset-page-customization). So you can pretty much set up whatever UX look and feel you require. For many, the out-of-the-box experience - with perhaps a little alteration - is all that's required. However, for others the value of their brand and brand awareness requires more extensive customization. This flexibility extends to not only Auth0 pages, but via extensibility can also be applied to the [email templates](/architecture-scenarios/implementation/${platform}/${platform}-branding#email-template-customization). Auth0 [Custom Domain](/architecture-scenarios/implementation/${platform}/${platform}-branding#custom-domain-naming) functionality further enhances consumer awareness by providing users with the confidence and peace of mind when it comes to safety and security. + +<% if (platform === "b2b") { %> +If you are sharing an Auth0 tenant across multiple customer organizations, providing each organization with their own domain of users and managing their credentials, you will need to consider how each user will know which credentials they should use and how they will trust that they are entering them somewhere safe and secure. See [Branding login by organization](#branding-login-by-organization) for details. +<% } %> + +While Auth0 provides for default information when it comes to error situations, out-of-the-box information can be somewhat cryptic as the context that can only be provided by you is missing. Auth0 [error page customization](/architecture-scenarios/implementation/${platform}/${platform}-branding#error-page-customization) guidance can however help mitigate that by allowing you to provide information of a more context-specific nature via your own support organization. + +::: panel Best Practice +To provide helpful resources for users who experience problems, you should also configure a friendly name and a logo, as well as provide the support email address and URL for your organization. To learn how, see [Dashboard Tenant Settings](/dashboard/reference/settings-tenant#settings). +::: + +::: panel Get Started with Auth0 Videos +Watch three short videos—[Brand: How It Works](/videos/get-started/07_01-brand-how-it-works), [Brand: Signup and Login Pages](/videos/get-started/07_02-brand-signup-login-pages), and [Brand: Emails and Error Pages](/videos/get-started/08-brand-emails-error-pages)—to learn how branding works with Auth0, how to use Auth0’s Universal Login feature to customize your sign up and login pages, and how to use Auth0 email templates and make changes to the reply email address, subject, redirect URL, and URL lifetime. +::: diff --git a/articles/architecture-scenarios/_includes/_branding/_password-reset.md b/articles/architecture-scenarios/_includes/_branding/_password-reset.md new file mode 100644 index 0000000000..c3b0785c61 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_branding/_password-reset.md @@ -0,0 +1,8 @@ +The [Password Reset](/universal-login/password-reset) page is used whenever a user takes advantage of password change functionality and, as with the login page, you can [customize it](/universal-login/password-reset#edit-the-password-reset-page) to reflect your organization's particular branding requirements. + +<% if (platform === "b2b") { %> +If your organization users will all be isolated from each other (i.e, each organization gets its own Auth0 [database connection](/connections/database)), and you are branding the [Universal Login](#universal-login-and-login-pages) pages by organization, then it's also important to brand things like the [password reset](/universal-login/password-reset) page so users know for which organization the password change is occurring. This can be done in a couple of ways: + +* Create JavaScript on the Password Reset page that can pull resources from a CDN based on the connection parameter that indicates from which organization the user is coming. +* Create a separate tenant for an organization and use Universal Login to customize what is required for that organization. +<% } %> diff --git a/articles/architecture-scenarios/_includes/_branding/_universal-login.md b/articles/architecture-scenarios/_includes/_branding/_universal-login.md new file mode 100644 index 0000000000..69e2691da7 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_branding/_universal-login.md @@ -0,0 +1,5 @@ +[Universal Login](/universal-login) is the recommended method for authenticating users, and it centers around use of the Login page. You can customize the Login page to support your organization's [branding requirements](/universal-login#customizing-universal-login). + +::: panel Best Practice +If you choose to customize the Universal Login page script, we strongly recommend that you make use of version control. To do this, you should deploy the script to your Auth0 tenant via [deployment automation](/architecture-scenarios/implementation/${platform}/${platform}-deployment) or via one of the [alternative strategies](/universal-login/version-control). +::: diff --git a/articles/architecture-scenarios/_includes/_deployment/_introduction.md b/articles/architecture-scenarios/_includes/_deployment/_introduction.md new file mode 100644 index 0000000000..c301f040e3 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_deployment/_introduction.md @@ -0,0 +1,31 @@ +In addition to adopting best practices for change management and [QA](/architecture-scenarios/implementation/${platform}/${platform}-qa), successful customers will also integrate Auth0 collateral management as part of some automated deployment process. As discussed in the Architecture section under [SDLC support](/architecture-scenarios/implementation/${platform}/${platform}-architecture#sdlc-support), you will want to ensure you configure separate Auth0 tenants for development, testing, and production environments, and you will want that configuration to be almost identical for the tenant in each environment. Using deployment automation helps ensure this, so that each environment tenant is configured the same, and you will be less likely to see bugs show up as a result of mismatched configurations between environments. + +::: panel Best Practice +However you configure deployment automation, we’d recommend you unit test your rules, custom DB scripts, and hooks prior to deployment, and run some integration tests against your tenant post-deployment too. For more details regarding this, see the [Quality Assurance](/architecture-scenarios/implementation/${platform}/${platform}-qa) guidance provided. +::: + +Auth0 provides support for a couple of different options when it comes to the deployment automation approaches you can use, and each can be used in conjunction with the other if desired: + +* The [Auth0 Deploy CLI tooling](/extensions/deploy-cli) provides you with an easy-to-use script that can help you integrate with your existing Continuous Integration/Continuous Deployment (CI/CD) pipeline. +* If you can’t integrate directly with, or for some reason you don’t have a CI/CD pipeline, then the Auth0 [Source Control Extensions](/extensions#deploy-hosted-pages-rules-and-database-connections-scripts-from-external-repositories) can provide an easy-to-set-up basic automation process with very low maintenance. + +::: warning +Note that both the Deploy CLI Tool and source control extensions can cause destructive changes; manual changes made directly in the dashboard between automated deployments could be lost! For this reason, if either is used, then **all** changes should be deployed from the source control subsystem referenced via the tooling and not made manually. +::: + +Each environment may also need some environment-specific configuration--Application Client ID’s and Client Secrets will be different between the Auth0 tenants, for example--so you’re going to want some way of being able to dynamically reference this rather than having hard-coded values. Auth0 provides support for handling environment-specific configuration information through one of the following two approaches: + +* Use [Tenant Specific Variables](#tenant-specific-variables) +* Use [keyword replacement](extensions/deploy-cli/references/environment-variables-keyword-mappings) if using the Auth0 Deploy CLI tool + +## Tenant specific variables + +Auth0 allows you to configure variables that are available from within custom [extensibility](/topics/extensibility); these can be thought of as environment variables for your Auth0 tenant. Rather than hard code references that change when moving code between development, test, and production environments, you can use a variable name that is configured in the tenant and referenced by the custom extensibility code. This makes it easier for the same custom code to function, without changes, in different tenants as the code can reference variables which will be populated with tenant-specific values at execution time: + +* For use of variables in Rules, see how to [configure values](/rules/guides/configuration#configure-values) +* For use of variables in Hooks, see how to configure [secrets](/hooks/secrets) in the editor +* For use of variables in Custom DB Scripts, see the [configuration parameters](/connections/database/custom-db/create-db-connection#step-3-add-configuration-parameters) + +::: panel Best Practice +It’s a recommended best practice to use variables to contain tenant-specific values as well as any sensitive secrets that should not be exposed in your custom code. If your custom code is deployed in GitHub/Gitlab/Bitbucket/VSTS, then using a tenant-specific variable avoids exposure of sensitive values via your repository. +::: diff --git a/articles/architecture-scenarios/_includes/_implementation-checklists.md b/articles/architecture-scenarios/_includes/_implementation-checklists.md new file mode 100644 index 0000000000..c4624b459c --- /dev/null +++ b/articles/architecture-scenarios/_includes/_implementation-checklists.md @@ -0,0 +1,13 @@ +Use the links below to download a spreadsheet that includes tasks for each phase of an Software Development Lifecycle (SDLC) project. + +Analyze Checklist + +Design Checklist + +Build Checklist + +Test Checklist + +Deploy Checklist + +Monitor Checklist diff --git a/articles/architecture-scenarios/_includes/_keep-reading.md b/articles/architecture-scenarios/_includes/_keep-reading.md new file mode 100644 index 0000000000..9697768911 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_keep-reading.md @@ -0,0 +1,37 @@ + +<% if (self !== "architecture") { %> +* [Architecture](/architecture-scenarios/implementation/${platform}/${platform}-architecture) +<% } %> +<% if (self !== "provisioning") { %> +* [Provisioning](/architecture-scenarios/implementation/${platform}/${platform}-provisioning) +<% } %> +<% if (self !== "authentication") { %> +* [Authentication](/architecture-scenarios/implementation/${platform}/${platform}-authentication) +<% } %> +<% if (self !== "branding") { %> +* [Branding](/architecture-scenarios/implementation/${platform}/${platform}-branding) +<% } %> +<% if (self !== "deployment") { %> +* [Deployment Automation](/architecture-scenarios/implementation/${platform}/${platform}-deployment) +<% } %> +<% if (self !== "qa") { %> +* [Quality Assurance](/architecture-scenarios/implementation/${platform}/${platform}-qa) +<% } %> +<% if (self !== "profile-mgmt") { %> +* [Profile Management](/architecture-scenarios/implementation/${platform}/${platform}-profile-mgmt) +<% } %> +<% if (self !== "authorization") { %> +* [Authorization](/architecture-scenarios/implementation/${platform}/${platform}-authorization) +<% } %> +<% if (self !== "operations") { %> +* [Operations](/architecture-scenarios/implementation/${platform}/${platform}-operations) +<% } %> +<% if (self !== "logout") { %> +* [Logout](/architecture-scenarios/implementation/${platform}/${platform}-logout) +<% } %> +<% if (self !== "operations") { %> +* [Operations](/architecture-scenarios/implementation/${platform}/${platform}-operations) +<% } %> +<% if (self !== "launch") { %> +* [Launch Preparation](/architecture-scenarios/implementation/${platform}/${platform}-launch) +<% } %> diff --git a/articles/architecture-scenarios/_includes/_launch/_compliance.md b/articles/architecture-scenarios/_includes/_launch/_compliance.md new file mode 100644 index 0000000000..8538d072c5 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_launch/_compliance.md @@ -0,0 +1,37 @@ +There are several requirements related to privacy and compliance. Auth0 cannot provide legal guidance on your privacy or other regulatory obligations, but we can provide a curated list of privacy requirements below for which Auth0 offers features that may help you meet your obligations. Prior to launch, you should check that you’ve met all your privacy obligations and review the features outlined below to ensure you’re leveraging all the available Auth0 features to help you meet your privacy and compliance requirements. + +## Publish privacy policy and obtain user consent + +If you collect or process personal data about users, you should have published a privacy policy and have established procedures to ensure your operations abide by the contents of the policy. You also need to obtain a user’s consent for the collection and processing of information. Auth0 provides options for [displaying a link to your privacy policy storing user consent](/compliance/gdpr/features-aiding-compliance#conditions-for-consent). + +## Provide access to view, correct and erase data + +Privacy legislation often requires that users have the right to view and correct any data held about them. If you are a data controller, you should provide a mechanism for this. Auth0 customers can [build a self-service feature to access and correct data via the management API](/compliance/gdpr/features-aiding-compliance#right-to-access-correct-and-erase-data). + +## Provide access to data portability + +If you are a data controller, you may be obligated to provide users a means to export their data from your system in a transportable format. Auth0 provides [user data portability mechanisms](/compliance/gdpr/features-aiding-compliance#data-portability) to help you satisfy this obligation via both manual export capabilities and the Management API which enables you to implement a self-service feature for users. + +## Take steps to minimize personal data + +You should have reviewed the personal data you collect about users to ensure it is legitimately required for the purposes of the processing covered in the privacy policy and consent. You should also confirm you have [minimized the data you collect](/compliance/gdpr/features-aiding-compliance#data-minimization), and established a data retention policy. You can optionally elect to encrypt data you store in user metadata for additional protection. + +## Data retention policy enforcement automated + +You should have a published data retention policy and automate the enforcement of it. The Auth0 management API or the Auth0 dashboard can be used to facilitate [erasure of user accounts](/compliance/gdpr/features-aiding-compliance/right-to-access-data). + +## Protect personal data + +Regardless of whether you are a data controller or a data processor, you have obligations to protect the personal data you hold about users. This includes use of encryption where possible, and implementing reasonable security measures to protect user accounts. Prior to launch, you should check if you are using all the security features available from Auth0 to help with this such as Brute Force Detection, Multi-Factor Authentication (for both users and administrators), and a strong password policy if using passwords. You should also ensure you have a process ready to respond to [Brute Force attacks](/compliance/gdpr/features-aiding-compliance#protect-and-secure-user-data). + +## Supplier evaluation + +Another common compliance obligation is to perform due diligence review of the security of any third-party suppliers to which you expose personal data. For Auth0, you will find information to facilitate this task on the Auth0 [security and certifications](https://auth0.com/security/) page where you can view the security certifications Auth0 has obtained. + +## Additional resources + +Additional resurces that may be useful for your compliance requirements include: +* [Auth0 Privacy Policy](https://auth0.com/privacy) +* [Security and Compliance](https://auth0.com/security/) +* [GDPR and Compliance Frameworks](/compliance) +* [Auth0 support for customer requirements](/compliance/gdpr/features-aiding-compliance) diff --git a/articles/architecture-scenarios/_includes/_launch/_introduction.md b/articles/architecture-scenarios/_includes/_launch/_introduction.md new file mode 100644 index 0000000000..4909da3507 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_launch/_introduction.md @@ -0,0 +1 @@ +Use this guide as you prepare for the launch of your application. We’ve included reminders about some content you may have viewed earlier during your planning or development phases as well as some new content unique to the launch phase. The sections below are useful to developers and project owners to ensure that you have everything lined up for a smooth launch. There are several things to check so it may help to assign ownership of different sections to different members of your team. \ No newline at end of file diff --git a/articles/architecture-scenarios/_includes/_launch/_launch.md b/articles/architecture-scenarios/_includes/_launch/_launch.md new file mode 100644 index 0000000000..c0c5526d56 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_launch/_launch.md @@ -0,0 +1,112 @@ +## Notifications / announcements + +It helps a launch go smoothly if all stakeholders are aware of the impending launch and understand the launch plan as well as their role and responsibilities. In addition to notifying teams that will be actively involved, it can help to notify teams that might be needed if anything goes wrong. Having someone on standby during a launch can help expedite response. Be sure to identify and notify any team that might need to answer questions from customers, including on social media. + +### Parties to notify + +* Customers +* Business parters, if applicable +* Application team(s) impacted by launch +* Support teams +* Network teams (network changes, on standby, in case of issues) +* Security teams (on standby, in case of issues) +* Marketing teams (ready for announcements, response to issues) +* Social media teams (ready to monitor social media, respond) +* Sales teams (prepared to answer questions from customers) +* Customer success teams (prepared to answer questions from customers) + +## Notification plan + +Your notification plan should include elements such as the target audience, the key takeaways for the audience, the message content, the plans for distributing the notification and how to test the messaging. + +A list of elements to include in the plan are: + +* Target audience (consider both internal & external audiences) +* Message +* Timing +* Dependencies +* Responsible parties (who will send it) +* Mechanism (how it will be communicated) +* Test message and delivery (if applicable - test to ensure notifications sent) + +## Notification distribution + +A common tactic is to release notifications in batches to spread out the initial onslaught of load and reduce the scope of confusion if there are any unforeseen glitches. It’s easier to correct issues with a small group than during a big-bang launch. + +* One approach is to start with a relatively small batch of notifications, and if no issues are identified, increase the size of the batches over time. +* You can also send out batches on a rolling schedule around the globe to spread out load hitting the system at once and have notifications arrive at an optimal time within each timezone to increase the likelihood of the messages being read. +* You can do a soft-launch to a portion of users, such as individual customers, regions or some other grouping that makes sense for your application. + +## Outage windows (if needed) + +Some organizations require a formal request for an outage window if any outages or downtime is required for a launch. If your organization requires this, be sure to identify if any downtime is required for the cutover or launch (or other dependent systems) and file the necessary outage or change requests in advance of any lead-time requirements. + +## Cutover plan (if needed) + +Some launches involve cutover from a previous solution to a new solution. If your project fits this scenario, you should be sure to identify everything that needs to happen as well as any dependencies, the responsible party for each task, and necessary timing. You may wish to plan alternates for all important roles or in each region in case anyone is unexpectedly sick or otherwise unavailable. A checklist of items to consider for the cutover plan is: + +* Have you documented the cutover plan and rollback plan if needed? +* Are backups needed of anything prior to change? +* Are any preparatory data changes required? +* Any DNS records to be changed? +* Any Firewall changes? +* Any new monitoring targets? +* Any software to be deployed? + +## Go / no-go criteria + +In your overall launch plan, it is helpful to have go/no-go criteria and to have discussed in advance the types of issues which could occur and which could be worked through vs would require reverting. A launch plan can specify periodic check-in timeframes with criteria of what to assess at each checkpoint and how long to allow an issue to continue unresolved. + +For each stage of the launch, it helps to have success criteria defined, that indicate the launch is proceeding as planned and can continue. Some example criteria could be: + +* User signups growing with minimal errors +* User logins at expected rate, minimal errors +* Reported support issues below a certain threshold +* No issues identified that could lead to corrupted data + +It’s also helpful to have identified criteria which could trigger a “no-go” decision to halt the launch. The risk tolerance for each environment varies, but a few example criteria might include: + +* High percent of user signup or login resulting in errors that cannot be resolved quickly +* High number of support issues that cannot be resolved quickly +* Condition identified that could lead to data corruption +* High severity security issue discovered + +## Rollback + +It is always wise to have a plan for how to rollback or revert a launch, just in case something unforeseeable occurs which cannot be resolved. Reviewing the launch plan for every step which involves a change can help identify the tasks or changes requires to revert a launch or cutover. + +The rollback plan should include the steps to take, the sequence, how long each is likely to take and the responsible party. Understanding the cumulative time required to roll back can help to determine the timing of the final go/no-go decision to fit within any required outage window. + +If any data is migrated or changed for the launch, the plan should include how to revert it, if needed. Reverting may require running scripts to undo operational changes or restoring a data store from a backup taken before the launch process began. + +It is also necessary to plan for the case where some data is entered into a new system before it has to be reverted. Will such data / transactions need to be abandoned with the rollback or will you have a way to capture and apply them elsewhere so they aren’t lost? + +If the resolution of issues or process to revert could potentially take longer than one shift, you’ll want to ensure you have a primary and perhaps a secondary person available and prepared to handle things during each work shift. If an issue results in the need for prolonged response, significantly beyond one shift, there are limits for how long people can realistically function without a break. It can help to be prepared with resources for a follow-the-sun issue response effort if needed. + +## Standby contacts + +As the launch day approaches, it’s a good idea to identify all contacts who might be needed for troubleshooting or resolving issues and request them to be on standby and ready to help if needed. The launch leader should have contact information for each person on the standby list to expedite communications. + +If there is a physical or virtual "launch room", the people on standby should know where it is and be ready to join if needed. Having a central room or video conference prepared can expedite communications and troubleshooting across all parties if an issue occurs. + +## Success Criteria + +A lot of planning goes into a launch in order to be successful, but will you know how to evaluate the launch? If you define success criteria before the launch, you can determine what to monitor and if any additional monitoring or checks need to be in place to evaluate the launch. +For example - if one element of the success criteria is the number of sign-ups or logins - do you have a way of monitoring that and has it been tested to ensure it is accurate? + +You’ll want statistics to be able to trumpet the success of your launch. You don’t want to find out after the launch that you didn’t capture any data to quantify all the hard work your team put into the launch. + +## Risks & mitigations plan + +It’s no fun to think of things that could go wrong, but if anything happens, you’ll be glad you did as having a plan can expedite response. A few examples to plan for include: + +* Software application bug +* Application incompatibility with user browser settings +* Network failure/outage +* DoS attack +* Hosting environment failure +* Load / capacity issues +* Data / corruption issues +* Security vulnerability discovered + +If you had a beta period, it may help to review the results of the beta to identify additional possible failure scenarios. diff --git a/articles/architecture-scenarios/_includes/_launch/_operations.md b/articles/architecture-scenarios/_includes/_launch/_operations.md new file mode 100644 index 0000000000..22a43ad85d --- /dev/null +++ b/articles/architecture-scenarios/_includes/_launch/_operations.md @@ -0,0 +1,96 @@ +## Status + +You should ensure your operations staff knows how to monitor Auth0 service status and has set up a means to subscribe to updates on Auth0 status. + +<%= include('../../_includes/_operations/_service-status.md', { platform: 'b2b' }) %> + +## Email provider setup + +You should double check that you have set up your own email provider to support production volumes of emails that might be sent to customers for signup, email validation, account recovery and the like. + +<%= include('../../_includes/_operations/_email-provider.md', { platform: 'b2b' }) %> + +## Infrastructure + +<%= include('../../_includes/_operations/_infrastructure.md', { platform: 'b2b' }) %> + +## NTP + +If this is not handled automatically by your hosting environment, you should have scripts which will automatically restart NTP (Network Time Protocol) if it fails and alerts that will notify someone if NTP is not running. Authentication transactions rely on accurate system time because security tokens may be evaluated as expired when received if there are time discrepancies between sending and receiving systems. + +## LoadBalancer timeouts checked + +If you use the AD/LDAP connector, you should check the load balancer settings in your environment to see if they terminate long running connections that are inactive. If they do, you can modify the [Auth0 AD/LDAP Connection settings](/connector/modify#configuration-file) to use the `LDAP_HEARTBEAT_SECONDS` setting to send periodic heartbeat messages to keep the connection open. + +## LoadBalancer configuration + +If your application maintains server state such that it depends on sticky load balancing to route users to a particular server, it can be beneficial to double check that all load balancer configurations are correct. One load balancer in a pool that is out of sync can cause intermittent errors that are hard to troubleshoot. A quick check of load balancer configuration can avoid such issues in the first place. + +## Logs + +You should check that you have set up the ability to capture log data, that logs are covered by your data retention policy and you have mechanisms to enforce logs data retention limits. You should also make sure that your development, support, and security teams know how to access logs data for troubleshooting and forensics purposes. Exporting log files to services that provide comprehensive analytics can help you identify patterns such as usage trends and errors. + +<%= include('../../_includes/_operations/_logging.md', { platform: 'b2b' }) %> + +## Monitoring + +Be sure to set up proactive monitoring of the Auth0 service as well as end-to-end authentication through your application. + +<%= include('../../_includes/_operations/_monitoring.md', { platform: 'b2b' }) %> + +## Auth0 Notifications + +You should ensure your team is monitoring all of the following communication channels from Auth0 to stay abreast of important announcements and changes. + +<%= include('../../_includes/_operations/_notifications.md', { platform: 'b2b' }) %> + +In addition, you should periodically check the [Auth0 migrations page](/product-lifecycle/migrations) for news about upcoming deprecations that might require your team to make changes. + +## Automated Deployment, version control + +While not required, it is highly recommended that you have deployment automation set up. You can respond more efficiently if you need to make any changes after launch if you have automated the ability to deploy and revert changes to dev, test and production environments. + +<%= include('../../_includes/_deployment/_introduction.md', { platform: 'b2b' }) %> + +## Backup / Restore + +You should have a plan and mechanism in place to support any backup/restore capability needed for your project. This can be done using the Auth0 Management API for data as well as the Automated Deployment capabilities described in the automated deployment section for Auth0 configuration. + +As noted in the Auth0 [Data Tenant Restore policy](policies/restore-deleted-tenant) and [Data Transfer policy](policies/data-transfer), Auth0 does not restore deleted tenants or move data between tenants. Auth0 provides the Auth0 Management API to provide customers a completely flexible capability to backup, restore and move data as needed. Customers can write scripts to retrieve data from Auth0 for backup purposes, and similarly write scripts for use with the Automated Deployment capability to restore any aspect of their Auth0 configuration. + +## Versions Up to Date + +You should double check that all technologies in your application stack, as well as browser versions used by your users are on current, up-to-date versions as this will impact Auth0’s ability to provide support if issues arise. +* Check you are using the latest supported version of node.js in [Auth0 dashboard settings](/dashboard/dashboard-tenant-settings#extensibility). +* Check you are using a version of SDK/Libraries supported by Auth0 per the [Auth0 Support Matrix](/support/matrix). + +## Certificate rollover plan + +Certificates may be used in identity deployments. To ensure a certificate expiration does not catch you by surprise, you should have a list of certificates in your environment along with the expiration dates, how you will be notified when expiration draws near and how the certificate rollover process works. + +### SAML connections + +For SAML connections, you obtain a certificate from the IdP and upload it to a SAML connection for the IdP in your Auth0 dashboard. When one of these certificates is about to expire, Auth0 will send email to dashboard administrators warning of the upcoming expiration. You can obtain the new certificate and upload it using the connection configuration screen. + +### WS-Fed connections + +For WS-Fed connections, if you configure them by specifying an ADFS URL, any changes will be picked up by a daily update. You can trigger an update manually by visiting the connection configuration page in the Auth0 dashboard and doing a Save. If a certificate is changed at the remote IdP, Auth0 can be updated by those mechanisms or by uploading a new metadata file in the same connection configuration screen. + +## Disaster Recovery / Business Continuity Plan in place + +While not an absolute requirement prior to launch, it is useful to have a disaster recovery plan in place to ensure business continuity in the face of different types of disasters, including system outages and natural disasters hitting a region where critical staff is located. + +## Processes documented + +Another item which is not an absolute requirement, but also recommended is to ensure all processes related to Auth0 are documented. This can include the following: + +* Change management for configuration +* Deployment of new changes and any automatic deployment mechanisms used, how to revert to previous version if issues found +* Certificate rollover processes, if any +* Adding or removing new Identity Providers, if applicable +* Changes to user profile structure in Auth0 or in directories Auth0 pulls from +* Adding or removing applications or APIs +* Capturing and exporting logs +* Backup/restore process you have implemented +* User management (forgotten password, lost phone) +* Root cause analysis after an incident diff --git a/articles/architecture-scenarios/_includes/_launch/_support.md b/articles/architecture-scenarios/_includes/_launch/_support.md new file mode 100644 index 0000000000..3eea47b43a --- /dev/null +++ b/articles/architecture-scenarios/_includes/_launch/_support.md @@ -0,0 +1,61 @@ +## Review Auth0 Policies + +When starting to prepare for your launch, be sure to read through [Auth0 Policies](/policies) and prepare your production operations accordingly for any required lead times or responsibilities on your part, according to the policies. + +## Review your Support plan, SLAs, Severity definitions and Support center documentation + +You should review the specifics of the [support plan](/support#support-center) you’ve purchased and the [Service Level Agreements](/support#defect-responses) associated with it, to ensure it is adequate for your needs. If you haven’t already done so, explore the [support center](https://support.auth0.com/) and familiarize yourself with support features such as viewing suggested solutions to common issues and [filing tickets](/support/tickets) and viewing your quota usage. It will be helpful to review the [severity level definitions](/support#defect-resolution-procedures) for support tickets so that you file tickets with the correct severity. One important note is that it is not possible today in the Support Center to increase the severity of a support ticket. If you file a ticket for a medium-grade issue which later becomes a high severity issue, you should file a new urgent, high severity ticket that explains anything new that triggers the urgency and references the original ticket for details. + +You should also ensure your development and support teams are familiar with the [Auth0 community forum](https://community.auth0.com/), discussed further below. Customers can often find answers there right away to common issues, avoiding the need to file a ticket, so it should be your first stop for technical questions. + +## Review the Auth0 community forum + +The [Auth0 community forum](https://community.auth0.com/) contains a wealth of information. If you have a question, chances are someone else has already asked the question on the forum. Answers are contributed by both Auth0 staff and the larger community of Auth0 users. + +Important notices are posted to the community forum to help you stay abreast of important news. Be sure to check out the “Community” and “FAQ” categories. The Community category contains pro-active posts on product announcements, roadmap information, How-To videos as well as important information about any upcoming feature deprecations. + +It’s a good idea to check out the Auth0 Community on a regular basis, not just when you have questions. While you are there, if you see a question you’ve already solved, please contribute your wisdom to help others! + +## Gather Auth0 troubleshooting information needed for support tickets + +We recommend your support team become familiar with our [troubleshooting guides](/troubleshoot) specific to identity protocols and Auth0. This includes the questions to research and information to collect before posting a question on the Auth0 forum or filing a support ticket. Authentication transactions often span multiple systems so there are some specialized troubleshooting techniques that are helpful to learn. + +## Have troubleshooting tools ready + +Your team will doubtless have already done some troubleshooting during the development of your application, but we recommend making sure your support team is also familiar with any tools below relevant to your project. If you need to file a ticket, the Auth0 support team may ask for a HAR (HTTP Archive) file to help analyze the issue so it’s helpful for your support staff to be familiar with how to do this. + +### Capture HAR file + +A [HAR file](/troubleshoot/guides/generate-har-files) captures a sequence of browser interactions and is a commonly used tool when debugging authentication issues. The process of authenticating a user often involves redirecting the user’s browser from an application to Auth0, and possibly to another remote Identity Provider, depending on the type of connection used. You can capture the redirection and the responses and analyze it to find clues about the cause of an issue. + +### Analyze HAR file + +Analyze the [HAR file](/troubleshoot/guides/generate-har-files#analyze-har-files) to obtain valuable troubleshooting information. It shows the sequence of browser redirects involved in an authentication transaction, along with the parameters used. The HAR file also shows if the authentication process stopped mid-stream and if so where, which helps to pinpoint the location of the issue. The HAR file contains tokens returned to the application front-end, and these can be pasted into appropriate viewers to see if they contain the expected contents. + +### View JWT + +The [jwt.io](https://jwt.io) tool was written by Auth0 and allows you to view the contents of a JWT-formatted token. Applications that delegate authentication to Auth0 via OIDC will receive an ID Token from Auth0. Depending on your type of application, the ID Token may be captured in a HAR file. The ID Token is in JWT format and can be pasted into jwt.io to view the contents of the ID Token. + +### View SAML request/response + +There are many SAML decoders available. The [samltool.io](https://samltool.io) decoder was written by Auth0 and allows you to view the contents of a SAML Request or Response. Applications that delegate authentication to Auth0 via SAML or use a SAML type of connection in Auth0 will use SAML Requests and Responses. These SAML Requests and Responses may be captured in a HAR file. The requests and responses can be pasted into samltool.io or other SAML decoders to view the contents of the SAML Request or Response. + +## Review Auth0 support matrix + +One potential cause of issues is using out of date versions of SDKs or libraries. We strongly recommend your team check your software stack, browsers, SDKs and libraries against the [Auth0 support matrix](/support/matrix) to ensure you are running on up-to-date, supported versions. In the event of an issue, the Auth0 support team may ask you to upgrade to a supported version. To avoid slowing down progress on issue resolution, be sure you are on up-to-date versions. + +## Use Auth0 feedback portal + +Auth0 welcomes feedback and ideas from Auth0 customers. If you have a suggestion for our product team, you can submit product feedback directly on the [Product Feedback portal](https://auth0.com/feedback). + +## Prepare real-time webtask log extension + +For debugging and supporting custom code in Auth0, including Rules, Hooks, Custom DB Scripts, and Custom OAuth Connections, knowledge of the [Realtime Webtask Log](/extensions/realtime-webtask-logs) is essential. This enables you to view output from your custom code, including output from console.log statements. + +::: panel Best Practice +We recommend installing the real-time webtask log extension and getting familiar with using it to view log output from your custom code as a debugging and support tool. +::: + +## Troubleshooting + +You should prepare to [troubleshoot issues](/troubleshoot/basics) both during your development as well as after your application or API goes live. Make sure your development and support teams are prepared with knowledge of troubleshooting tools, and the list of common issues to check when troubleshooting an issue. diff --git a/articles/architecture-scenarios/_includes/_launch/_tenant-check.md b/articles/architecture-scenarios/_includes/_launch/_tenant-check.md new file mode 100644 index 0000000000..2f9f2ce0d5 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_launch/_tenant-check.md @@ -0,0 +1,112 @@ +## Tenant Check + +This section covers a list of configurations to check in your tenant. This should be done periodically during development and sufficiently before launch so you have time to fix anything amiss. + +### General tenant check + +#### Tenant preparation check + +Check to ensure you have [set up tenant environments](/dev-lifecycle/setting-up-env) to support your SDLC lifecycle and that Dev, Test and Prod tenants are cleanly separated so that ongoing development work after launch doesn’t negatively impact your production environment. + +<%= include('../../_includes/_architecture/_sdlc-support.md', { platform: 'b2c' }) %> + +#### Tenant association check + +<%= include('../../_includes/_architecture/_tenant-association.md', { platform: 'b2c' }) %> + +#### Specify production tenant + +To ensure Auth0 recognizes your production tenant, be sure to [set your production tenant](/dev-lifecycle/setting-up-env#set-the-environment +) with the “production” flag in the Support Center. + +#### Tenant production Check + +Auth0 provides a [Production Check](/pre-deployment) facility to detect many common errors. You should ensure this has been run and any findings from the report mitigated before launch. + +In addition, you should check the [best practice configurations advice](/pre-deployment/tests/best-practice), for which checking cannot be automated. + +#### Tenant Settings Check + +##### Tenant Settings + +Make sure to follow the [Auth0 tenant settings best practices](/best-practices/tenant-settings#set-up-branding-configuration) in configuring your logo as well as your support email and support URL so user's know how to get help if an issue occurs. You'll want to check your SSO Session Timeout settings and the list of dashboard admins with access to your production tenant as well. For further information on tenant setting, see the Auth0 dashboard [tenant settings documentation](/dashboard/dashboard-tenant-settings#settings). + +##### Error Page Customization + +<%= include('../../_includes/_branding/_error-page.md', { platform: 'b2c' }) %> + +##### Legacy feature flags off + +If you have an older tenant, you may have various legacy feature flags enabled in your [tenant settings advanced tab](/dashboard/dashboard-tenant-settings#advanced). If you have any toggles on in the “Migrations” section of this tab, you should review your usage and make plans to migrate off the legacy feature. + +##### Delegated admin extension + +While you are checking the list of users with access to your production tenant, don't forget to check any users specified in the [Delegated Admin Extension](/extensions/delegated-admin/v3). + +#### Custom Domain Naming set up + +<%= include('../../_includes/_branding/_custom-domain-naming.md', { platform: 'b2c' }) %> + +### Application and Connection settings check + +Each of your application configurations in Auth0 should be checked against the [application configuration best practices](/best-practices/application-settings). + +Each of your connection settings should be reviewed against the [connection configuration best practices](/best-practices/connection-settings). + +In addition, you should review that all connections are appropriate and that no experimental connections are left in your production tenant as they could enable unauthorized access. + +If you use SAML connections, it is a best practice to configure the connections to sign SAML requests. + +### Page customization check + +If you use the Auth0 universal login page, password reset page, or Guardian multi-factor authentication, you should check that you have adequately customized the pages displayed to the end user. + +#### Universal Login Page + +<%= include('../../_includes/_branding/_universal-login.md', { platform: 'b2c' }) %> + +#### Password Reset Page customization + +<%= include('../../_includes/_branding/_password-reset.md', { platform: 'b2c' }) %> + +#### Guardian + +<%= include('../../_includes/_branding/_guardian.md', { platform: 'b2c' }) %> + +### Authorization check + +If you are using Auth0’s [authorization feature](https://auth0.com/docs/authorization), be sure to double check all privileges granted to ensure authorizations are appropriate for your production environment. + +### API configuration check + +#### Access token expiration + +You should double check the [API access token expiration settings](/dashboard/reference/settings-api) to ensure they are appropriate for each API in your production environment. + +#### API offline access + +If your application does not request refresh tokens, this should be off. + +#### Access token signing algorithm + +It is recommended that the [API access token signing algorithm](/getting-started/set-up-api#signing-algorithms) be set to RS256 rather than HS256 to minimize exposure of the signing key. + +#### API Access token validation + +If you have any custom APIs, be sure to check that they are adequately [validating the access tokens](/api-auth/tutorials/verify-access-token) they receive before using the information in them. + +### API Scopes + +If you have applications making machine-to-machine calls to any of your APIs, you should review the scopes specified for the API to ensure they are all appropriate for your production environment. For further information see the documentation on [client credentials grant](/api-auth/config/using-the-auth0-dashboard). + +### Rules/Hooks check + +You should also have aligned your rules with Auth0 [rules best practices](/best-practices/rules). + +### Email templates customized + +<%= include('../../_includes/_branding/_email-templates.md', { platform: 'b2b' }) %> + +### Attack protection configured + +<%= include('../../_includes/_authentication/_attack-protection.md', { platform: 'b2b' }) %> diff --git a/articles/architecture-scenarios/_includes/_launch/_testing.md b/articles/architecture-scenarios/_includes/_launch/_testing.md new file mode 100644 index 0000000000..7ceb804ac1 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_launch/_testing.md @@ -0,0 +1,25 @@ +Prior to launch, you should have completed all the testing that applies to your environment. + +<%= include('../../_includes/_qa/_introduction.md', { platform: 'b2c' }) %> + +### Unit testing + +<%= include('../../_includes/_qa/_unit-testing.md', { platform: 'b2c' }) %> + +### Integration testing + +<%= include('../../_includes/_qa/_integration-testing.md', { platform: 'b2c' }) %> + +### Mock Testing + +<%= include('../../_includes/_qa/_mock-testing.md', { platform: 'b2c' }) %> + +### Pen testing (optional) + +If you will be conducting penetration tests, you should be aware of Auth0’s [penetration testing policy](/policies/penetration-testing) and abide by it. Penetration tests require advance notice to Auth0 so that your tests are not mistaken for malicious activity and shut down. + +### Load testing (optional) + +If you will be conducting load tests, you should be aware of Auth0’s [load testing policy](/policies/load-testing) and abide by it. Load tests require advance notice to Auth0. In planning your load testing, you will also need to be aware of Auth0’s [API rate limits](/policies/rate-limits). + +<%= include('../../_includes/_qa/_load-testing.md', { platform: 'b2c' }) %> diff --git a/articles/architecture-scenarios/_includes/_logout/_introduction.md b/articles/architecture-scenarios/_includes/_logout/_introduction.md new file mode 100644 index 0000000000..08510e5ea8 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_logout/_introduction.md @@ -0,0 +1,47 @@ +[Logout](/logout) is the act of terminating an authenticated session when it's no longer needed, thus minimizing the likelihood that unauthorized parties can "take over" the session. This is typically achieved by provisioning a logout option on the user interface you provide to your users. Multiple types of sessions can be created when a user logs in (e.g., local application sessions, Auth0 session, third-party Identity Provider sessions), and you will need to determine which of these sessions need to be terminated when the user clicks any **Logout** option. + +::: panel Best Practice +Your logout behavior should make it clear to a user which session(s) are being terminated, and ideally, will display a visual confirmation of logout afterward. +::: + +When configuring logout behavior, you'll need to consider: + +* Which sessions should be terminated when the user initiates logout? +* What information should you provide to users as confirmation of the sessions terminated? +* Where should users be redirected to after logout completes? +* How long do you want sessions to last in the event that users do not trigger the logout process? +<% if (platform === "b2b") { %> +* Should the End User be logged out of all of their application sessions when they log out of one? +* Should the session with an organization's IDP also be terminated at logout? +<% } %> + +Given the varying types of sessions that can be created whenever a user logs in, there are several types of logout possible. Local application logout ends the session with the application, whereas Auth0 logout [terminates the Auth0 session](/logout/guides/logout-auth0). If you have organizations that are using their own IDP, you may want to consider a [Federated Logout](#federated-logout) strategy and implement accordingly. Global, or [Single Logout](/logout/guides/logout-applications) (SLO), ends the Auth0 session and also sends a logout request/notice to applications relying on the Auth0 session. + +The functionality provided by your application, as well as your use of features like [Single Sign-on (SSO)](/sso), will inform your decision as to what type of logout is required and what visual confirmation you'll need to provide to your users. Regardless of which option you choose, the logout process you implement should make it clear to the user which sessions are being terminated, and also when the logout process has completed. + +::: warning +If the logout feature in one application terminates an Auth0 SSO session that is used by other applications, the user may lose work if they have uncommitted transactions. Be sure to add the functionality needed to handle such conditions to minimize the likelihood of lost work. +::: + +<% if (platform === "b2b") { %> +In some situations, a user may be expected to logout of all associated applications when they log out of any one of the applications you provide. This is something that can add complexity. However if you have concerns that users could leave themselves vulnerable (perhaps due to data sensitivity or the like), then you will likely need to review [Single Logout](#single-logout) and implement accordingly. + +<% } %> + +## Where to send users after logout + +Once your user logs out, they will be redirected to a specific location of your choosing. This location is specified as the **logout redirect URL**, and you can [define this as a parameter](/logout/guides/redirect-users-after-logout) via the Auth0 Dashboard. + +The URL(s) you use to redirect users after logging out must be [whitelisted in the Dashboard](/logout#redirect-users-after-logout) to mitigate open-redirect security vulnerabilities. You can whitelist them at the tenant or application levels. + +::: note +If the user logs out and you redirect them back to the application, and the application redirects to an Identity Provider that still has a valid session for the user, the user will be logged in silently to the application. This may appear to the user as if the logout process didn't function properly. +::: + +## Automatic termination of sessions + +Not all users will trigger the logout process manually, so Auth0 also provides **session timeout** to prevent overly long-lived sessions. This setting is [available and configurable via the Auth0 Dashboard](/dashboard/reference/settings-tenant#login-session-management). + +::: panel Get Started with Auth0 Video +Watch this short video [Logout](/videos/get-started/10-logout) to learn about different kinds of logout behavior and different session layers. Learn how to configure callback URLs in the application and tenant settings in the Dashboard. +::: diff --git a/articles/architecture-scenarios/_includes/_multitenancy.md b/articles/architecture-scenarios/_includes/_multitenancy.md new file mode 100644 index 0000000000..50c06de00b --- /dev/null +++ b/articles/architecture-scenarios/_includes/_multitenancy.md @@ -0,0 +1,3 @@ +Many B2B platforms implement some form of isolation and/or branding for their customers' organization, and this can add complexity to any Identity and Access Management (IAM) system. If this applies to you, then we recommend you take some time to read through our guidance and best practice advice concerning this type of environment. + +Multiple Organization Architecture (Multitenancy) Overview diff --git a/articles/architecture-scenarios/_includes/_operations/_email-provider.md b/articles/architecture-scenarios/_includes/_operations/_email-provider.md new file mode 100644 index 0000000000..8f83e0bece --- /dev/null +++ b/articles/architecture-scenarios/_includes/_operations/_email-provider.md @@ -0,0 +1,5 @@ +Auth0 sends [emails](/email) to users for events such as signup welcome, email validation, breached password, and password reset events. You can customize the email templates for each type of event, and advanced customization of email handling is also possible. Auth0 provides a test email provider with limited capacity for basic testing, but you must set up your own email provider for production use, and customization of email templates will not work until you have established your own provider. + +::: panel Best Practice +The default Auth0 email provider does not support sending production volumes of email or customization of email templates. You should therefore configure your own email provider before deploying to production. +::: diff --git a/articles/architecture-scenarios/_includes/_operations/_infrastructure.md b/articles/architecture-scenarios/_includes/_operations/_infrastructure.md new file mode 100644 index 0000000000..540e16cd72 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_operations/_infrastructure.md @@ -0,0 +1,3 @@ +### Firewalls + +If custom code executing in Auth0 (such as in a Rule, Hook, or Custom DB scripts) will call a service inside your network, or if you configure an on-premise SMTP provider in Auth0, then you may need to configure your firewall to allow [inbound traffic from Auth0](/guides/ip-whitelist#inbound-calls). The IP addresses to allow through the firewall are specific to each region and are listed on the Rules, Hooks, Custom DB scripts, and email provider configuration screens in your Auth0 dashboard (as described in [Whitelist IP Addresses](/guides/ip-whitelist)). diff --git a/articles/architecture-scenarios/_includes/_operations/_introduction.md b/articles/architecture-scenarios/_includes/_operations/_introduction.md new file mode 100644 index 0000000000..33fb73bae3 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_operations/_introduction.md @@ -0,0 +1,29 @@ +Operationalization requires configuring or setting up infrastructure to support the scalable, measurable, and quantifiable operation that’s necessary for business continuity. In Auth0, this includes configuring supporting services (such as email providers), monitoring services for your deployment, detecting anomalous situations, and making preparations to recover quickly and smoothly when something goes wrong in a production environment. + +Establishing effective operational behaviors is something that successful customers have found pays dividends, and there are a number of things you will want to consider when looking at your workflow: + +* What should you do to proactively detect failures? +* How can you obtain data on Auth0’s operational status? +* What should you do about Auth0 security bulletins related to the Auth0 service? +* Does Auth0 provide information regarding impending changes in the Auth0 service? +* How can you check for important notices from Auth0? +* What should you do with Auth0 log data so that you can analyze it and keep it for longer than Auth0’s limited data retention period? +* How can you scan Auth0 logs to determine if peak loads in your application trigger any rate limits or other errors? +* What email services should you use to support production volumes of email messages to users? Can I use Auth0's out-of-box email provider in my production environment? +* Do you need to configure your firewall and what firewall ports will you need to open for internal services that need to receive communications from Auth0 (such as custom databases, web services, and email servers)? +<% if (platform === "b2b") { %> +* How will you provision new organizations? +* Do you need to provide self-service provisioning for your customer so that they can configure their own organizational IdPs? +<% } %> + +Auth0 supports functionality for [monitoring](#monitoring) Auth0 service operation as well as providing information regarding Auth0 [service status](#service-status). In addition, Auth0 makes security-related bulletins as well as information regarding upcoming changes to the Auth0 service available via various [notifications](#notifications). Auth0 [logging](#logging) services also provide extensive functionality for tracing and identifying operational anomalies, including restrictions encountered due to rate limiting and/or excessive loading. + +Out-of-box, Auth0 provides email delivery services to help you accelerate your integration. These services, however, are not meant for scale-of-use in production environments, and do not provide for any specific service level or guarantee when it comes to email delivery. Our best practice recommendation, which customers typically follow, involves configuring your own [email service provider](#email-provider-setup). + +You may also need to make changes to [infrastructure](#infrastructure) configuration in order to support integration with Auth0 and to support use of Auth0 extensibility. For example, if you need to provide callbacks to your internal or even external infrastructure (e.g., if you need to make external API calls in Rules or Hooks, or via custom database scripts if you need to leverage existing legacy identity storage), then you may need to configure your Firewall settings. + +<% if (platform === "b2b") { %> +Once you know how you want organizations to be represented in your system, you will want too consider how you are going to provision the organization itself. See [Provisioning organizations](#provisioning-organizations) for more information. + +In addition, many of our customers have developed one or more self-service portals for use by their customers' organization admins to provide self-service capabilities for configuring their own [IdPs](#self-service-idp-provisioning). +<% } %> diff --git a/articles/architecture-scenarios/_includes/_operations/_logging.md b/articles/architecture-scenarios/_includes/_operations/_logging.md new file mode 100644 index 0000000000..41ce91d599 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_operations/_logging.md @@ -0,0 +1,15 @@ +Auth0 provides extensive capability when it comes to the logging of events, and also in the scanning of logs in order to identify event anomalies (see [logs documentation](/logs) for further details). Standard log retention period for Auth0 logs is determined by subscription level with the shortest period being 2 days and the longest period being only 30 days. Leveraging Auth0 support for integrating with external logging services will allow you to retain logs outside of this, and will also provide for log aggregation across your organization. + +::: panel Best Practice +You should leverage one of the Auth0 logs extensions to send log data to an external log analytics service. This will enable keeping data for longer periods of time and provide advanced analytics on the log data. +::: + +You should review the log data [retention period](/logs/references/log-data-retention) for your subscription level, and implement a log data export extension to send log data to an external log analytics service. Development teams can use log files for troubleshooting and detecting intermittent errors that may be hard to find via QA tests. Security teams will probably want log data in case forensic data is ever needed. Exporting log files to services that provide comprehensive analytics can help you see patterns such as usage trends and attack protection triggers. + +### Rate limits and other errors + +Auth0 provides a unique error code for errors reported when the [rate limit is exceeded](/policies/rate-limits#exceeding-the-rate-limit). You should set up automatic scanning of logs to check for rate limit errors so you can proactively address activity that hits rate limits before it causes too much trouble for your users. Auth0 also publishes error codes for other types of errors, and you will find it helpful to scan logs for [authentication errors](/libraries/error-messages) as well as errors from Auth0 Management API calls (Management API error codes are shown below each call in the [Management API Explorer](/api/management/v2)). + +::: panel Best Practice +Calling the Management API to retrieve user profile information from within a Rule is a common cause of rate limit errors because such API calls can execute for every login as well as periodic session checks. +::: diff --git a/articles/architecture-scenarios/_includes/_operations/_monitoring.md b/articles/architecture-scenarios/_includes/_operations/_monitoring.md new file mode 100644 index 0000000000..d64277752e --- /dev/null +++ b/articles/architecture-scenarios/_includes/_operations/_monitoring.md @@ -0,0 +1,5 @@ +You should establish mechanisms for [monitoring Auth0 implementations](/monitoring), so your support or operations team receives the timely information needed to proactively handle service outages. Auth0 provides monitoring endpoints that can be incorporated into your monitoring infrastructure. These endpoints are designed to provide a response suitable for consumption by monitoring services. It should be noted that they only provide data on Auth0. For complete end-to-end monitoring, which is essential for checking the ability of users to log in, we recommend that you set up synthetic transaction monitoring. This will provide greater granularity for your monitoring and enable you to detect outages unrelated to Auth0 as well as degradation of performance, so you can respond more proactively. + +::: panel Best Practice +You should set up the ability to send synthetic login transactions to facilitate end-to-end monitoring of authentication. You can do this with a simple application that uses the [Resource Owner Password Grant](/api-auth/tutorials/password-grant) in combination with a test user that has no privileges, and don’t forget about [Auth0 rate limiting policies](/policies/rate-limits) too. +::: diff --git a/articles/architecture-scenarios/_includes/_operations/_notifications.md b/articles/architecture-scenarios/_includes/_operations/_notifications.md new file mode 100644 index 0000000000..57dd93c1f9 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_operations/_notifications.md @@ -0,0 +1,21 @@ +There are several different types of notifications from Auth0 that you should watch for as they contain important information that could impact your tenant(s) and project. + +::: note +Proactive security notifications and other operational announcements are sent by Auth0 to dashboard administrators. You should ensure that the people who need to receive such messages are dashboard administrators. +::: + +### Dashboard notifications + +From time to time, Auth0 may send an important announcement related to your tenant. These announcements about your service will be sent to your Auth0 dashboard and depending on the severity of the announcement, via email to the registered Auth0 dashboard administrators. You should make a regular practice of logging in to the dashboard and checking the bell icon at the top for any important notices. In addition, you should review emails from Auth0 in a timely fashion as they may convey important information about changes or actions you need to take. + +### Auth0 security bulletins + +Auth0 regularly conducts a number of security-related tests, and if any issues are found, will proactively identify and notify customers who need to make security-related changes. Due to the extensible nature of the Auth0 product, however, it may not be possible for Auth0 to identify every impacted customer, so you should regularly check Auth0 [security bulletins](/security/bulletins). You should make sure a security contact for your organization is listed in Support Center. + +::: panel Best Practice +It is a best practice to check the Auth0 [Security Bulletins](/security/bulletins) page periodically and take the recommended action if you are impacted by any security bulletins. +::: + +### Change log + +Auth0 provides information on changes to the service in the Auth0 [change log](https://auth0.com/changelog). You should make a regular practice of reviewing Auth0 change logs to be aware of changes. Support teams researching an issue may find it useful to review the change log to determine if recent changes might be related, especially if these are [breaking changes](/migrations). Development teams will also want to review the change logs to identify new features that may be beneficial. diff --git a/articles/architecture-scenarios/_includes/_operations/_service-status.md b/articles/architecture-scenarios/_includes/_operations/_service-status.md new file mode 100644 index 0000000000..a42bdbd948 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_operations/_service-status.md @@ -0,0 +1,7 @@ +The Auth0 [status dashboard](https://status.auth0.com/) together with the Auth0 [uptime dashboard](http://uptime.auth0.com/) shows current and past status of the Auth0 service in a human-readable format. If any monitoring alerts are triggered, and as a first step in troubleshooting, your operations staff should check the status dashboard to see if there is a current outage. The public cloud status page also provides a facility for subscribing to outage notifications, and we also recommend that you check the status of any 3rd party, [external services](/monitoring/guides/check-external-services) you depend on - such as Social Providers. Having this information handy can help quickly eliminate possible causes when troubleshooting an issue and should be at the top of a troubleshooting checklist for developers as well as the helpdesk staff. + +::: panel Best Practice +Information on how to check the status of Auth0 as well as any dependent services (such as Social Providers) should be at the top of a troubleshooting checklist for both developers and helpdesk staff, and we recommend you subscribe via the Auth0 status page to set up notification of any status updates. +::: + +In the event of an outage to the public cloud service, Auth0 performs a Root Cause Analysis (RCA) and publishes the results on the [Auth0 status page](/support#auth0-status). Auth0 performs a thorough investigation after an outage--including a determination of root cause, as well as contributing factors and how to prevent the issue from occurring again--and as a result, an RCA document can take a few weeks to be published. diff --git a/articles/architecture-scenarios/_includes/_planning.md b/articles/architecture-scenarios/_includes/_planning.md new file mode 100644 index 0000000000..8ad9191355 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_planning.md @@ -0,0 +1,9 @@ +We provide planning guidance in PDF format that you can download and refer to for details about our recommended strategies. + +<% if (platform === "b2b") { %> +B2B IAM Project Planning Guide +<% } %> + +<% if (platform === "b2c") { %> +B2C IAM Project Planning Guide +<% } %> diff --git a/articles/architecture-scenarios/_includes/_profile-mgmt/_account-verification.md b/articles/architecture-scenarios/_includes/_profile-mgmt/_account-verification.md new file mode 100644 index 0000000000..0306b71049 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_profile-mgmt/_account-verification.md @@ -0,0 +1,3 @@ +You’ll also need to work with a verified user account at all times and make use of the mechanisms Auth0 provides. You should also consider regulatory compliance like [GDPR](https://eugdpr.org/) which has very specific requirements for protecting EU citizens from privacy and data breaches. + +Auth0 provides out-of-box functionality for sending a [verification email](/email/custom#verification-email) to a user's email address to verify their account. By default, Auth0 automatically sends verification emails for any [Database Connection](/connections/database) identity created as part of [self sign-up](/architecture-scenarios/implementation/${platform}/${platform}-provisioning#self-sign-up). However, Auth0 also provides a [Management API endpoint](/api/v2#!/Tickets/post_email_verification) that you can use to send verification emails in cases where email address validation is not performed by a Social Provider upon user registration. diff --git a/articles/architecture-scenarios/_includes/_profile-mgmt/_blocking-users.md b/articles/architecture-scenarios/_includes/_profile-mgmt/_blocking-users.md new file mode 100644 index 0000000000..d66954e4a6 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_profile-mgmt/_blocking-users.md @@ -0,0 +1,3 @@ +[Blocking user access](/users/guides/block-and-unblock-users) in Auth0 provides a way to prevent user login to applications under certain conditions. By default, the Auth0 Dashboard provides an out-of-the-box mechanism to give administrators the ability to both block and unblock user access to all applications, and you can implement this functionality via use of the [Auth0 Management API](/api/management/v2#!/Users/patch_users_by_id). You can also use Auth0 extensibility to [disable user access to certain applications](/users/guides/manage-user-access-to-applications) as well as provide more fine-grained [access control](/architecture-scenarios/implementation/${platform}/${platform}-authorization). + +In addition, the Auth0 Management API provides you with the ability to [unblock](/api/management/v2#!/User_Blocks/delete_user_blocks_by_id) users disabled due to excessive use of incorrect credentials. diff --git a/articles/architecture-scenarios/_includes/_profile-mgmt/_de-provisioning.md b/articles/architecture-scenarios/_includes/_profile-mgmt/_de-provisioning.md new file mode 100644 index 0000000000..cfbccfab6c --- /dev/null +++ b/articles/architecture-scenarios/_includes/_profile-mgmt/_de-provisioning.md @@ -0,0 +1,7 @@ +Your application may need to support a user’s request to remove their account (for example, you might need to meet [GDPR](https://eugdpr.org/) requirements). You can implement such a feature, along with a number of other profile-related functions, using the [Management API](/api/management/v2#!/Users). The Management API allows you to retrieve information stored about a user and update it as required. + +Auth0 is capable of supporting various privacy-related requirements including the display of links to consent notices on signup and data protection to support the rights of users to view and correct data you’ve collected about them. + +::: note +[GDPR](https://eugdpr.org/) and other privacy directives require that users have the right to view and correct data held about them. They also have the right to be “forgotten.” You can use the Management API to address these requirements and meet your legislative obligations. +::: diff --git a/articles/architecture-scenarios/_includes/_profile-mgmt/_introduction.md b/articles/architecture-scenarios/_includes/_profile-mgmt/_introduction.md new file mode 100644 index 0000000000..d0098b386d --- /dev/null +++ b/articles/architecture-scenarios/_includes/_profile-mgmt/_introduction.md @@ -0,0 +1,49 @@ +At some point, you may need to change the information stored in a user’s [profile](/users/concepts/overview-user-profile). A user’s profile (also known as the user’s account) is stored in Auth0, and changes to the information it contains may need to happen for a number of different reasons: + +* Self-served information updates +* Mandatory updates concerning your organizations T's & C’s +* Changes due to regulatory compliance + +::: warning +You cannot directly access a user profile across multiple Auth0 tenants. If you’re deploying multiple Auth0 tenants to production then this is something you need to be aware of. +::: + +An [Identity Provider](/identityproviders) populates a user’s profile using data supplied during the login process, and this is referred to as the [Normalized User Profile](/users/normalized/auth0). + +::: note +The Normalized User Profile is updated from the identity provider during login, and you can change the limited set of the information it contains through the Auth0 Management API. You can also use Auth0 extensibility, such as [Rules](/rules), as an alternative to override information in the Normalized User Profile. See [User Profile Data Modification](/users/concepts/overview-user-profile#user-profile-data-modification) for more information. +::: + +By default, there is one user profile created for each user identity, and there are a number of things to consider: + +* What should you do if you need to store information to help customize a user’s experience? +* What if you need to store user information that didn’t originate from an identity provider? +* Why would you need to store user-related information that a user cannot modify? +* What do you do if you need to store user-related information that a user cannot modify? +* What happens if a user forgets their password? +* What should a user do if they want to change their password? +<% if (platform === "b2b") { %> +* How do you provide an administrator from a third-party organization with the ability to manage their users? +<% } %> + +Auth0 provides for the storage of [Metadata](#metadata) against a user’s profile, which allows for the capture of additional information, such as preference for language and/or accessibility in order to enhance the user experience. Metadata can be used to store both information that a user can change, and also information they can’t; the latter giving you the capability of associating, for example, a user profile with records in your existing systems without modifying existing implementation. + +For users who forget their passwords or who are allowed to change their password via some existing self-service mechanism (or self-service mechanism you have planned), you can leverage Auth0-provided [Password Reset](#password-reset) functionality. This can be integrated with your existing implementation and comes already incorporated with any out-of-box Auth0 UI widgets including [Universal Login](/universal-login). + +You’ll also want to make sure that you are working with a [verified user account](#account-verification) at all times. Auth0 provides out-of-box mechanisms for doing that too. You should also consider [regulatory compliance](/compliance) such as ([GDPR](https://eugdpr.org/) which has very specific requirements when it comes to protecting EU citizens from privacy and data breaches. + +Though Auth0 doesn’t currently provide a centralized profile management portal out-of-the-box, for the purpose of self-serviced profile management, you can use the Auth0 Management API to build your own or utilize an already built UI. See our Auth0 [community guidance](https://community.auth0.com/t/how-to-allow-the-end-user-to-update-their-own-profile-information/6228)which describes the Management API endpoint. All calls to the Management API will require use of an [Access Token](/tokens/concepts/access-tokens). + +::: warning +Self-service profile management can raise security as well as data privacy concerns. For example, you may want to allow a user to change their email address, however, doing so without following best practice security guidance could result in a user locking themselves out of their account, leaking Personally Identifiable Information (PII), or worse, opening up a potential breach in security. +::: + +Alternatively, you can use the Auth0 Dashboard to [manage aspects of a user’s profile](users/guides/manage-users-using-the-dashboard). Managing a user’s profile via the Auth0 Dashboard is more of an administrative provision and **should not** be used for self-serviced profile management in a production environment. However, the interface provided by the Dashboard can be extremely useful during development as it provides a quick and simple way of manipulating a user’s profile information. + +<% if (platform === "b2b") { %> +If you need to provide a way for your customers to have an administrator manage their own users when they are storing those credentials in your system, you can either build something yourself or use an Auth0 Extension. See [Admin Portal](#admin-portal) for more information. +<% } %> + +::: panel Get Started with Auth0 Video +Watch this video [User Profiles](/videos/get-started/06-user-profiles) to learn what Auth0 User Profiles are used for and what they contain. Understand how Auth0 normalizes user profile data from various identity providers and uses metadata and root attributes. You can manage user profiles with the Auth0 Dashboard. +::: diff --git a/articles/architecture-scenarios/_includes/_profile-mgmt/_linking-accounts.md b/articles/architecture-scenarios/_includes/_profile-mgmt/_linking-accounts.md new file mode 100644 index 0000000000..572f16a38e --- /dev/null +++ b/articles/architecture-scenarios/_includes/_profile-mgmt/_linking-accounts.md @@ -0,0 +1,9 @@ +By default, there is one [user profile](/users/concepts/overview-user-profile) (user account) for each user identity. If you enable login from multiple identity providers - via Facebook or Google [social authentication](/architecture-scenarios/implementation/${platform}/${platform}-authentication#social-authentication) as well as via Auth0 [username and password authentication](/architecture-scenarios/implementation/${platform}/${platform}-authentication#username-and-password-authentication) - then each will have a separate user profile. You can use Auth0’s functionality for [linking user accounts](/users/concepts/overview-user-account-linking) to create one profile for a user as an aggregate of all their associated identities. + +The process of linking accounts merges user profiles in pairs: a primary account and a secondary account must be specified in the linking process. The number of accounts that can be linked, however, extends beyond a single pair. For example, you can use an account which already has multiple accounts merged with it as the primary, and link an additional secondary account to it. This means that one user account can have multiple identities associated with it, which provides a number of advantages: + +* Users can log in using multiple identities without creating a separate profile for each one. +* Registered users can use new login identities, but continue using their existing profile. +* Users can carry their profile around, irrespective of which identity they use for login. +* Users can link to an account with more identity information in order to provide a more complete profile. +* Your applications can retrieve connection-specific user profile data. diff --git a/articles/architecture-scenarios/_includes/_profile-mgmt/_metadata.md b/articles/architecture-scenarios/_includes/_profile-mgmt/_metadata.md new file mode 100644 index 0000000000..8fe125d585 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_profile-mgmt/_metadata.md @@ -0,0 +1,23 @@ +In addition to the Normalized User Profile information, [Metadata](/users/concepts/overview-user-metadata) can be stored in an Auth0 user profile. Metadata provides a way to store information that did not originate from an identity provider, or a way to store information that overrides what an identity provider supplies. + +::: panel Best Practice +Use of Metadata should follow Auth0 [user data storage best practices](/best-practices/user-data-storage-best-practices#metadata). Metadata storage is not designed to be a general purpose data store, and you should still use your own external storage facility when possible. Metadata size and complexity should also be kept to a minimum, and the Auth0 Management API has a strict set of guidance when it comes to updating and/or deleting metadata associated with a user. +::: + +You can manipulate metadata via both the Auth0 Management API and the Auth0 Authentication API. See [Manage User Metadata](/users/guides/manage-user-metadata) for more information. As is the case when managing the Normalized User Profile, calls to the Management API for manipulating Metadata requires use of an [Access Token](api/management/v2/tokens). + +::: warning +<%= include('../../_includes/_rate-limit-policy.md') %> +::: + +### User metadata + +User metadata (also referred to as `user_metadata`) is information that can be stored against a user profile and that a user can read and update as part of any self-service profile management. Metadata of this nature may be something like salutation for a user, or a user’s preferred language which could be used to [customize the emails](/email/templates#common-variables) sent by Auth0. + +::: panel Best Practice +Store any information that you want use to customize Auth0 emails in metadata and preferably `user_metadata` if the user is allowed to change it, such as information used to determine the language for an email. +::: + +### App metadata + +App metadata (also referred to as `app_metadata`) is, on the other hand, information that can be stored with a user profile but can **only be read or updated with appropriate authorization**; `app_metadata` is not directly accessible to a user. This type of metadata could be something like a flag to indicate that the last set of valid terms and conditions was accepted by the user, and a date to indicate when the user accepted them. diff --git a/articles/architecture-scenarios/_includes/_profile-mgmt/_password-reset.md b/articles/architecture-scenarios/_includes/_profile-mgmt/_password-reset.md new file mode 100644 index 0000000000..0407264659 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_profile-mgmt/_password-reset.md @@ -0,0 +1,9 @@ +For users who forget their passwords or who are allowed to change their password via some existing self-service mechanism, Auth0 provides [Password Reset](/connections/database/password-change) functionality. You can integrate this with your existing implementation and comes already incorporated with out-of-the-box Auth0 UI widgets included as part of [Universal Login](/universal-login). + +::: warning +Password change and password reset is only supported for Auth0 [Database Connection](/connections/database) types. +::: + +Auth0 Universal Login provides built-in UX support for password reset using Auth0 Authentication API functionality. Alternatively, you can use the [Auth0 Authentication API](/connections/database/password-change#use-the-authentication-api), through one of the Auth0 SDKs appropriate to your development environment. Email templates used during password reset workflow can also be fully customized, whether you use Auth0 out-of-box UI widgets or customized Universal Login. + +You can use the Auth0 Management API, on the other hand, to [directly change the password](/connections/database/password-change#directly-set-the-new-password) for a user identity defined using a Database Connection type. You can use the Auth0 Management API as part of any self-service profile management implementation, and also as part of any [Change Password page customization](/architecture-scenarios/implementation/${platform}/${platform}-branding#change-password-page-customization). diff --git a/articles/architecture-scenarios/_includes/_provisioning/_deprovisioning.md b/articles/architecture-scenarios/_includes/_provisioning/_deprovisioning.md new file mode 100644 index 0000000000..5571357acc --- /dev/null +++ b/articles/architecture-scenarios/_includes/_provisioning/_deprovisioning.md @@ -0,0 +1 @@ +Auth0 will *not* communicate with the upstream IdP if there is an active SSO session with Auth0, unless you force it with a `prompt=login`. If one of your customer organizations can not manage logout for those users, they may still have access after they’ve been decommissioned. Depending on the IdP, if Auth0 gets a token for their API, you can request information about the user from the IdP in a [rule](/rules) to poll whether that user should still have access or not. If you don’t have this ability, you will have to provide your customer organizations a way to trigger a block or decommission of users in your system either through an API call or a UI. diff --git a/articles/architecture-scenarios/_includes/_provisioning/_introduction.md b/articles/architecture-scenarios/_includes/_provisioning/_introduction.md new file mode 100644 index 0000000000..4a6ec7c089 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_provisioning/_introduction.md @@ -0,0 +1,33 @@ +Determining how users get signed up is important to address early, and the decisions you make here will influence many of the decisions you will need to make going forward. We’ve found there are a typical set of patterns for how users will get added to your system, and things to take note of when considering workflow design too. + +::: panel Best Practice +Whilst Auth0 supports numerous workflows, web based workflows using Auth0 [Universal Login](/universal-login) for sign up are considered both industry and Auth0 best practice as they provide for optimal functionality and the best security. +::: + +Auth0 supports user sign up via a number of different [identity providers](/identityproviders). During sign up, Auth0 provisions the [user profile](/users/concepts/overview-user-profile) so that it contains the user’s account information. There are a number of things to consider when looking at functionality and workflow: + +<% if (platform==="b2b") { %> +* Does a user get added to your company's domain or do they belong to or remain in their organization's domain? +* If the user stays in their own domain, do they belong to a single organization or can they belong to multiple organizations? +* How do you provision the organization itself in your system? +<% } %> +* Should you use Auth0 as an identity store? +* Can you use your own (legacy) identity store with Auth0? +* How do you migrate user identities from your identity store to Auth0? +<% if (platform==="b2c") { %> +* Can your users sign up using their existing social accounts such as Google and Facebook? +<% } %> +<% if (platform==="b2b") { %> +* Can your users sign up using their organization's identity provider? +* Can your users be invited or self register? + +One of the first determinations to make when providing your service(s) to other businesses is identifying to which domain users belong. Based on the answer to that question, there are a couple of different approaches you can take to provision those users. See [Provisioning organization users](#provisioning-organization-users) for more information. Once you know how you want organizations to be represented in your system, you will want too consider how you are going to provision the organization itself. See [Provisioning organizations](#provisioning-organizations) for more information. +<% } %> + +Auth0 provides out-of-the-box identity storage that can be leveraged to store user credentials safely and securely. See [Self Sign Up](#self-sign-up) for more information. If you already have a legacy identity store and you want to offload the management of it, then the [User Migration](#user-migration) capabilities provide you with a number of options to do so. + +Alternatively, if you have to maintain your legacy identity store - perhaps because you’ve got applications which you aren’t ready to migrate or which can’t be migrated - then you can use the [identity store proxy](#identity-store-proxy) capability. Allowing your customers to use “bring their own identity” is also an attractive proposition and though we find our customers don’t initially do so, you can use the [Social Sign Up](#social-sign-up) capability to provide it. + +::: panel Get Started with Auth0 Videos +Watch these two short videos [Provision: Users Stores](/videos/get-started/02-provision-user-stores) and [Provision: Import Users](/videos/get-started/03-provision-import-users) to learn how user profiles are provisioned within an Auth0 tenant and how Auth0 allows you to move your existing users to an Auth0 user store. +::: diff --git a/articles/architecture-scenarios/_includes/_provisioning/_organizations.md b/articles/architecture-scenarios/_includes/_provisioning/_organizations.md new file mode 100644 index 0000000000..7dd959ad2c --- /dev/null +++ b/articles/architecture-scenarios/_includes/_provisioning/_organizations.md @@ -0,0 +1,30 @@ +::: panel best practice +What you need to do when provisioning an organization will depend on how organizations are represented in your system. This can take some time to step back and consider how users of those organizations will be interacting with your applications. See [Multiple Organization Architecture](/media/articles/architecture-scenarios/planning/Multiple-Organization-Architecture-Multitenancy-Overview.pdf) to determine how to configure organizations for your IAM system. +::: + +When provisioning organizations you need to consider the following: + +* You will need to add the organization to your own application configuration and/or database +* You will need to make changes to your Auth0 configuration. This will include doing some or all of the following: + * Create a unique tenant + * Add a database connection (if you have isolated users per organization) + * Add an enterprise connection for this organization + * This will include working with the organization to either update their existing configuration or add configuration for your Auth0 tenant if they are not a legacy organization. + * Provision an administrator for the organization +* To avoid mistakes, you may want to create an [Organization Admin Portal](#organization-admin-portal) to make it easier to provision new organizations. + +### Organization Admin Portal +An organization admin portal is a portal that allows your administrators to create, modify, and remove organizations. There are multiple activities that need to be done both in your own system and your Auth0 tenant. This portal will likely need to exist in your own system so it has access to your datastores and configuration. However, Auth0 provides the [**Auth0 Management API**](/api/management/v2) so that you can incorporate changes to your Auth0 tenant at the same time that you create the changes in your own system. + +There are two main approaches that can be taken for creating a new organization. The one you choose depends highly on your tolerance for how long it would take to deploy a new organization. +* **Live Updates to your Auth0 Tenant**: If you want to be able to create new organizations in real-time, then you will likely want to make the changes directly to your Auth0 tenant using the Auth0 Management API. This allows the changes to take place in real-time and allow the addition of a new organization to take effect immediately. + +::: warning + Live Updates do come with some things to consider. There are certain operations that must be done in serial to avoid issues. Enabling clients on a connection, adding callback URL's to an Application are two examples. Any operation in the Management API where you must retrieve an entire list and re-submit the entire list with the new value added to it are operations that must be done in serial to avoid two parallel operations overwriting one of the values. +::: + +* **Change the Repository and Re-deploy**: If you are taking advantage of the Deploy CLI (or a custom CLI) as part of your [CI/CD pipeline]( /architecture-scenarios/implementation/${platform}/${platform}-deployment), you may prefer to push your changes directly to your repository and then kickoff a new deployment instead. This can take a little more time, but it has benefits associated with version history and the ability to backout a change by re-deploying the previous version. + +::: panel Best Practice +You may want to have a separate repository just for the items that the organizations need so that you don't have to re-deploy other common components and risk making an error. +::: diff --git a/articles/architecture-scenarios/_includes/_provisioning/_self-signup.md b/articles/architecture-scenarios/_includes/_provisioning/_self-signup.md new file mode 100644 index 0000000000..6799c34345 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_provisioning/_self-signup.md @@ -0,0 +1,5 @@ +Self sign up leverages Auth0 [Database Connections](/connections/database) to store the user ID, password, and (optional) username identity information collected from new users during the sign up process. Database connection policies governing things such as minimum [username length](connections/database/require-username#username-length) or [password strength and complexity](/connections/database/password-options) can be configured via the Auth0 Dashboard. + +::: panel Best Practice +Auth0 [Universal Login](/universal-login) as well Auth0 widgets such as [Lock](https://auth0.com/lock) integrate with Database Connections to provide comprehensive user interface functionality for sign up out-of-the-box. These UI artifacts are fully reactive, and with feature rich configuration and comprehensive customization, you can deploy functionality for user self sign up as well as login. +::: diff --git a/articles/architecture-scenarios/_includes/_provisioning/_social-signup.md b/articles/architecture-scenarios/_includes/_provisioning/_social-signup.md new file mode 100644 index 0000000000..c581a3e097 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_provisioning/_social-signup.md @@ -0,0 +1 @@ +Social signup is synonymous with sign in via [social authentication](/architecture-scenarios/implementation/${platform}/${platform}-authentication#social-authentication) - there’s no distinction here *per se*, as user [profile](/architecture-scenarios/implementation/${platform}/${platform}-profile-mgmt) creation happens automatically upon first social login. diff --git a/articles/architecture-scenarios/_includes/_provisioning/_user-migration.md b/articles/architecture-scenarios/_includes/_provisioning/_user-migration.md new file mode 100644 index 0000000000..fea6aca40e --- /dev/null +++ b/articles/architecture-scenarios/_includes/_provisioning/_user-migration.md @@ -0,0 +1,17 @@ +In addition to hosting the [User Profile](/architecture-scenarios/implementation/${platform}/${platform}-profile-mgmt), Auth0 also has the capability to both [proxy](#identity-store-proxy) your own legacy identity store and provide a secure Auth0 hosted replacement. Both of these capabilities are supported via the use of Auth0 [Database Connections](/identityproviders#database-and-custom-connections). If you decide to use Auth0 as a replacement for your legacy identity store then you can migrate users either all at once with [Bulk Migration](users/concepts/overview-user-migration#bulk-user-imports-with-the-management-api), or progressively with [Automatic Migration](users/concepts/overview-user-migration#automatic-migrations). + +::: panel Best Practice +Customers often opt for a two-stage approach to user migration, using Automatic Migration first to migrate as many users as possible, then using Bulk Migration for the users that remain. See [User Migration Scenarios](users/references/user-migration-scenarios) for more information. +::: + +Automatic Migration is preferred as it allows users to be migrated individually and also allows them to retain their existing password in almost all situations. For Bulk Migration, we recommend using the [Management API](api/management/v2#!/Jobs/post_users_imports) over the [User Import/Export extension](/users/concepts/overview-user-migration#migrate-users-with-the-user-import-export-extension) in all but the most simple cases, as the Management API provides for greater flexibility and control. + +With Bulk Migration users typically need to **reset their password once migration is complete**, _unless_ passwords are stored hashed in your legacy identity store using bcrypt (or you can generate them in bcrypt form). In this case, you _may_ be able to use bulk migration and **preserve user passwords** as part of the process, depending on the bcrypt algorithm and the number of salt rounds used. See [Bulk Import Database Schema Examples](/users/references/bulk-import-database-schema-examples) for more information. + +::: panel Best Practice +<%= include('../../_includes/_rate-limit-policy.md') %> +::: + +### Identity store proxy + +Auth0 Database Connection types can also be configured to proxy an existing (legacy) identity store. If you need to keep user identities defined in your own legacy store - for example, if you have one or more business critical applications that you can’t migrate to Auth0, but which still need access to these identities - then you can easily integrate with Auth0. See [Authenticate Users Using Your Database](/connections/database/custom-db) for more information. diff --git a/articles/architecture-scenarios/_includes/_qa/_integration-testing.md b/articles/architecture-scenarios/_includes/_qa/_integration-testing.md new file mode 100644 index 0000000000..629c1f9d99 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_qa/_integration-testing.md @@ -0,0 +1,13 @@ +It is a recommended best practice that you set up different tenants for development, testing, and production as discussed in Architecture guidance for [SDLC support](architecture-scenarios/implementation/${platform}/${platform}-architecture#sdlc-support). Auth0 allows you to configure variables that are available from within custom [extensibility](/topics/extensibility); these can be thought of as environment variables for your Auth0 tenant. Rather than hard code references that change when moving code between development, test, and production environments, you can use a variable name that is configured in the tenant and referenced by the custom extensibility code. This makes it easier for the same custom code to function, without changes, in different tenants as the code can reference variables which will be populated with tenant-specific values at execution time: + +* For use of variables in Rules, see how to [configure values](/rules/guides/configuration#configure-values) +* For use of variables in Hooks, see how to configure [secrets](/hooks/secrets) in the editor +* For use of variables in Custom DB Scripts, see the [configuration parameters](/connections/database/custom-db/create-db-connection#step-3-add-configuration-parameters) + +::: panel Best Practice +It’s a recommended best practice to use variables to contain tenant-specific values as well as any sensitive secrets that should not be exposed in your custom code. If your custom code is deployed in GitHub, then using a tenant-specific variable avoids exposure of sensitive values via your GitHub repository. +::: + +### Test automation + +You can automate your overall build process by incorporating deployment automation as well as test automation. This can be used to deploy new versions of configuration and/or custom code to Auth0 and execute automated tests. If the tests uncover any failures, the deployment automation capabilities can be used to revert to the last working version. For further information, see the [deployment automation guidance](/architecture-scenarios/implementation/${platform}/${platform}-deployment) provided. diff --git a/articles/architecture-scenarios/_includes/_qa/_introduction.md b/articles/architecture-scenarios/_includes/_qa/_introduction.md new file mode 100644 index 0000000000..9f423218bc --- /dev/null +++ b/articles/architecture-scenarios/_includes/_qa/_introduction.md @@ -0,0 +1,11 @@ +Quality Assurance is important in identifying issues before they impact your customers and, depending on the nature of your project, there are several different types of quality assurance testing that you’re going to want to consider as part of your integration with Auth0: + +* Is your application easy to understand and use, even by those with a disability? +* Does your application need to work across various different browsers and devices? +* Does your application need to work in multinational and/or international environments? +* How will your application perform when subjected to unexpected production loads? +* How can you ensure your application is safe from security-related vulnerabilities? + +Auth0 [Universal Login](/universal-login) and associated UI widgets (such as [Lock](/libraries/lock)) have already been designed and built following usability and accessibility best practices, and provide tested out-of-box support for a whole host of [browsers and devices](/support/matrix#browsers). Support for [internationalization](/i18n) (I18N) is also provided out-of-box, with built-in extensibility designed for custom multi-language and localization (L10N) situations. + +To ensure functional requirements are met and unexpected events are handled correctly, guidance is provided for testing the [integration](#integration-testing) between your application(s) and Auth0, and for [unit testing](#unit-testing) individual extensibility modules (such as [Rules](/rules/guides/debug#try-this-rule), [Hooks](/hooks/update), and Custom Database scripts). Guidance is also provided regarding Auth0's [penetration testing policy](/policies/penetration-testing) to help when testing for security vulnerability, and also how [Mock](#mock-testing) testing can be leveraged in conjunction with our [load testing policy](/policies/load-testing) to help ensure your application(s) perform under unexpected load. diff --git a/articles/architecture-scenarios/_includes/_qa/_load-testing.md b/articles/architecture-scenarios/_includes/_qa/_load-testing.md new file mode 100644 index 0000000000..1761e56882 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_qa/_load-testing.md @@ -0,0 +1,15 @@ +Load tests require prior approval from Auth0, as explained in the Auth0 [load test policy](/policies/load-testing). Be sure to note the lead time for a request to be reviewed and allow enough time for review as well as conducting the tests. If your load test request has been approved, the following guidance can help avoid errors and faulty test results. + +* Run an HTTP trace on a test execution of your application to identify all the calls your application or intended test needs to make, and make sure your test includes them so it is representative of what will happen in production. +* Design your test to be mindful of Auth0 API rate limits. +* Use of any custom code in Auth0 (Rules, Custom DB scripts, Hooks, Custom OAuth connections) will invoke the Auth0 custom code sandbox and this may cost more in terms of performance. Turn off Rules unless they are essential to the test. If they are off you will have higher throughput than if they are on. +* Estimate the expected overall load for your production environment and percent of calls to each endpoint and structure your performance test accordingly so it gives you a realistic test result. Different endpoints have different performance costs. Failure to design a representative test will result in misleading results. +* Don’t make calls that depend on the results of earlier calls without checking that pre-requisite calls or responses have completed. Simply building in a delay may not be adequate. +* Be sure to implement adequate error handling. A frequent cause of issues during tests is errors in custom code (rules, hooks, Custom db scripts, Custom OAuth connection scripts) caused by unhandled exceptions in the custom code. +* Load tests should be written to start at a low level and increase the load gradually, capturing data at each level, to get the most useful results. Starting at a high level and immediately failing gives less information about what the system can sustain. +* It is normal to need to run a performance test multiple times, possibly adjusting the code under test or the test harness/configuration. Be sure to start your testing early to allow enough time for more than one iteration. +* Use your own mail provider account and make sure to arrange ahead of time for enough mail-sending quota or you may be rate-limited by the mail provider. Turn off mail sending if you do not use it. +* Be sure to use your own account credentials for all social connections rather than Auth0 dev keys. In the Auth0 dashboard, go to Connections -> Social -> {name of connection} - to see instructions for how to add your own social provider account credentials into the connection. +Note: some social providers do not allow load testing. Check your provider(s) for their policy +* In order to avoid rate limiting, and more accurately simulate real load, your tests will need to send requests for different users, not all requests for the same user. If you use only one or a few users, caching may reduce the effective load and not provide realistic results. +* Be sure to stay within the agreed-upon parameters for the test and the Auth0 [load test policy](/policies/load-testing). Auth0 reserves the right to terminate any performance/load testing which does not stay within the bounds of agreed-upon parameters or which extends beyond the scheduled test window. diff --git a/articles/architecture-scenarios/_includes/_qa/_mock-testing.md b/articles/architecture-scenarios/_includes/_qa/_mock-testing.md new file mode 100644 index 0000000000..786ee3b346 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_qa/_mock-testing.md @@ -0,0 +1 @@ +In a balance between Auth0’s [load testing policy](/policies/load-testing) and the desire to load test, it is common practice among Auth0’s customers to mock out Auth0’s endpoints. This is a valuable practice in order to ensure that your application works with your expected interfaces without having to restrict your testing, and tools such as [MockServer](http://www.mock-server.com/), [JSON Server](https://github.com/typicode/json-server) or even [Postman](https://learning.getpostman.com/docs/postman/mock_servers/setting_up_mock/) can be used to assist. diff --git a/articles/architecture-scenarios/_includes/_qa/_unit-testing.md b/articles/architecture-scenarios/_includes/_qa/_unit-testing.md new file mode 100644 index 0000000000..a8ebd23233 --- /dev/null +++ b/articles/architecture-scenarios/_includes/_qa/_unit-testing.md @@ -0,0 +1 @@ +The objective of unit testing is to test individual units of code. If you create custom code within Auth0 in the form of Rules, Hooks, and/or Custom DB scripts, you should consider use a testing framework (such as [Mocha](https://mochajs.org/)) to test your code. Companies who have been most successful with Auth0 have found it useful to execute these unit tests prior to [automatically deploying](/architecture-scenarios/implementation/${platform}/${platform}-deployment) Auth0 tenant configuration and collateral. diff --git a/articles/architecture-scenarios/_includes/_rate-limit-policy.md b/articles/architecture-scenarios/_includes/_rate-limit-policy.md new file mode 100644 index 0000000000..ce743cf61d --- /dev/null +++ b/articles/architecture-scenarios/_includes/_rate-limit-policy.md @@ -0,0 +1 @@ +Calls to the Management API are subject to [Auth0 Rate Limiting policy](/policies/rate-limits). You must take this into consideration, and to assist, Auth0 generally recommends use of the appropriate [Auth0 SDK](/libraries) for your development environment rather than calling our APIs directly. diff --git a/articles/architecture-scenarios/application/mobile-api/index.md b/articles/architecture-scenarios/application/mobile-api/index.md deleted file mode 100644 index db5281bdf1..0000000000 --- a/articles/architecture-scenarios/application/mobile-api/index.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -order: 04 -title: Mobile + API -image: /media/articles/architecture-scenarios/mobile-api.png -extract: Mobile application which talks to an API. The application will use OpenID Connect with the Authorization Code Grant using Proof Key for Code Exchange (PKCE) to authenticate users. -description: Explains the architecture scenario with a mobile application communicating with an API. -toc: true ---- - -# Mobile + API - -In this scenario we will build a Timesheet API for a fictitious company named ExampleCo. The API will allow management of timesheet entries for an employee or a contractor. - -We will also be building a mobile application which will be used to view and log timesheet entries in the centralized timesheet database using the API. - - -::: panel TL;DR -* Auth0 provides API Authentication and Authorization as a means to secure access to API endpoints (see [API Authentication and Authorization](/architecture-scenarios/application/mobile-api/part-1#api-authentication-and-authorization)) -* For authorizing a mobile app user and granting access to the API, Auth0 supports the Authorization Code Grant Flow with PKCE (see [Proof Key for Code Exchange](/architecture-scenarios/application/mobile-api/part-1#proof-key-for-code-exchange-pkce-)) -* Both the mobile app and the API must be configured in the Auth0 Dashboard (see [Auth0 Configuration](/architecture-scenarios/application/mobile-api/part-2)) -* User Permissions can be enforced using the Authorization Extension (see [Configure the Authorization Extension](/architecture-scenarios/application/mobile-api/part-2#configure-the-authorization-extension)) -* The API is secured by ensuring that a valid [Access Token](/tokens/access-token) is passed in the HTTP Authorization header when calls are made to the API (see [Implement the API](/architecture-scenarios/application/mobile-api/part-3#secure-the-endpoints)) -* The Auth0.Android SDK can be used to authorize the user of the mobile app and obtain a valid Access Token which can be used to call the API (see [Authorize the User](/architecture-scenarios/application/mobile-api/part-3#authorize-the-user)) -* The mobile app can retrieve the user's profile information by decoding the ID Token (see [Get the User Profile](/architecture-scenarios/application/mobile-api/part-3#get-the-user-profile)) -* UI Elements can be displayed conditionally based on the scope that was granted to the user (see [Display UI Elements Conditionally Based on Scope](/architecture-scenarios/application/mobile-api/part-3#display-ui-elements-conditionally-based-on-scope)) -* The mobile app provides the Access Token in the HTTP Authorization header when making calls to the API (see [Call the API](/architecture-scenarios/application/mobile-api/part-3#call-the-api)) -* The mobile app user's Access Token can be renewed to ensure the user does not have to log in again during a session (see [Renew the Token](/architecture-scenarios/application/mobile-api/part-3#renew-the-token)) -::: - -## The Premise - -ExampleCo is a consulting startup company. Currently they have approximately 100 employees and they also outsource several activities to external contractors. All employees and external contractors are required to fill in their timesheets every week. - -The company has built a timesheets application, a scenario we covered in [Single Sign-On for Regular Web Apps](/architecture-scenarios/application/web-app-sso). The internal employees use this web app to fill in their timesheets, but the company wants a mobile application for employees and contractors to use while not on the premises. The app will be used to log timesheet entries and send the data to the centralized timesheet database using the API. The app will also allow managers to approve timesheet entries. - -### Goals & Requirements - -ExampleCo wants to build a flexible solution. There are potential multiple employees and contractors who should be able to log timesheet entries, as well as batch processes which may upload timesheet entries from other, external systems. - -Hence the company has decided to develop a single Timesheets API which will be used to log time not only by this mobile app, but by all other apps as well. They want to put in place a security architecture that is flexible enough to accommodate this. ExampleCo wants to ensure that a large part of the code and business logic for the application can be shared across the different applications. - -It is required that only authorized users and applications are allowed access to the Timesheets API. - -<%= include('./_stepnav', { - next: ["1. Solution Overview", "/architecture-scenarios/application/mobile-api/part-1"] -}) %> diff --git a/articles/architecture-scenarios/application/mobile-api/part-1.md b/articles/architecture-scenarios/application/mobile-api/part-1.md deleted file mode 100644 index ffc292f62b..0000000000 --- a/articles/architecture-scenarios/application/mobile-api/part-1.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -description: Solutions Overview for the Mobile + API architecture scenario -toc: true ---- - -# Mobile + API: Solutions Overview - -<%= include('../../_includes/_api-overview-of-solution.md') %> - -<%= include('../../_includes/_api-authentication-and-authorization.md') %> - -## Proof Key for Code Exchange (PKCE) - -OAuth 2 provides several grant types for different use cases. In this particular use case, we want to access the API from a mobile application, which will use the OAuth 2.0 [Proof Key for Code Exchange](/api-auth/grant/authorization-code-pkce) to do so. - -The [Authorization Code Grant](/api-auth/grant/authorization-code) has some security issues, when implemented on native applications. For instance, a malicious attacker can intercept the `authorization_code` returned by Auth0 and exchange it for an [Access Token](/tokens/access-token) (and possibly a [Refresh Token](/tokens/refresh-token)). - -The Proof Key for Code Exchange (PKCE) (defined in [RFC 7636](https://tools.ietf.org/html/rfc7636)) is a technique used to mitigate this authorization code interception attack. - -With PKCE, the Application creates, for every authorization request, a cryptographically random key called `code_verifier` and its transformed value called `code_challenge`, which is sent to Auth0 to get the `authorization_code`. When the Application receives the `authorization_code`, it will send the code and the `code_verifier` to Auth0's token endpoint to exchange them for the requested tokens. - -![PKCE](/media/articles/architecture-scenarios/mobile-api/authorization-code-grant-pkce.png) - -1. The native app initiates the flow and redirects the user to Auth0 (specifically to the [/authorize endpoint](/api/authentication#authorization-code-grant-pkce-)), sending the `code_challenge` and `code_challenge_method` parameters. -2. Auth0 redirects the user to the native app with an `authorization_code` in the querystring. -3. The native app sends the `authorization_code` and `code_verifier` together with the `redirect_uri` and the `client_id` to Auth0. This is done using the [/oauth/token endpoint](/api/authentication?http#authorization-code-pkce-). -4. Auth0 validates this information and returns an `access_token` (and optionally a `refresh_token`). -5. The native app can use the `access_token` to call the API on behalf of the user. - -## Authorization Extension - -The [Auth0 Authorization Extension](/extensions/authorization-extension) allows you to provide authorization support in your application, by assigning Roles, Groups and Permissions to Users. - -The Authorization Extension creates a [Rule](/rules) which will augment the [User profile](/rules/current#rule-syntax) during the authentication flow with the Roles, Groups and Permissions assigned to the user. You can then use this information to ensure that the `access_token` issued to a user only contains scopes which are allowed according to the permissions defined in the Authorization Extension. - -<%= include('./_stepnav', { - prev: ["Introduction", "/architecture-scenarios/application/mobile-api"], next: ["2. Auth0 Configuration", "/architecture-scenarios/application/mobile-api/part-2"] -}) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/application/mobile-api/part-2.md b/articles/architecture-scenarios/application/mobile-api/part-2.md deleted file mode 100644 index f1b1993815..0000000000 --- a/articles/architecture-scenarios/application/mobile-api/part-2.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -description: Auth0 Configuration for the Mobile + API architecture scenario -toc: true ---- - -# Mobile + API: Auth0 Configuration - -In this section we will review all the configurations we need to apply at the [Auth0 Dashboard](${manage_url}). - - -## Create the API - -Click on the [APIs menu option](${manage_url}/#/apis) on the left, and click the Create API button. - -You will be required to supply the following details for your API: - -- __Name__: a friendly name for the API. Does not affect any functionality. -- __Identifier__: a unique identifier for the API. We recommend using a URL but note that this doesn't have to be a publicly available URL, Auth0 will not call your API at all. This value cannot be modified afterwards. -- __Signing Algorithm__: the algorithm to sign the tokens with. The available values are `HS256` and `RS256`. When selecting RS256 the token will be signed with the tenant's private key. For more details on the signing algorithms see the Signing Algorithms paragraph below. - -![Create API](/media/articles/architecture-scenarios/mobile-api/create-api.png) - -Fill in the required information and click the __Create__ button. - -<%= include('../../_includes/_api-signing-algorithms.md') %> - -<%= include('../../_includes/_api-configure-scopes.md') %> - -## Create the Application - -There are four application types in Auth0: __Native__ (used by mobile or desktop apps), __Single Page Web Applications__, __Regular Web Applications__ and __Machine to Machine Application__ (used by CLIs, Daemons, or services running on your backend). For this scenario we want to create a new Application for our mobile application, hence we will use Native as the application type. - -To create a new Application, navigate to the [dashboard](${manage_url}) and click on the [Applications](${manage_url}/#/applications}) menu option on the left. Click the __+ Create Application__ button. - -Set a name for your Application (we will use `Timesheets Mobile`) and select `Native` as the type. - -Click __Create__. - -![Create Application](/media/articles/architecture-scenarios/mobile-api/create-application.png) - -## Configure the Authorization Extension - -You will need to ensure that the Authorization Extension is installed for your tenant. You can refer to the [Authorization Extension documentation](/extensions/authorization-extension#how-to-install) for details on how to do this. - -### Define Permissions - -You will need to define Permissions which correlates with the scopes you have already defined. In the Authorization Extension, click the _Permissions_ tab, and then click on the **Create Permission** button. In the dialog, capture the details for each permission. Ensure that the name of the permission is exactly the same as the corresponding scope: - -![Create Permission](/media/articles/architecture-scenarios/mobile-api/create-permission.png) - -Proceed to create the permissions for all the remaining scopes: - -![Permissions](/media/articles/architecture-scenarios/mobile-api/permissions.png) - -### Define Roles - -Head over to the _Roles_ tab and create 2 Roles. Click the **Create Role** button and select the **Timesheets SPA** application. Give the Role a name and description of Employee, and select the `delete:timesheets`, `create:timesheets` and `read:timesheets` permissons. Click on **Save**. - -![Create Employee Role](/media/articles/architecture-scenarios/mobile-api/create-employee-role.png) - -Next, follow the same process to create a **Manager** role, and ensure that you have selected all the permissions: - -![Create Manager Role](/media/articles/architecture-scenarios/mobile-api/create-manager-role.png) - -### Assign Users to Roles - -You will need to assign all users to either the Manager or the User role. You can do this by going to the _Users_ tab in the Authorization Extension and selecting a user. On the user information screen, go to the _Roles_ tab. You can add a role to the user by clicking the **Add Role to User** button, and selecting the approproate role for the user. - -![Add User to Role](/media/articles/architecture-scenarios/mobile-api/add-user-role.png) - -### Configuring the Authorization Extension - -You will also need to ensure that the Rule for the Authorization Extension is published. You can do this by clicking on your user avatar in to top right of the Authorization Extension, and selecting the **Configuration** option: - -![Navigate to COnfiguration](/media/articles/architecture-scenarios/mobile-api/select-configuration.png) - -Ensure that you have enabled **Permissions** and then click the **Publish Rule** button: - -![Pulish Rule](/media/articles/architecture-scenarios/mobile-api/publish-rule.png) - -### Create a Rule to validate token scopes - -The final step in this process is to create a Rule which will validate that the scopes contained in an `access_token` is valid based on the permissions assigned to the user. Any scopes which are not valid for a user should be removed from the `access_token`. - -In your Auth0 Dashboard, go to the _Rules_ tab. You should see the Rule created by the Authorization Extension: - -![Rules](/media/articles/architecture-scenarios/mobile-api/rules-1.png) - -Click on the **Create Rule** button and select the **Empty Rule** template. You can give the Rule a name, such as **Access Token Scopes**, and then specify the following code for the Rule: - -```js -function (user, context, callback) { - if (context.clientName !== 'Timesheets SPA') { - return callback(null, user, context); - } - - var permissions = user.permissions || []; - var requestedScopes = context.request.body.scope || context.request.query.scope; - var filteredScopes = requestedScopes.split(' ').filter( function(x) { - return x.indexOf(':') < 0; - }); - Array.prototype.push.apply(filteredScopes, permissions); - context.accessToken.scope = filteredScopes.join(' '); - - callback(null, user, context); -} -``` - -The code above will ensure that all Access Tokens will only contain the scopes which are valid according to a user's permissions. Once you are done you can click on the **Save** button. - -Rules execute in the order they are displayed on the Rules page, so ensure that the new rule you created is positioned below the rule for the Authorization Extension, so it executes after the Authorization Extension rule: - -![Rules](/media/articles/architecture-scenarios/mobile-api/rules-2.png) - -<%= include('./_stepnav', { - prev: ["1. Solution Overview", "/architecture-scenarios/application/mobile-api/part-1"], next: ["3. API + Mobile Implementation", "/architecture-scenarios/application/mobile-api/part-3"] -}) %> diff --git a/articles/architecture-scenarios/application/mobile-api/part-3.md b/articles/architecture-scenarios/application/mobile-api/part-3.md deleted file mode 100644 index 427b2950b2..0000000000 --- a/articles/architecture-scenarios/application/mobile-api/part-3.md +++ /dev/null @@ -1,201 +0,0 @@ ---- -description: API and Mobile Configuration for the Mobile + API architecture scenario -toc: true ---- - -# Mobile + API: API and Mobile Configuration - -<%= include('../../_includes/_api-implement.md') %> - -## Implement the Mobile App - -In this section we will see how we can implement a mobile application for our scenario. - -::: note -[See the implementation in Android.](/architecture-scenarios/application/mobile-api/mobile-implementation-android#1-set-up-the-application) -::: - -### Authorize the User - -To authorize the user we will implement an [Authorization Code Grant Flow with PKCE](/api-auth/tutorials/authorization-code-grant-pkce). The mobile application should first send the user to the [authorization URL](/api/authentication#authorization-code-grant-pkce-) along with the `code_challenge` and the method used to generate it: - -```text -https://${account.namespace}/authorize? - audience=API_AUDIENCE& - scope=SCOPE& - response_type=code& - client_id=YOUR_CLIENT_ID& - code_challenge=CODE_CHALLENGE& - code_challenge_method=S256& - redirect_uri=https://YOUR_APP/callback -``` - -The `GET` request to the authorization URL should include the following values: - -Parameter | Description -----------|------------ -__client_id__ | The value of your Auth0 Client Id. You can retrieve it from the Settings of your Application at the [Auth0 Dashboard](${manage_url}/#/applications). -__audience__ | The value of your API Identifier. You can retrieve it from the Settings of your API at the [Auth0 Dashboard](${manage_url}/#/apis). -__scope__ | The [scopes](/scopes) which determine the claims to be returned in the `id_token` and `access_token`. For example, a scope of `openid` will return an `id_token` in the response. In our example mobile app, we use the following scopes: `create:timesheets read:timesheets openid profile email offline_access`. These scopes allow the mobile app to call the API, obtain a `refresh_token`, and return the user's `name`, `picture`, and `email` claims in the `id_token`. -__response_type__ | Indicates the Authentication Flow to use. For a mobile application using PKCE, this should be set to `code`. -__code_challenge__ | The generated code challenge from the code verifier. You can find instructions on generating a code challenge [here](/api-auth/tutorials/authorization-code-grant-pkce#1-create-a-code-verifier). -__code_challenge_method__ | Method used to generate the challenge. Auth0 supports only `S256`. -__redirect_uri__ | The URL which Auth0 will redirect the browser to after authorization has been granted by the user. The Authorization Code will be available in the code URL parameter. This URL must be specified as a valid callback URL under your [Application's Settings](${manage_url}/#/applications). - -::: note -[See the implementation in Android.](/architecture-scenarios/application/mobile-api/mobile-implementation-android#2-authorize-the-user) -::: - -### Get the Credentials - -After a successful request to the authorization URL, you should receive the following response: - -```text -HTTP/1.1 302 Found -Location: https://${account.namespace}/callback?code=AUTHORIZATION_CODE -``` - -Next you can exchange the `authorization_code` from the response for an Access Token that can be used to call your API. Perform a `POST` request to the [Token URL](/api/authentication#authorization-code-pkce-) including the following data: - -```har -{ - "method": "POST", - "url": "https://${account.namespace}/oauth/token", - "headers": [ - { "name": "Content-Type", "value": "application/json" } - ], - "postData": { - "mimeType": "application/json", - "text": "{\"grant_type\":\"authorization_code\",\"client_id\": \"${account.clientId}\",\"code_verifier\": \"YOUR_GENERATED_CODE_VERIFIER\",\"code\": \"YOUR_AUTHORIZATION_CODE\",\"redirect_uri\": \"com.myclientapp://myclientapp.com/callback\", }" - } -} -``` - -Parameter | Description -----------|------------ -__grant_type__ | This must be set to `authorization_code`. -__client_id__ | The value of your Auth0 Client Id. You can retrieve it from the Settings of your Application at the [Auth0 Dashboard](${manage_url}/#/applications). -__code_verifier__ | Cryptographically random key that was used to generate the `code_challenge` passed to [authorization URL](/api/authentication#authorization-code-grant-pkce-) (`/authorize`). -__code__ | The `authorization_code` received from the previous authorize call. -__redirect_uri__ | The URL must match the `redirect_uri` passed in the previous section to `/authorize`. - -The response from the Token URL will contain: - -```json -{ - "access_token": "eyJz93a...k4laUWw", - "refresh_token": "GEbRxBN...edjnXbL", - "id_token": "eyJ0XAi...4faeEoQ", - "token_type": "Bearer", - "expires_in":86400 -} -``` - -- __access_token__: An `access_token` for the API, specified by the `audience`. -- __refresh_token__: A [Refresh Token](/tokens/refresh-token/current) will only be present if you included the `offline_access` scope AND enabled __Allow Offline Access__ for your API in the Dashboard. -- __id_token__: An `id_token` JWT containing user profile information. -- __token_type__: A string containing the type of token, this will always be a Bearer token. -- __expires_in__: The amount of seconds until the `access_token` expires. - -You will need to store the above credentials in local storage for use in calling your API and retrieving the user profile. - -::: note -[See the implementation in Android.](/architecture-scenarios/application/mobile-api/mobile-implementation-android#store-credentials) -::: - -### Get the User Profile - -To retrieve the [User Profile](/api/authentication?http#user-profile), your mobile application can decode the [ID Token](/tokens/id-token) using one of the [JWT libraries](https://jwt.io/#libraries-io). This is done by [verifying the signature](/tokens/id-token#verify-the-signature) and [validating the claims](/tokens/id-token#validate-the-claims) of the token. After validating the ID Token, you can access its payload containing the user information: - -```json -{ - "email_verified": false, - "email": "test.account@userinfo.com", - "clientID": "q2hnj2iu...", - "updated_at": "2016-12-05T15:15:40.545Z", - "name": "test.account@userinfo.com", - "picture": "https://s.gravatar.com/avatar/dummy.png", - "user_id": "auth0|58454...", - "nickname": "test.account", - "created_at": "2016-12-05T11:16:59.640Z", - "sub": "auth0|58454..." -} -``` - -::: note -[See the implementation in Android.](/architecture-scenarios/application/mobile-api/mobile-implementation-android#3-get-the-user-profile) -::: - -### Display UI Elements Conditionally Based on Scope - -Based on the `scope` of the user, you may want to show or hide certain UI elements. To determine the scope issued to a user, you will need to inspect the the `scope` which was granted when the user was authenticated. This will be a string containing all the scopes, so you therefore need to inspect this string to see whether it contains the required `scope` and based on that make a decision whether to display a particular UI element. - -::: note -[See the implementation in Android](/architecture-scenarios/application/mobile-api/mobile-implementation-android#4-display-ui-elements-conditionally-based-on-scope) -::: - -### Call the API - -To access secured resources from your API, the authenticated user's `access_token` needs to be included in requests that are sent to it. This is accomplished by sending the `access_token` in an `Authorization` header using the `Bearer` scheme. - -::: note -[See the implementation in Android.](/architecture-scenarios/application/mobile-api/mobile-implementation-android#5-call-the-api) -::: - -### Renew the Token - -::: warning -Refresh Tokens must be stored securely by an application since they do not expire and allow a user to remain authenticated essentially forever. If Refresh Tokens are compromised or you no longer need them, you can revoke the Refresh Tokens using the [Authentication API](/api/authentication#revoke-refresh-token). -::: - -To refresh your `access_token`, perform a `POST` request to the `/oauth/token` endpoint using the `refresh_token` from your authorization result. - -A [Refresh Token](/tokens/refresh-token/current) will only be present if you included the `offline_access` scope in the previous authorization request and enabled __Allow Offline Access__ for your API in the Dashboard. - -Your request should include: - -```har -{ - "method": "POST", - "url": "https://${account.namespace}/oauth/token", - "httpVersion": "HTTP/1.1", - "cookies": [], - "headers": [ - { "name": "Content-Type", "value": "application/json" } - ], - "queryString" : [], - "postData" : { - "mimeType": "application/json", - "text" : "{ \"grant_type\": \"refresh_token\", \"client_id\": \"${account.clientId}\", \"refresh_token\": \"YOUR_REFRESH_TOKEN\" }" - }, - "headersSize" : 150, - "bodySize" : 0, - "comment" : "" -} -``` - -Parameter | Description -----------|------------ -__grant_type__ | This must be set to `refresh_token`. -__client_id__ | The value of your Auth0 Client Id. You can retrieve it from the Settings of your Application at the [Auth0 Dashboard](${manage_url}/#/applications). -__refresh_token__ | the `refresh_token` to use, from the previous authentication result. - -The response will include the new `access_token`: - -```json -{ - "access_token": "eyJz93a...k4laUWw", - "refresh_token": "GEbRxBN...edjnXbL", - "id_token": "eyJ0XAi...4faeEoQ", - "token_type": "Bearer", - "expires_in":86400 -} -``` - -::: note -[See the implementation in Android.](/architecture-scenarios/application/mobile-api/mobile-implementation-android#store-the-credentials) -::: - -<%= include('./_stepnav', { - prev: ["2. Auth0 Configuration", "/architecture-scenarios/application/mobile-api/part-2"], next: ["Conclusion", "/architecture-scenarios/application/mobile-api/part-4"] -}) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/application/mobile-api/part-4.md b/articles/architecture-scenarios/application/mobile-api/part-4.md deleted file mode 100644 index 7dd6a93185..0000000000 --- a/articles/architecture-scenarios/application/mobile-api/part-4.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -description: Conclusion for the Mobile + API architecture scenario ---- - -# Mobile + API: Conclusion - -In this document we covered a simple scenario: an API, used by a mobile application to allow employees to capture their timesheets. - -We learned about the Authorization Code Grant with PKCE, what an Access Token is, how to configure an API in Auth0, how to configure a mobile application to communicate securely with this API, how to define and secure our API endpoints, how to use the provided libraries to validate the Access Token and how to retrieve a new one from Auth0. - -We started by describing the business case and the requirements and went on explaining how each requirement can be met and the thought process behind each choice that was made. - -We used Node.js for the API implementation and Android for the mobile application. Hopefully though after going through this document you are able to build this using the technologies you prefer. - -Don't forget to check back for new business cases and more complex architecture scenarios! - -<%= include('./_stepnav', { - prev: ["3. API + Mobile Implementation", "/architecture-scenarios/application/mobile-api/part-3"] -}) %> diff --git a/articles/architecture-scenarios/application/server-api/index.md b/articles/architecture-scenarios/application/server-api/index.md deleted file mode 100644 index a07f61ce7b..0000000000 --- a/articles/architecture-scenarios/application/server-api/index.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -order: 02 -title: Server Application + API -image: /media/articles/architecture-scenarios/server-api.png -extract: Server to server communication where a server “Application” needs to make secure calls to an API (“Resource Server”), but on behalf of the application vs. a user. -description: Explains the architecture scenario with server to server communication with secure calls to an API (“Resource Server”), but on behalf of the application vs. a user. -toc: true ---- - -# Server + API - -In this scenario we will build a Timesheet API for a fictitious company named ExampleCo. The API will allow to add timesheet entries for an employee or a contractor. - -We will also be building a cron job which will process timesheet entries from an external system to the centralized timesheet database using the API. - -::: panel TL;DR -* Auth0 provides API Authentication and Authorization as a means to secure access to API endpoints (see [API Authentication and Authorization](/architecture-scenarios/application/server-api/part-1#api-authentication-and-authorization)) -* For authorizing a Machine to Machine Application (a CLI, service or daemon where no user interaction is involved) Auth0 supports the Client Credentials grant (see [Client Credentials Grant](/architecture-scenarios/application/server-api/part-1#client-credentials-grant)) -* Both the Machine to Machine Application and the API must be configured in the Auth0 Dashboard (see [Auth0 Configuration](/architecture-scenarios/application/server-api/part-2)) -* The API will be secured by ensuring that a valid Access Token (which is implemented as a JSON Web Token) is passed in the HTTP Authorization header when calls are made to the API (see [Implement the API](/architecture-scenarios/application/server-api/part-3)) -* Upon successful authorization an Access Token is issued to the Machine to Machine Application (see [Get an Access Token](/architecture-scenarios/application/server-api/part-3#get-an-access-token)) -* The Machine to Machine Application can in turn use this Access Token to pass along as an HTTP Authorization header to authenticate calls to API endpoints (see [Invoke the API](/architecture-scenarios/application/server-api/part-3#invoke-the-api)) -::: - -## The Premise - -ExampleCo is a consulting startup company. Currently they have approximately 100 employees and they also outsource several activities to external contractors. All employees and external contractors are required to fill in their timesheets every week. For this purpose, they built a timesheets application, a scenario we covered in [Single Sign-On for Regular Web Apps](/architecture-scenarios/application/web-app-sso). The internal employees use this web app to fill in their timesheets but some of the external contractors already use another tool to track their timesheets. Hence a solution to avoid the double work is required. It was decided to build a cron job which will read the timesheet entries from this external system, and automatically upload those to ExampleCo's backend using an API. - -### Goals & Requirements - -ExampleCo wants to build a flexible solution. At the moment only an automated process needs to push timesheet entries but in the future the company plans on launching more applications, like a mobile app to accommodate their sales teams. Hence the company has decided to develop a single Timesheets API which will be used to log time not only by this server process, but by all future applications as well. They want to put in place a security architecture that is flexible enough to accommodate this. ExampleCo wants to ensure that a large part of the code and business logic for the application can be shared across the different applications. - -It is required that only authorized users and applications are allowed access to the Timesheets API. - -<%= include('./_stepnav', { - next: ["1. Solution Overview", "/architecture-scenarios/application/server-api/part-1"] -}) %> diff --git a/articles/architecture-scenarios/application/server-api/part-1.md b/articles/architecture-scenarios/application/server-api/part-1.md deleted file mode 100644 index 7638816527..0000000000 --- a/articles/architecture-scenarios/application/server-api/part-1.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -description: Solutions Overview for the Server + API architecture scenario -toc: true ---- - -# Server + API: Solution Overview - -<%= include('../../_includes/_api-overview-of-solution.md') %> - -<%= include('../../_includes/_api-authentication-and-authorization.md') %> - -## Client Credentials Grant - -OAuth 2 provides several *grant types* for different use cases. In this particular use case where a cron job will be uploading timesheets via an API, there is no interactive user (or resource owner) who grants permission to the cron job to access the API. - -The cron job is also not making the API calls on behalf of any user. Instead there is a machine-to-machine authorization and the application (the cron job) makes calls to the Resource Server (the API) on its own behalf. - -For situations like this where there is no user interaction involved, the Client Credentials Grant is ideal. With Client Credentials Grant (defined in [RFC 6749, section 4.4](https://tools.ietf.org/html/rfc6749#section-4.4)) an Application can directly request an `access_token` from the Authorization Server by using its Client Credentials (a Client Id and a Client Secret). Instead of identifying a Resource Owner, this token will represent the Application itself. - -![Client Credentials Grant Flow](/media/articles/architecture-scenarios/server-api/client-credentials-grant.png) - -1. The Application authenticates with the Authorization Server using its Client ID and Client Secret. -1. The Authorization Server validates this information and returns an `access_token`. -1. The Application can use the `access_token` to call the Resource Server on behalf of itself. - -<%= include('./_stepnav', { - prev: ["Introduction", "/architecture-scenarios/application/server-api"], next: ["2. Auth0 Configuration", "/architecture-scenarios/application/server-api/part-2"] -}) %> diff --git a/articles/architecture-scenarios/application/server-api/part-2.md b/articles/architecture-scenarios/application/server-api/part-2.md deleted file mode 100644 index c85bab6ade..0000000000 --- a/articles/architecture-scenarios/application/server-api/part-2.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -description: Auth0 Configuration for the Server + API architecture scenario -toc: true ---- - -# Server + API: Auth0 Configuration - -In this section we will review all the configurations we need to apply using the [Auth0 Dashboard](${manage_url}). - -## Configure the API - -Click on the [APIs menu option](${manage_url}/#/apis) on the left, and click the **Create API** button. - -You will be required to supply the following details for your API: - -- **Name**: a friendly name for the API. Does not affect any functionality. -- **Identifier**: a unique identifier for the API. We recommend using a URL but note that this doesn't have to be a publicly available URL, Auth0 will not call your API at all. This value cannot be modified afterwards. -- **Signing Algorithm**: the algorithm to sign the tokens with. The available values are `HS256` and `RS256`. When selecting RS256 the token will be signed with the tenant's private key. For more details on the signing algorithms see the [Signing Algorithms paragraph](#signing-algorithms) below. - -![Create API](/media/articles/architecture-scenarios/server-api/create-api.png) - -Fill in the required information and click the **Create** button. - -### Signing Algorithms - -When you create an API you have to select the algorithm your tokens will be signed with. The signature is used to verify that the sender of the JWT is who it says it is and to ensure that the message wasn't changed along the way. - -::: note - The signature is part of a JWT. If you are not familiar with the JWT structure please refer to: [JSON Web Tokens (JWTs) in Auth0](/jwt#what-is-the-json-web-token-structure-). -::: - -To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that. That algorithm, which is part of the JWT header, is the one you select for your API: `HS256` or `RS256`. - -- **RS256** is an [asymmetric algorithm](https://en.wikipedia.org/wiki/Public-key_cryptography) which means that there are two keys: one public and one private (secret). Auth0 has the secret key, which is used to generate the signature, and the consumer of the JWT has the public key, which is used to validate the signature. - -- **HS256** is a [symmetric algorithm](https://en.wikipedia.org/wiki/Symmetric-key_algorithm) which means that there is only one secret key, shared between the two parties. The same key is used both to generate the signature and to validate it. Special care should be taken in order for the key to remain confidential. - -The most secure practice, and our recommendation, is to use **RS256**. Some of the reasons are: - -- With RS256 you are sure that only the holder of the private key (Auth0) can sign tokens, while anyone can check if the token is valid using the public key. -- Under HS256, If the private key is compromised you would have to re-deploy the API with the new secret. With RS256 you can request a token that is valid for multiple audiences. -- With RS256 you can implement key rotation without having to re-deploy the API with the new secret. - -For a more detailed overview of the JWT signing algorithms refer to: [JSON Web Token (JWT) Signing Algorithms Overview](https://auth0.com/blog/json-web-token-signing-algorithms-overview/). - -## Configure the Scopes - -Once the application has been created you will need to configure the Scopes which applications can request during authorization. - -In the settings for your API, go to the *Scopes* tab. In this section you can add all four of the scopes which was discussed before, namely `batch:upload`, `read:timesheets`, `create:timesheets`, `delete:timesheets`, `approve:timesheets`. - -::: note - For the purposes of this document we will only be ever concerned with the `batch:upload` scope, as that is all that is required by the Cron job. For completeness sake we are however adding the necessary scopes which will be required by future applications as well. -::: - -![Add Scopes](/media/articles/architecture-scenarios/server-api/add-scopes.png) - -## Create the Application - -When creating an API in the Auth0 Dashboard, a test application for the API will automatically be generated. In the Auth0 Dashboard, navigate to the [Application Section](${manage_url}/#/applications) and you will see the test application for the Timesheets API. - -![Machine to Machine Application](/media/articles/architecture-scenarios/server-api/non-interactive-client.png) - -Go to the settings for the application by clicking on the gear icon, and rename the application to `Timesheets import Job`. - -For the cron job you will need a Machine to Machine Application. This test application which was generated when the API was created was automatically configured as a Machine to Machine Application as can be seen in the screenshot below. - -![Machine to Machine Application Settings](/media/articles/architecture-scenarios/server-api/non-interactive-client-settings.png) - -## Configure Application's access to the API - -The final part of the Auth0 configuration is to allow the application access to the Timesheets API. Go back to the configuration of the API, and select the *Machine to Machine Application* tab. - -You will see the **Timesheets Import Job** application listed, and it should have access to API as can be seen from the switch to the right of the application name which indicates a value of `Authorized`. If it does not indicate that the application is authorized, simply toggle the value of the switch from `Unauthorized` to `Authorized`. - -![Authorize Application](/media/articles/architecture-scenarios/server-api/authorize-client.png) - -You will also need to specify which scopes will be included in Access Tokens which are issued to the application when the application authorizes with Auth0. - -Expand the settings for the application by clicking on the down arrow to the far right, and you will see the list of available scopes. The cron job will only require the `batch:upload` scope as it will simply create new timesheets based on the timesheet entries in the external system. - -Once you have selected the `batch:upload` scope you can save the settings by clicking the **Update** button. - -![Assign Scopes](/media/articles/architecture-scenarios/server-api/assign-scopes.png) - -Now that we have designed our solution and discussed the configurations needed on Auth0 side, we can proceed with the implementation part. That's what the next paragraph is all about, so keep reading! - - -<%= include('./_stepnav', { - prev: ["1. Solution Overview ", "/architecture-scenarios/application/server-api/part-1"], next: ["3. Application Implementation", "/architecture-scenarios/application/server-api/part-3"] -}) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/application/server-api/part-3.md b/articles/architecture-scenarios/application/server-api/part-3.md deleted file mode 100644 index 5549f66eee..0000000000 --- a/articles/architecture-scenarios/application/server-api/part-3.md +++ /dev/null @@ -1,137 +0,0 @@ ---- -description: Application Implementation for the Server + API architecture scenario -toc: true ---- - -# Server + API: Application Implementation - -In this section of the tutorial, we will take an in-depth look into our API and its associated Machine to Machine Application. - -::: note - For simplicity reasons we will keep our implementation solely focused on the authentication and authorization part. As you will see in the samples the input timesheet entry will be hard-coded and the API will not persist the timesheet entry, simply echo back some of the info. -::: - -## Define the API endpoints - -First we need to define the endpoints of our API. - -::: panel What is an API endpoint? -An **API endpoint** is a unique URL that represents an object. In order to interact with this object you need to point your application towards that URL. For example, if you had an API that could return either order or customers, you might configure two endpoints: `/orders` and `/customers`. Your application would interact with these endpoints using different HTTP methods, for example `POST /orders` to create a new order, or `GET /orders` to retrieve the dataset of one or more orders. -::: - -We will configure one single endpoint that will be used for creating timesheet entries. The endpoint will be `/timesheets/upload` and the HTTP method `POST`. - -The API will expect a JSON object as input, containing the timesheet information. We will use the following JSON: - -```json -{ - 'user_id': '007', - 'date': '2017-05-10T17:40:20.095Z', - 'project': 'StoreZero', - 'hours': 5 -} -``` - -The API will print the JSON, so we can verify the contents and echo back a message like the following: `Created timesheet 14 for employee 007`. - -::: note - See the implementation in [Node.js](/architecture-scenarios/application/server-api/api-implementation-nodejs#1-define-the-api-endpoint) -::: - -### Secure the API endpoints - -::: panel-warning Configure the API -In order to secure your endpoints you need to have your API configured in the Auth0 Dashboard. For information on how to do that refer to the [Configure the API](#configure-the-api) paragraph of this document. -::: - -The first step towards securing our API endpoint is to get an Access Token as part of the Header and validate it. If it's not valid then we should return an HTTP Status 401 (Unauthorized) to the calling process. - -::: note - See the implementation in [Node.js](/architecture-scenarios/application/server-api/api-implementation-nodejs#2-secure-the-api-endpoint) -::: - -#### Get an Access Token - -To get an Access Token without using our application sample implementation, perform a `POST` operation to the `https://${account.namespace}/oauth/token` endpoint with a payload in the following format: - -```json -{ - audience: "YOUR_API_IDENTIFIER", - grant_type: "client_credentials", - client_id: "${account.client_id}", - client_secret: "${account.client_secret}" -} -``` - -::: note - For more information on this refer to: [API Authorization: Asking for Access Tokens for a Client Credentials Grant](/api-auth/config/asking-for-access-tokens). -::: - -## Check the application permissions - -Now we have secured our API's endpoint with an Access Token but we still haven't ensured that the process calling the API has indeed the rights to post a new timesheet entry. - -As discussed earlier in this doc, each Access Token may include a list of the permissions that have been granted to the client. These permissions are defined using the scope request parameter. For more information on how to configure this refer to the [Configure the Scopes](#configure-the-scopes) paragraph. - -For our endpoint we will require the scope `batch:upload`. - -::: note - See the implementation in [Node.js](/architecture-scenarios/application/server-api/api-implementation-nodejs#3-check-the-client-permissions) -::: - -### Implement the Machine to Machine Application - -In this section we will see how we can implement a Machine to Machine Application for our scenario. - -::: note - For simplicity reasons we will keep our implementations solely focused on the authentication and authorization part and configure our application to send a single hard-coded timesheet entry to the API. Also, we will print in the console, something we wouldn't do with a server running process. -::: - -### Get an Access Token - -We will start by invoking the Auth0 `/oauth/token` API endpoint in order to get an Access Token. - -In order to do so we will need the following configuration values: - -- **Domain**: The value of your Auth0 Domain. You can retrieve it from the *Settings* of your application at the [Auth0 Dashboard](${manage_url}/#/applications). This value will be a part of the API URL: `https://${account.namespace}/oauth/token`. - -- **Audience**: The value of your API Identifier. You can retrieve it from the *Settings* of your API at the [Auth0 Dashboard](${manage_url}/#/apis). - -- **Client ID**: The value of your Auth0 application's Id. You can retrieve it from the *Settings* of your application at the [Auth0 Dashboard](${manage_url}/#/applications). - -- **Client Secret**: The value of your Auth0 application's Secret. You can retrieve it from the *Settings* of your application at the [Auth0 Dashboard](${manage_url}/#/applications). - -Our implementation should perform a `POST` operation to the `https://${account.namespace}/oauth/token` endpoint with a payload in the following format: - -```json -{ - "audience": "YOUR_API_IDENTIFIER", - "grant_type": "client_credentials", - "client_id": "${account.client_id}", - "client_secret": "${account.client_secret}" -} -``` - -For more information on this refer to: [API Authorization: Asking for Access Tokens for a Client Credentials Grant](/api-auth/config/asking-for-access-tokens). - -::: note - See the implementation in [Python](/architecture-scenarios/application/server-api/cron-implementation-python#get-an-access-token). -::: - -## Invoke the API - -Now that we have an Access Token, which includes the valid scopes, we can invoke our API. - -In order to do so we will: -- Build a hard-coded timesheet entry in JSON format. -- Add the Access Token as an `Authorization` header to our request. -- Make the HTTP POST request. -- Parse the response and print it in the terminal (optional). - -::: note - See the implementation in [Python](/architecture-scenarios/application/server-api/cron-implementation-python#invoke-the-api). -::: - -<%= include('./_stepnav', { - prev: ["2. Auth0 Configuration", "/architecture-scenarios/application/server-api/part-2"], next: ["Conclusion", "/architecture-scenarios/application/server-api/part-4"] -}) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/application/server-api/part-4.md b/articles/architecture-scenarios/application/server-api/part-4.md deleted file mode 100644 index 35ba5464ba..0000000000 --- a/articles/architecture-scenarios/application/server-api/part-4.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -description: Conclusion for the Server + API architecture scenario -toc: true ---- - -# Server + API: Conclusion - -In this document we covered a simple scenario: an API, used to import timesheet entries in ExampleCo's systems, and a cron job, used by external contractors to send in their timesheets using this API. - -We learned about the Client Credentials Grant, what an Access Token is, how to configure an API in Auth0, how to configure a Machine to Machine Application to communicate securely with this API, how to define and secure our API endpoints, how to use the provided libraries to validate the Access Token and how to retrieve a new one from Auth0. - -We started by describing the business case and the requirements and went on explaining how each requirement can be met and the thought process behind each choice that was made. - -We used Node.js for the API implementation and Python for the non interactive server process, hopefully though after going through this document you are able to build this using the technologies you prefer. - -<%= include('./_stepnav', { - prev: ["3. Application Implementation", "/architecture-scenarios/application/server-api/part-3"] -}) %> diff --git a/articles/architecture-scenarios/application/spa-api/index.md b/articles/architecture-scenarios/application/spa-api/index.md deleted file mode 100644 index 92e1b4dbca..0000000000 --- a/articles/architecture-scenarios/application/spa-api/index.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -order: 03 -title: SPA + API -image: /media/articles/architecture-scenarios/spa-api.png -extract: Single Page Web Application which talks to an API. The application will use OpenID Connect with the Implicit Grant Flow to authenticate users with Auth0. -description: Explains the architecture scenario where a Single Page Web Application (SPA) talks to an API using OpenID Connect, and the OAuth 2.0 Implicit Grant Flow, to authenticate users with Auth0. -toc: true ---- - -# SPA + API - -In this scenario, we will build a Timesheet API for a fictitious company named ExampleCo. The API will allow adding timesheet entries for an employee or a contractor. - -We will also be building a Single Page Application (SPA) which will be used to log timesheet entries and send them to the centralized timesheet database using the API. - -::: panel TL;DR -* Auth0 provides API Authentication and Authorization as a means to secure access to API endpoints (see [API Authentication and Authorization](/architecture-scenarios/application/spa-api/part-1#api-authentication-and-authorization)) -* For authorizing a user of a SPA, Auth0 supports the Implicit Grant (see [Implicit Grant](/architecture-scenarios/application/spa-api/part-1#implicit-grant)) -* Both the SPA and the API must be configured in the Auth0 Dashboard (see [Auth0 Configuration](/architecture-scenarios/application/spa-api/part-2#auth0-configuration)) -* User Permissions can be enforced using the Authorization Extension (see [Configure the Authorization Extension](/architecture-scenarios/application/spa-api/part-2#configure-the-authorization-extension)) -* The API will be secured by ensuring that a valid Access Token is passed in the HTTP Authorization header when calls are made to the API (see [Implement the API](/architecture-scenarios/application/spa-api/part-3#implement-the-api)) -* The Auth0.js library can be used to authorize the user of the SPA and obtain a valid Access Token which can be used to call the API (see [Authorize the User](/architecture-scenarios/application/spa-api/part-3#authorize-the-user)) -* The SPA can pass the Access Token in the HTTP Authorization header when making calls to the API (see [Call the API](/architecture-scenarios/application/spa-api/part-3#call-the-api)) -* The SPA can display UI elements conditionally based on scopes granted to user (see [Display UI Elements Conditionally Based on Scope](/architecture-scenarios/application/spa-api/part-3#display-ui-elements-conditionally-based-on-scope)) - -::: - -## The Premise - -ExampleCo is a consulting startup company. Currently, they have approximately 100 employees and they also outsource several activities to external contractors. All employees and external contractors are required to fill in their timesheets every week. - -The company has built a timesheets application, a scenario we covered in [Single Sign-On for Regular Web Apps](/architecture-scenarios/application/web-app-sso). The internal employees use this web app to fill in their timesheets but the company wants to replace it with a SPA. The app will be used to log timesheet entries and send the data to the centralized timesheet database using the API. The app will also allow managers to approve timesheet entries. - -## Goals & Requirements - -ExampleCo wants to build a flexible solution. At the moment only a SPA is required to capture timesheet entries but in the future, the company plans on launching more applications, like a mobile app to accommodate their sales teams. Hence the company has decided to develop a single Timesheets API which will be used to log time not only by this server process but by all future applications as well. They want to put in place a security architecture that is flexible enough to accommodate this. ExampleCo wants to ensure that a large part of the code and business logic for the application can be shared across the different applications. - -It is required that only authorized users and applications are allowed access to the Timesheets API. - -Two kinds of users will use this SPA: employees and managers. The employees should be able to read, create and delete their own timesheet entries, while the managers should be able to approve timesheets as well. - -<%= include('./_stepnav', { - next: ["1. Solution Overview", "/architecture-scenarios/application/spa-api/part-1"] -}) %> diff --git a/articles/architecture-scenarios/application/spa-api/part-1.md b/articles/architecture-scenarios/application/spa-api/part-1.md deleted file mode 100644 index fbda32a8d4..0000000000 --- a/articles/architecture-scenarios/application/spa-api/part-1.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -description: Solution Overview for the SPA + API architecture scenario -toc: true ---- - -# SPA + API: Solution Overview - -<%= include('../../_includes/_api-overview-of-solution.md') %> - -<%= include('../../_includes/_api-authentication-and-authorization.md') %> - -## Implicit Grant - -OAuth 2.0 provides several __grant types__ for different use cases. In this particular use case, we want to access the API from a [client-side app](/quickstart/spa). - -The SPA will use the OAuth 2.0 [Implicit Grant](/api-auth/grant/implicit) to do so. - -The Implicit Grant (defined in [RFC 6749, section 4.1](https://tools.ietf.org/html/rfc6749#section-4.2)) is similar to the [Authorization Code Grant](/api-auth/grant/authorization-code), but the main difference is that the application receives an `access_token` directly, without the need for an `authorization_code`. This happens because the application, which is typically a JavaScript app running within a browser, is less trusted than a web app running on the server, hence cannot be trusted with the `client_secret` (which is required in the Authorization Code Grant). - -Once the user authenticates, the application receives the `id_token` and `access_token` in the hash fragment of the URI. The application can now use the `id_token` to obtain information about the user, and `access_token` to call the API on behalf of the user. - -![Implicit Grant](/media/articles/api-auth/implicit-grant.png) - -1. The app initiates the flow and redirects the browser to Auth0 (specifically to the [/authorize endpoint](/api/authentication#implicit-grant)), so the user can authenticate. - -1. Auth0 authenticates the user. The first time the user goes through this flow, and if the application is a third party application, a consent page will be shown where the permissions, that will be given to the Client, are listed (for example, post messages, list contacts, and so forth). - -1. Auth0 redirects the user to the app with an `access_token` (and optionally an `id_token`) in the hash fragment of the URI. The app can now extract the tokens from the hash fragment. - -1. The app can use the `access_token` to call the API on behalf of the user. - -## Authorization Extension - -The [Auth0 Authorization Extension](/extensions/authorization-extension) allows you to configure Roles, Groups, and Permissions, and assign them to Users. - -- The Permissions are actions that someone can do. For ExampleCo's business needs, we will configure four Permissions: read, create, delete and approve timesheets. -- The Roles are collections of Permissions. ExampleCo's timesheets app will be used by two kinds of users (employees and managers), with different permissions each, so we will configure two Roles: employee and manager. - -Since this covers our business case we will not create any Groups. - -The Authorization Extension will create a [Rule](/rules) which will read the Roles, Groups, and Permissions assigned to a user and add this information to the [User profile](/rules/current#rule-syntax) during the authentication flow. We can use this information to ensure that the `access_token` issued to a user only contains scopes which are allowed. We can later on proceed to customize our app, like disabling the Approve Timesheets functionality if the user does not have the required permission to do so. - -<%= include('./_stepnav', { - prev: ["Introduction", "/architecture-scenarios/application/spa-api"], next: ["2. Auth0 Configuration", "/architecture-scenarios/application/spa-api/part-2"] -}) %> diff --git a/articles/architecture-scenarios/application/spa-api/part-2.md b/articles/architecture-scenarios/application/spa-api/part-2.md deleted file mode 100644 index 27e262ac0b..0000000000 --- a/articles/architecture-scenarios/application/spa-api/part-2.md +++ /dev/null @@ -1,168 +0,0 @@ ---- -description: Auth0 Configuration for the SPA + API architecture scenario -toc: true ---- - -# SPA + API: Auth0 Configuration - -In this section we will review all the configurations we need to apply at the [Auth0 Dashboard](${manage_url}). - -## Create the API - -Navigate to the [APIs section](${manage_url}/#/apis) of the dashboard, and click the **Create API** button. - -You will be asked to supply the following details for your API: - -- __Name__: a friendly name for the API. Does not affect any functionality. -- __Identifier__: a unique identifier for the API. We recommend using a URL but note that this doesn't have to be a publicly available URL, Auth0 will not call your API at all. This value cannot be modified afterwards. -- __Signing Algorithm__: the algorithm to sign the tokens with. The available values are `HS256` and `RS256`. When selecting RS256 the token will be signed with the tenant's private key. For more details on the signing algorithms see the [Signing Algorithms paragraph](#signing-algorithms) below. - -![Create API](/media/articles/architecture-scenarios/spa-api/create-api.png) - -Fill in the required information and click the **Create** button. - -## Signing Algorithms - -When you create an API you have to select the algorithm your tokens will be signed with. The signature is used to verify that the sender of the JWT is who it says it is and to ensure that the message wasn't changed along the way. - -::: note -The signature is part of a JWT. If you are not familiar with the JWT structure please refer to [JSON Web Tokens (JWTs) in Auth0](/jwt#what-is-the-json-web-token-structure-). -::: - -To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that. That algorithm, which is part of the JWT header, is the one you select for your API: `HS256` or `RS256`. - -- __RS256__ is an [asymmetric algorithm](https://en.wikipedia.org/wiki/Public-key_cryptography) which means that there are two keys: one public and one private (secret). Auth0 has the secret key, which is used to generate the signature, and the consumer of the JWT has the public key, which is used to validate the signature. - -- __HS256__ is a [symmetric algorithm](https://en.wikipedia.org/wiki/Symmetric-key_algorithm) which means that there is only one secret key, shared between the two parties. The same key is used both to generate the signature and to validate it. Special care should be taken in order for the key to remain confidential. - -The most secure practice, and our recommendation, is to use __RS256__. Some of the reasons are: - -- With RS256 you are sure that only the holder of the private key (Auth0) can sign tokens, while anyone can check if the token is valid using the public key. -- Under HS256, If the private key is compromised you would have to re-deploy the API with the new secret. With RS256 you can request a token that is valid for multiple audiences. -- With RS256 you can implement key rotation without having to re-deploy the API with the new secret. - -::: note -For a more detailed overview of the JWT signing algorithms refer to [JSON Web Token (JWT) Signing Algorithms Overview](https://auth0.com/blog/json-web-token-signing-algorithms-overview/). -::: - -## Configure the Scopes - -Once the application has been created you will need to configure the Scopes which applications can request during authorization. - -In the settings for your API, go to the **Scopes** tab. In this section you can add the scopes for our business case: `read:timesheets`, `create:timesheets`, `delete:timesheets`, and `approve:timesheets`. - -![Add Scopes](/media/articles/architecture-scenarios/spa-api/add-scopes.png) - -## Create the Application - -There are four application types in Auth0: -- __Native__ (used by mobile or desktop apps), -- __Single Page Web Applications__, -- __Regular Web Applications__ and -- __Machine to Machine Applications__ (used by CLIs, Daemons, or services running on your backend). - -For this scenario we want to create a new Application for our SPA, hence we will use Single Page Application as the application type. - -To create a new Application, navigate to the [dashboard](${manage_url}) and click on the [Applications](${manage_url}/#/applications}) menu option on the left. Click the __+ Create Application__ button. - -Set a name for your Application (we will use `Timesheets SPA`) and select `Single Page Web Applications` as the type. - -Click __Create__. - -![Create Application](/media/articles/architecture-scenarios/spa-api/create-client.png) - -That's it for now. When we are done with the SPA implementation we will revisit the dashboard and this Application's settings to make some changes in its configuration. - -## Configure the Authorization Extension - -You will need to ensure that the Authorization Extension is installed for your tenant. You can refer to the [Authorization Extension documentation](/extensions/authorization-extension#how-to-install) for details on how to do this. - -### Define Permissions - -You will now define the required Permissions, according to the scopes you have already defined: `read:timesheets`, `create:timesheets`, `delete:timesheets`, and `approve:timesheets`. - -In the Authorization Extension, click the **Permissions** tab, and then click on the **Create Permission** button. - -In the dialog, capture the details for each permission. - -Ensure that the name of the permission is exactly the same as the corresponding scope: - -![Create Permission](/media/articles/architecture-scenarios/spa-api/create-permission.png) - -Proceed to create the permissions for all the remaining scopes: - -![Permissions](/media/articles/architecture-scenarios/spa-api/permissions.png) - -### Define Roles - -Next let's configure the two Roles: employee and manager. - -Head over to the **Roles** tab, click the **Create Role** button, and select the **Timesheets SPA** application. - -Set the **Name** and **Description** to `Employee`, and select the `delete:timesheets`, `create:timesheets` and `read:timesheets` permissons. Click on **Save**. - -![Create Employee Role](/media/articles/architecture-scenarios/spa-api/create-employee-role.png) - -Next, follow the same process to create a `Manager` role, and ensure that you have selected all the permissions. - -![Create Manager Role](/media/articles/architecture-scenarios/spa-api/create-manager-role.png) - -### Assign Users to Roles - -You need to assign all users to either the `Manager` or the `Employee` role. - -You can do this by going to the **Users** tab in the Authorization Extension and selecting a user. - -On the user information screen, go to the **Roles** tab. Click **Add Role to User**, and select the appropriate role. - -![Add User to Role](/media/articles/architecture-scenarios/spa-api/add-user-role.png) - -### Configuring the Authorization Extension - -You will also need to ensure that the Rule for the Authorization Extension is published. - -To do so, click on your user avatar in the top right of the Authorization Extension, and select **Configuration**. - -![Navigate to Configuration](/media/articles/architecture-scenarios/spa-api/select-configuration.png) - -Make sure that **Permissions** are enabled and then click **Publish Rule**. - -![Pulish Rule](/media/articles/architecture-scenarios/spa-api/publish-rule.png) - -### Create a Rule to validate token scopes - -The final step in this process is to create a Rule which will validate that the scopes contained in an `access_token` is valid based on the permissions assigned to the user. Any scopes which are not valid for a user should be removed from the `access_token`. - -In your Auth0 Dashboard, go to the **Rules** tab. You should see the Rule created by the Authorization Extension: - -![Rules](/media/articles/architecture-scenarios/spa-api/rules-1.png) - -Click on the **Create Rule** button and select the **Empty Rule** template. You can give the Rule a name, such as **Access Token Scopes**, and then specify the following code for the Rule: - -```js -function (user, context, callback) { - if (context.clientName !== 'Timesheets SPA') { - return callback(null, user, context); - } - - var permissions = user.permissions || []; - var requestedScopes = context.request.body.scope || context.request.query.scope; - var filteredScopes = requestedScopes.split(' ').filter( function(x) { - return x.indexOf(':') < 0; - }); - Array.prototype.push.apply(filteredScopes, permissions); - context.accessToken.scope = filteredScopes.join(' '); - - callback(null, user, context); -} -``` - -The code above will ensure that all Access Tokens will only contain the scopes which are valid according to a user's permissions. Once you are done you can click on the **Save** button. - -Rules execute in the order they are displayed on the Rules page, so ensure that the new rule you created is positioned below the rule for the Authorization Extension, so it executes after the Authorization Extension rule: - -![Rules](/media/articles/architecture-scenarios/spa-api/rules-2.png) - -<%= include('./_stepnav', { - prev: ["1. Solution Overview", "/architecture-scenarios/application/spa-api/part-1"], next: ["3. API + SPA Implementation", "/architecture-scenarios/application/spa-api/part-3"] -}) %> diff --git a/articles/architecture-scenarios/application/spa-api/part-3.md b/articles/architecture-scenarios/application/spa-api/part-3.md deleted file mode 100644 index 2a6e8ea77c..0000000000 --- a/articles/architecture-scenarios/application/spa-api/part-3.md +++ /dev/null @@ -1,212 +0,0 @@ ---- -description: API and SPA Configuration for the SPA + API architecture scenario -toc: true ---- - -# SPA + API: API and SPA Configuration - -In this section we will see how we can implement an API for our scenario. - -::: note -For simplicity reasons we will keep our implementation solely focused on the authentication and authorization part. As you will see in the samples the input timesheet entry will be hard-coded and the API will not persist the timesheet entry, simply echo back some of the info. -::: - -## Define the API endpoints - -First we need to define the endpoints of our API. - -::: panel What is an API endpoint? -An **API endpoint** is a unique URL that represents an object. In order to interact with this object you need to point your application towards that URL. For example, if you had an API that could return either order or customers, you might configure two endpoints: `/orders` and `/customers`. Your application would interact with these endpoints using different HTTP methods, for example `POST /orders` to create a new order, or `GET /orders` to retrieve the dataset of one or more orders. -::: - -For this implementation we will only define 2 endpoints; one for retrieving a list of all timesheets for an employee, and another which will allow an employee to create a new timesheet entry. - -An `HTTP GET` request to the `/timesheets` endpoint will allow a user to retrieve their timesheets, and an `HTTP POST` request to the `/timesheets` endpoint will allow a user to add a new timesheet. - -::: note -See the implementation in [Node.js](/architecture-scenarios/application/spa-api/api-implementation-nodejs#1-define-the-api-endpoints) -::: - -### Secure the Endpoints - -When an API receives a request with a bearer Access Token as part of the header, the first thing to do is to validate the token. This consists of a series of steps, and if any of these fails then the request must be rejected with a `Missing or invalid token` error message to the calling app. - -The validations that the API should perform are: - -- Check that the JWT is well formed -- Check the signature -- Validate the standard claims - -::: note -[JWT.io](https://jwt.io/) provides a list of libraries that can do most of the work for you: parse the JWT, verify the signature and the claims. -::: - -Part of the validation process is to also check the Application permissions (scopes), but we will address this separately in the next paragraph of this document. - -For more information on validating Access Tokens, refer to [Verify Access Tokens](/api-auth/tutorials/verify-access-token). - -::: note -See the implementation in [Node.js](/architecture-scenarios/application/spa-api/api-implementation-nodejs#2-secure-the-api-endpoints) -::: - -### Check the Application's Permissions - -By now we have verified that the JWT is valid. The last step is to verify that the application has the permissions required to access the protected resources. - -To do so, the API needs to check the [scopes](/scopes) of the decoded JWT. This claim is part of the payload and it is a space-separated list of strings. - -::: note -See the implementation in [Node.js](/architecture-scenarios/application/spa-api/api-implementation-nodejs#3-check-the-client-permissions) -::: - -### Determine user identity - -For both endpoints (retrieving the list of timesheets, and adding a new timesheet) we will need to determine the identity of the user. - -For retrieving the list of timesheets this is to ensure that we only return the timesheets belonging to the user making the request, and for adding a new timesheet this is to ensure that the timesheet is associated with the user making the request. - -One of the standard JWT claims is the `sub` claim which identifies the principal that is the subject to the claim. In the case of the Implicit Grant flow this claim will contain the user's identity, which will be the unique identifier for the Auth0 user. You can use this to associate any information in external systems with a particular user. - -You can also use a custom claim to add another attribute of the user - such as their email address - to the `access_token` and use that to uniquely identify the user. - -::: note -See the implementation in [Node.js](/architecture-scenarios/application/spa-api/api-implementation-nodejs#4-determine-the-user-identity) -::: - -## Implement the SPA - -In this section we will see how we can implement a SPA for our scenario. - -### Authorize the user - -To authorize the user we will be using the [auth0.js library](/libraries/auth0js). You can initialize a new instance of the Auth0 application as follows: - -```js -var auth0 = new auth0.WebAuth({ - clientID: '${account.clientId}', - domain: '${account.namespace}', - responseType: 'token id_token', - audience: 'YOUR_API_IDENTIFIER', - redirectUri: '${account.callback}', - scope: 'openid profile read:timesheets create:timesheets' -}); -``` - -You need to pass the following configuration values: - -- __clientID__:The value of your Auth0 Client Id. You can retrieve it from the Settings of your Application at the [Dashboard](${manage_url}/#/applications}). -- __domain__: The value of your Auth0 Domain. You can retrieve it from the Settings of your Application at the [Dashboard](${manage_url}/#/applications}). -- __responseType__: Indicates the Authentication Flow to use. For a SPA which uses the __Implicit Flow__, this should be set to `token id_token`. The `token` part, triggers the flow to return an `access_token` in the URL fragment, while the `id_token` part, triggers the flow to return an `id_token` as well. -- __audience__: The value of your API Identifier. You can retrieve it from the [Settings of your API](${manage_url}/#/apis}) at the Dashboard. -- __redirectUri__: The URL to which Auth0 should redirect to after the user has authenticated. -- __scope__: The [scopes](/scopes) which determine the information to be returned in the `id_token` and `access_token`. A scope of `openid profile` will return all the user profile information in the `id_token`. You also need to request the scopes required to call the API, in this case the `read:timesheets create:timesheets` scopes. This will ensure that the `access_token` has these scopes. - -To initiate the authentication flow you can call the `authorize()` method: - -```js -auth0.authorize(); -``` - -After the authentication, Auth0 will redirect back to the __redirectUri__ you specified when configuring the new instance of the Auth0 application. At this point you will need to call the `parseHash()` method which parses a URL hash fragment to extract the result of an Auth0 authentication response. - -The contents of the authResult object returned by parseHash depend upon which authentication parameters were used. It may include the following: - -- __idToken__: An `id_token` JWT containing user profile information -- __accessToken__: An `access_token` for the API, specified by the __audience__. -- __expiresIn__: A string containing the expiration time (in seconds) of the `access_token`. - -You also need to store the tokens returned by the authentication result in local storage to keep track of the fact that the user is logged in. You can also subsequently retrieve the `access_token` from local storage when calling your API. - -```js -this.auth0.parseHash((err, authResult) => { - if (authResult && authResult.accessToken && authResult.idToken) { - window.location.hash = ''; - // Store the authResult in local storage and redirect the user elsewhere - localStorage.setItem('access_token', authResult.accessToken); - localStorage.setItem('id_token', authResult.idToken); - } else if (err) { - // Handle authentication error, for example by displaying a notification to the user - } -}); -``` - -::: note -See the implementation in [Angular 2](/architecture-scenarios/application/spa-api/spa-implementation-angular2#2-authorize-the-user) -::: - -### Get the User Profile - -::: panel Extract info from the token -This section shows how to retrieve the user info using the `access_token` and the [/userinfo endpoint](/api/authentication#get-user-info). To avoid this API call, you can just decode the `id_token` [using a library](https://jwt.io/#libraries-io) (make sure you validate it first). If you need additional user information consider using [our Management API](/api/management/v2#!/Users/get_users_by_id) from your backend. -::: - -The `client.userInfo` method can be called passing the returned `authResult.accessToken` in order to retrieve the user's profile information. It will make a request to the [/userinfo endpoint](/api/authentication#get-user-info) and return the `user` object, which contains the user's information, similar to the example below: - -```json -{ - "email_verified": "false", - "email": "test@example.com", - "clientID": "AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHH", - "updated_at": "2017-02-07T20:50:33.563Z", - "name": "tester9@example.com", - "picture": "https://gravatar.com/avatar/example.png", - "user_id": "auth0|123456789012345678901234", - "nickname": "tester9", - "created_at": "2017-01-20T20:06:05.008Z", - "sub": "auth0|123456789012345678901234" -} -``` - -You can access any of these properties in the callback function passed when calling the `userInfo` function: - -```js -const accessToken = localStorage.getItem('access_token'); - -auth0.client.userInfo(accessToken, (err, profile) => { - if (profile) { - // Get the user’s nickname and profile image - var nickname = profile.nickname; - var picture = profile.picture; - } -}); -``` - -::: note -See the implementation in [Angular 2](/architecture-scenarios/application/spa-api/spa-implementation-angular2#3-get-the-user-profile) -::: - -### Display UI Elements Conditionally Based on Scope - -Based on the `scope` of the user, you may want to show or hide certain UI elements. To determine the scope issued to a user, you will need to store the scope which was initially requested during the authorization process. When a user is authorized, the `scope` will also be returned in the `authResult`. - -If the `scope` in the `authResult` is empty, then all the scopes which was requested was granted. If the `scope` in the `authResult` is not empty, it means a different set of scopes were granted, and you should use the ones in `authResult.scope`. - -::: note -See the implementation in [Angular 2](/architecture-scenarios/application/spa-api/spa-implementation-angular2#4-display-ui-elements-conditionally-based-on-scope) -::: - -### Call the API - -To access secured resources from your API, the authenticated user's `access_token` needs to be included in requests that are sent to it. This is accomplished by sending the `access_token` in an `Authorization` header using the `Bearer` scheme. - -::: note -See the implementation in [Angular 2](/architecture-scenarios/application/spa-api/spa-implementation-angular2#5-call-the-api) -::: - -### Renew the Access Token - -As a security measure, it is recommended that the lifetime of a user's `access_token` be kept short. When you create an API in the Auth0 dashboard, the default lifetime is `7200` seconds (2 hours), but this can be controlled on a per-API basis. - -Once expired, an `access_token` can no longer be used to access an API. In order to obtain access again, a new `access_token` needs to be obtained. - -Obtaining a new `access_token` can be done by repeating the authentication flow, used to obtain the initial `access_token`. In a SPA this is not ideal, as you may not want to redirect the user away from their current task to complete the authentication flow again. - -In cases like this you can make use of [Silent Authentication](/api-auth/tutorials/silent-authentication). Silent authentication lets you perform an authentication flow where Auth0 will only reply with redirects, and never with a login page. This does however require that the user was already logged in via [SSO (Single Sign-On)](/sso). - -::: note -See the implementation in [Angular 2](/architecture-scenarios/application/spa-api/spa-implementation-angular2#6-renew-the-access-token) -::: - -<%= include('./_stepnav', { - prev: ["2. Auth0 Configuration", "/architecture-scenarios/application/spa-api/part-2"], next: ["Conclusion", "/architecture-scenarios/application/spa-api/part-4"] -}) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/application/spa-api/part-4.md b/articles/architecture-scenarios/application/spa-api/part-4.md deleted file mode 100644 index 1bd0228d29..0000000000 --- a/articles/architecture-scenarios/application/spa-api/part-4.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -description: Conclusion for the SPA + API architecture scenario -toc: true ---- - -# SPA + API: Conclusion - -In this document we covered a simple scenario involving an API used by a Single Page Application (SPA) to allow employees to capture their timesheets. - -We learned about the Implicit Grant, what an Access Token is, how to configure an API in Auth0, how to configure a SPA application to communicate securely with this API, how to define and secure our API endpoints, how to use the provided libraries to validate the Access Token and how to retrieve a new one from Auth0. - -We started by describing the business case and the requirements and went on explaining how each requirement can be met and the thought process behind each choice that was made. - -We used Node.js for the API implementation and Angular for the SPA. Hopefully though after going through this document you are able to build this using the technologies you prefer. - -<%= include('./_stepnav', { - prev: ["3. API + SPA Implementation", "/architecture-scenarios/application/spa-api/part-3"] -}) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/application/web-app-sso/index.md b/articles/architecture-scenarios/application/web-app-sso/index.md deleted file mode 100644 index 4bca57ee11..0000000000 --- a/articles/architecture-scenarios/application/web-app-sso/index.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -order: 01 -title: Single Sign-On for Regular Web Apps -image: /media/articles/architecture-scenarios/web-oidc.png -extract: Traditional web application which needs to authenticate users using OpenID Connect. -description: Regular web app scenario which needs to authenticate users using OpenID Connect. -toc: true ---- - -# Single Sign-On for Regular Web Apps - -In this scenario, we will build a web application for a fictitious company named ExampleCo. The app is meant to be used by ExampleCo's employees and contractors. Employees will use their existing corporate directory (Active Directory), while contractors will be managed in a separate user store. - -::: panel TL;DR -* Auth0 supports open standards such as OAuth 2.0 and OpenID Connect (OIDC) for authentication and authorization (see [Which protocol to use](/architecture-scenarios/application/web-app-sso/part-1#which-protocol-to-use)) -* OIDC supports several different authorization flows - the most appropriate one for Web Applications being the Authorization Code Flow (see [Authentication Flow](/architecture-scenarios/application/web-app-sso/part-1#authentication-flow)) -* Your application will be configured in Auth0 as an application (see [Application](/architecture-scenarios/application/web-app-sso/part-2#application)) -* Identity Providers will be configured in Auth0 as a Connection (see [Connections](/architecture-scenarios/application/web-app-sso/part-2#connections)) -* Auth0 provides a Lock widget, which allow users to log in to the application (see [User Login](/architecture-scenarios/application/web-app-sso/part-3#user-login)) -* The web application needs to manage session state to keep track of the fact that the user is logged in. Along with this, Auth0 and the Identity Provider is also managing session information. (see [Session Management](/architecture-scenarios/application/web-app-sso/part-3#session-management)) -* Conversely, logging a user out also involves three layers of session management (see [User Logout](/architecture-scenarios/application/web-app-sso/part-3#user-logout)) -* Access Control can be managed with the Auth0 Authorization Extension (see [Access Control](/architecture-scenarios/application/web-app-sso/part-3#access-control)) -::: - -::: note -By _Regular Web App_, we mean an app that uses primarily server side, page `GET`, `POST`, and cookies for maintaining state. This is contrast with a Web _SPA_ (Single Page App), that heavily relies on client side JavaScript code calling an API. -::: - -## The Premise - -ExampleCo is a consulting startup company. Currently they have approximately 100 employees and they also outsource several activities to external contractors. Most of the employees work from the company's main office, but there are some teams that work remotely. Additionally, some employees frequently travel to customer locations and work from mobile devices. - -All employees and external contractors are required to fill in their timesheets every week using spreadsheets. The current system is inefficient and the company decided that they need to move to a better and more automated solution. - -The company evaluated several of the available timesheets application and concluded that it would be more cost-effective to build their own in-house solution, since they are looking for a very simple application at the moment. The app will be built using ASP.NET Core, since their developers are already using this technology and they can have the app ready in a week or so. - -### Goals & Requirements - -ExampleCo wants to launch the new solution quickly so they chose to start simple and build into it as they gather feedback from their employees. - -The application should be available to logged in users only. Each user will have a role, and based on this role, they should be able to perform certain actions and view specific data. - -::: panel Authentication vs Authorization -ExampleCo wants to __authenticate__ and __authorize__ each user. Authentication has to do with identity: verifying that the user is indeed who they claim to be. Authorization is about deciding which resources a user should have access to, and what they should be allowed to do with those resources. -::: - -ExampleCo's timesheets app needs to support two roles: _User_ and _Admin_: -- Someone with the User role can add timesheet entries, by specifying the date, the application and the hours worked. The Admin role also has this same right. -- Those with the User role should have access only to their own timesheets entries. -- Someone with the Admin role can additionally: - - Approve or reject timesheet entries of other users. - - Edit the application drop-down list of values (add, edit, delete). - -Each user will be required to fill in their timesheets by the end of the week. They can either choose to register daily their timesheets or add the entries for the whole week together. The timesheets will have to be reviewed and approved by an Admin. The rejected entries will have to be updated by each employee and re-submitted for approval. - -The company uses Active Directory for all employees and employees will sign into the Timesheet application using their Active Directory credentials. The external contractors can sign in with a username and password. Contractors are not on ExampleCo's corporate directory. - -ExampleCo wants to minimize user login burden, but wants to maintain a level of security depending on the operation: submitting timesheet entries is lower risk than approving them. However the approved timesheets are used for customer charging so security is definitely a requirement. The authentication strategy should be flexible so it can adapt as the company grows. For example, they should easily be able to add additional authentication requirements, like multifactor authentication, for Admins. - -The solution should be available both to the employees with a physical presence in the company office, as well as to those working remotely, without the overhead of a VPN connection, hence the app should be deployed on a cloud provider like Heroku or Microsoft Azure. - -![Diagram of the solution](/media/articles/architecture-scenarios/web-app-sso/solution-diagram.png) - -<%= include('./_stepnav', { - next: ["1. Solution Overview", "/architecture-scenarios/application/web-app-sso/part-1"] -}) %> diff --git a/articles/architecture-scenarios/application/web-app-sso/part-1.md b/articles/architecture-scenarios/application/web-app-sso/part-1.md deleted file mode 100644 index 7671d8390c..0000000000 --- a/articles/architecture-scenarios/application/web-app-sso/part-1.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -description: Regular web app scenario solution overview -toc: true ---- - -# SSO for Regular Web Apps: Solution Overview - -In this section, we'll cover the solution we're implementing, including details on identity management, protocols to use, and the authentication flow required. - -## Identity Management - -ExampleCo decided to use Auth0 as their Identity as a Service (IDaaS) provider. The reasoning behind this decision was that the company did not want to commit resources on training, implementation and maintenance of identity and access management. Furthermore, the company plans on building into this solution in the future, possibly adding a mobile native app and an API to push approved timesheets to their internal systems. Auth0 provides the flexibility to incorporate such changes in their architecture with minimum effort. - -::: note -Identity-as-Service ("IDaaS") is a cloud-based service for identity and access management. The offered services often include SSO, federated identity, password management, and more. -::: - -## Which protocol to use - -The next decision has to do with which protocol to use, OAuth 2.0 with OpenID Connect (OIDC) or SAML. - -::: note -Auth0 implements proven, common and popular identity protocols, both for consumer oriented web products (OAuth 2.0, OAuth 1.0, OpenID) and for enterprise deployments (SAML, WS-Federation, LDAP). You have complete freedom to use the one that best meets your business needs. -::: - -__OpenID Connect__ is an authentication protocol, based on the OAuth 2.0 family of specifications. It uses simple JSON identity tokens (JWT) delivered via the OAuth 2.0 protocol. - -::: panel OAuth vs OpenID Connect (OIDC) -OAuth 2.0 and OpenID Connect (OIDC) are often mistaken for the same thing, but this is not exact. -__OAuth 2.0__ is a protocol that lets you authorize one website (the consumer or application) to access your data from another website (the resource server or provider). For example, you want to authorize a website to access some files from your Dropbox account. The website will redirect you to Dropbox which will ask you whether it should provide access to your files. If you agree the website will be authorized to access your files from Dropbox. At the core, OAuth 2.0 is about resource access and sharing. -__OpenID Connect__, on the other hand, is a simple identity layer built on top of the OAuth 2.0 protocol. It gives you one login for multiple sites. Each time you need to log in to a website using OIDC, you are redirected to your OpenID site where you login, and then taken back to the website. At the core, OIDC is concerned with user authentication. -::: - -__SAML__ is an XML-based protocol, that provides both authentication and authorization between trusted parties. - -Compared to SAML, OpenID Connect is lighter weight and simpler to deal with. SAML is proven, powerful and flexible, but for the requirements of this app, that flexibility and power is not required. Identity federation (one of the most compelling reasons for adopting SAML) is not required here either, And if it ever became a requirement, it can be easily handled by Auth0, in the same way it deals with AD (that uses LDAP). - -For these reasons, ExampleCo will use OpenID Connect for their implementation. - -## Authentication Flow - -OpenID Connect supports more than one flow for authentication. Since our scenario involves a regular web app we will use the __Authorization Code Flow__. - -The flow goes as follows: -1. The web app (called the __Client__ in OIDC terms) initiates the authentication request by redirecting the __user-agent__ (browser) to Auth0 (the __Authorization Server__ in OIDC terms). -1. Auth0 authenticates the user (via the user-agent). The first time the user goes through this flow a consent page will be shown where the permissions that will be given to the Application are listed (for example, post messages, list contacts). The user logs in to the service (unless they are already logged in) and authorizes the application access. -1. Assuming the user grants access, Auth0 redirects the __user-agent__ back to the __Application__, along with an _authorization code_ in the querystring. -1. The Application sends the _authorization code_ to Auth0, along with the application credentials (`client_id` and `client_secret`), and asks for a token. -1. Auth0 authenticates the __Application__ (using the `client_id` and `client_secret`) and validates the _authorization code_. If valid, Auth0 responds back with an __ID Token__. - -![Diagram of the Authorization Code Flow](/media/articles/architecture-scenarios/web-app-sso/authz-code-flow.png) - -::: panel Form Post Response Mode -Another option is to use the __OAuth 2.0 Form Post Response Mode__ with `response_type=id_token&response_mode=form_post`. Due to the `response_type=id_token` request parameter, the response contains the `id_token` directly, instead of the authorization code, while the `response_mode=form_post` encodes the `id_token` with the rest of the Authorization Response parameters as HTML form values that are auto-submitted in the User Agent. This way you can have an optimized authentication flow (no need to exchange the code for an `id_token`), however you have to make sure that it is supported by the technology you are using to implement your app (ASP .NET Core middleware does support it). For more details refer to the [OAuth 2.0 Form Post Response Mode specification](https://openid.net/specs/oauth-v2-form-post-response-mode-1_0.html). -::: - -The __ID Token__ (usually referred to as `id_token`) is a __JSON Web Token (JWT)__ that contains identity data. It is consumed by the application and used to get user information like the user's name, email, and so forth, typically used for UI display. - -::: panel More on tokens -Tokens are alphanumeric strings used in token-based authentication. They allow users to authenticate with a username and password once and get a token in return which they can use from that point on. They have a limited lifetime duration. - -__JSON Web Tokens (JWTs)__ are tokens that conform to the [JSON Web Token Standard](https://tools.ietf.org/html/rfc7519) and contain information about an identity in the form of claims. They are self-contained in that it is not necessary for the recipient to call a server to validate the token. JWTs can be signed using a secret (with the __HMAC__ algorithm) or a public/private key pair using __RSA__. You can find more information on JWT [here](/jwt). - -The ID Token, which is a JWT, conforms to an industry standard (IETF [RFC 7519](https://tools.ietf.org/html/rfc7519)) and contains three parts: A header, a body and a signature. -- The header contains the type of token and the hash algorithm used on the contents of the token. -- The body, also called the payload, contains identity claims about a user. There are some claims with registered names, for things like the issuer of the token, the subject of the token (who the claims are about), and the time of issuance. Any number of additional claims with other names can be added, though care must be taken to keep the JWT within the browser size limitations for URLs. -- The signature is used by the recipient of a JWT to validate the integrity of the information conveyed in the JWT. -::: - -### How to validate an ID Token - -The validation of an ID Token requires several steps: -1. If the ID Token is encrypted, decrypt it using the keys and algorithms that the Application specified. -1. The Issuer Identifier for the OpenID Provider must match the value of the `iss` (issuer) claim. -1. The `aud` (audience) claim should contain the Application's `client_id` value. The ID Token must be rejected if the ID Token does not list the Application as a valid audience, or if it contains additional audiences not trusted by the Application. -1. If the ID Token contains multiple audiences, the Application should verify that an `azp` claim is present. -1. If an `azp` (authorized party) claim is present, the Application should verify that its `client_id` is the claim value. -1. The Application must validate the signature of ID Tokens according to JWS using the algorithm specified in the JWT `alg` header parameter. The Application must use the keys provided by the Issuer. -1. The `alg` value should be the default of `RS256` or the algorithm sent by the Application in the `id_token_signed_response_alg` parameter during registration. -1. If the JWT `alg` header parameter uses a MAC based algorithm such as `HS256`, `HS384`, or `HS512`, the octets of the UTF-8 representation of the client_secret corresponding to the `client_id` contained in the `aud` (audience) claim are used as the key to validate the signature. For MAC based algorithms, the behavior is unspecified if the `aud` is multi-valued or if an `azp` value is present that is different than the `aud` value. -1. The current time must be before the time represented by the `exp` claim. -1. The `iat` claim can be used to reject tokens that were issued too far away from the current time, limiting the amount of time that nonces need to be stored to prevent attacks. The acceptable range is Application specific. -1. If a `nonce` value was sent in the Authentication Request, a `nonce` claim must be present and its value checked to verify that it is the same value as the one that was sent in the Authentication Request. The Application should check the `nonce` value for replay attacks. The precise method for detecting replay attacks is Application specific. -1. If the `acr` claim was requested, the Application should check that the asserted claim value is appropriate. -1. If the `auth_time` claim was requested, either through a specific request for this claim or by using the `max_age` parameter, the Application should check the `auth_time` claim value and request re-authentication if it determines too much time has elapsed since the last End-User authentication. - -::: note -If you store ID Tokens on your server, you must do so securely. -::: - -<%= include('./_stepnav', { - prev: ["Introduction", "/architecture-scenarios/application/web-app-sso"], - next: ["2. Auth0 Configuration", "/architecture-scenarios/application/web-app-sso/part-2"] -}) %> diff --git a/articles/architecture-scenarios/application/web-app-sso/part-2.md b/articles/architecture-scenarios/application/web-app-sso/part-2.md deleted file mode 100644 index dc3f22ffe8..0000000000 --- a/articles/architecture-scenarios/application/web-app-sso/part-2.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -description: Regular web app scenario configuration for Auth0 -toc: true ---- -# SSO for Regular Web Apps: Auth0 Configuration - -In this section we will review all the configurations we need to apply using the [Auth0 Dashboard](${manage_url}). - -## Application - -The Auth0 configuration part starts with registering the timesheets app at the Auth0 dashboard as an __application__. An application is making protected resource requests on behalf of the resource owner (end-user). - -::: note -The term "application" does not imply any particular implementation characteristics. An application can be a web app, a mobile app or an SPA. In the case of ExampleCo it is a ASP.NET Core web app. -::: - -The main characteristics of an application in Auth0 are: -- __Name__: The canonical name of the application. This is used to identify the application at the portal, emails, logs, and more. -- __Client ID__ (read-only): The unique identifier for the application. This is the ID used in the application when setting up authentication with Auth0. It is an auto-generated alphanumeric string. -- __Client secret__ (read-only): A string used to sign and validate tokens which will be used in the different authentication flows. It is auto-generated and it must be kept confidential. -- __Domain__: The domain name assigned to the Auth0 account. The format of the domain is `{account-name}.auth0.com` or `{account-name}.{location}.auth0.com`, for example `ExampleCo.auth0.com`. -- __Callback URL__: The URL where the user is redirected after they authenticate. - -### Create an Application - -ExampleCo's scenario involves only one application: the timesheets web app. Hence we have to configure one Application at Auth0 side. - -To register a database connection, go to the [dashboard](${manage_url}) and in the side navigation select [Applications](${manage_url}/#/applications). - -Click on the button __+ Create Application__. You will be prompted for the name and the type of the application. We will name our application `Timesheet-App` and select `Regular Web Applications` as the application type. - -![Create Application Dialog Box](/media/articles/architecture-scenarios/web-app-sso/new-client.png) - -When you click __Create__ you will be navigated to the [Quick Start view](${manage_url}/#/applications/${account.clientId}/quickstart). Here you can pick the technology you plan on using to build your app and the relevant how-to quickstart will be displayed. - -The other available views are: -- [Settings](${manage_url}/#/applications/${account.clientId}/settings): Here you can view and update the settings of your application. This is the page you will use to retrieve information like _Domain_, _Client ID_, and _Client Secret_. In this page you will also have to [set the __Callback URL__ for your application](#configure-callback-urls). -- [Addons](${manage_url}/#/applications/${account.clientId}/addons): Addons are plugins associated with an application in Auth0. Usually, they are third party APIs used by the application that Auth0 generates Access Tokens for (for example Salesforce, Azure Service Bus, Azure Mobile Services, SAP, and so forth). We will not use any Addons in this scenario. -- [Connections](${manage_url}/#/applications/${account.clientId}/connections): Connections are sources of users. We will use this view shortly to enable specific connections for our application. - -### Configure Callback URLs - -The __Allowed Callback URLs__ field contains the URL(s) where Auth0 will redirect to after the user has authenticated in order for the OpenID Connect to complete the authentication process. You can specify multiple valid URLs by comma-separating them. You can use the star symbol as a wildcard for subdomains, for example `*.google.com`. Make sure to specify the protocol, `http://` or `https://`, otherwise the callback may fail in some cases. - -The Callback URL for our sample project is `http://localhost:5000/signin-auth0`. Go ahead and set this value to the __Allowed Callback URLs__ field if you plan on using our sample, otherwise add the URL you chose to deploy your application to. - -## Connections - -The next step is to configure the identity providers that will be used for authentication at the web app. Each identity provides maps to a __connection__ in Auth0. Each application needs at least one connection, and each connection can be used for more than one application. - -ExampleCo needs to configure two connections: one Active Directory connection for the internal employees, and one Database connection for external parties. - -::: panel Supported identity providers -Auth0 supports a vast variety of protocols and identity providers: -- Social: Allow your users to log in using Google, Facebook, LinkedIn, Github, and many more. -- Enterprise: Allow your users to log in using Active Directory, ADFS, LDAP, SAML-P, and many more. -- Database connections: Create your own user store by configuring a new database connection, and authenticate your users using email/username and password. The credentials can be securely stored either in the Auth0 user store, or in your own database. -- Passwordless authentication: Allow your users to login without the need to remember a password and use an authentication channel like SMS or e-mail. -::: - -### Create a database connection - -To register a database connection, go to the [dashboard](${manage_url}) and in the side navigation select [Connections > Database](${manage_url}/#/connections/database). - -Click on the button __+ Create DB Connection__. You will be prompted for the name of the connection. We will name our connection `Timesheet-Users`. - -![Create DB Connection Dialog Box](/media/articles/architecture-scenarios/web-app-sso/new-db-conn.png) - -When you click __Save__ you will be navigated to the _Settings_ page for the new connection. Ensure that you enable your application to use this connection at the _Applications Using This Connection_ section. - -![Enable the application to use this DB connection](/media/articles/architecture-scenarios/web-app-sso/enable-client-db.png) - -For more information on database connections refer to [Database Identity Providers](/connections/database). - -### Create an Active Directory / LDAP Connection - -Next you need to configure your Active Directory / LDAP connection. Go to the [Auth0 dashboard](${manage_url}) and in the side navigation select the [Connections > Enterprise](${manage_url}/#/connections/enterprise)). - -There you need to create the AD / LDAP connection and install the AD Connector. You can find details in these documents: -- [How to connect your Active Directory with Auth0](/connections/enterprise/active-directory) -- [How to install the Active Directory/LDAP Connector](/connector) - -::: note -The AD/LDAP Connector, is a bridge between your Active Directory and the Auth0 Service. This bridge is necessary because AD is typically locked down to your internal network, and Auth0 is a cloud service running on a completely different context. -[More information](/connector/overview) -::: - -Once you have configured the connection and the connector, be sure to enable your application to use this AD / LDAP connection: - -![Enable the application to use this AD connection](/media/articles/architecture-scenarios/web-app-sso/enable-client-ad.png) - -::: panel Kerberos support -The AD/LDAP connector supports Kerberos to make it easer for your users to authenticate when they are on a domain-joined machine within the corporate network. To activate Kerberos on an Active Directory you have to simply enable the option in the dashboard. After enabling Kerberos you'll also be able to configure the __IP Ranges__. When users originate from these IP address ranges this information will be exposed in the SSO endpoint which means client-side SDKs like auth0.js and the Lock will be able to detect Kerberos support and allow Integrated Windows Authentication. -[More information](/connector/kerberos) - -::: note -If you enable Kerberos then you need to make some changes to the AD/LDAP's configuration file. For details refer to: [Modify the AD/LDAP Connector Settings](/connector/modify). -::: - -Now that we have designed our solution and discussed the configurations needed on Auth0 side, we can proceed with integrating Auth0 with our timesheets web app. That's what the next paragraph is all about, so keep reading! - -<%= include('./_stepnav', { - prev: ["1. Solution Overview", "/architecture-scenarios/application/web-app-sso/part-1"], - next: ["3. Application Implementation", "/architecture-scenarios/application/web-app-sso/part-3"] -}) %> diff --git a/articles/architecture-scenarios/application/web-app-sso/part-3.md b/articles/architecture-scenarios/application/web-app-sso/part-3.md deleted file mode 100644 index 52afc1b4f7..0000000000 --- a/articles/architecture-scenarios/application/web-app-sso/part-3.md +++ /dev/null @@ -1,171 +0,0 @@ ---- -description: Regular web app scenario application implementation -toc: true ---- -# SSO for Regular Web Apps: Application Implementation - -Let's walk through the implementation of our regular web application. We used ASP .NET Core for the implementation, you can find the code in [this GitHub repository](https://github.com/auth0-samples/auth0-pnp-webapp-oidc). - -The sample contains an application which uses Active Directory integration to authenticate company employees and an Auth0 database connection for external contractors. Authorization is implemented using rules and claims as we will see in detail in this paragraph. - -## User Login - -Auth0 provides a Lock widget which serves as a login component for your application, meaning that you do not have to implement your own login screen. The Lock widget seamlessly integrates with all of the connections you configure inside your Auth0 dashboard, whether they be database, social or enterprise connections. - -There are a number of different ways in which you can implement a Login screen using a web application and Auth0: -- __Hosted Lock__: Use an instance of the Lock widget which is hosted on the Auth0 infrastructure. -- __Embedded Lock__: Embed the Lock widget inside a web page of your application. You have some customization options for the actual Lock widget, and full control over the rest of the HTML on the page. -- __Custom UI__: Develop a completely custom web page for the login screen. The custom HTML form will post back to your server which will in turn authenticate the user using the Authentication API. For more information on when to use a Custom UI refer to [Lock vs. a Custom UI](/libraries/when-to-use-lock). - -The recommended best practice is to use Hosted Lock because it is the most secure option and the easiest way to enable users to log in to your application. - -### Automate Home Realm Discovery (HRD) - -By default, Lock will display all the connections available for login. Selecting the appropriate Identity Providers from multiple options is called _Home Realm Discovery (HRD)_. In our case the options are either authenticating with Active Directory (for company employees) or using email/password for our database connection (external contractors). - -You may however want to avoid that first step, where the user needs to choose the Identity Provider (IdP), and have the system identify it instead of asking every time. Lock offers you the following options: - -- __Identify the IdP programatically__: When you initiate an authentication transaction with Auth0 you can optionally send a `connection` parameter. This value maps directly with any connection defined in your dashboard. When using the Hosted version of Lock by calling the [`/authorize`](/api/authentication/reference#database-ad-ldap-passive-) endpoint, you can pass along a `connection` query string parameter containing the name of the connection. Alternatively, if you are using Embedded Lock, this is as simple as writing `auth0.show({connections: ['YOUR_CONNECTION']});`. - - There are multiple practical ways of getting the `connection` value. One of them is to use __vanity URLs__: for example, company employees will use `https://internal.yoursite.com`, while external contractors will use `https://external.yoursite.com`. - -- __Use email domains__: Lock can use email domains as a way of routing authentication requests. Enterprise connections in Auth0 can be mapped to `domains`. If a connection has this setup, then the password textbox gets disabled automatically when typing an e-mail with a mapped domain. Note that you can associate multiple domains to a single connection. - -For additional information on this topic refer to: [Selecting the connection in Auth0 for multiple login options](/libraries/lock/v10/selecting-the-connection-for-multiple-logins). - -## Session Management - -When talking about managing sessions, there are typically three layers of sessions we need to consider: - -- __Application Session__: The first is the session inside the application. Even though your application uses Auth0 to authenticate users, you will still need to keep track of the fact that the user has logged in to your application. In a normal web application this is achieved by storing information inside a cookie. -- __Auth0 session__: Next, Auth0 will also keep a session and store the user's information inside a cookie. Next time when a user is redirected to the Auth0 Lock screen, the user's information will be remembered. -- __Identity Provider session__: The last layer is the Identity Provider, for example Facebook or Google. When you allow users to sign in with any of these providers, and they are already signed into the provider, they will not be prompted to sign in. They may simply be required to give permissions to share their information with Auth0 and in turn your application. - -When developing a web application, you will therefore need to keep track of the fact that the user has logged in to your Web application. You can do this by making use of a cookie-based session to keep track of the fact that the user has signed in, and also store any of the user related information or tokens. - -::: panel How do I control the duration of the user's local application session? Can I drive that from Auth0? -The web app has full control over the user's local application session. How this is done usually depends on the web stack being used (for example, ASP.NET). Regardless, all approaches ultimately use one or more cookies to control the session. The developer can choose to use the expiration of the JWT `id_token` returned by Auth0 to control their session duration or ignore it completely. Some developers store the `id_token` itself in session state and end the user's session when it has expired. - -The reason why you would use the expiration of the token to determine the expiration of the local session is because it gives you centralized control of the duration of a user session from the Auth0 Dashboard. -::: - -The login flow is as follows: - -![Login Flow Diagram](/media/articles/architecture-scenarios/web-app-sso/login-flow.png) - -1. __Initiate OIDC Authentication Flow__: The user's browser will send a request to Auth0 to initiate the OIDC flow. -1. __Set SSO Cookie__: Auth0 will set a cookie to store the user's information. -1. __Code exchange and return ID Token__: Auth0 will make a request back to the web server and return the code. The web server will exchange the code for an ID Token. -1. __Set auth cookie and send response__: The web server will send a response back to the browser and set the application authentication cookie to store the user's session information. -1. __Auth cookie sent with every subsequent request__: The application authentication cookie will be sent on every subsequent request as proof that the user is authenticated. - -::: panel How does Auth0's SSO session impact the application's session? -Auth0 manages its own single-sign-on session. Applications can choose to honor or ignore that SSO session when it comes to maintaining their own local session. The Lock widget even has a special feature where it can detect if an Auth0 SSO session exists and ask the user if they wish to log in again as that same user. - -![Lock Widget SSO](/media/articles/architecture-scenarios/web-app-sso/sso-login.png) - -If they do so, they are signed in without having to re-enter their credentials with the actual IDP. Even though the user didn't authenticate, the application still performs an authentication flow with Auth0 and obtains a new `id_token`, which can be used to then manage the new local application session. -::: - -**See the implementation in [ASP.NET Core](/architecture-scenarios/application/web-app-sso/implementation-aspnetcore#configure-the-cookie-and-oidc-middleware)**. - -## User Logout - -When logging the user out, you will once again need to think about the three layers of sessions which we spoke about before: -- __Application Session__: You need to log out the user from your Web Application, by clearing their session. -- __Auth0 session__: You need to log out the user from Auth0. To do this you redirect the user to `https://${account.namespace}/v2/logout`. Redirecting the user to this URL clears all single sign-on cookies set by Auth0 for the user. -- __Identity Provider session__: Although this is not common practice, you can force the user to log out from the Identity Provider used, for example Facebook or Google. To do this add a `federated` querystring parameter to the logout URL: `https://${account.namespace}/v2/logout?federated`. - -To redirect a user after logout, add a `returnTo` querystring parameter with the target URL as the value: `https://${account.namespace}/v2/logout?returnTo=http://www.example.com`. Note, that you will need to add the `returnTo` URL as an __Allowed Logout URLs__. For more information on how to implement this refer to: [Logout](/logout). - -The logout flow (not including federated logout) is as follows: - -![Logout Flow Diagram](/media/articles/architecture-scenarios/web-app-sso/logout-flow.png) - -1. __Initiate Logout Flow__: The logout flow will be initiated from the browser, for example by the user clicking a _Logout_ link. A request will be made to the web server. -1. __Clear user’s local session__: The user's Application Session / Cookie will be cleared. -1. __Redirect browser to Auth0 Logout__: The user's browser will be redirected to the Auth0 Logout URL. -1. __Clear SSO Cookie__: Auth0 will clear the user's SSO Cookie. -1. __Redirect to post-logout URL__: Auth0 will return a redirect response and redirect the user's browser to the `returnTo` querystring parameter. - -**See the implementation in [ASP.NET Core](/architecture-scenarios/application/web-app-sso/implementation-aspnetcore#implement-the-logout)**. - -## Access Control - -Authorization refers to the process of determining what actions a user can perform inside your application. - -You can either implement authorization directly inside your application, independently of Auth0, or use one of the available ways to retrieve the user authorization levels, put them as authorization claims inside the `id_token` and validate these claims inside your application, once you retrieve the token, to control access. - -There are various ways in which you can retrieve and set the user authorization claims when using Auth0: -- By configuring and using the [Auth0 Authorization Extension](/extensions/authorization-extension). -- By using Active Directory groups. These can be used in combination with the Authorization Extension by mapping Active Directory Groups to Groups you define using the Authorization extension. -- Add metadata to the user's profile by making use of [rules](/rules#add-roles-to-a-user). -- By calling an external services from inside a [rule](/rules). - -Since in our case the company has already Active Directory set up, we will enforce access control using the Authorization Extension in combination with Active Directory groups. - -::: panel Authorization Extension -At this point in time the authorization extension is primarily designed to enforce coarse-grained authorization, for example to control access to an application based on a user's group membership. It is not necessarily designed to control fine-grained access (such as whether a user can perform a specific action inside the application), even though this is how we are utilizing it in this instance. -::: - -All users will implicitly be regular users, but timesheet administrators will be assigned to an `Admin` group which will allow them to approve timesheets. The Authorization Extension allows for mapping groups to existing group membership. - -All timesheet administrators will be assigned to the `Timesheet Administrators` group on Active Directory, which will be automatically mapped to the `Admin` group inside the Timesheet Application. - -When you install the Authorization Extension, it creates a rule in the background, which does the following: -1. Determine the user's group membership. -1. Store the user's group membership info as part of the `app_metadata`. -1. Add the user's group membership to the outgoing token. -1. Verify that the user has been granted access to the current application. - - -### Install the Authorization Extension - -To install the Authorization extension navigate to the [Extensions](${manage_url}/#/extensions) view of your Auth0 Dashboard, and select and install the Auth0 Authorization extension. - -![Install the Authorization Extension](/media/articles/architecture-scenarios/web-app-sso/install-authz-ext.png) - -Once installed, you will see the app listed under _Installed Extensions_. - -When you click on the link to open the extension for the first time, you will be prompted to provide permission for the extension to access your Auth0 account. If you do so, you will be redirected to the Authorization Dashboard. - -Once on the Authorization Dashboard, navigate to Groups in the navigation menu, and create a new group called `Admin`. - -![Create Admin Group](/media/articles/architecture-scenarios/web-app-sso/create-admin-group.png) - -After the group has been added you can click on the new group to go to the group management section. Go to the _Group Mappings_ tab and add a new group mapping which will map all Active Directory users in the `Timesheet Admins` groups to the `Admin` group you just created. - -![Add Admin Group Mapping](/media/articles/architecture-scenarios/web-app-sso/add-group-mapping.png) - -Once you click __Save__ you can see the new mapping listed. - -![View Admin Group Mapping](/media/articles/architecture-scenarios/web-app-sso/view-group-mapping.png) - -With the mapping configured you only need to maintain membership to the `Timesheet Admins` group in Active Directory, and those users will be automatically mapped to the `Admin` group inside our application. - -For more information refer to the [Authorization Extension documentation](/extensions/authorization-extension). - -### Enforce permissions in your application - -When you installed the Authorization Extension, it also created an Auth0 rule which will add an `authorization` claim with all the authorization related settings for a particular user. The groups for a user will be added as a sub-claim of the `authorization` claim called `groups` and all the groups a user belongs to will be added as an array to this claim. This is an example of what JSON payload of a ID Token may look like with the groups listed: - -```json -{ - "sub": "1234567890", - "name": "John Doe", - "authorization": { - "groups": ["Admin"] - } -} -``` - -In your application you will therefore need to decode the ID Token returned when a user is authenticated, and extract the groups which a user belongs to from the `authorization` claim. You can then store these groups, along with other user information inside the user's session, and subsequently query these to determine whether a user has permissions to perform a certain action based on their group membership. - -::: note -See the implementation in [ASP.NET Core](/architecture-scenarios/application/web-app-sso/implementation-aspnetcore#implement-admin-permissions). -::: - -<%= include('./_stepnav', { - prev: ["2. Auth0 Configuration", "/architecture-scenarios/application/web-app-sso/part-2"], - next: ["4. Conclusion", "/architecture-scenarios/application/web-app-sso/part-4"] -}) %> diff --git a/articles/architecture-scenarios/application/web-app-sso/part-4.md b/articles/architecture-scenarios/application/web-app-sso/part-4.md deleted file mode 100644 index b3c4be4d57..0000000000 --- a/articles/architecture-scenarios/application/web-app-sso/part-4.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -description: Regular web app scenario conclusion -toc: true ---- -# SSO for Regular Web Apps: Conclusion - -In this tutorial we covered a simple scenario: a regular web app, hosted in the cloud, using Auth0 for authentication, while utilizing the existing Active Directory user store. We learned what OpenID Connect offers and why it was preferable for this business case, how the Authentication Flow works, what an ID Token is and how to validate and manipulate it, how to configure applications and connections on Auth0 dashboard, how to implement user login and logout using Lock, and how session management and access control works. - -We started by describing the business case and the requirements and went on explaining how each requirement can be met and the thought process behind each choice that was made. - -We used ASP .NET Core for the sample web app implementation, hopefully though after going through this document you are able to build such a web app using the framework you prefer. - -<%= include('./_stepnav', { - prev: ["3. Application Implementation", "/architecture-scenarios/application/web-app-sso/part-3"] -}) %> diff --git a/articles/architecture-scenarios/application/web-saml.md b/articles/architecture-scenarios/application/web-saml.md deleted file mode 100644 index bfab970284..0000000000 --- a/articles/architecture-scenarios/application/web-saml.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -order: 05 -title: Regular Web App (using SAML) -image: /media/articles/architecture-scenarios/web-saml.png -extract: Traditional web application which needs to authenticate users using SAML2 -description: Explains the architecture scenario of using a traditional web application to authenticate users using SAML2. -beta: true ---- - -# Regular Web App (using SAML) - -::: note -This architecture scenario is under construction and will be updated soon. -::: - -![](/media/articles/architecture-scenarios/web-saml.png) - -In this scenario you have a traditional web application which needs to authenticate users using SAML2. The end result of the SAML flow after a user has successfully authenticated is a POST of the SAML Response (which contains SAML Assertions about the user) to a server-side endpoint (aka callback) in the Application. The Application therefore needs some SAML library that can process that response, validate the user, and create a local login session, which usually stored using one or more cookies. - -::: note -In this scenario an Access Token is also returned but it is rarely used since their is no API involved against which the user needs to be authenticated. -::: - -## Read More - -The following is a list of articles on this website which will help you to implement this scenario: - -* [Lock](/libraries/lock) -* [SAML](/saml-configuration) diff --git a/articles/architecture-scenarios/b2b-b2e.md b/articles/architecture-scenarios/b2b-b2e.md new file mode 100644 index 0000000000..590a1cea72 --- /dev/null +++ b/articles/architecture-scenarios/b2b-b2e.md @@ -0,0 +1,44 @@ +--- +order: 07 +title: Business to Business + Employees Identity Scenarios +image: /media/articles/architecture-scenarios/b2b-b2e.png +extract: This is essentially a hybrid between B2B and B2E where you have a larger SAAS application, like Zendesk for example, where users are grouped into companies. +description: Explains the architecture scenario of a hybrid between B2B and B2E where you have a larger SAAS application. +beta: true +topics: + - b2b + - b2e + - architecture + - lockjs + - saml + - active-directory + - social-connections +contentType: concept +useCase: + - invoke-api + - secure-an-api + - build-an-app +--- + +# Business to Business + Employees Identity Scenarios + +::: note +This architecture scenario is under construction and will be updated soon. +::: + +![](/media/articles/architecture-scenarios/b2b-b2e.png) + +This is essentially a hybrid between B2B and B2E for larger SAAS applications (such as Zendesk). In a situation like this, users would primarily be grouped into companies, but you may also have internal users (employees) who log into perform support or administrative tasks. Those internal users will typically use federated identity to authenticate. + +## Read More + +The following is a list of articles on this website which will help you to implement this scenario: + +* [Lock](https://auth0.com/lock) +* [Protocols supported by Auth0](/protocols) +* [Connect Active Directory with Auth0](/connections/enterprise/active-directory-ldap) +* [SAML](/saml-configuration) +* [Using Auth0 in SaaS, multi-tenant Apps](/saas-apps) +* [Identity Providers supported by Auth0](/identityproviders) +* [Social Login](https://auth0.com/learn/social-login/) +* [Auth0 SSO Dashboard (sample)](https://github.com/auth0-samples/auth0-sso-dashboard) diff --git a/articles/architecture-scenarios/b2b.md b/articles/architecture-scenarios/b2b.md new file mode 100644 index 0000000000..ec33e404f6 --- /dev/null +++ b/articles/architecture-scenarios/b2b.md @@ -0,0 +1,52 @@ +--- +url: /architecture-scenarios/b2b +classes: topic-page +title: Business to Business Identity and Access Management +description: Explains the architecture scenario B2B IAM with a SAAS application. +topics: + - b2b + - b2biam + - SDLC +contentType: index +useCase: + - implementation +--- + +

      +
      +

      Business to Business Identity and Access Management

      +

      + This guidance is relevant to all project stakeholders. We recommend reading it in its entirety at least once, even if you've already started your journey with Auth0. We provide a Project Planning Guide in PDF format, details about how to get started with each phase of the implementation process, and checklists to help you manage the tasks in each phase. +

      +
      + +<%= include('./_includes/_base-ways-to-integrate.md', { platform: 'b2b' }) %> + +## Project Planning Guide + +<%= include('./_includes/_planning.md', { platform: 'b2b' }) %> + +## Multiple Organization Architecture (Multitenancy) + +<%= include('./_includes/_multitenancy.md', { platform: 'b2b' }) %> + +## Get started + +<%= include('./_includes/_base-intro.md', { platform: 'b2b' }) %> + +<%= include('../_includes/_topic-links', { links: [ + 'architecture-scenarios/implementation/b2b/b2b-architecture', + 'architecture-scenarios/implementation/b2b/b2b-provisioning', + 'architecture-scenarios/implementation/b2b/b2b-authentication', + 'architecture-scenarios/implementation/b2b/b2b-branding', + 'architecture-scenarios/implementation/b2b/b2b-deployment', + 'architecture-scenarios/implementation/b2b/b2b-qa', + 'architecture-scenarios/implementation/b2b/b2b-profile-mgmt', + 'architecture-scenarios/implementation/b2b/b2b-authorization', + 'architecture-scenarios/implementation/b2b/b2b-logout', + 'architecture-scenarios/implementation/b2b/b2b-operations' +] }) %> + +## Implementation planning checklists + +<%= include('./_includes/_implementation-checklists.md') %> diff --git a/articles/architecture-scenarios/b2c.md b/articles/architecture-scenarios/b2c.md new file mode 100644 index 0000000000..f9e43afa16 --- /dev/null +++ b/articles/architecture-scenarios/b2c.md @@ -0,0 +1,49 @@ +--- +url: /architecture-scenarios/b2c +classes: topic-page +title: Business to Consumer Identity and Access Management +description: Explains the architecture scenario B2C IAM with an eCommerce or SAAS application. +topics: + - b2c + - CIAM + - SDLC +contentType: concept +useCase: + - implementation +--- + +
      +
      +

      Business to Consumer Identity and Access Management

      +

      + This guidance is relevant to all project stakeholders. We recommend reading it in its entirety at least once, even if you've already started your journey with Auth0. We provide a Project Planning Guide in PDF format, details about how to get started with each phase of the implementation process, and checklists to help you manage the tasks in each phase. +

      +
      + +<%= include('./_includes/_base-ways-to-integrate.md', { platform: 'b2c' }) %> + +## Project Planning Guide + +<%= include('./_includes/_planning.md', { platform: 'b2c' }) %> + +## Get started + +<%= include('./_includes/_base-intro.md', { platform: 'b2c' }) %> + +<%= include('../_includes/_topic-links', { links: [ + 'architecture-scenarios/implementation/b2c/b2c-architecture', + 'architecture-scenarios/implementation/b2c/b2c-provisioning', + 'architecture-scenarios/implementation/b2c/b2c-authentication', + 'architecture-scenarios/implementation/b2c/b2c-branding', + 'architecture-scenarios/implementation/b2c/b2c-deployment', + 'architecture-scenarios/implementation/b2c/b2c-qa', + 'architecture-scenarios/implementation/b2c/b2c-profile-mgmt', + 'architecture-scenarios/implementation/b2c/b2c-authorization', + 'architecture-scenarios/implementation/b2c/b2c-logout', + 'architecture-scenarios/implementation/b2c/b2c-operations', + 'architecture-scenarios/implementation/b2c/b2c-launch' +] }) %> + +## Implementation planning checklists + +<%= include('./_includes/_implementation-checklists.md') %> diff --git a/articles/architecture-scenarios/b2e.md b/articles/architecture-scenarios/b2e.md new file mode 100644 index 0000000000..a35f10a932 --- /dev/null +++ b/articles/architecture-scenarios/b2e.md @@ -0,0 +1,114 @@ +--- +order: 06 +title: Business to Employees Identity Scenarios +image: /media/articles/architecture-scenarios/b2e.png +extract: Large organization who wants to federate their existing enterprise directory service to allow employees to log in to applications using their existing enterprise credentials. +description: Explains the architecture scenario of B2E with a large organization that wants to extend their existing enterprise directory service. +topics: + - b2e + - architecture + - lockjs + - active-directory + - saml + - sso +contentType: concept +useCase: + - invoke-api + - secure-an-api + - build-an-app +--- + +# Business to Employees Identity Scenarios + +The B2E (Business to Employees) scenario involves applications that are used by employee users. These are applications that are targeted toward users who are typically acting on behalf of an organization such as an employer, a university, or a group in which they are a member, as opposed to acting on their own behalf. + +Such applications that are custom written by the organization may use the OIDC/OAuth protocol to externalize authentication whereas those that have been purchased will often use the SAML protocol. In either case, the enterprise will typically want to use some form of Enterprise connection, such as a SAML Identity Provider, ADFS, G Suite, Azure AD or a directory service such as AD or OpenLDAP, and less frequently, a custom DB, for authentication of enterprise users. + +For a business that is creating or integrating applications with Auth0 for a B2E environment, there are several requirements that are common for this scenario. This guide will summarize the most common requirements for B2E applications and explain the Auth0 features which help meet each need. + +## Enterprise providers + +Most businesses already have a corporate identity repository which has information on all the employee users and user profile information. It may also contain information on partners and contractors. A common requirement for the B2E scenario therefore, is to allow such users to log in via [Auth0 Enterprise connections](/connections/identity-providers-enterprise) such as SAML2 providers, ADFS, G Suite, Azure AD or an on-premise corporate directory service. This is attractive to users because it allows them to avoid creating yet another username and password for each application and instead leverage the same login credential across all their enterprise applications. + +This is especially attractive to security interests within the company because user credentials are only exposed to the identity stack instead of to each application. Furthermore, this architecture allows the business to retain control over access to applications because the enterprise identity provider provides a single shutoff point. If a user leaves the organization, administrators can simply disable the user’s account in the corporate identity provider and the user can no longer log in to any of the applications using that identity provider. + +Auth0 makes it easy to enable login via a wide variety of enterprise providers with just a few simple configuration steps. + +## Groups and roles + +With a lot of users, you may set up groups and roles to manage access and privileges. Often, these are stored and administered in a directory service. + +Auth0 can get user attributes, like groups and roles, from a directory service or enterprise identity provider during authentication. You can then make the attributes available through tokens returned to the application or with the Auth0 Management API. + +## Profile translation + +Sometimes a directory or identity provider returns attributes in one format, but your application uses another format. Using Auth0's [Rules](/rules/current/metadata-in-rules), you can [map and translate user profile attributes](https://auth0.com/rules/saml-attribute-mapping). You can even translate between OIDC/OAuth, SAML, WS-Fed, and LDAP. + +For example, you retrieve attributes in SAML assertion format from a SAML Identity Provider. With a rule you can then translate the attributes to custom claims in an ID Token for an OIDC/OAuth application. + +You can also map SAML attributes to the Auth0 user profile from the dashboard. To do this, go to [Connections > Enterprise > SAMLP Identity Provider](${manage_url}/#/connections/enterprise), select your SAML connection, and set your attribute mappings in the **Mappings** tab. + +## Extensibility with augmented user profiles + +You may want to enrich user profiles with attributes or data retrieved from other services. For example, you might receive an address or phone number and wish to translate that into a geographic region. [Auth0 Rules](/rules) enable you to write small snippets of code that execute during the authentication transaction. This lets you execute logic or call other services for user information, then add [user metadata](/users/concepts/overview-user-metadata) to the Auth0 user profile and optionally the resulting tokens sent to your applications. + +## Single Sign-on + +If you have several internal applications, you can set up [Single Sign-on (SSO)](/sso) across them so users only have to log in once. + +Auth0 supports integration with applications that externalize authentication using industry standard identity protocols: + +* OIDC/OAuth +* SAML2 +* WS-Fed + +After some configuration, all your applications can leverage your enterprise identity provider. In this setup, Auth0 is the broker between your applications and enterprise identity providers. + +Now when a user signs in to one application, they can access other applications integrated with Auth0 without having to log in again. This will be true until their SSO session expires. You should configure the SSO session length within Auth0 to meet security policies. + +## Single Sign-on integrations + +You can also integrate purchased applications with Auth0 for Single Sign-on (SSO). Auth0 provides [pre-built integrations](/integrations/sso) for applications such as: + +* Salesforce +* Zendesk +* Slack +* New Relic + +## Branding + +Branding is an important part of any application. Your logo, colors and styles should be consistent in all parts of the application. You can [customize](/libraries/custom-signup) the login, signup, and error pages displayed by Auth0 so it matches your application. Add your own logo, text, and colors. There's also I18N/L10N support for global rollouts. [Emails for verification or password resets](/email/templates) are customizable too. + +[Login screens](/libraries/lock/v11/ui-customization) should appear to come from your application’s branded domain name. To maintain consistency, you can define a [custom domain name](/custom-domains) for the login screen displayed by Auth0. + +## Multi-factor authentication + +Internal or employee applications often deal with sensitive content. [Multi-factor authentication (MFA)](/mfa) helps protect your data and applications. Auth0 provides a variety of ways to implement MFA. And for more flexibility, you can use Rules to turn it on only for the applications or user groups that need it. + +## Logs export + +Need to analyze logs or store them long-term? Auth0 provides extensions to [export logs to external tools](/logs) for analysis and retention. You can also retrieve log data with the Management API. + +## Audit + +Companies have many uses for logs data, one of which is audit reports. Auth0 captures a variety of data in log files, which may be useful for your audit reporting. The logs have information on authenticated users, the identity provider used, and when significant administrative changes are made in the Auth0 dashboard. + +Log events each have an event type. You can use event types as filters when querying log data with the Management API, or when exporting logs to log analysis tools. + +## Monitoring + +Monitoring the infrastructure and services that your applications depend on is critical. Auth0 provides an [Auth0 Status](https://status.auth0.com) page you can subscribe to. + +Auth0 makes every effort to minimize outages, but if there is any disruption to service, it will appear on the status page. To support requirements for root cause analysis documentation after a disruption, Auth0 conducts internal analysis and publishes the results on the disruption notice when the analysis is completed. + +## Anomaly Detection + +An unfortunate part of modern life on the internet is hackers. Hackers are constantly trying to find a way into applications. For example, they may try to log in using common passwords. Or they may use credentials stolen from elsewhere, hoping that users re-used the same passwords at other sites. + +Auth0's [Attack Protection](/attack-protection) detects these situations for Auth0 Database connections and provides options for how to respond. Turn on Attack Protection and configure the response options so you can respond appropriately if such an event occurs. + +## Github Deployment + +Do you manage a lot of your application code in Github? You can deploy code for rules, hooks, or custom database access from there with Auth0's [Github Deployment extension](/extensions/github-deploy). + +If you have a full continuous integration/continuous deployment pipeline, use the [Auth0 Deploy CLI tool](https://github.com/auth0/auth0-deploy-cli) for greater flexibility. diff --git a/articles/architecture-scenarios/business/b2b-b2e.md b/articles/architecture-scenarios/business/b2b-b2e.md deleted file mode 100644 index 7465dc745b..0000000000 --- a/articles/architecture-scenarios/business/b2b-b2e.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -order: 07 -title: Business to Business + Enterprise Identity Scenarios -image: /media/articles/architecture-scenarios/b2b-b2e.png -extract: This is essentially a hybrid between B2B and B2E where you have a larger SAAS application, like Zendesk for example, where users are grouped into companies. -description: Explains the architecture scenario of a hybrid between B2B and B2E where you have a larger SAAS application. -beta: true ---- - -# Business to Business + Enterprise Identity Scenarios - -::: note -This architecture scenario is under construction and will be updated soon. -::: - -![](/media/articles/architecture-scenarios/b2b-b2e.png) - -This is essentially a hybrid between B2B and B2E for larger SAAS applications (such as Zendesk). In a situation like this, users would primarily be grouped into companies, but you may also have internal users (employees) who log into perform support or administrative tasks. Those internal users will typically use federated identity to authenticate. - -## Read More - -The following is a list of articles on this website which will help you to implement this scenario: - -* [Lock](https://auth0.com/lock) -* [Protocols supported by Auth0](/protocols) -* [Connect Active Directory with Auth0](/connections/enterprise/active-directory) -* [SAML](/saml-configuration) -* [Using Auth0 in SaaS, multi-tenant Apps](/saas-apps) -* [Identity Providers supported by Auth0](/identityproviders) -* [Social Login](https://auth0.com/learn/social-login/) -* [Auth0 SSO Dashboard (sample)](https://github.com/auth0-samples/auth0-sso-dashboard) diff --git a/articles/architecture-scenarios/business/b2b.md b/articles/architecture-scenarios/business/b2b.md deleted file mode 100644 index 11bf1641ee..0000000000 --- a/articles/architecture-scenarios/business/b2b.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -order: 05 -title: Business to Business Identity Scenarios -image: /media/articles/architecture-scenarios/b2b.png -extract: In this scenario you usually have a larger SAAS application, like Zendesk for example, where their customers are typically other companies which are registered as tenants. -description: Explains the architecture scenario of B2B with large SAAS application. -beta: true ---- - -# Business to Business Identity Scenarios - -::: note -This architecture scenario is under construction and will be updated soon. -::: - -![](/media/articles/architecture-scenarios/b2b.png) - -In this scenario you usually have a larger SAAS application, like Zendesk for example, where their customers are typically other companies which are registered as tenants. Each of these companies (also referred to as tenants) will have their own set of users who can access the information of that tenant on the SAAS application. - -When a tenant is smaller, these users can be stored and authenticated with a Database connection (username/password). Some of the tenants may also be large enterprise companies who wants federate their enterprise directory so they can manage their own users and the users can log in with their existing enterprise credentials. - -## Read More - -The following is a list of articles on this website which will help you to implement this scenario: - -* [Lock](https://auth0.com/lock) -* [Protocols supported by Auth0](/protocols) -* [Using Auth0 in SaaS, multi-tenant Apps](/saas-apps) -* [Identity Providers supported by Auth0](/identityproviders) -* [Connect Active Directory with Auth0](/connections/enterprise/active-directory) -* [Social Login](https://auth0.com/learn/social-login/) diff --git a/articles/architecture-scenarios/business/b2c.md b/articles/architecture-scenarios/business/b2c.md deleted file mode 100644 index 17f31735d7..0000000000 --- a/articles/architecture-scenarios/business/b2c.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -order: 04 -title: Business to Consumer Identity Scenarios -image: /media/articles/architecture-scenarios/b2c.png -extract: Usually eCommerce or SAAS applications which have end users (consumers) as customers and the application typically used OpenID Connect as a protocol to communicate with Auth0. -description: Explains the architecture scenario B2C with an eCommerce or SAAS application. -beta: true ---- - -# Business to Consumer Identity Scenarios - -::: note -This architecture scenario is under construction and will be updated soon. -::: - -![](/media/articles/architecture-scenarios/b2c.png) - -Usually eCommerce or SAAS applications which have end users (consumers) as customers and the application typically used OpenID Connect as a protocol to communicate with Auth0. - -Users are created and stored with a Database connection (username/password) which they can then later use to log in, or alternatively users can use a social connection such as Facebook, Twitter, Google, and so on to log in. Passwordless connections are also common with B2C. - -## Read More - -The following is a list of articles on this website which will help you to implement this scenario: - -* [Lock](https://auth0.com/lock) -* [Protocols supported by Auth0](/protocols) -* [Database Identity Providers](/connections/database) -* [Import users to Auth0](/connections/database/migrating) -* [Social Login](https://auth0.com/learn/social-login/) -* [Passwordless](/connections/passwordless) diff --git a/articles/architecture-scenarios/business/b2e.md b/articles/architecture-scenarios/business/b2e.md deleted file mode 100644 index b66f66c4c7..0000000000 --- a/articles/architecture-scenarios/business/b2e.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -order: 06 -title: Business to Enterprise Identity Scenarios -image: /media/articles/architecture-scenarios/b2e.png -extract: Large organization who wants to federate their existing enterprise directory service to allow employees to log in to applications using their existing enterprise credentials. -description: Explains the architecture scenario of B2E with a large organization that wants to extend their existing enterprise directory service. -beta: true ---- - -# Business to Enterprise Identity Scenarios - -::: note -This architecture scenario is under construction and will be updated soon. -::: - -![](/media/articles/architecture-scenarios/b2e.png) - -In this scenario you have a large organization who wants to federate their existing enterprise directory service to allow employees to log in to the various internal, as well as 3rd party applications, using their existing enterprise credentials. - -The 3rd party applications will typically be configured to use SAML as a protocol to communicate with Auth0, whereas the internal applications will more typically use OpenID Connect to communicate with Auth0. - -Since there are usually multiple configured applications, SSO (single sign-on) is important. Often times some sort of dashboard UI is used to host shortcuts to all the applications that a given user has access to. In that case, users typically first log into the dashboard and then jump to the various applications they wish to use, and each jump uses SSO to facilitate automatic login. - -## Read More - -The following is a list of articles on this website which will help you to implement this scenario: - -* [Lock](https://auth0.com/lock) -* [Protocols supported by Auth0](/protocols) -* [Connect Active Directory with Auth0](/connections/enterprise/active-directory) -* [SAML](/saml-configuration) -* [What is SSO (Single Sign On)?](/sso) -* [Auth0 SSO Dashboard (sample)](https://github.com/auth0-samples/auth0-sso-dashboard) diff --git a/articles/architecture-scenarios/checklists.md b/articles/architecture-scenarios/checklists.md new file mode 100644 index 0000000000..16712907ca --- /dev/null +++ b/articles/architecture-scenarios/checklists.md @@ -0,0 +1,72 @@ +--- +title: Implementation Planning Checklists +description: Links to checklists for your implementation. +topics: + - SDLC + - checklists + - best practices + - implementation checklist +contentType: reference +useCase: + - implementation +--- +# Implementation Planning Checklists + +Click the links below to download a checklist that corresponds to a phase in the SDLC (Software Development Lifecycle). You can open the checklist in any spreadsheet application and customize them to suit your needs. + +## ![](/media/articles/architecture-scenarios/checklists/file_type_icons-02.png) Analyze Checklist + +Analyze Checklist Download + +In the Analyze phase, analyze end-user business requirements and determine project goals as part of the high-level plan for the project. Convert the requirements and goals into system functions that the organization intends to develop. Activities include: + +* Gathering business requirements +* Creating process diagrams +* Performing detailed analysis +* Alignment to project plan + +## ![](/media/articles/architecture-scenarios/checklists/file_type_icons-02.png) Design Checklist + +Design Checklist Download + +In the Design phase, describe the desired features and operations of the system, including business rules, pseudo-code, screen layouts, and other necessary documentation. Activities include: + +* Infrastructure design +* System model design + +## ![](/media/articles/architecture-scenarios/checklists/file_type_icons-02.png) Build Checklist + +Build Checklist Download + +In the Build phase, develop the actual system through implementation of infrastructure and code. Activities include: + +* Infrastructure implementation +* Code implementation + +## ![](/media/articles/architecture-scenarios/checklists/file_type_icons-02.png) Test Checklist + +Test Checklist Download + +In the Test phase, integrate and deploy all implemented code in the testing environment infrastructure. Testing then follows Software Testing Life Cycle activities to check the system for errors, bugs, and defects to verify that system features work as expected (or not). Activities include: + +* Write test cases +* Execute test cases + +## ![](/media/articles/architecture-scenarios/checklists/file_type_icons-02.png) Deploy Checklist + +Deploy Checklist Download + +In the Deploy phase, deploy the system to either a staging or production environment, where actual users begin to operate and interact with it. + +Eventually, you deploy all components of the system to the production environment when you make a live release. + +## ![](/media/articles/architecture-scenarios/checklists/file_type_icons-02.png) Monitor Checklist + +Monitor Checklist Download + +In the Monitor phase, make enhancements, corrections, and changes to ensure the system continues to work and stays updated to meet the business objectives and support the needs of the users. Activities include: + +* Monitoring +* Maintenance +* Changes and adjustments +* Upgrade and adapt to future needs diff --git a/articles/architecture-scenarios/implementation-resources.md b/articles/architecture-scenarios/implementation-resources.md new file mode 100644 index 0000000000..b4c4f6a955 --- /dev/null +++ b/articles/architecture-scenarios/implementation-resources.md @@ -0,0 +1,115 @@ +--- +title: Implementation Resources +description: Learn about all the resources Auth0 provides to help you with your Auth0 implementation. +toc: true +topics: + - architecture + - api-auth + - sample-code + - sdks + - documentation + - guides + - quickstarts +contentType: concept +useCase: + - get-started + - implementation + - learning + - testing + - run-sample-code + - get-help + - enter-support-ticket +--- +# Implementation Resources + +Auth0 provides a wealth of resources to help you effectively engage with our product and community. This list provides links to the resources available, by category. + +## Get started + +Resources designed to help you learn the basics of Auth0 include: + +* [**Getting Started documentation**](/getting-started): Explore the Auth0 Dashboard and common terms used for components of the Auth0 service. Gain a broad understanding of Auth0 and learn the terminology you might hear when working with Auth0 staff or reading our docs. + +* [**Get Started with Auth0 Video Series**](/videos/get-started): In these short videos, we cover how easy it is to complete the basic steps to use Auth0 with your applications. Watch the series before you start your project so you can get the benefit of our knowledge and experience with other customers. We cover tenant configuration, provisioning user stores and importing users, authentication, authorization, and branding and customization of everything shown to your users. + +* [**Architecture scenarios**](/architecture-scenarios): Review common architecture scenarios and learn how to implement them with Auth0. Scenarios include tutorials for common architecture patterns, such as a Single-Page Application (SPA) calling an API. High-level descriptions are useful for architects, while tutorials will help development teams. + +* [**Implementation guides**](/topics/guides): Learn how to implement commonly-used features, such as user management and multi-factor authentication (MFA). This information is useful for both architects and developers. + +## Learn + +Auth0 provides numerous tutorials, guides, white papers, and blog posts that focus on both learning and providing quick reference checks. + +* [**Docs site**](https://auth0.com/docs/): Browse through our docs to explore a wealth of available topics, or use our search to quickly find content related to a topic or term. + +* [**Feature descriptions and white papers**](https://auth0.com/learn/): Investigate short descriptions of features, industry case studies, and reference white papers. The Auth0 Learn site provides a quick overview of Auth0 features and their business value; it is helpful for project owners as well as architects and developers. + +* [**Blog posts**](https://auth0.com/blog/): Read blog posts written by experts on a variety of topics--from time-honored advice to breaking news in the identity space. Many blog posts are oriented toward architects and developers. + +## Run sample code + +Once your development team is ready to build, Auth0 provides sample programs, SDKs, and libraries to speed your project along. + +* [**Quickstarts**](/quickstarts): Investigate a rich array of small sample programs that demonstrate how to implement the key features you’ll want to include in your program, such as authentication, session management, profile updates, and logout. Quickstarts will give developers a head start on understanding how to integrate applications with Auth0. + +* [**Libraries and SDKs**](/libraries): Simplify your custom application development by using our extensive set of libraries and SDKs, which abstract many of the details of identity protocols for you. Auth0 SDKs support numerous languages and frameworks to simplify your integration with Auth0. We also provide a library for Lock, a login widget, that you can use across several platforms, including iOS and Android. + +* [**Management API**](/api/management/v2): Explore and manipulate objects, configurations, and settings within Auth0. The Management API Explorer allows you to quickly manipulate individual objects and settings on an *ad-hoc* basis and test API calls before coding them into your applications. + +* [**Authentication API**](/api/authentication): Authenticate and authorize users via the OIDC, OAuth, and SAML protocols. The Authentication API Explorer allows you to experiment with authentication and authorization flows, and test API calls before coding them into your applications. + +## Try out features and API calls + +While building, Auth0 allows you to experiment with and test out various product features. + +* **TRY buttons/links**: Quickly try out Auth0 product features. **TRY** buttons are located throughout Auth0 and allow you to experiment with connections, rules, hooks, and email templates. + +* [**Authentication API Explorer**](/api/authentication#introduction): Experiment with authentication and authorization flows, and test API calls before coding them into your applications. + +* [**Management API Explorer**](/api/management/v2): Quickly manipulate individual objects and settings on an *ad-hoc* basis and test API calls before coding them into your applications. + +* [**Postman Collections**](/api/postman): Easily dissect our APIs' calls using Postman by importing our Postman Collections. + +## Get help + +Auth0 resources that help you troubleshoot your implementation include: + +* [**Auth0 Community forum**](https://community.auth0.com/): Connect with the world of Auth0 via Auth0 posts, FAQs, and community Q&As. Architects and developers find this a valuable source of information for learning and connecting with others as well as getting help on issues. + +* [**Support Center**](https://support.auth0.com/): View and manage your subscription and tenants, file and view support requests, run automated production checks on a tenant, and view compliance information. Paid subscribers will find the support center a valuable resource if an issue or question cannot be solved by documentation or by searching the forum. + + * [**Create support cases**](/support/tickets): Create and file a support case if you need help. + + * [**Support Plans and Service Level Agreements**](/support#defect-responses): Learn about multiple levels of support available for purchase. + + * [**Troubleshooting tips**](/onboarding/enterprise-support#what-to-check-before-logging-an-issue) and [**Information to include in your support case**](/onboarding/enterprise-support#information-to-provide-when-logging-an-issue): Get advice to help your development and support teams analyze issues. + +* [**Supported versions**](/support/matrix): Understand which versions of SDKs, browsers, and languages are supported. Architects and developers should review this to ensure your project employs languages, libraries, and SDKs that will allow your implementation to work with Auth0. + +* [**Feedback Portal**](https://auth0.com/feedback): Make product suggestions. (You can also do this via the Support Center if you want better visibility into what you’ve filed over time.) Architects and developers can use this site to provide feedback on the Auth0 product for consideration as enhancements in the future. + +* [**Professional Services**](/services): Engage our world-wide professional services team to help speed your project to success. Project owners will find this useful for learning how Auth0 identity experts can help accelerate your project or fill in any temporary skill gaps. + +## Setup and monitor operations + +When you're ready to plan your launch, Auth0 provides the following resources: + +* [**Pre-launch advice**](/pre-deployment) and [**Production check**](/pre-deployment/how-to-run-test): Get tips and tools to help you plan your launch. Project managers and development and operations teams should explore these tips to leverage advice for a smooth launch. + +* [**Operational policies**](/policies): Familiarize yourself with Auth0's policies, so you know lead times for operational requests. Policies are useful for an entire team, but project owners and operations teams in particular should be aware of Auth0's operational policies. + +* [**Status Dashboard**](https://status.auth0.com): Quickly determine the availability of Auth0 services and subscribe to status updates. Although service interruptions are rare, when one occurs Auth0 conducts a root cause analysis and publishes the results on this site. Operations and support teams should be familiar with how to check Auth0 status. + +* [**Monitor endpoints**](/monitoring): Learn how to integrate our monitoring endpoints into your monitoring infrastructure. This information is of particular use to operations teams and project owners. + +* [**Log data**](/logs): Learn about the types of logs Auth0 provides, log data retention, and tools you can use to export log data to external analytical tools for analysis and long-term data storage. This information is useful for developers and operations teams, as well as compliance teams interested in data retention. + +* [**Dashboard notices**](/architecture-scenarios/implementation/b2c/b2c-operations#notifications): Stay informed about important announcements from Auth0. From time to time, Auth0 notifies you of important information via your Auth0 Dashboard and (depending on the severity of the information) via email to your registered Auth0 Dashboard Admins. You should regularly log in to the Dashboard and check the bell icon at the top for any important notices. + +## Satisfy privacy, security, and compliance needs + +View info on Auth0’s privacy policy, security policy, compliance certifications, and how Auth0 can help you with your compliance needs. This information is useful for project owners as well as security, privacy teams, and procurement teams. + +* [Privacy and Cookie Policy](https://auth0.com/privacy) +* [Security, Privacy and Compliance](https://auth0.com/security/) +* [Compliance Frameworks and Certifications](/compliance) diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-architecture.md b/articles/architecture-scenarios/implementation/b2b/b2b-architecture.md new file mode 100644 index 0000000000..b38753d752 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-architecture.md @@ -0,0 +1,56 @@ +--- +title: Architecture +description: How you configure your Auth0 tenant architecture affects your B2B IAM implementation. +toc: true +topics: + - b2b + - b2biam + - architecture +contentType: concept +useCase: + - tenant-architecture +--- +# Architecture + +<%= include('../../_includes/_architecture/_introduction.md', { platform: 'b2b' }) %> + +## Tenant provision + +<%= include('../../_includes/_architecture/_tenant-provision.md', { platform: 'b2b' }) %> + +### Tenant provision for complex organizations + +In most cases, provisioning separate Auth0 tenants for your customer's organizations is not necessary. However, in certain circumstances this can be something that is valuable for reducing the complexity of your setup. For instance, we recommend provisioning a separate Auth0 tenant for your customers' organization as a best practice if: + +* Your customers' organizations have isolated users that aren't shared with other organizations. +* You have some customer organizations that support more than one IdP. For example, your customer has their own IdP but also has some users that aren't in their IdP and whose credentials you will need to store. Or, your customer wants to provide for one or more social connections in addition to their enterprise IdP. + +If both of these situations are the case, then we recommend that you create separate Auth0 tenants for each customer that needs it. This allows you to have a separate custom domain for them and to easily customize their login experience, including [Home Realm Discovery](/architecture-scenarios/implementation/b2b/b2b-authentication#home-real-discovery) on their login page. + +::: warning +Maintaining multiple Auth0 tenants can add complexity to your system and should not be done unless absolutely necessary. +::: + +## Tenant association + +<%= include('../../_includes/_architecture/_tenant-association.md', { platform: 'b2b' }) %> + +## Custom domains + +<%= include('../../_includes/_architecture/_custom-domains.md', { platform: 'b2b' }) %> + +## SDLC support + +<%= include('../../_includes/_architecture/_sdlc-support.md', { platform: 'b2b' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2b' }) %> + +## Multiple Organization Architecture (Multitenancy) + +<%= include('../../_includes/_multitenancy.md', { platform: 'b2b' }) %> + +# Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2b', self: 'architecture' }) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-authentication.md b/articles/architecture-scenarios/implementation/b2b/b2b-authentication.md new file mode 100644 index 0000000000..4414be9c8f --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-authentication.md @@ -0,0 +1,127 @@ +--- +title: Authentication +description: How authentication works in your B2B IAM implementation. +toc: true +topics: + - b2b + - b2biam + - authentication + - universal-login +contentType: concept +useCase: + - authentication +--- +# Authentication + +<%= include('../../_includes/_authentication/_introduction.md', { platform: 'b2b' }) %> + +## Universal Login + +<%= include('../../_includes/_authentication/_universal-login.md', { platform: 'b2b' }) %> + +## Home realm discovery + +Home realm discovery (HRD) is the process of identifying which identity provider (or which connection in Auth0) the user belongs to *before* authenticating them. There are two ways HRD can occur: + +* Provide a way for the decision to be made at the application +* Have Home Realm Discovery happen on the Universal Login page + +Your system may need to do either or both methods so it is important to understand all approaches to HRD so that you can apply the one(s) that make the most sense to your applications. + +::: panel Best practice +If you don’t need to know ahead of time (for example, all of your users are in a shared user pool), then you don’t need to do HRD. You can allow users to authenticate first and then determine which organization they belong to using app metadata. HRD is really only needed if you have multiple connections within your Auth0 tenant. +::: + +### Application driven HRD + +A common and effective way for determining which realm a user belongs to is when an application is branded for each organization. The organization has its own instance of the application. This copy or instance can be physically isolated (running on a separate set of servers) or virtually isolated (running on shared servers, but presented as if it could be isolated), and is generally denoted through either a custom hostname (`companyA.application1.yourcompany.com`) or path (`application1.yourcompany.com/companyA`). + +::: warning +This method will only work if you are not sharing users between organizations. If you are sharing users within organizations, then you must support [Home Realm Discovery on the Universal Login Page](#hrd-through-universal-login) +::: + +::: panel Best practice +If your application already knows what connection (IdP) the user needs, then pass that along when you redirect the user to `/authorize` using the connection query parameter. +::: + +If this is the case for your application(s) then home realm discovery is a simple matter of storing the Auth0 connection name with the organization specific application configuration and sending that connection name as a parameter when redirecting the user for Universal Login. Sending the connection parameter can be achieved by adding it as a query parameter when you redirect them to the authorize endpoint. For more information see the [Authentication API docs](/api/authentication#authorization-code-flow); however, you will generally accomplish this using the SDK for whichever language your application is written in. + +::: panel Best practice +If an organization needs more than one IdP, then you will have to do a second round of Home Realm Discovery once identifying their organization. This can be achieved with Auth0 through creating a dedicated Auth0 tenant for that organization and creating an enterprise connection to that tenant. +::: + +### HRD through Universal Login + +There are three main approaches to Home Realm Discovery through Universal Login: + +* Discover the realm through the user’s email subdomain. +* Discover the realm by looking up a user identifier in some sort of map of identifier to realm map. +* Allow the user to choose or enter their realm (or organization). + +In both of the first two approaches, you may consider doing “Identifier First Login”. This means that you present only the ability to enter an identifier first. After which you collect the user’s identifier, and then based on the identifier you either automatically redirect the user or present a way for the user to enter their password if redirection is unnecessary. + +::: warning +Though it is possible to implement Identifier First Login or allow a user to select their organization at the application instead of on the Universal Login Page, this can add complexity with respect to single sign on as well as complexity associated with replicating that behavior in all of your applications. Instead Auth0 recommends implementing some form of HRD through Universal Login. +::: + +#### HRD through Universal Login using the email subdomain + +The simplest way to implement home realm discovery on the universal login page is to utilize the email subdomain of the user’s identifier to map that to their Identity Provider. This, of course, only works in situations where the email subdomain will be a 1:1 mapping to an organization or at least to an Identity Provider. Auth0’s Lock widget can do this for you if you are using the domain map in an enterprise connection, however if you want to build this yourself, you can, but it requires you to build a mapping of email subdomain to connection. + +#### HRD through Universal Login using the Identifier to Realm Map + +A second, more complex alternative is to store a map of identifier’s to IdP and provide a public endpoint to access that information. Then on the Universal Login page you can find the connection and redirect back to /authorize with the connection. The main drawbacks to this approach are latency, and more importantly security when it comes to identifier discovery: if you’re using email addresses, this makes it much easier for someone to discover whether a particular email address is a user of yours. + +::: panel Best practice +Any public endpoint should have rate limiting applied to it to prevent hackers from using it to discover information and to prevent denial of service attacks. +::: + +#### HRD through Universal Login using user choice + +The other simple option is to allow your users to choose from a list, if you don’t mind making public the list of organizations who use your product, or by allowing the user to enter their organization name explicitly. Once the user tells you which organization they belong to, you can redirect back to Auth0 with the connection for that organization specified, or simply prompt them for their username and password if the connection is a database connection. + +## Username and password authentication + +<%= include('../../_includes/_authentication/_username-and-password-authentication.md', { platform: 'b2b' }) %> + +## Application integration + +<%= include('../../_includes/_authentication/_application-integration.md', { platform: 'b2b' }) %> + +## Anomaly detection + +<%= include('../../_includes/_authentication/_attack-protection.md', { platform: 'b2b' }) %> + +## SSO with legacy systems + +<%= include('../../_includes/_authentication/_sso-legacy.md', { platform: 'b2b' }) %> + +## Enterprise Login + +The “bring your own identity” scenario has become a must-have for almost all B2B applications. Most enterprise companies expect to be able to integrate their IdP into your application so their employees don't need to store another set of credentials. This is a valuable way of simplifying the user authentication experience without compromising security, and using [Universal Login](#universal-login) makes it easy to start adding support for [Enterprise Connections](/connections/identity-providers-enterprise) with minimal disruption. + +::: panel Best Practice +Once you start supporting enterprise connections for users, you must do some form of [Home Realm Discovery](#home-realm-discovery) so that you can determine which connection to send the user to for authentication. +::: + +With enterprise connection support, user identities and credentials are managed by the identity provider of your customers' organization, as well as certain identity claims - which Auth0 will use to populate the user [profile](/architecture-scenarios/implementation/b2b/b2b-profile-mgmt). + +::: panel Best Practice +"Bring your own identity" is a great feature to provide, but if you don't support this from day one, and sometimes even if you do, you may have an organization that wants to switch to their own IdP after already having used the application for a while. You will need a way to [link user accounts](/users/concepts/overview-user-account-linking) to provide an effective way of associating the new identity with the old database identity. +::: + +## Multi-factor authentication (MFA) + +<%= include('../../_includes/_authentication/_mfa.md', { platform: 'b2b' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2b' }) %> + +## Multiple Organization Architecture (Multitenancy) + +<%= include('../../_includes/_multitenancy.md', { platform: 'b2b' }) %> + +# Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2b', self: 'authentication' }) %> diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-authorization.md b/articles/architecture-scenarios/implementation/b2b/b2b-authorization.md new file mode 100644 index 0000000000..5d0ca8d405 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-authorization.md @@ -0,0 +1,61 @@ +--- +title: Authorization +description: User authorization and related planning considerations for your B2B IAM implementation. +toc: true +topics: + - b2b + - b2biam + - user-authorization +contentType: concept +useCase: + - user-authorization +--- +# Authorization + +<%= include('../../_includes/_authorization/_introduction.md', { platform: 'b2b' }) %> + +## Application integration + +<%= include('../../_includes/_authorization/_application-integration.md', { platform: 'b2b' }) %> + +## API integration + +<%= include('../../_includes/_authorization/_api-integration.md', { platform: 'b2b' }) %> + +## Role Based Access Control (RBAC) + +<%= include('../../_includes/_authorization/_rbac.md', { platform: 'b2b' }) %> + +The core RBAC feature can be used in many multi-organization scenarios. See [Organization Data in an Access Tokens](#organization-data-in-an-access-token) for more information on how to ensure your setup can support your RBAC needs. + +## Machine-to-Machine (M2M) authorization + +<%= include('../../_includes/_authorization/_m2m.md', { platform: 'b2b' }) %> + +## Organization Data in an Access Token + +If you have a separate API from your application in your system that supports your multi-organization application, it is important to restrict operations to only the organization that the token was generated for. This requires that there is some sort of information in the access token to tell the API which organization the access token was issued for. This can be done in a couple of different ways depending on the answers to a couple of simple questions: + +1. Will the End Users in this organization potentially have more than one organization, or is each End User isolated to a specific organization? +2. Will you be allowing any Machine-to-Machine (M2M) access to your API? +3. If you are allowing Machine-to-Machine (M2M) access to your API, Will you have any developers who need a single client ID and secret to access multiple organizations (but not *all* organizations)? +4. Will you be allowing the creating of third-party apps that require consent? + +If End Users are isolated to a single organization **and** you will either not be allowing M2M access to your API or you will have a separate client ID/secret for each organization that needs access **and** you will *not* be allowing third-party apps that require consent, then the simplest approach is to just create a custom claim in the access token [using rules for the user based tokens](#access-token-claims) and [using the client credentials hook for M2M calls](#machine-to-machine-m2m-authorization). You can store organization name in client metadata and extract it from rules or hooks to include in access_token as a custom claim. RBAC will work out of the box for this approach as well as long as each End User can only belong to one organization. + +If End Users have more than one organization they can belong to or you might give a single developer a client ID and secret for M2M calls to more than one organization, then you will be best served by creating a separate audience (a separate API instance in your Auth0 tenant) for each organization. This gives you a few nice abilities: +1. First, it allows you to pass the audience as a first-class parameter to Auth0 without having to create a custom parameter. The benefit of this is that Auth0 will help enforce the existence of the audience, and it will pass it to your rules. It will also ensure that an issued refresh token will only work for the specific audience it was originally issued to. +2. It allows you to restrict client grants to only specific organizations out of the box. The alternative is to create a more complicated client credentials hook to attempt to retrieve the restrictions from somewhere else and also require a much more complex and potentially troublesome way to tell the client credentials call which organization to issue the access token for. +3. This also allows you to use the core RBAC feature with Auth0 and ensure that the End Users who have access to more than one organization can have a potentially different role for each organization. + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2b' }) %> + +## Multiple Organization Architecture (Multitenancy) + +<%= include('../../_includes/_multitenancy.md', { platform: 'b2b' }) %> + +# Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2b', self: 'authorization' }) %> diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-branding.md b/articles/architecture-scenarios/implementation/b2b/b2b-branding.md new file mode 100644 index 0000000000..b2da74226e --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-branding.md @@ -0,0 +1,65 @@ +--- +title: Branding +description: How to configure Auth0 items to reflect your brand and desired user experience. +toc: true +topics: + - b2b + - b2biam + - branding + - universal-login + - login-pages + - password-reset-pages + - custom-domains + - error-pages +contentType: concept +useCase: + - user-logout +--- +# Branding + +<%= include('../../_includes/_branding/_introduction.md', { platform: 'b2b' }) %> + +## Universal login and login pages + +<%= include('../../_includes/_branding/_universal-login.md', { platform: 'b2b' }) %> + +## Branding login by organization + +Whether or not you need to do special customization on the Universal Login page is determined by how you plan to manage your customers’ organization. Before reading through this section, make sure you have read through the [Universal Login section](#universal-login-and-login-pages) and know how you are approaching organizations by reviewing [Multiple Organization Architecture](https://drive.google.com/a/auth0.com/file/d/1y2G8RNHTBujcCrnMRhp6_phQiRAkZzfF/view?usp=sharing). + +If your organization users will all be isolated from each other, than it’s important to make it clear on the Universal Login page which organization the login page is for. This can be done in a couple of ways: + +* Create JavaScript on the Universal Login Page that can pull resources from a CDN based on the organization presented to it. +* Create a separate tenant for the organization and use the Universal Login page to customize as desired for that organization. + +## Custom domain naming + +<%= include('../../_includes/_branding/_custom-domain-naming.md', { platform: 'b2b' }) %> + +## Email template customization + +<%= include('../../_includes/_branding/_email-templates.md', { platform: 'b2b' }) %> + +## Password reset page customization + +<%= include('../../_includes/_branding/_password-reset.md', { platform: 'b2b' }) %> + +## Error page customization + +<%= include('../../_includes/_branding/_error-page.md', { platform: 'b2b' }) %> + +## Guardian multi-factor page customization + +<%= include('../../_includes/_branding/_guardian.md', { platform: 'b2b' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2b' }) %> + +## Multiple Organization Architecture (Multitenancy) + +<%= include('../../_includes/_multitenancy.md', { platform: 'b2b' }) %> + +# Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2b', self: 'branding' }) %> diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-deployment.md b/articles/architecture-scenarios/implementation/b2b/b2b-deployment.md new file mode 100644 index 0000000000..8f0c437182 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-deployment.md @@ -0,0 +1,28 @@ +--- +title: Deployment Automation +description: How Auth0 tooling helps to automate tenant deployment. +topics: + - b2b + - b2biam + - tenants + - deployment +contentType: concept +useCase: + - tenant-deployment +--- + +# Deployment Automation + +<%= include('../../_includes/_deployment/_introduction.md', { platform: 'b2b' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2b' }) %> + +## Multiple Organization Architecture (Multitenancy) + +<%= include('../../_includes/_multitenancy.md', { platform: 'b2b' }) %> + +# Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2b', self: 'deployment' }) %> diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-launch.md b/articles/architecture-scenarios/implementation/b2b/b2b-launch.md new file mode 100644 index 0000000000..358e53464e --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-launch.md @@ -0,0 +1,30 @@ +--- +classes: topic-page +title: Launch Preparation +description: Launch preparation considerations for your B2B IAM implementation. +topics: + - b2b + - ciam + - launch +contentType: concept +useCase: + - launch +--- +# Launch Preparation + +<%= include('../../_includes/_launch/_introduction.md', { platform: 'b2b' }) %> +<%= include('../../../_includes/_topic-links', { links: [ + 'architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-tenantcheck', + 'architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-testing', + 'architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-operations', + 'architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-compliance', + 'architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-support', + 'architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-launch' + ] }) %> + +## Project Planning Guide +<%= include('../../_includes/_planning.md', { platform: 'b2b' }) %> + +# Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2b', self: 'launch' }) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-compliance.md b/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-compliance.md new file mode 100644 index 0000000000..01a2a4ce91 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-compliance.md @@ -0,0 +1,24 @@ +--- +title: Compliance Readiness +description: Compliance checks to perform before launch of your B2B IAM implementation. +topics: + - b2b + - ciam + - launch + - compliance +contentType: concept +useCase: + - launch +--- + +# Compliance + +<%= include('../../../_includes/_launch/_compliance.md', { platform: 'b2b' }) %> + +# Project Planning Guide + +<%= include('../../../_includes/_planning.md', { platform: 'b2b' }) %> + +# Keep reading + +<%= include('../../../_includes/_keep-reading.md', { platform: 'b2b', self: '*ignore*' }) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-launch.md b/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-launch.md new file mode 100644 index 0000000000..835be1391e --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-launch.md @@ -0,0 +1,23 @@ +--- +title: Launch Day Preparation +description: Launch preparation considerations for your B2B IAM implementation. +topics: + - b2b + - ciam + - launch +contentType: concept +useCase: + - launch +--- + +# Launch Day Readiness + +<%= include('../../../_includes/_launch/_launch.md', { platform: 'b2b' }) %> + +# Project Planning Guide + +<%= include('../../../_includes/_planning.md', { platform: 'b2b' }) %> + +# Keep reading + +<%= include('../../../_includes/_keep-reading.md', { platform: 'b2b', self: '*ignore*' }) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-operations.md b/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-operations.md new file mode 100644 index 0000000000..e4742e5f13 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-operations.md @@ -0,0 +1,24 @@ +--- +title: Operations Readiness +description: Operations checks to perform before launch of your B2B IAM implementation. +topics: + - b2b + - ciam + - launch + - operations +contentType: concept +useCase: + - launch +--- + +# Operational Readiness + +<%= include('../../../_includes/_launch/_operations.md', { platform: 'b2b' }) %> + +# Project Planning Guide + +<%= include('../../../_includes/_planning.md', { platform: 'b2b' }) %> + +# Keep reading + +<%= include('../../../_includes/_keep-reading.md', { platform: 'b2b', self: '*ignore*' }) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-support.md b/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-support.md new file mode 100644 index 0000000000..818c04db04 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-support.md @@ -0,0 +1,23 @@ +--- +title: Support Readiness +description: Support readiness for the launch of your B2B IAM implementation. +topics: + - b2b + - ciam + - launch + - support +contentType: concept +useCase: + - launch +--- + +# Support Readiness + +<%= include('../../../_includes/_launch/_support.md', { platform: 'b2b' }) %> + +# Project Planning Guide +<%= include('../../../_includes/_planning.md', { platform: 'b2b' }) %> + +# Keep reading + +<%= include('../../../_includes/_keep-reading.md', { platform: 'b2b', self: '*ignore*' }) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-tenantcheck.md b/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-tenantcheck.md new file mode 100644 index 0000000000..bbe597465c --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-tenantcheck.md @@ -0,0 +1,24 @@ +--- +title: Tenant Check +description: Tenant Checks to perform before launch of your B2B IAM implementation. +topics: + - b2b + - ciam + - launch + - configuration +contentType: concept +useCase: + - launch +--- + +# Tenant configuration check + +<%= include('../../../_includes/_launch/_tenant-check.md', { platform: 'b2b' }) %> + +# Project Planning Guide + +<%= include('../../../_includes/_planning.md', { platform: 'b2b' }) %> + +# Keep reading + +<%= include('../../../_includes/_keep-reading.md', { platform: 'b2b', self: '*ignore*' }) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-testing.md b/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-testing.md new file mode 100644 index 0000000000..e3c2314ffe --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-launch/b2b-launch-testing.md @@ -0,0 +1,24 @@ +--- +title: Testing Complete +description: Testing preparation for the launch of your B2B IAM implementation. +topics: + - b2b + - ciam + - launch + - testing +contentType: concept +useCase: + - launch +--- + +# Testing + +<%= include('../../../_includes/_launch/_testing.md', { platform: 'b2b' }) %> + +# Project Planning Guide + +<%= include('../../../_includes/_planning.md', { platform: 'b2b' }) %> + +# Keep reading + +<%= include('../../../_includes/_keep-reading.md', { platform: 'b2b', self: '*ignore*' }) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-logout.md b/articles/architecture-scenarios/implementation/b2b/b2b-logout.md new file mode 100644 index 0000000000..f818eb1ceb --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-logout.md @@ -0,0 +1,58 @@ +--- +title: Logout +description: User logout planning considerations for your B2B IAM implementation. +topics: + - b2b + - b2biam + - logout + - sessions +contentType: concept +useCase: + - user-logout +--- +# Logout + +<%= include('../../_includes/_logout/_introduction.md', { platform: 'b2b' }) %> + +## Single Logout + +If you are doing [Federated Logout](#federated-logout) you will likely also want to do Single Logout (SLO), and there are two main approaches you can take. + +::: warning +SLO can add complexity to your system, so you need to ensure that you really need it before adding the extra development and maintenance time to your system. +::: + +### Short-lived tokens + +::: panel Best Practice +You want to avoid making too many calls to your Auth0 tenant to avoid rate limiting and poor performance. A best practice is to only request new tokens if tokens have expired and a user takes an action. This will avoid applications that are simply open, but not in use, from continually polling for new tokens. +::: + +This is by far the simplest approach to Single Logout. Each application enforces a short time within which a user can use the system, say, 5-10 minutes. On each action a user performs, if the time has expired then either a redirect to Auth0 (for regular web apps), or [Silent Authentication](https://auth0.com/docs/api-auth/tutorials/silent-authentication) for client side Single Page Applications will be used to obtain new tokens. Ordinarily new tokens will be issued silently due to the Single Sign On (SSO) session. However, after logout, all applications will fail to get new tokens silently because the SSO session will have been removed, and the user will need to re-enter their credentials. + +::: warning +If you are automatically forwarding the user directly to their own IdP as part of an enterprise connection using the connection parameter, this can break this technique unless you are also doing [Federated Logout](#federated-logout) +::: + +### Build a logout service + +Another technique you can use is to build a logout service that can track and destroy application sessions. Each application would notify the logout service when it creates and removes a session. The (logout) service would either have direct access to all application's server side sessions and destroy them directly, or it will have the ability to make a back-channel call to each application to tell the application that it must remove its session. + +This technique can be quite effective as there is low-latency between when a user calls logout, and when they are then logged out of all applications. However it can add complexity and also additional development time for implementation. It will also require some way to ensure that new applications added to the system are added to this service. + +## Federated Logout + +[Federated User Logout](/logout/guides/logout-idps) may be something that you need to consider for your application. If you or your customers will be using a third-party IdP (i.e., something other than a [Database Identity Provider](/connections/database)) then the question of whether you need to log the user out of the IdP when they log out of your application is something you will need to answer. The answer depends on what your users would expect. If the application and/or IdP you use is tied closely to a customer organization and a central part of day-to-day operations, then it may be frustrating for users to get logged out of their IdP when they log out of your application. If not, then being logged out of the IdP may be expected, or in some cases even desired. In most B2B scenarios, our customers find that it is preferable *not* to perform federated logout for a user. + + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2b' }) %> + +## Multiple Organization Architecture (Multitenancy) + +<%= include('../../_includes/_multitenancy.md', { platform: 'b2b' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2b', self: 'logout' }) %> diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-operations.md b/articles/architecture-scenarios/implementation/b2b/b2b-operations.md new file mode 100644 index 0000000000..7efd77e295 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-operations.md @@ -0,0 +1,62 @@ +--- +title: Operations +description: How to operationalize your Auth0 tenant environments. +toc: true +topics: + - b2b + - b2biam + - tenants + - operations +contentType: concept +useCase: + - tenant-operations +--- + +# Operations + +<%= include('../../_includes/_operations/_introduction.md', { platform: 'b2b' }) %> + +## Service status + +<%= include('../../_includes/_operations/_service-status.md', { platform: 'b2b' }) %> + +## Email provider setup + +<%= include('../../_includes/_operations/_email-provider.md', { platform: 'b2b' }) %> + +## Infrastructure + +<%= include('../../_includes/_operations/_infrastructure.md', { platform: 'b2b' }) %> + +## Logging + +<%= include('../../_includes/_operations/_logging.md', { platform: 'b2b' }) %> + +## Monitoring + +<%= include('../../_includes/_operations/_monitoring.md', { platform: 'b2b' }) %> + +## Notifications + +<%= include('../../_includes/_operations/_notifications.md', { platform: 'b2b' }) %> + +## Provisioning organizations + +<%= include('../../_includes/_provisioning/_organizations.md', { platform: 'b2b' }) %> + +## Self-Service IdP provisioning + +While Auth0 [connections](/identityproviders) make it easy to configure IdPs, it can be a time-consuming process to onboard customer organization IdPs especially if you are selling to new customer organizations on a regular basis or existing organizations have changing IdP requirements. As a result, many of our customers have found it worthwhile to build a self-service portal for their customers' organization admins so that they can configure their own IdPs. This cuts down on your IT department's workload. The [Auth0 Management API](/api/management/v2) provides all necessary [connection](/api/management/v2#!/Connections/get_connections) management functionality to achieve this. + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2b' }) %> + +## Multiple Organization Architecture (Multitenancy) + +<%= include('../../_includes/_multitenancy.md', { platform: 'b2b' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2b', self: 'operations' }) %> + diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-profile-mgmt.md b/articles/architecture-scenarios/implementation/b2b/b2b-profile-mgmt.md new file mode 100644 index 0000000000..bdc3ed3749 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-profile-mgmt.md @@ -0,0 +1,57 @@ +--- +title: Profile Management +description: User profile management planning considerations for your B2B IAM implementation. +toc: true +topics: + - b2b + - b2biam + - user-profiles +contentType: concept +useCase: + - profile-management + - manage-user-profiles +--- +# Profile Management + +<%= include('../../_includes/_profile-mgmt/_introduction.md', { platform: 'b2b' }) %> + +## Metadata + +<%= include('../../_includes/_profile-mgmt/_metadata.md', { platform: 'b2b' }) %> + +## Password reset + +<%= include('../../_includes/_profile-mgmt/_password-reset.md', { platform: 'b2b' }) %> + +## Account verification + +<%= include('../../_includes/_profile-mgmt/_account-verification.md', { platform: 'b2b' }) %> + +## Blocking users + +<%= include('../../_includes/_profile-mgmt/_blocking-users.md', { platform: 'b2b' }) %> + +## Admin portal + +An admin portal is an application where you can create new users, edit a user’s profile, see activity about a user, etc. This application should be accessible by administrators only. Though Auth0 provides its management dashboard, it is not advised to give access to the management dashboard to many people as there are a lot of ways someone can unintentionally break your Auth0 tenant. Instead, Auth0 provides two other options: + +* [**Auth0 Management API**](/api/management/v2): With the Management API you can easily construct an application that provides administrators the ability to manage users. You can either incorporate this into an existing application that already exists for your administrators, or create a new one with a UI that matches your current applications. + +* [**Auth0 Delegated Administration Extension**](/extensions/delegated-admin/v3): This powerful and flexible extension allows you to customize a user administration experience. You can tailor this extension so that you can allow your customer admins to log in and allow them to only see and manage users within their organization. + +::: panel Best practice +If you are providing your own way for an administrator to manage users, you should only allow administrators to send users a change password link through email rather than allowing administrators to set passwords directly. If you must go against this recommendation and allow your administrators to set someone’s password, you should force the user to change their password at their next login so that only they know the password (and not an administrator as well). +::: + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2b' }) %> + +## Multiple Organization Architecture (Multitenancy) + +<%= include('../../_includes/_multitenancy.md', { platform: 'b2b' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2b', self: 'profile-mgmt' }) %> + diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-provisioning.md b/articles/architecture-scenarios/implementation/b2b/b2b-provisioning.md new file mode 100644 index 0000000000..8f2fe1e387 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-provisioning.md @@ -0,0 +1,117 @@ +--- +title: Provisioning +description: User provisioning functionality and considerations for your B2B IAM implementation. +toc: true +topics: + - b2b + - b2biam + - user-migration + - custom-db + - universal-login + - user-profiles +contentType: concept +useCase: + - user-provisioning + - store-user-data +--- +# Provisioning + +<%= include('../../_includes/_provisioning/_introduction.md', { platform: 'b2b' }) %> + +## Provisioning organizations + +<%= include('../../_includes/_provisioning/_organizations.md', { platform: 'b2b' }) %> + +## User migration + +<%= include('../../_includes/_provisioning/_user-migration.md', { platform: 'b2b' }) %> + +## Provisioning organization users + +An organization should map directly to one of your business customers/partners. Each business/partner that you are working with has users who will be logging in. We call those end users *organization users*. +There are two different approaches to how to store your organization users: + +* **Isolated to the organization**: Every user *belongs* to exactly one organization. It would not make sense for that user to be a part of more than one organization, and even if they were, it would make sense for them to have a separate “identity” for that other organization. For example, a retail employee that works part time at two different stores has two different logins for each of those stores even if the stores both use the SaaS application. To learn more, see [Provisioning users isolated to the organization](#provisioning-users-isolated-to-the-organization). +* **Shared between organizations**: In a case like this, users either create credentials in your company, or they can access other organizations instances of your application using credentials from their own organization. A simple way to look at this is that one user may be authorized to access more than one organization’s instance of the application. A user would understand that they can use the same credentials to access both instances of an application. For example, some doctors contract with multiple clinics and may need to be able to sign into each separate clinic with their same credentials. To learn more, see [Provisioning users shared between organizations](#provisioning-users-shared-between-organizations). + +### Provisioning users isolated to the organization + +Isolating users to the organization can provide a nice clean barrier between organizations. If no users ever need to access more than one organization (or you would rather force them to create multiple accounts), then this is an attractive approach. + +You need to provision those users at the IdP level. Each of the organizations will have its own IdP for accomplishing this. This IdP will come in one of three flavors: + +* **Your Auth0 Tenant is the IdP**: A Database Connection in your main tenant dedicated to this organization. +* **Organizations bring their own IdP**: You set up an Enterprise Connection for them. +* **Organizations with more than one IdP**: This situation is a little more tricky becasue you have multiple options for approaching this situation. In descending order of complexity, these include: + * You convince them to create (or find that they already have) one main IdP that can route to their individual IdPs. + * You create separate organizations (e.g. customerorg-department1 and customerorg-department2) in your applications. + * You set up a new Auth0 tenant just for them and add as many IdPs as they need (which may include a database in Auth0) to that tenant, along with their own custom domain and branding. + * You make your existing tenant and login page more complex to handle [Home Realm Discovery](/architecture-scenarios/implementation/b2b/b2b-authentication#home-real-discovery) just for organizations that have more than one IdP. + +We recommend using Auth0 as an IdP as a starting point because it’s simple to implement a user invite workflow: an administrator creates a user; a randomly-generated password is created for that user, but never stored or shown to anyone; and then the user receives a welcome email with a link to set their password. Compared to other invite flows, the only thing special about this is that the person who is creating the user will have to either select the organization ahead of time, or the system will force the organization to match that of the user doing the inviting (in situations where there is an organization administrator who belongs to that organization only). To learn more, see [User invite](#user-invite). + +::: panel Best Practice +If you can keep a main Auth0 tenant with a one-to-one mapping between organization and connection, it will greatly simplify your login system, making it more maintainable and extendable for the future. See [Multiple Organization Architecture documents: isolated users by organization](https://drive.google.com/a/auth0.com/file/d/1fzWWu7CUWaPpmaSO01gEhVYmkSXvV28l/view?usp=sharing) for a more in-depth view. +::: + +### Provisioning users shared between organizations + +When sharing users between organizations, you will need a way to authorize access. Because you won’t know where a user might belong when authenticating, we typically recommend storing your users in a single domain and then figuring out which organizations they can access by using user app metadata. Because of this, provisioning will often be done by starting with a User Invite workflow for the single database connection, and then app metadata will be used to authorize access. User app metadata allows information to be stored in a user’s profile that can impact a user's capabilities but which a user cannot change. Let’s say I’m a doctor and I belong to Clinic A and Clinic B. I might have an organizations object in my app metadata that looks like: `{ “organizations”: [“clinicA”,”clinicB”] }`, and then when attempting to log into the app for Clinic B, a rule can check that Clinic B is in the `organizations` array. + +::: panel Best Practice +Because users are shared, you won’t be able to determine who has access by isolating them to their own connection, therefore you will need to use their app metadata to make the determination. When provisioning, you will need a way to set the organizations they have access to or add a new organization to an already existing user. +::: + +### Deprovisioning limitations + +<%= include('../../_includes/_provisioning/_deprovisioning.md', { platform: 'b2b' }) %> + +## User invite + +In most B2B scenarios, only particular individuals are allowed access to the application. As a result, it is often simpler to have an administrator provision user accounts rather than having users sign up and then have an administrator approve them. Provisioning can often be done in an automated fashion when users are added to a centralized system as well. + +There are three different personas who might be [inviting users](/design/creating-invite-only-applications): + +* An administrator at your company may create the users for each organization. +* An administrator from each organization may be assigned to creating users. +* Another system responsible for creating users mahy exist, and that system may then create a user in Auth0. +Regardless of the audience, the technique can be similar, with the exception of the third option which would require the use of the management API and could not be done using the Delegated Administration Extension. The rest is a matter of using the right authorization model for the application. + +User invite can be accomplished in a few ways: + +* Using the [Delegated Administration Extension](/extensions/delegated-admin/v3) +* Updating a pre-existing user administration system that you’ve already created to use the [Management API](/api/management/v2) +* Creating a new application to do this using the Management API. + +::: panel Best Practice +Whether you are using the Management API or the Delegated Administration Extension, it is important to create each user with a random temporary password and *not* store that password anywhere! Then, use the Management API to send an email to the user with a link to set their password. This ensures that the only person who knows the password is the user themselves. +::: + +::: warning +One of the main principles of OIDC is that no one except the user themselves ever knows their password. If you are doing an invite flow, have your backend system randomly generate a password and then discard it and have your user reset their password before ever logging in. Do not create a temporary password and give it to them to log in the first time. +::: + +## Enterprise sign up + +Enterprise sign up is synonymous with sign in via [enterprise login](/architecture-scenarios/implementation/b2b/b2b-authentication#enterprise-login)—there’s no distinction here *per se*, as user [profile](/architecture-scenarios/implementation/b2b/b2b-profile-mgmt) creation happens automatically upon first enterprise login. + +::: panel best practice +A nice advantage of allowing your customers to use their own IdP is that they can administer their users and assign roles and access in their own IdP setup instead of forcing you to build administration for them. Working out the mapping for those customers will make this much easier. +::: + +::: warning + If mapping isn't enough and you must put some metadata in your system, keep in mind that Auth0 will not create the user until they log in to the system the first time. Therefore, you will need to use rule extensibility to pull the initial information from somewhere else, or force users to log in the first time before you can add the metadata. +::: + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2b' }) %> + +## Multiple Organization Architecture (Multitenancy) + +<%= include('../../_includes/_multitenancy.md', { platform: 'b2b' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2b', self: 'provisioning' }) %> + diff --git a/articles/architecture-scenarios/implementation/b2b/b2b-qa.md b/articles/architecture-scenarios/implementation/b2b/b2b-qa.md new file mode 100644 index 0000000000..2aa5556410 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2b/b2b-qa.md @@ -0,0 +1,41 @@ +--- +title: Quality Assurance +description: Quality Assurance considerations for your B2B IAM implementation. +toc: true +topics: + - qa + - b2b + - b2biam + - quality +contentType: concept +useCase: + - quality-assurance +--- +# Quality Assurance + +<%= include('../../_includes/_qa/_introduction.md', { platform: 'b2b' }) %> + +## Unit testing + +<%= include('../../_includes/_qa/_unit-testing.md', { platform: 'b2b' }) %> + +## Integration testing + +<%= include('../../_includes/_qa/_integration-testing.md', { platform: 'b2b' }) %> + +## Mock testing + +<%= include('../../_includes/_qa/_mock-testing.md', { platform: 'b2b' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2b' }) %> + +## Multiple Organization Architecture (Multitenancy) + +<%= include('../../_includes/_multitenancy.md', { platform: 'b2b' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2b', self: 'qa' }) %> + diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-architecture.md b/articles/architecture-scenarios/implementation/b2c/b2c-architecture.md new file mode 100644 index 0000000000..9d01f715a0 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-architecture.md @@ -0,0 +1,40 @@ +--- +title: Architecture +description: How you configure your Auth0 tenant architecture affects your B2C IAM implementation. +toc: true +topics: + - b2c + - ciam + - tenants +contentType: concept +useCase: + - tenant-architecture +--- + +# Architecture + +<%= include('../../_includes/_architecture/_introduction.md', { platform: 'b2c' }) %> + +## Tenant provision + +<%= include('../../_includes/_architecture/_tenant-provision.md', { platform: 'b2c' }) %> + +## Tenant association + +<%= include('../../_includes/_architecture/_tenant-association.md', { platform: 'b2c' }) %> + +## Custom domains + +<%= include('../../_includes/_architecture/_custom-domains.md', { platform: 'b2c' }) %> + +## SDLC support + +<%= include('../../_includes/_architecture/_sdlc-support.md', { platform: 'b2c' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2c' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2c', self: 'architecture' }) %> diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-authentication.md b/articles/architecture-scenarios/implementation/b2c/b2c-authentication.md new file mode 100644 index 0000000000..daffa7e833 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-authentication.md @@ -0,0 +1,52 @@ +--- +title: Authentication +description: How authentication works in your B2C IAM implementation. +toc: true +topics: + - b2c + - ciam + - authentication + - universal-login +contentType: concept +useCase: + - authentication +--- +# Authentication + +<%= include('../../_includes/_authentication/_introduction.md', { platform: 'b2c' }) %> + +## Universal Login + +<%= include('../../_includes/_authentication/_universal-login.md', { platform: 'b2c' }) %> + +## Username and password authentication + +<%= include('../../_includes/_authentication/_username-and-password-authentication.md', { platform: 'b2c' }) %> + +## Application integration + +<%= include('../../_includes/_authentication/_application-integration.md', { platform: 'b2c' }) %> + +## Anomaly detection + +<%= include('../../_includes/_authentication/_attack-protection.md', { platform: 'b2c' }) %> + +## SSO with legacy systems + +<%= include('../../_includes/_authentication/_sso-legacy.md', { platform: 'b2c' }) %> + +## Social authentication + +<%= include('../../_includes/_authentication/_social-authentication.md', { platform: 'b2c' }) %> + +## Multi-factor authentication (MFA) + +<%= include('../../_includes/_authentication/_mfa.md', { platform: 'b2c' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2c' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2c', self: 'authentication' }) %> diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-authorization.md b/articles/architecture-scenarios/implementation/b2c/b2c-authorization.md new file mode 100644 index 0000000000..4394f0b496 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-authorization.md @@ -0,0 +1,39 @@ +--- +title: Authorization +description: User authorization and related planning considerations for your B2C IAM implementation. +toc: true +topics: + - b2c + - ciam + - user-authorization +contentType: concept +useCase: + - user-authorization +--- +# Authorization + +<%= include('../../_includes/_authorization/_introduction.md', { platform: 'b2c' }) %> + +## Application integration + +<%= include('../../_includes/_authorization/_application-integration.md', { platform: 'b2c' }) %> + +## API integration + +<%= include('../../_includes/_authorization/_api-integration.md', { platform: 'b2c' }) %> + +## Role Based Access Control (RBAC) + +<%= include('../../_includes/_authorization/_rbac.md', { platform: 'b2c' }) %> + +## Machine-to-Machine (M2M) Authorization + +<%= include('../../_includes/_authorization/_m2m.md', { platform: 'b2c' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2c' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2c', self: 'authorization' }) %> diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-branding.md b/articles/architecture-scenarios/implementation/b2c/b2c-branding.md new file mode 100644 index 0000000000..cba76c1648 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-branding.md @@ -0,0 +1,52 @@ +--- +title: Branding +description: How to configure Auth0 items to reflect your brand and desired user experience. +toc: true +topics: + - b2c + - ciam + - branding + - universal-login + - login-pages + - password-reset-pages + - custom-domains + - error-pages +contentType: concept +useCase: + - user-logout +--- +# Branding + +<%= include('../../_includes/_branding/_introduction.md', { platform: 'b2c' }) %> + +## Universal login and login pages + +<%= include('../../_includes/_branding/_universal-login.md', { platform: 'b2c' }) %> + +## Custom domain naming + +<%= include('../../_includes/_branding/_custom-domain-naming.md', { platform: 'b2c' }) %> + +## Email template customization + +<%= include('../../_includes/_branding/_email-templates.md', { platform: 'b2c' }) %> + +## Password reset page customization + +<%= include('../../_includes/_branding/_password-reset.md', { platform: 'b2c' }) %> + +## Error page customization + +<%= include('../../_includes/_branding/_error-page.md', { platform: 'b2c' }) %> + +## Guardian multi-factor page customization + +<%= include('../../_includes/_branding/_guardian.md', { platform: 'b2c' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2c' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2c', self: 'branding' }) %> diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-deployment.md b/articles/architecture-scenarios/implementation/b2c/b2c-deployment.md new file mode 100644 index 0000000000..896280664b --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-deployment.md @@ -0,0 +1,24 @@ +--- +title: Deployment Automation +description: How Auth0 tooling helps to automate tenant deployment. +topics: + - b2c + - ciam + - tenants + - deployment +contentType: concept +useCase: + - tenant-deployment +--- + +# Deployment Automation + +<%= include('../../_includes/_deployment/_introduction.md', { platform: 'b2c' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2c' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2c', self: 'deployment' }) %> diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-launch.md b/articles/architecture-scenarios/implementation/b2c/b2c-launch.md new file mode 100644 index 0000000000..8eed687f5e --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-launch.md @@ -0,0 +1,30 @@ +--- +classes: topic-page +title: Launch Preparation +description: Launch preparation considerations for your B2C IAM implementation. +topics: + - b2c + - ciam + - launch +contentType: concept +useCase: + - launch +--- +# Launch Preparation + +<%= include('../../_includes/_launch/_introduction.md', { platform: 'b2c' }) %> +<%= include('../../../_includes/_topic-links', { links: [ + 'architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-tenantcheck', + 'architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-testing', + 'architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-operations', + 'architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-compliance', + 'architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-support', + 'architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-launch' + ] }) %> + +## Project Planning Guide +<%= include('../../_includes/_planning.md', { platform: 'b2c' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2c', self: 'launch' }) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-compliance.md b/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-compliance.md new file mode 100644 index 0000000000..1712d77cc6 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-compliance.md @@ -0,0 +1,24 @@ +--- +title: Compliance Readiness +description: Compliance checks to perform before launch of your B2C IAM implementation. +topics: + - b2c + - ciam + - launch + - compliance +contentType: concept +useCase: + - launch +--- + +# Compliance + +<%= include('../../../_includes/_launch/_compliance.md', { platform: 'b2c' }) %> + +# Project Planning Guide + +<%= include('../../../_includes/_planning.md', { platform: 'b2c' }) %> + +# Keep reading + +<%= include('../../../_includes/_keep-reading.md', { platform: 'b2c', self: '*ignore*' }) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-launch.md b/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-launch.md new file mode 100644 index 0000000000..3459fb54f8 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-launch.md @@ -0,0 +1,23 @@ +--- +title: Launch Day Preparation +description: Launch preparation considerations for your B2C IAM implementation. +topics: + - b2c + - ciam + - launch +contentType: concept +useCase: + - launch +--- + +# Launch Day Readiness + +<%= include('../../../_includes/_launch/_launch.md', { platform: 'b2c' }) %> + +# Project Planning Guide + +<%= include('../../../_includes/_planning.md', { platform: 'b2c' }) %> + +# Keep reading + +<%= include('../../../_includes/_keep-reading.md', { platform: 'b2c', self: '*ignore*' }) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-operations.md b/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-operations.md new file mode 100644 index 0000000000..eb2a8942e8 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-operations.md @@ -0,0 +1,24 @@ +--- +title: Operations Readiness +description: Operations checks to perform before launch of your B2C IAM implementation. +topics: + - b2c + - ciam + - launch + - operations +contentType: concept +useCase: + - launch +--- + +# Operational Readiness + +<%= include('../../../_includes/_launch/_operations.md', { platform: 'b2c' }) %> + +# Project Planning Guide + +<%= include('../../../_includes/_planning.md', { platform: 'b2c' }) %> + +# Keep reading + +<%= include('../../../_includes/_keep-reading.md', { platform: 'b2c', self: '*ignore*' }) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-support.md b/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-support.md new file mode 100644 index 0000000000..188827213e --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-support.md @@ -0,0 +1,23 @@ +--- +title: Support Readiness +description: Support readiness for the launch of your B2C IAM implementation. +topics: + - b2c + - ciam + - launch + - support +contentType: concept +useCase: + - launch +--- + +# Support Readiness + +<%= include('../../../_includes/_launch/_support.md', { platform: 'b2c' }) %> + +# Project Planning Guide +<%= include('../../../_includes/_planning.md', { platform: 'b2c' }) %> + +# Keep reading + +<%= include('../../../_includes/_keep-reading.md', { platform: 'b2c', self: '*ignore*' }) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-tenantcheck.md b/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-tenantcheck.md new file mode 100644 index 0000000000..dc54e51cb3 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-tenantcheck.md @@ -0,0 +1,24 @@ +--- +title: Tenant Check +description: Tenant Checks to perform before launch of your B2C IAM implementation. +topics: + - b2c + - ciam + - launch + - configuration +contentType: concept +useCase: + - launch +--- + +# Tenant configuration check + +<%= include('../../../_includes/_launch/_tenant-check.md', { platform: 'b2c' }) %> + +# Project Planning Guide + +<%= include('../../../_includes/_planning.md', { platform: 'b2c' }) %> + +# Keep reading + +<%= include('../../../_includes/_keep-reading.md', { platform: 'b2c', self: '*ignore*' }) %> \ No newline at end of file diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-testing.md b/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-testing.md new file mode 100644 index 0000000000..6e313784cb --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-launch/b2c-launch-testing.md @@ -0,0 +1,24 @@ +--- +title: Testing Complete +description: Testing preparation for the launch of your B2C IAM implementation. +topics: + - b2c + - ciam + - launch + - testing +contentType: concept +useCase: + - launch +--- + +# Testing + +<%= include('../../../_includes/_launch/_testing.md', { platform: 'b2c' }) %> + +# Project Planning Guide + +<%= include('../../../_includes/_planning.md', { platform: 'b2c' }) %> + +# Keep reading + +<%= include('../../../_includes/_keep-reading.md', { platform: 'b2c', self: '*ignore*' }) %> diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-logout.md b/articles/architecture-scenarios/implementation/b2c/b2c-logout.md new file mode 100644 index 0000000000..79659c64c7 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-logout.md @@ -0,0 +1,23 @@ +--- +title: Logout +description: User logout planning considerations for your B2C IAM implementation. +topics: + - b2c + - ciam + - logout + - sessions +contentType: concept +useCase: + - user-logout +--- +# Logout + +<%= include('../../_includes/_logout/_introduction.md', { platform: 'b2c' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2c' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2c', self: 'logout' }) %> diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-operations.md b/articles/architecture-scenarios/implementation/b2c/b2c-operations.md new file mode 100644 index 0000000000..b10ab32dcc --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-operations.md @@ -0,0 +1,49 @@ +--- +title: Operations +description: How to operationalize your Auth0 tenant environments. +toc: true +topics: + - b2c + - ciam + - tenants + - operations +contentType: concept +useCase: + - tenant-operations +--- + +# Operations + +<%= include('../../_includes/_operations/_introduction.md', { platform: 'b2c' }) %> + +## Service status + +<%= include('../../_includes/_operations/_service-status.md', { platform: 'b2c' }) %> + +## Email provider setup + +<%= include('../../_includes/_operations/_email-provider.md', { platform: 'b2c' }) %> + +## Infrastructure + +<%= include('../../_includes/_operations/_infrastructure.md', { platform: 'b2c' }) %> + +## Logging + +<%= include('../../_includes/_operations/_logging.md', { platform: 'b2c' }) %> + +## Monitoring + +<%= include('../../_includes/_operations/_monitoring.md', { platform: 'b2c' }) %> + +## Notifications + +<%= include('../../_includes/_operations/_notifications.md', { platform: 'b2c' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2c' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2c', self: 'operations' }) %> diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-profile-mgmt.md b/articles/architecture-scenarios/implementation/b2c/b2c-profile-mgmt.md new file mode 100644 index 0000000000..5065318caf --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-profile-mgmt.md @@ -0,0 +1,48 @@ +--- +title: Profile Management +description: User profile management planning considerations for your B2C IAM implementation. +toc: true +topics: + - b2c + - ciam + - user-profiles +contentType: concept +useCase: + - profile-management + - manage-user-profiles +--- +# Profile Management + +<%= include('../../_includes/_profile-mgmt/_introduction.md', { platform: 'b2c' }) %> + +## Metadata + +<%= include('../../_includes/_profile-mgmt/_metadata.md', { platform: 'b2c' }) %> + +## Password reset + +<%= include('../../_includes/_profile-mgmt/_password-reset.md', { platform: 'b2c' }) %> + +## Account verification + +<%= include('../../_includes/_profile-mgmt/_account-verification.md', { platform: 'b2c' }) %> + +## Blocking users + +<%= include('../../_includes/_profile-mgmt/_blocking-users.md', { platform: 'b2c' }) %> + +## Linking user accounts + +<%= include('../../_includes/_profile-mgmt/_linking-accounts.md', { platform: 'b2c' }) %> + +## De-provisioning + +<%= include('../../_includes/_profile-mgmt/_de-provisioning.md', { platform: 'b2c' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2c' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2c', self: 'profile-mgmt' }) %> diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-provisioning.md b/articles/architecture-scenarios/implementation/b2c/b2c-provisioning.md new file mode 100644 index 0000000000..df2c065de1 --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-provisioning.md @@ -0,0 +1,39 @@ +--- +title: Provisioning +description: User provisioning functionality and considerations for your B2C IAM implementation. +toc: true +topics: + - b2c + - ciam + - user-migration + - custom-db + - universal-login + - user-profiles +contentType: concept +useCase: + - user-provisioning + - store-user-data +--- +# Provisioning + +<%= include('../../_includes/_provisioning/_introduction.md', { platform: 'b2c' }) %> + +## User migration + +<%= include('../../_includes/_provisioning/_user-migration.md', { platform: 'b2c' }) %> + +## Self sign up + +<%= include('../../_includes/_provisioning/_self-signup.md', { platform: 'b2c' }) %> + +## Social sign up + +<%= include('../../_includes/_provisioning/_social-signup.md', { platform: 'b2c' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2c' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2c', self: 'provisioning' }) %> diff --git a/articles/architecture-scenarios/implementation/b2c/b2c-qa.md b/articles/architecture-scenarios/implementation/b2c/b2c-qa.md new file mode 100644 index 0000000000..e27135e1cf --- /dev/null +++ b/articles/architecture-scenarios/implementation/b2c/b2c-qa.md @@ -0,0 +1,36 @@ +--- +title: Quality Assurance +description: Quality Assurance considerations for your B2C IAM implementation. +toc: true +topics: + - qa + - b2c + - ciam + - quality +contentType: concept +useCase: + - quality-assurance +--- +# Quality Assurance + +<%= include('../../_includes/_qa/_introduction.md', { platform: 'b2c' }) %> + +## Unit testing + +<%= include('../../_includes/_qa/_unit-testing.md', { platform: 'b2c' }) %> + +## Integration testing + +<%= include('../../_includes/_qa/_integration-testing.md', { platform: 'b2c' }) %> + +## Mock testing + +<%= include('../../_includes/_qa/_mock-testing.md', { platform: 'b2c' }) %> + +## Project Planning Guide + +<%= include('../../_includes/_planning.md', { platform: 'b2c' }) %> + +## Keep reading + +<%= include('../../_includes/_keep-reading.md', { platform: 'b2c', self: 'qa' }) %> diff --git a/articles/architecture-scenarios/implementations/mobile-api/api-implementation-nodejs.md b/articles/architecture-scenarios/implementations/mobile-api/api-implementation-nodejs.md deleted file mode 100644 index f23828c963..0000000000 --- a/articles/architecture-scenarios/implementations/mobile-api/api-implementation-nodejs.md +++ /dev/null @@ -1,248 +0,0 @@ ---- -description: The Node.js implementation of the API for the Mobile + API architecture scenario -url: /architecture-scenarios/application/mobile-api/api-implementation-nodejs -toc: true ---- - -# Mobile + API: Node.js Implementation for the API - -This document is part of the [Mobile + API Architecture Scenario](/architecture-scenarios/application/mobile-api) and it explains how to implement the API in Node.js. Please refer to the scenario for information on the implemented solution. - -::: note -The full source code for the Node.js API implementation can be found in [this GitHub repository](https://github.com/auth0-samples/auth0-pnp-exampleco-timesheets/tree/master/timesheets-api/node). -::: - -## 1. Define the API endpoints - -We will use the [Express web application framework](http://expressjs.com/) to build our Node.js API. - -### Create a package.json File - -Create a folder for your API, navigate into it and run `npm init`. This will setup your `package.json` file. - -You can leave the default settings or change them as you see fit. - -Our sample's `package.json` looks like the following: - -```json -{ - "name": "timesheets-api", - "version": "1.0.0", - "description": "API used to add timesheet entries for employees and contractors", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/auth0-samples/auth0-pnp-timesheets.git" - }, - "author": "Auth0", - "license": "MIT", - "bugs": { - "url": "https://github.com/auth0-samples/auth0-pnp-timesheets/issues" - }, - "homepage": "https://github.com/auth0-samples/auth0-pnp-timesheets#readme" -} -``` - -### Install the Dependencies - -Next, we need to set our dependencies. We will use the following modules: - -- **express**: This module adds the [Express web application framework](https://expressjs.com/). - -- **cors**: This module adds support for enabling [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) which is required since the API will be called from a Single Page Application running on a different domain inside a web browser. - -- **jwks-rsa**: This library retrieves RSA signing keys from a **JWKS** (JSON Web Key Set) endpoint. Using `expressJwtSecret` we can generate a secret provider that will provide the right signing key to `express-jwt` based on the `kid` in the JWT header. For more information refer to the [node-jwks-rsa GitHub repository](https://github.com/auth0/node-jwks-rsa). - -- **express-jwt**: This module lets you authenticate HTTP requests using JWT tokens in your Node.js applications. It provides several functions that make working with JWTs easier. For more information refer to the [express-jwt GitHub repository](https://github.com/auth0/express-jwt). - -- **body-parser**: This is a Node.js body parsing middleware. It extracts the entire body portion of an incoming request stream and exposes it on `req.body` as something easier to interface with.For more information and several alternatives refer to the body-parser GitHub repository. - -To install these dependencies run the following: - -```bash -npm install express cors express-jwt jwks-rsa body-parser express-jwt-authz --save -``` - -### Implement the Endpoints - -Navigate to your API directory and create a `server.js` file. Your code needs to: - -- Get the dependencies. -- Implement the endpoint(s). -- Launch the API server. - -This is our sample implementation: - -```js -const express = require('express'); -const app = express(); -const jwt = require('express-jwt'); -const jwksRsa = require('jwks-rsa'); -const cors = require('cors'); -const bodyParser = require('body-parser'); - -// Enable CORS -app.use(cors()); - -// Enable the use of request body parsing middleware -app.use(bodyParser.json()); -app.use(bodyParser.urlencoded({ - extended: true -})); - -// Create timesheets API endpoint -app.post('/timesheets', function(req, res){ - res.status(201).send({message: "This is the POST /timesheets endpoint"}); -}) - -// Launch the API Server at localhost:8080 -app.listen(8080); -``` - -Launch your API server using `node server` and make an HTTP POST request to `localhost:8080/timesheets`. You should see a JSON response with the message `This is the POST /timesheets endpoint`. - -So now we have our endpoint but anyone can call it. Continue to the next paragraph to see how we can fix this. - -## 2. Secure the API endpoints - -In order to validate our token we will use the `jwt` function, provided by the [express-jwt middleware](https://github.com/auth0/express-jwt#usage), and the `jwks-rsa` to retrieve our secret. The libraries do the following: - -1. `express-jwt` will decode the token and pass the request, the header and the payload to `jwksRsa.expressJwtSecret`. - -1. `jwks-rsa` will then download all signing keys from the JWKS endpoint and see if a one of the signing keys matches the `kid` in the header of the JWT. If none of the signing keys match the incoming `kid`, an error will be thrown. If we have a match, we will pass the right signing key to `express-jwt`. - -1. `express-jwt` will the continue its own logic to validate the signature of the token, the expiration, `audience` and the `issuer`. - -The steps we will follow in our code are: - -- Create the middleware function to validate the Access Token. -- Enable the use of the middleware in our routes. - -You can also write some code to actually save the timesheet to a database. This is our sample implementation (some code is omitted for brevity): - -```js -// set dependencies - code omitted - -// Enable CORS - code omitted - -// Create middleware for checking the JWT -const checkJwt = jwt({ - // Dynamically provide a signing key based on the kid in the header and the singing keys provided by the JWKS endpoint - secret: jwksRsa.expressJwtSecret({ - cache: true, - rateLimit: true, - jwksRequestsPerMinute: 5, - jwksUri: `https://${account.namespace}/.well-known/jwks.json` - }), - - // Validate the audience and the issuer - audience: '{YOUR_API_IDENTIFIER}', //replace with your API's audience, available at Dashboard > APIs - issuer: 'https://${account.namespace}/', - algorithms: [ 'RS256' ] -}); - -// Enable the use of request body parsing middleware - code omitted - -// create timesheets API endpoint - code omitted -app.post('/timesheets', checkJwt, function(req, res){ - var timesheet = req.body; - - // Save the timesheet to the database... - - //send the response - res.status(201).send(timesheet); -}); -// launch the API Server at localhost:8080 - code omitted -``` - -If we launch our server now and do an HTTP POST to `localhost:8080/timesheets` we should get the error message `Missing or invalid token` (which is perfectly fine since we didn’t send an Access Token in our request). - -In order to test the working scenario as well we need to: - -- Get an Access Token. For details on how to do so refer to: [Get an Access Token](/architecture-scenarios/application/server-api#get-an-access-token). -- Invoke the API while adding an `Authorization` header to our request with the value `Bearer ACCESS_TOKEN` (where *ACCESS_TOKEN* is the value of the token we retrieved in the first step). - -## 3. Check the application permissions - -In this step we will add to our implementation the ability to check if the application has permissions (or `scope`) to use our endpoint in order to create a timesheet. In particular we want to ensure that the token has the correct scope, which is `batch:upload`. - -In order to do this we will make use of the `express-jwt-authz` Node.js package, so go ahead and add that to your project: - -```bash -npm install express-jwt-authz --save -``` - -Now it is as simple as adding a call to `jwtAuthz(...)` to your middleware to ensure that the JWT contain a particular scope in order to execute a particular endpoint. - -We will add an additional dependency. The **express-jwt-authz** library, which is used in conjunction with express-jwt, validates the [JWT](/jwt) and ensures it bears the correct permissions to call the desired endoint. For more information refer to the [express-jwt-authz GitHub repository](https://github.com/auth0/express-jwt-authz). - -This is our sample implementation (some code is omitted for brevity): - -```js -// set dependencies - some code omitted -const jwtAuthz = require('express-jwt-authz'); - -// Enable CORS - code omitted - -// Create middleware for checking the JWT - code omitted - -// Enable the use of request body parsing middleware - code omitted - -// create timesheets API endpoint -app.post('/timesheets', checkJwt, jwtAuthz(['create:timesheets']), function(req, res){ - var timesheet = req.body; - - // Save the timesheet to the database... - - //send the response - res.status(201).send(timesheet); -}) - -// launch the API Server at localhost:8080 - code omitted -``` - -If we invoke our API with a token that does not include this scope we should get the error message Forbidden with the HTTP status code `403`. You can test this by removing this scope from your API. - -## 4. Determine the User Identity - -The `express-jwt` middleware which is used to validate the JWT, also sets the `req.user` with the information contained in the JWT. If you want to use the `sub` claim to identify the user uniquely, you can simply use `req.user.sub`. - -In the case of the timesheets application however, we want to use the email address of the user as the unique identifier. - -The first thing we need to do is to write a rule which will add the email address of the user to the `access_token`. Go to the [Rules section](${manage_url}/#/rules}) of the Dashboard and click on the __Create Rule__ button. - -You can give the rule a descriptive name, for example `Add email to Access Token`, and then use the following code for the rule: - -```js -function (user, context, callback) { - const namespace = 'https://api.exampleco.com/'; - context.accessToken[namespace + 'email'] = user.email; - callback(null, user, context); -} -``` - -The `namespace` is used to ensure the claim has a unique name and does not clash with the names of any of the standard OIDC claims. You can typically use the URL of your application or API as the namespace. - -::: note -For more information on namespaced claims, refer to [User profile claims and scope](/api-auth/tutorials/adoption/scope-custom-claims). -::: - -Next, inside your API, you can retrieve the value of the claim from `req.user`, and use that as the unique user identity which you can associate with timesheet entries. - -```js -app.get('/timesheets', checkJwt, jwtAuthz(['read:timesheets']), function(req, res) { - var timesheet = req.body; - - // Associate the timesheet entry with the current user - var userId = req.user['https://api.exampleco.com/email']; - timesheet.user_id = userId; - - // Save the timesheet to the database... - - //send the response - res.status(201).send(timesheet); -}); -``` \ No newline at end of file diff --git a/articles/architecture-scenarios/implementations/mobile-api/mobile-implementation-android.md b/articles/architecture-scenarios/implementations/mobile-api/mobile-implementation-android.md deleted file mode 100644 index 19ac56e82f..0000000000 --- a/articles/architecture-scenarios/implementations/mobile-api/mobile-implementation-android.md +++ /dev/null @@ -1,1406 +0,0 @@ ---- -description: The Android implementation of the API for the Mobile + API architecture scenario -url: /architecture-scenarios/application/mobile-api/mobile-implementation-android -toc: true ---- - -# Mobile + API: Android Implementation for the Mobile App - -This document is part of the [Mobile + API Architecture Scenario](/architecture-scenarios/application/mobile-api) and it explains how to implement the mobile application in Android. Please refer to the scenario for information on the implemented solution. - -## 1. Set Up the Application - -<%= include('../../../_includes/_package', { - org: 'auth0-samples', - repo: 'auth0-pnp-exampleco-timesheets', - path: 'timesheets-mobile/android', - requirements: [ - 'Android Studio 2.3', - 'Android SDK 25', - 'Emulator - Nexus 5X - Android 6.0' - ] -}) %> - -### Set the Dependencies - -For this implementation, we will use the following dependencies within the app’s `build.gradle` file: - -- [Auth0.Android](https://github.com/auth0/Auth0.Android): this package enables integration with Auth0 to authenticate users. -- [OkHttp](http://square.github.io/okhttp/): this package provides an HTTP application to make requests to the Node.JS API. -- [JWTDecode.Android](https://github.com/auth0/JWTDecode.Android): this package will assist with decoding JWTs. -- AppCompat: this package lets us use the toolbar widget for navigation in our activities. - -```gradle -dependencies { - compile 'com.squareup.okhttp:okhttp:2.7.5' - compile 'com.auth0.android:auth0:1.10.0' - compile 'com.auth0.android:jwtdecode:1.1.1' - compile 'com.android.support:appcompat-v7:25.3.1' - testCompile 'junit:junit:4.12' -} -``` - -### Update the Manifest - -Open the application's `AndroidManifest.xml` and add the internet permission: - -```xml - -``` - -We’ll also update the application details to utilize the Toolbar widget: - -```xml - - -``` - -### Set Configuration Values - -Set your Auth0 Client ID, Auth0 Domain, and API’s url in the `strings.xml` resource located in `/res/values/strings.xml`: - -```xml - - ExampleCo Timesheets - Log in - ... - ... - http://10.0.2.2:8080/timesheets - -``` - -### Create Package Structure - -For this implementation, create directories for activities, models, and utils in the application package. - -- `activities/`: this package will contain the `LoginActivity.java`, `TimeSheetActivity.java`, `FormActivity.java`, and `UserActivity.java`. -- `models/`: this package will contain the `TimeSheet.java` and `User.java` data models. -- `utils/`: this package will contain the `UserProfileManager.java`, `TimeSheetAdapter.java`, and `ImageTask.java` - -## 2. Authorize the User - -### Update the Manifest - -Open the app's `AndroidManifest.xml` and add the `LoginActivity`: - -```xml - - - - - - - - - - - - - - - - -``` - -### Create the Login Activity Layout - -Next create `login_activity.xml`, the layout for the `LoginActivity`: - -```xml - - - - - -
    • - Invite-Only Applications + User Invitation Applications

      - Using Auth0 with invite-only applications, which are those where access is limited to a select group of previously-identified users. + Using Auth0 with applications where an administrator creates the user account and then invites the user to complete the signup process by setting a password.

    • diff --git a/articles/design/using-auth0-with-multi-tenant-apps.md b/articles/design/using-auth0-with-multi-tenant-apps.md index 2e7057a9b3..3aa8e483a1 100644 --- a/articles/design/using-auth0-with-multi-tenant-apps.md +++ b/articles/design/using-auth0-with-multi-tenant-apps.md @@ -1,44 +1,72 @@ --- -description: This articles discusses how you can use Auth0 with multi-tenant applications. +description: This article discusses how you can use Auth0 to secure multi-tenant applications. crews: crew-2 toc: true +topics: + - design + - multi-tenancy +contentType: concept +useCase: strategize --- -# Using Auth0 with Multi-Tenant Applications -In this article, we will discuss (at a high-level) how Auth0 can help you manage users for your multi-tenant applications. +# Using Auth0 to Secure Your Multi-Tenant Applications -Multi-tenancy refers to the software architecture principle where a single instance of software runs on a server that is accessible to multiple groups of users. +This article provides a high-level overview of how Auth0 can help you manage your multi-tenant applications. -When working with multi-tenant software, you can serve multiple customers from a single application instance running on one server (or pool of servers). This contrasts with single-tenant software, where you serve each customer with a dedicated software instance running on dedicated servers. In summation: +## What is multi-tenancy -| Tenancy Type | Definition | -| - | - | -| Multi-Tenant | One instance, multiple customers | -| Single-Tenant | One instance, one customer | +[Multi-tenancy](https://en.wikipedia.org/wiki/Multitenancy) is when a single instance of software runs on a server that is accessible to multiple groups of users. -We define **tenant** as a group of users who share access to one particular application instance. One example of this includes a company with multiple employees, all of whom have access to your SaaS offering. +Auth0's Public Cloud is an example of a multi-tenant application. Your applications, settings, and connections are a single tenant, which shares resources with other tenants in the Public Cloud. -When you use a multi-tenant setup, one single instance of your SaaS offering would be shared across multiple tenants (or multiple companies), each of whom has its own group of employees. However, each tenant has a dedicated share of that instance, and you can then customize each share to meet the needs of the tenant that's using it. Such customization includes (but isn't limited to) branding, functionality, and access control. +Please note that this article is **not about using multiple Auth0 tenant(s)**. It is about using Auth0 to secure your own multi-tenant application. -## Auth0 and Multi-Tenancy +## Auth0 and multi-tenancy -By using a single Auth0 tenant for all of *your* customers, you maintain simplicity in your architecture and are able to manage all of your authentication flows in one place. The primary method by which you can handle multi-tenancy is to use multiple [connections](identityproviders). +There are several ways you can secure multi-tenant applications with Auth0. You can handle your multi-tenancy needs with one of the following approaches: -::: note -We recommend that you [create multiple Auth0 tenants](https://github.com/auth0/auth0-multitenant-spa-api-sample) only if you need to share access to the Auth0 Dashboard with individual customers. -::: +* [Use multiple connections](#use-multiple-connections) +* [Identify different tenants by application](#identify-tenants-by-application) +* [Store tenant details in app_metadata](#store-tenant-details-in-app_metadata) +* [Use separate Auth0 tenants](#create-separate-auth0-tenants-for-each-customer) -## Use Multiple Connections +### Use multiple connections + +You can use multiple connections to handle your tenants. Each connection would represent and contain a different pool of users. ::: warning -Auth0 enforces a limit of 50 Database Connections for each [application](/applications). Users with Enterprise agreements do not have any Database Connections limits. +If you use [Lock](/libraries/lock) in your applications, Lock supports a maximum of **50 Database Connections** per [application](/applications). Enterprise Connections are not affected by this limit. If you use the New Universal Login Experience, Lock is not involved and this limitation therefore does not affect you. ::: -While using multiple [Connections](/identityproviders) introduces additional layers of complexity, there are several scenarios where this option might make sense: +Using multiple [Connections](/identityproviders) introduces additional layers of complexity, but there are several scenarios where the upsides of this option outweigh the downsides: * You have different Connection-level requirements, such as varying password policies, for each of your Applications. -* You have users from different Connections. For example, one app may have users providing username/password credentials, while another app handles Enterprise logins. +* You have user pools from different Connections. For example, one app may have users providing username/password credentials, while another app handles Enterprise logins. + +To implement this, you can call `/authorize` with a connection specified for the user, using the `connection` option in the [Auth0 SPA SDK](/libraries/auth0-spa-js), or by passing a `connection` parameter to the `authorize()` method in [Auth0.js](/libraries/auth0js/v9). ::: note -For additional assistance on how you can customize Auth0, please contact [Sales](https://auth0.com/?contact=true) to discuss possible architecture scenarios. +There are entity limits which may apply when using Auth0 libraries. See [Entity Limit Policy](/policies/entity-limits) for details. ::: + +### Identify tenants by application + +You can represent each of your tenants with a separate application in Auth0. + +Representing each of your tenants with an application allows you to configure each one differently. You can also enable/disable [connections](/connections) for individual applications if your tenants have varying requirements. Doing so, however, requires you to track the tenants to which your users belong within your application. Then, when they log in, you will need to specify the application they are to use. + +### Store tenant details in app_metadata + +Storing tenant details in the user [metadata](/users/concepts/overview-user-metadata#metadata-usage) is the simplest of the implementation scenarios we cover in this article. + +Using the identifier of your choice (e.g., `"tenant": "customer_12345"`), you can store tenant related details in the `app_metadata`. Doing so allows all of your users, regardless of which tenant to which they belong, to log in using one uniform method. + +You can check for this value in your application after users log in and are redirected. This will help you sort users. + +### Create separate Auth0 tenants for each customer + +You can create a new Auth0 tenant for each of your application's tenants. + +We recommend that you follow this approach only if you need to share access to the Auth0 Dashboard with individual customers. Otherwise, one of the above solutions is a more practical and easy to manage one than attempting to manage many Auth0 tenant dashboards, which is also not a scalable solution as your customer base grows. + +This method requires you to use a different set of Auth0 credentials when calling Auth0 APIs to authenticate users belonging to each customer, because you would be using different applications on different Auth0 tenants (with different Client IDs) for each of your customers. diff --git a/articles/design/web-apps-vs-web-apis-cookies-vs-tokens.md b/articles/design/web-apps-vs-web-apis-cookies-vs-tokens.md index d59ca69e09..534c8d6a6f 100644 --- a/articles/design/web-apps-vs-web-apis-cookies-vs-tokens.md +++ b/articles/design/web-apps-vs-web-apis-cookies-vs-tokens.md @@ -1,15 +1,19 @@ --- description: This page compares web applications to web APIs and cookies vs. Tokens. +topics: + - design + - web-apps + - cookies + - tokens + - apis +contentType: concept +useCase: strategize --- # Web Apps vs Web APIs / Cookies vs Tokens * For us **Web Apps** are the traditional server-side applications that use **cookie-based authentication**. -* **Web APIs**, on the other hand, represent for us a new breed of applications, typically single page apps (like Angular, Ember, Backbone, and so on) or native mobile apps (like iOS, Android, and so on) which consume APIs (written in Node, Ruby, ASP.NET or even a mix of those) and will benefit from **token based authentication**. - -::: note -Before moving forward, you might want to read these articles for more context: [Cookies vs Tokens. Getting auth right with Angular.JS](https://auth0.com/blog/2014/01/07/angularjs-authentication-with-cookies-vs-token/) and [10 Things You Should Know about Tokens](https://auth0.com/blog/2014/01/27/ten-things-you-should-know-about-tokens-and-cookies/). -::: +* **Web APIs**, on the other hand, represent for us a new breed of applications, typically single-page apps (like Angular, Ember, Backbone, and so on) or native mobile apps (like iOS, Android, and so on) which consume APIs (written in Node, Ruby, ASP.NET or even a mix of those) and will benefit from **token based authentication**. * **Cookie-based authentication** is implemented by each web platform differently, but at the end of the day, they all end up setting some cookie (tied to a session on the server) which represents the "authenticated user". On each request, that cookie is sent and the session is deserialized from some store (in memory if it's a single server or some persistent storage if it's a server farm). We provide SDKs for most of the platforms that will tie into the corresponding authentication subsystem (such as passport on node, IPrincipal on .NET or Java, and so on). @@ -17,6 +21,8 @@ Before moving forward, you might want to read these articles for more context: [ * For both approaches you can get the **same amount of information from the user**. That's controlled by the `scope` parameter sent in the login request (either using the [Auth0Lock](/lock), our [JavaScript library](https://github.com/auth0/auth0.js) or a plain link). The `scope` is a parameter of the `.signin({scope: 'openid name email'})` method which ends up being part of the querystring in the login request. You can get more details about this in the [Scopes Documentation](/scopes). -* By default we use `scope=openid` in **token-based authentication** to avoid having a huge token. You can control any [standard OpenID Connect claims](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) that you want to get in the token by adding them as scope values. For example, `scope=openid name email family_name address phone_number`. +* By default we use `scope=openid` in **token-based authentication** to avoid having a huge token. You can control any [standard OpenID Connect (OIDC) claims](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) that you want to get in the token by adding them as scope values. For example, `scope=openid name email family_name address phone_number`. + +* Finally, you can **mix token-based authentication** with **cookie-based authentication**. Take into account that cookies will work just fine if the web app and the API are served from the same domain, so you might not need token based authentication. Now, if you need to, we also return a JWT on the web app flow. Each of our SDKs will do it differently. If you want to call your APIs from JavaScript (instead of using the existing cookie), then somehow you have to set the ID Token in your webpage. One way of doing it is by setting it on your layout/master page--something like `window.token = ${"<%= id_token %>;"}`--and then getting it from anywhere in your JavaScript code. -* Finally, you can **mix token-based authentication** with **cookie-based authentication**. Take into account that cookies will work just fine if the web app and the API are served from the same domain, so you might not need token based authentication. Now, if you need to, we also return a JWT on the web app flow. Each of our SDK will do it differently. If you want to call your APIs from JavaScript (instead of using the existing cookie) then somehow you have to set the `id_token` in your webpage. One way of doing it is by setting it on your layout/master page something like `window.token = ${"<%= id_token %>;"}` and then you get it from anywhere in your JavaScript code. +<%= include('../_includes/_samesite_none') %> \ No newline at end of file diff --git a/articles/dev-centers/java.md b/articles/dev-centers/java.md index e385db98ab..7d3e89fcb1 100644 --- a/articles/dev-centers/java.md +++ b/articles/dev-centers/java.md @@ -2,6 +2,10 @@ title: Java Developer Center description: Resources and documentation for Java developers logo: java +topics: + - java +contentType: reference +useCase: strategize --- # Java SDK Developer Center @@ -10,7 +14,7 @@ Here at Auth0 we try to offer as many libraries as needed to ensure we make your ## Java Servlet -A simple servlet based solution, suitable if you are using a legacy application or alternate Web MVC Framework without Spring support. If your application only needs secured endpoints and the ability to programmatically work with a Principal object for GrantedAuthority checks this library is a good fit. +A simple servlet based solution, suitable if you are using a legacy application or alternate Web MVC Framework without Spring support. If your application only needs secured endpoints and the ability to programmatically work with a Principal object for GrantedAuthority checks, this library is a good fit. - [Documentation](/server-platforms/java) - [Library](https://github.com/auth0/auth0-servlet) @@ -22,9 +26,8 @@ A modern Java Spring library that allows you to use Auth0 with Java Spring for s - [Documentation](/server-platforms/java-spring-mvc) - [Library](https://github.com/auth0/auth0-spring-mvc) -- [Sample Project](https://github.com/auth0-samples/auth0-spring-mvc-sample): Simple sample project that demonstrates using Auth0 with Java Spring to create a Secured MVC Web Application. -- [Sample Project demonstrating Lock, auth0.js, Social Connection Login, Database Connection and Account Linking](https://github.com/auth0-samples/auth0-spring-boot-social-dbconnection-link): Extends the simpler [Auth0 Spring MVC Sample Project](https://github.com/auth0-samples/auth0-spring-mvc-sample) and demonstrates Social Login, Database Connection Login and [account linking](/link-accounts). In this app, you can choose to login either with a Social Login or a Database Connection. If you login using Social Login and have not already linked you DB Connection then you are requested to do so. You can find details on how to setup and use this sample application in the _README_ of the [GitHub repository](https://github.com/auth0-samples/auth0-spring-boot-social-dbconnection-link). -- [Sample Project demonstrating Passwordless Authentication, Multifactor Authentication opt-in & account linking](https://github.com/auth0-samples/auth0-spring-mvc-passwordless-mfa-sample): Extends the simpler [Auth0 Spring MVC Sample Project](https://github.com/auth0-samples/auth0-spring-mvc-sample) and demonstrates using Auth0 (including Lock Passwordless and Auth0.js) with Java Spring to create a Secured MVC Web Application using [Passwordless Authentication](/connections/passwordless), [Multifactor Authentication](/multifactor-authentication) Opt-in & [account linking](/link-accounts). You can find details on how to setup and use this sample application in the _README_ of the [GitHub repository](https://github.com/auth0-samples/auth0-spring-mvc-passwordless-mfa-sample. +- [Sample Project](https://github.com/auth0-samples/auth0-spring-mvc-sample): A simple sample project that demonstrates usage of Auth0 with Java Spring to create a Secured MVC Web Application. +- [Sample Project demonstrating Lock, auth0.js, Social Connection Login, Database Connection and Account Linking](https://github.com/auth0-samples/auth0-spring-boot-social-dbconnection-link): Extends the simpler [Auth0 Spring MVC Sample Project](https://github.com/auth0-samples/auth0-spring-mvc-sample) and demonstrates Social Login, Database Connection Login and [account linking](/users/concepts/overview-user-account-linking). In this app, you can choose to login either with a Social Login or a Database Connection. If you login using Social Login and have not already linked your DB Connection, then you are requested to do so. You can find details on how to setup and use this sample application in the _README_ of the [GitHub repository](https://github.com/auth0-samples/auth0-spring-boot-social-dbconnection-link). ## Java Spring Security MVC @@ -35,32 +38,32 @@ A modern Java Spring library that allows you to use Auth0 with Spring Security f - [Sample Project](https://github.com/auth0-samples/auth0-spring-security-mvc-sample) ::: panel Authorization Code Grant -All three technologies displayed above, adopt the `Oauth2 / OIDC Authorization Code Grant` flow in which authentication results in a callback to the server-side application with a `code`. This is then exchanged for [id_token](/tokens/id_token) and [access_token](/tokens/access_token) on the server-side (as part of the callback), and once the tokens have been received by the application, then `UserProfile` information can also be retrieved via request with a valid Token. +All three technologies displayed above, adopt the `Oauth2 / OIDC Authorization Code Grant` flow in which authentication results in a callback to the server-side application with a `code`. This is then exchanged for [ID Token](/tokens/id_token) and [Access Token](/tokens/access_token) on the server-side (as part of the callback) and once the tokens have been received by the application, then `UserProfile` information can also be retrieved via request with a valid Token. ::: ## Java Spring Security API -A modern Java Spring library that allows you to use Auth0 with Spring Security. Leverages Spring Boot dependencies. Validates the JWT from Auth0 in every API call to assert authentication according to configuration. This library would be suitable for headless APIs and SPA (single page application) backend end server scenarios. +A modern Java Spring library that allows you to use Auth0 with Spring Security. Leverages Spring Boot dependencies. Validates the JWT from Auth0 in every API call to assert authentication according to configuration. This library would be suitable for headless APIs and SPA (single-page application) backend end server scenarios. - [Documentation](/server-apis/java-spring-security) - [Library](https://github.com/auth0/auth0-spring-security-api) - [Sample Project](https://github.com/auth0-samples/auth0-spring-security-api-sample) -- [Companion SPA Applications](https://github.com/auth0-samples/auth0-spring-security-api-client-samples): Sample application that works as a companion for the [Auth0 Spring Security API Sample](https://github.com/auth0-samples/auth0-spring-security-api-sample) and [Auth0 Spring Security API Resource Server Sample](#auth0-resource-server-sample-using-spring-boot-and-spring-security). This sample provides an easy to understand seed project for users wishing to combine Java Spring Security API Server with a single page application front-end. The sample can run in two different modes: - - The SPA and API Server trust one another, and share the same Auth0 application information. In other words, they both have the same ClientId and therefore share the same Audience in their JWT Tokens. Hence the JWT Token received upon successful authentication in the SPA application is also passed in the Authorization Bearer header of the AJAX requests to the API Server. The API Server accepts the audience as it is the same as its own. - - The SPA application and API Server each have their own Auth0 Application on a shared Tenant (Account / Domain). In this situation, each has a different ClientId, and the Audience of the JWT Token generated for each application is different. The SPA application logs in and receives a JWT Token for authentication / authorization checks local to the SPA application. When making AJAX requests to the API Server, a delegation token is used instead - in effect, the SPA application swaps its own JWT Token for a JWT Token that is valid for requests to the API Server. +- [Companion SPA Applications](https://github.com/auth0-samples/auth0-spring-security-api-client-samples): A sample application that works as a companion for the [Auth0 Spring Security API Sample](https://github.com/auth0-samples/auth0-spring-security-api-sample) and [Auth0 Spring Security API Resource Server Sample](#auth0-resource-server-sample-using-spring-boot-and-spring-security). This sample provides an easy to understand seed project for users wishing to combine Java Spring Security API Server with a single-page application front-end. The sample can run in two different modes: + - The SPA and API Server trust one another and share the same Auth0 application information. In other words, they both have the same ClientId and therefore share the same Audience in their JWT Tokens. Hence the JWT Token received upon successful authentication in the SPA application is also passed in the Authorization Bearer header of the AJAX requests to the API Server. The API Server accepts the audience as it is the same as its own. + - The SPA application and API Server each have their own Auth0 Application on a shared Tenant (Account / Domain). In this situation, each has a different ClientId, and the Audience of the JWT Token generated for each application is different. The SPA application logs in and receives a JWT Token for authentication / authorization checks, local to the SPA application. When making AJAX requests to the API Server, a delegation token is used instead - in effect, the SPA application swaps its own JWT Token for a JWT Token that is valid for requests to the API Server. You can find details on how to setup and use this sample application at the _README_ of the [GitHub repository](https://github.com/auth0-samples/auth0-spring-security-api-client-samples/tree/master/auth0-spring-security-api-angular-client). -## Using Auth0 with Spring Boot and Spring Security for Single Sign On (SSO) +## Using Auth0 with Spring Boot and Spring Security for Single Sign-on (SSO) -We have created a [sample application](https://github.com/auth0-samples/auth0-spring-security-mvc-sso-sample) that demonstrates using Auth0 with Spring Boot and Spring Security to create two traditional server-side MVC web apps that are configured for Single Sign On with one another. `app1.com` is the main _portal_ website and `app2.com` is a _partner_ website that depends on `app1.com` for SSO authentication. The sample offers also one more _portal_ website, `app3.com`, which is a Single Page Application written in Angular 1.x. This is optional and provided for those wishing to do SSO with a mix of Server side and Single Page Apps. +We have created a [sample application](https://github.com/auth0-samples/auth0-spring-security-mvc-sso-sample) that demonstrates using Auth0 with Spring Boot and Spring Security to create two traditional server-side MVC web apps that are configured for SSO with one another. `app1.com` is the main _portal_ website and `app2.com` is a _partner_ website that depends on `app1.com` for Single Sign-on (SSO) authentication. The sample also offers one more _portal_ website, `app3.com`, which is a Single-Page Application written in Angular 1.x. This is optional and provided for those wishing to do SSO with a mix of Server side and Single-Page Apps. -The aim of this solution is to provide a simple, no-frills sample, developers can follow to understand the orchestration required to achieve SSO using Auth0 using Java, without having to also cope with understanding additional libraries or frameworks. +The aim of this solution is to provide a simple, no-frills sample that developers can follow to understand the orchestration required to achieve SSO using Auth0 using Java, without having to also cope with understanding additional libraries or frameworks. You can find more details on how to setup and use this sample application [here](https://github.com/auth0-samples/auth0-spring-security-mvc-sso-sample). ## Auth0 Resource Server Sample using Spring Boot and Spring Security -We have created a [sample application](https://github.com/auth0-samples/auth0-spring-security-api-resource-server-sample) that demonstrates using Auth0 with Spring Boot and Spring Security to create a secure Resource Server. This sample would be suitable for headless APIs and SPA (single page application) backend end server scenarios. It is specifically intended to demonstrate how to setup and read `scope` information from an Auth0 IDP JWT [Access Token](/tokens/access_token), and use this information to control authentication and authorization to secured endpoints. +We have created a [sample application](https://github.com/auth0-samples/auth0-spring-security-api-resource-server-sample) that demonstrates using Auth0 with Spring Boot and Spring Security to create a secure Resource Server. This sample would be suitable for headless APIs and SPA (single-page application) backend end server scenarios. It is specifically intended to demonstrate how to setup and read `scope` information from an Auth0 IDP JWT [Access Token](/tokens/access_token) as well as how to use this information to control authentication and authorization to secured endpoints. This sample application shows you how to: - Configure and run Java based Spring API server with Auth0 and Spring Security. diff --git a/articles/dev-lifecycle/child-tenants.md b/articles/dev-lifecycle/child-tenants.md index 2ca30101f0..3c2bdba948 100644 --- a/articles/dev-lifecycle/child-tenants.md +++ b/articles/dev-lifecycle/child-tenants.md @@ -1,13 +1,22 @@ --- description: How to request child tenants for your Auth0 tenant +topics: + - child-tenants + - dev-tools +contentType: how-to +useCase: + - support + - development --- # Child Tenant Request Process -This request process is for self-service customers requesting a development, test, or staging tenant that's linked to their paid production tenant. This tenant is called a **child tenant**. +This request process is for Developer or Developer Pro customers requesting a development, test, or staging tenant that's linked to their paid production tenant. This tenant is called a **child tenant**. -::: note Free tenants do not include a child tenant. + +::: warning +This policy does not apply if you have an Enterprise subscription. If you need to add child tenants to your subscription, contact your designated Technical Account Manager or our [Support](${env.DOMAIN_URL_SUPPORT}). ::: ## Child Tenant Policy diff --git a/articles/dev-lifecycle/index.md b/articles/dev-lifecycle/index.md index 6328251492..69cd2850f7 100644 --- a/articles/dev-lifecycle/index.md +++ b/articles/dev-lifecycle/index.md @@ -2,6 +2,12 @@ classes: topic-page title: Development Lifecycle description: Introduction to development lifecycle in Auth0. +topics: + - dev-tools +contentType: + - index + - how-to +useCase: development ---
      diff --git a/articles/dev-lifecycle/local-testing-and-development.md b/articles/dev-lifecycle/local-testing-and-development.md index 9b8b37a1bc..128c09eb32 100644 --- a/articles/dev-lifecycle/local-testing-and-development.md +++ b/articles/dev-lifecycle/local-testing-and-development.md @@ -1,32 +1,45 @@ --- description: How to develop and test Auth0 applications. +topics: + - dev-tools + - local-env +contentType: how-to +useCase: development --- # Work with Auth0 Locally In most cases, authenticating users through Auth0 requires an Internet connection. However, you can still develop and test apps that use Auth0 locally. In some cases, you might not need access to an Internet connection. ::: note -Please see [Setting Up Multiple Environments](/dev-lifecycle/setting-up-env) for information on structuring your development, test, and production environments when using Auth0. +See [Setting Up Multiple Environments](/dev-lifecycle/setting-up-env) for information on structuring your development, test, and production environments when using Auth0. ::: -## Use JSON Web Tokens (JWT) with Client-Side Applications +## Use JSON Web Tokens (JWT) with client-side applications -Because [JSON Web Tokens (JWT)](/jwt) are stateless (that is, the app that consumes them cares only about its contents, not any of its previous states), this is one of the easiest scenarios to test locally. +Because [JSON Web Tokens (JWT)](/tokens/concepts/jwts) are stateless (that is, the app that consumes them cares only about its contents, not any of its previous states), this is one of the easiest scenarios to test locally. You can obtain JWTs for testing using any of the following methods: -1. Create a test user for a database [connection](/identityproviders), and programatically log this user in. Essentially, you are using the recommended process for [calling an API using a highly-trusted application](/api-auth/grant/password). For detailed implementation instructions, see [Execute the Resource Owner Password Grant](/api-auth/tutorials/password-grant). +1. Create a test user for a database [connection](/identityproviders), and programmatically log this user in. Essentially, you are using the recommended process for [calling an API using a highly-trusted application](/api-auth/grant/password). For detailed implementation instructions, see [Execute the Resource Owner Password Grant](/api-auth/tutorials/password-grant). -2. Use a browser bot (such as Selenium) to play the role of a user, log in and retrieve a JWT. While this approach may take some effort to develop and maintain, it will allow you to test any [redirection rules](/rules/redirect) or [MFA prompts](/multifactor-authentication) that you have configured. +2. Use a browser bot (such as Selenium) to play the role of a user, log in and retrieve a JWT. While this approach may take some effort to develop and maintain, it will allow you to test any [redirection rules](/rules/redirect) or [MFA prompts](/mfa) that you have configured. -## Use Sessions with Server-Side Applications +## Use sessions with server-side applications Unless your server-side application allows the generation of artificial sessions for testing, you'll need a way to perform a login through Auth0 manually. -For a high-level overview of how to do this, see [Calling APIs from Server-side Web Apps](/api-auth/grant/authorization-code). For detailed implementation instructions, see [Execute an Authorization Code Grant Flow](/api-auth/tutorials/authorization-code-grant). +For a high-level overview of how to do this, see [Authorization Code Flow](/flows/concepts/auth-code). For detailed implementation instructions, see our tutorial, [Call API Using the Authorization Code Flow](/flows/guides/auth-code/call-api-auth-code). -## Use Local Domains with Auth0 +## Use local domains with Auth0 -If you're developing your application locally, you can use `localhost` and other domains inaccessible by Auth0 (such as those on an intranet) as callback URLs. +If you're developing your application locally, you can use `localhost` and other domains inaccessible by Auth0 (such as those on an intranet) as [callback URLs](/users/guides/redirect-users-after-login). For example, during development you could use `http://localhost:3000/callback` as the callback URL. -Because Auth0's main identity protocol is [OpenID Connect](/protocols), Auth0 never needs to directly call your application's server. Instead, Auth0 redirects users to your application's endpoint(s) with required information contained in a query string or hash fragment. +To set a callback URL, go to [Applications > Settings](${manage_url}/#/applications/${account.clientId}/settings) and add the URL to the **Allowed Callback URLs** list. + +Because Auth0's main identity protocol is OpenID Connect (OIDC), Auth0 never needs to directly call your application's server. Instead, Auth0 redirects users to your application's endpoint(s) with required information contained in a query string or hash fragment. + +## Divert emails for testing + +If you want to test your local application and do not want the emails (creation, validation, etc.) to be delivered to the actual email address of the users your application creates or validates, Auth0 recommends using a custom email provider. For example, a service like [Mailtrap](https://mailtrap.io/signin) or your own custom SMTP server implementation can apply whatever logic you require to trap the emails. This ensures that users do not receive emails but you can access them for validation and troubleshooting. + +<%= include('../_includes/_email-domain-blacklist') %> diff --git a/articles/dev-lifecycle/setting-up-env.md b/articles/dev-lifecycle/setting-up-env.md index 5a5e4bf92d..f3ec26e81b 100644 --- a/articles/dev-lifecycle/setting-up-env.md +++ b/articles/dev-lifecycle/setting-up-env.md @@ -1,41 +1,50 @@ --- description: Use multiple Auth0 tenants to manage various environments. +topics: + - dev-tools + - local-env +contentType: how-to +useCase: development --- # Set Up Multiple Environments -__Development__, __Test__, __Q&A__ environments are easy to setup in Auth0. Simply create a new tenant for each to guarantee the maximum isolation between these environments. You can easily switch between tenants using the tenant chooser from the top right menu on the dashboard. You can also configure different administrators for each. +__Development__, __staging__, and __production__ environments are easy to set up in Auth0. Create a new tenant for each environment to guarantee isolation between them. You can easily switch between tenants using the tenant chooser from the top right menu on the Dashboard. You can also configure different administrators for each. ::: warning -Moving your tenant to a Development environment will impact [rate limits](https://auth0.com/docs/policies/rate-limits) for calls to the Authentication and Management API. +Production [rate limits](/policies/rate-limits) only apply to tenants tagged as `Production`. Ensure your tenant's environment tag is set to `Production` before going live. ::: -![](/media/articles/lifecycle/environments.png) - -The example above uses a simple naming convention to distinguish each environment, you can name your multiple environments anyway you prefer. No need to use this naming convention, though it is the one recommended. +You can name your multiple environments any way you prefer. For production environments, we strongly recommend using [custom domains](/custom-domains). ::: note -If you have a subscription plan costing at least **$167 (USD) per month**, you can request a [child account](/dev-lifecycle/child-tenants) that is identical to your Production account for use in a development/staging/testing environment. This includes paid/upgraded features, as well as individual configuration options, such as Rules. Free accounts do *not* include a child account. +If you have a subscription plan costing at least **$167 (USD) per month**, you can request a [child account](/dev-lifecycle/child-tenants) that is identical to your Production account in terms of paid/upgraded features for use in a development/staging/testing environment. Free accounts do *not* include a child account. ::: ## Set the Environment For each new tenant created, you should specify its environment. You can assign environment tags to your tenants to differentiate between development, staging, and production environments. -To assign an environment tag to a tenant, go to the [Auth0 Support Center > Tenants](${env.DOMAIN_URL_SUPPORT}/tenants/public). Locate your tenant and click the gear icon to bring up the **Settings** section. +::: note +If your tenant is mixed use, choose the higher environment. For example, a tenant used for both development and production should be set to `Production`. +::: + +1. To assign an environment tag to a tenant, go to the [Auth0 Support Center > Tenants](${env.DOMAIN_URL_SUPPORT}/tenants/public). Locate your tenant, and click the gear icon to bring up the **Settings** section. ![Support Center Tenants](/media/articles/clients/support-tenants.png) Next, select the **Assign Environment Tag** option. Use the form to identify your tenant's environment as either `Development`, `Staging`, or `Production`. -If your tenant is mixed use, choose the higher environment. For example, a tenant used for both development and production should be set to `Production`. - After selecting the environment, click on **Save Changes**. ![Support Center Tenants Settings](/media/articles/clients/support-tenants-settings.png) +::: note +Environment Tags are not available in [Private Cloud deployments ](/private-cloud). All tenants in the same environment will have the same limits. +::: + ## Migration -Through the [Management API v2](/api/management/v2), you can automate the migration of assets (rules, database connections, and so forth) between tenants. +Through the [Management API v2](/api/management/v2), you can automate the migration of assets ([rules](/rules/current), database [connections](/connections), and so forth) between tenants. For easier configuration management, save your configuration values in the [Dashboard](${manage_url}/#/rules), instead of hardcoding them into your __rules__ or __db connections__ scripts. @@ -48,13 +57,27 @@ function(user, context, callback){ } ``` -This code however is not portable since this URL will likely change from development to production. +This code, however, is not portable since this URL will likely change from development to production. + +The recommended way of working with code that you need to use/move from development to product is via [Rules](${manage_url}/#/rules) section. If you have not yet created a rule, you'll need to do so. (Otherwise, jump to step 4.) + +1. Click __Create Your First Rule__. + +![Create Your First Rule](/media/articles/lifecycle/rules-create-first.png) + +2. Choose the __empty rule__ template. -The recommended way is to navigate to the [Dashboard > Rules](${manage_url}/#/rules), scroll at the bottom of the page, set your configuration value (we will use `log_url` for the key name, and `https://someurl/log` for value), and click __Create__. +![Rules Templates](/media/articles/lifecycle/rules-template-empty.png) + +3. Enter a name for your new rule, and click __Save__. + +![Enter Rule Name](/media/articles/lifecycle/rules-enter-name.png) + +4. Navigate back to [Auth0 Dashboard Rules](${manage_url}/#/rules), and scroll to the bottom of the page to set your configuration values (we will use `log_url` for the key name, and `https://someurl/log` for value), then click __Create__. ![Rules Configuration Values](/media/articles/lifecycle/rules-conf-values.png) -Now you can write your rule as follows: +5. Now, you can write your rule. Edit the rule you created, enter the following code in the code area, and click __Save__. ```js function(user, context, callback){ @@ -63,12 +86,14 @@ function(user, context, callback){ } ``` -This code is portable and when you migrate to production you only need to change this setting, instead of searching your scripts. +![Write Rule Code](/media/articles/lifecycle/rules-rule-code.png) + +This code is portable, and when you migrate to production, you only need to change this setting instead of searching your scripts. ## AD/LDAP Connectors -Since an AD/LDAP Connector is tied to a specific Connection within an Auth0 tenant, if you setup multiple Auth0 tenants, you will need to create an AD/LDAP Connection and setup an AD/LDAP Connector for each tenant that requires this form of authentication. +If you use multiple Auth0 tenants with AD/LDAP, you will need to create an AD/LDAP Connection and set up an AD/LDAP Connector for each tenant. This is because each AD/LDAP Connector is tied to a specific Connection within an Auth0 tenant. -Multiple AD/LDAP Connectors can point to the same AD or LDAP directory, but each AD/LDAP connector can only be used by one Connection within one Auth0 tenant. +Multiple AD/LDAP Connectors can point to the same AD or LDAP directory, but each AD/LDAP Connector can only be used by one Connection within one Auth0 tenant. -If you have multiple AD/LDAP directories against which users will authenticate (for example, to support different departments or customers, each with their own directory) you can setup multiple AD/LDAP Connectors within each Auth0 tenant. +If you have multiple AD/LDAP directories against which users will authenticate (for example, to support different departments or customers, each with their own directory), you can set up multiple AD/LDAP Connectors within each Auth0 tenant. diff --git a/articles/email/custom.md b/articles/email/custom.md index 3c09eb4d1c..904c232284 100644 --- a/articles/email/custom.md +++ b/articles/email/custom.md @@ -1,29 +1,34 @@ --- description: The Auth0 APIs provide endpoints that allow you to completely manage email flow, and control when and how emails are sent. toc: true +topics: + - email +contentType: concept +useCase: customize-emails --- # Custom Email Handling The default email flow in Auth0 can address the requirements of most applications, but there may be instances where more flexibility is required. For example: - * Localization - * Custom **Redirect To** URLs based on the user or tenant - * Different email templates per application or tenant +* Localization +* Custom **Redirect To** URLs based on the user or tenant +* Different email templates per application or tenant The Auth0 Management API provides endpoints that allow you to completely manage email flow, and control when and how emails are sent. To begin, you will need to disable automatic emails by deselecting **Status** under the **Verification Email** and **Welcome Email** tabs on the [Email Templates](${manage_url}/#/emails) page of the Auth0 dashboard. -![Disable Verification Email](/media/articles/email/custom/email-custom.png) - ## Verification Email A verification email should be sent to every user for which the `email_verified` property is `false`. Typically, these are users in database connections or users authenticating with Social Providers that do not validate email addresses upon new user registration. -Using a [Rule](/rules), you can call your API when a user logs in for the first time with an email address that has not been verified. After calling your API, [add a flag](/rules/metadata-in-rules) to the user's profile metadata that indicates that the verification email has been sent: +Using a [Rule](/rules), you can call your API when a user logs in for the first time with an email address that has not been verified. After calling your API, [add a flag](/users/concepts/overview-user-metadata) to the user's profile metadata that indicates that the verification email has been sent: ```js function (user, context, callback) { + + const request = require('request'); + user.user_metadata = user.user_metadata || {}; if (user.email_verified || user.user_metadata.verification_email_sent) { return callback(null, user, context); @@ -34,7 +39,7 @@ function (user, context, callback) { json: { user: user, context: context, - secretToken: ";ojhsajk;h;Kh:Jh", + secretToken: configuration.MY_SECRET_TOKEN, }, timeout: 5000 }, function(err, response, body){ @@ -61,12 +66,17 @@ A custom redirect is useful when you want to direct users to certain URLs based The Auth0 Management API provides a [post_verification_email](/api/v2#!/Tickets/post_email_verification) endpoint that generates the verification link for each user. This endpoint allows you to specify the `resultUrl` to which users will be redirected after they have validated their email address by clicking the link in the verification email. +We recommend whitelisting the url through the dashboard. + ## Welcome Email A welcome email is sent to users once they have verified their email address. This can be implemented using a rule which sends the email only if the user's email address has been verified and the email has not been sent previously. ```js function (user, context, callback) { + + const request = require('request'); + if (!user.email_verified || user.welcome_email_sent) { return callback(null, user, context); } @@ -84,7 +94,7 @@ function (user, context, callback) { return callback(new Error(err)); // Email sent flag persisted in the user's profile. - user.persistent.welcome_email_sent = true; + user.app_metadata.welcome_email_sent = true; return callback(null, user, context); }); } diff --git a/articles/email/index.md b/articles/email/index.md index bb18e59700..2f3fec2e0d 100644 --- a/articles/email/index.md +++ b/articles/email/index.md @@ -1,15 +1,24 @@ --- url: /email description: Auth0 built-in email services. +topics: + - email +contentType: + - index + - reference + - how-to +useCase: customize-emails --- # Emails in Auth0 +An Auth0 [Database Connection](/connections/database) provides several emails as a part of its authentication flow, including verification emails, welcome emails, change password emails, breached password, and blocked account emails. The **Multi-factor Authentication Enrollment Email** can be sent to users in any connection. + ::: warning -Auth0's built-in email provider is not supported for use in a production environment and should be used for testing only. +Auth0's built-in email provider is not supported for use in a production environment, should be used for testing only, and has several restrictions. ::: -When you first create your application Auth0 provides a built-in email provider to send emails. This includes verification emails, welcome emails, change password emails, and blocked account emails. This is meant to be used for testing purposes only, and has several restrictions: +Auth0's built-in email provider has these restrictions: * You will not be able to use any of the email customization features. The content of the emails sent for testing will be restricted to format of the existing templates. @@ -29,7 +38,7 @@ To remove these restrictions in your testing or to setup your production level e After you have configured your own email service provider, the [Emails](${manage_url}/#/emails) dashboard will allow you to customize your emails beyond the existing templates. ::: note -For users with the **Free Subscription** plan, email workflows and using the custom email provider features are available. However a paid subscription plan is required for email customizations. See the [subscription pricing page](https://auth0.com/pricing) for more details. +For users with the **Free Subscription** plan, email workflows and using the custom email provider features are available. However, a paid subscription plan is required for email customizations. See the [subscription pricing page](https://auth0.com/pricing) for more details. ::: For more information see [Customizing Your Emails](/email/templates). diff --git a/articles/email/liquid-syntax.md b/articles/email/liquid-syntax.md index 06ae3b12eb..205cd9025e 100644 --- a/articles/email/liquid-syntax.md +++ b/articles/email/liquid-syntax.md @@ -1,5 +1,12 @@ --- description: How to use Liquid syntax in your email templates. +topics: + - email + - liquid +contentType: + - how-to + - concept +useCase: customize-emails --- # Liquid Syntax in Email Templates diff --git a/articles/email/providers.md b/articles/email/providers.md index 3d25685ac1..659f40862b 100644 --- a/articles/email/providers.md +++ b/articles/email/providers.md @@ -1,185 +1,220 @@ --- -description: How to configure your own SMTP email provider. +title: Use Your Own SMTP Email Provider +description: Learn how to configure your own SMTP email provider, so you can more completely manage, monitor, and troubleshoot your email communications. toc: true +topics: + - email + - smtp + - email-providers +contentType: how-to +useCase: customize-emails --- -# Use your own SMTP Email Provider +# Use Your Own SMTP Email Provider -Auth0 allows you to configure your own SMTP email provider. Auth0's built-in email infrastructure should be used for testing level emails only. By using your own provider you can more completely manage, monitor and troubleshoot your email communications. +Auth0 allows you to configure your own SMTP email provider so you can more completely manage, monitor, and troubleshoot your email communications. + +::: note +Auth0's built-in email infrastructure should be used for testing-level emails only. +::: Auth0 currently supports the following providers: -* [Amazon SES](#configure-amazon-ses-for-sending-email) -* [Mandrill](#configure-mandrill-for-sending-email) -* [SendGrid](#configure-sendgrid-for-sending-email) -* [SparkPost](#configure-sparkpost-for-sending-email) -* [Custom SMTP](#configure-a-custom-smtp-server-for-sending-email) +* [Amazon SES](#configure-amazon-ses) +* [Mandrill](#configure-mandrill) +* [SendGrid](#configure-sendgrid) +* [SparkPost](#configure-sparkpost) +* [Mailgun](#configure-mailgun) +* [Other SMTP](#configure-a-custom-smtp-server) (e.g., Gmail, Yahoo) -::: note -You can only configure one email provider (Amazon SES, Sendgrid, and so on.) which will be used for all emails. -::: +You can only configure one email provider, which will be used for all emails. + +## Whitelist IP addresses -## Configure Amazon SES for Sending Email +To ensure that emails can be sent from Auth0 to your SMTP, you must open the right ports and allow inbound connections from specific IP addresses. To get the list of IPs, navigate to [Dashboard > Emails > Provider](${manage_url}/#/templates/provider). -There are several steps to follow to configure Amazon SES for sending email. If you want to use the SES API, please follow this guide. +## Configure Amazon SES -You can use two types of credentials +To use the Amazon SES API to send emails, you must complete several configuration steps. First, though, you need to decide which credentials you want to use: -1. API Credentials -2. SMTP Credentials (the secret is usually 44 characters long) +* API Credentials +* SMTP Credentials (the secret is usually 44 characters long) -For more information about SES credentials, visit [Using Credentials With Amazon SES](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/using-credentials.html). +For more info about SES credentials, see Amazon's [Using Credentials With Amazon SES](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/using-credentials.html). -### Using API Credentials +### Use API credentials + +1. Sign up for an [Amazon AWS](http://aws.amazon.com/ses/) account, or log in. -1. Sign up for an [Amazon AWS](http://aws.amazon.com/ses/) account, or login. 2. [Verify your domain](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-domains.html). - ![](/media/articles/email/providers/ses-verify.png) 3. [Verify email addresses](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses.html) 4. [Request production access](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html?icmpid=docs_ses_console). -5. [Get Your AWS Access Keys](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/get-aws-keys.html). Copy these keys. You will need to enter these values into Auth0 (see below). - ![](/media/articles/email/providers/aws-keys.png) +5. [Get your AWS access keys](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/get-aws-keys.html). Copy these keys; you will need to enter these values into Auth0. -6. [Attach a policy with the right permissions](http://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage.html). Attach a policy with the `ses:SendRawEmail` and `ses:SendEmail` permissions, as in this example: +6. [Attach a policy with the proper permissions](http://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage.html). Attach a policy with the `ses:SendRawEmail` and `ses:SendEmail` permissions, as in this example: - ![](/media/articles/email/providers/aws-policy.png) +```json +{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "ses:SendRawEmail", + "ses:SendEmail" + ], + "Resource": "*" + } + ] +} +``` -7. Go to the [Custom Email Provider](${manage_url}/#/emails/provider) page of the Auth0 dashboard. Click **Use my own Email Provider** and click the **Amazon Web Services** logo. +7. Navigate to Auth0 [Custom Email Providers](${manage_url}/#/emails/provider). Activate the **Use my own email provider** toggle, and click the **Amazon Web Services** logo. -8. Enter your AWS `Access Key Id`, `Secret Access Key` and `Region` in the appropriate fields: + ![Select Email Provider](/media/articles/dashboard/emails/providers/emails-providers-list.png) - ![](/media/articles/email/providers/enter-keys.png) +8. Provide a **From** email address, enter your AWS **Access Key Id** and **Secret Access Key**, select your **Region**, and click **Save**: -9. Click **Save**. + ![Enter AWS API Email Provider Values](/media/articles/dashboard/emails/providers/emails-providers-settings-aws.png) -Now you can send a test email using the **SEND TEST EMAIL** button on the [Custom Email Provider](${manage_url}/#/emails/provider) page of the Auth0 dashboard. If you don't receive an email after a few minutes, please check your [dashboard logs](${manage_url}/#/logs) for any failures. +You can now send a test email using the **Send Test Email** button. If you have configured everything correctly, you will receive a confirmation email. If you do not receive an email after a few minutes, please check your [Auth0 logs](${manage_url}/#/logs) for any failures. -The [Amazon SES console](https://console.aws.amazon.com/ses) will now display all emails which have been sent to your users. +The [Amazon SES console](https://console.aws.amazon.com/ses) will now display delivery insights for all emails that have been sent to your users. -### Using SMTP Credentials +### Use SMTP credentials -1. Sign up for an [Amazon AWS](http://aws.amazon.com/ses/) account, or login. -2. [Verify your domain](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-domains.html). +1. Sign up for an [Amazon AWS](http://aws.amazon.com/ses/) account, or log in. - ![](/media/articles/email/providers/ses-verify.png) +2. [Verify your domain](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-domains.html). 3. [Request production access](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html?icmpid=docs_ses_console). -4. [Get Your SMTP Credentials](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html). Copy the security credentials. You will need to enter these values into Auth0. +4. [Get your SMTP credentials](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html). Copy the security credentials; you will need to enter these values into Auth0. + +5. Navigate to Auth0 [Custom Email Providers](${manage_url}/#/emails/provider). Activate the **Use my own email provider** toggle, and click the **SMTP** logo. + + ![Select Email Provider](/media/articles/dashboard/emails/providers/emails-providers-list.png) + +6. Provide a **From** email address, then enter your SMTP server **Host**, **Port**, **Username**, and **Password**, and click **Save**. You can use `email-smtp.us-east-1.amazonaws.com` (using the appropriate region rather than `us-east-1`) for **Host** and `587` for **Port**. - ![](/media/articles/email/providers/ses-smtp.png) + ![Enter AWS SMTP Email Provider Values](/media/articles/dashboard/emails/providers/emails-providers-settings-smtp.png) -5. Go to the [Custom Email Provider](${manage_url}/#/emails/provider) page of the Auth0 dashboard. Click **Use my own Email Provider** and click the **SMTP** logo. +You can now send a test email using the **Send Test Email** button. If you have configured everything correctly, you will receive a confirmation email. If you do not receive an email after a few minutes, please check your [Auth0 logs](${manage_url}/#/logs) for any failures. -6. Enter your SMTP server `Host`, `Port`, `Username` and `Password` in the appropriate fields. You can use `email-smtp.us-east-1.amazonaws.com` (using the appropriate region instead of `us-east-1`) for `Host` and `587` for `Port`. +The [Amazon SES console](https://console.aws.amazon.com/ses) will now display delivery insights for all emails that have been sent to your users. - ![](/media/articles/email/providers/enter-smtp-data.png) +## Configure Mandrill -7. Click **Save**. +1. Sign up for a [Mandrill](https://www.mandrill.com/signup/) account, or log in. -Now you can send a test email using the **SEND TEST EMAIL** button on the [Custom Email Provider](${manage_url}/#/emails/provider) page of the Auth0 dashboard. If you don't receive an email after a few minutes, please check your [dashboard logs](${manage_url}/#/logs) for any failures. +2. Navigate to Mandrill [Settings](https://mandrillapp.com/settings), and click **Add API key**. Copy this key value. -The [Amazon SES console](https://console.aws.amazon.com/ses) will now display all emails which have been sent to your users. +3. Navigate to Auth0 [Custom Email Providers](${manage_url}/#/emails/provider). Activate the **Use my own email provider** toggle, and click the **Mandrill** logo. -## Configure Mandrill for Sending Email + ![Select Email Provider](/media/articles/dashboard/emails/providers/emails-providers-list.png) -1. Sign up for a [Mandrill](https://www.mandrill.com/signup/) account, or login. Go to the [Settings page](https://mandrillapp.com/settings) and click **Add API key**. Save this key value. +4. Provide a *From** email address, enter the Mandrill **API Key** you previously copied, and click **Save**: - ![](/media/articles/email/providers/mandrill-keygen.png) + ![Enter Mandrill Email Provider Values](/media/articles/dashboard/emails/providers/emails-providers-settings-mandrill.png) -2. Go to the [Custom Email Provider](${manage_url}/#/emails/provider) page of the Auth0 dashboard. Click **Use my own Email Provider** and click the **Mandrill** logo. +You can now send a test email using the **Send Test Email** button. If you have configured everything correctly, you will receive a confirmation email. If you do not receive an email after a few minutes, please check your [Auth0 logs](${manage_url}/#/logs) for any failures. -3. Enter your previously obtained Mandrill `API Key`: +The Mandrill [Outbound Activity](https://mandrillapp.com/activity) page will now display delivery insights for all emails that have been sent to your users. - ![](/media/articles/email/providers/mandrill-key.png) +## Configure SendGrid -Now you can send a test email using the **SEND TEST EMAIL** button on the [Custom Email Provider](${manage_url}/#/emails/provider) page of the Auth0 dashboard. If you don't receive an email after a few minutes, please check your [dashboard logs](${manage_url}/#/logs) for any failures. +1. Sign up for a [SendGrid](https://sendgrid.com) account, or log in. (If you have a Microsoft Azure subscription, you can get a free account in the Azure Marketplace.) -The [Outbound Activity](https://mandrillapp.com/activity) page in Mandrill will now display all emails which have been sent to your users, including the subject and the delivery status of each message. +2. Navigate to SendGrid **Settings > API Keys**, and click **Create API Key**. Provide a name for your key, enable **Full Access** for **Mail Send** permissions, and click **Save**. Copy this key value. -![](/media/articles/email/providers/email-mandrill-monitoring.png) +3. Navigate to Auth0 [Custom Email Providers](${manage_url}/#/emails/provider). Activate the **Use my own email provider** toggle, and click the **SendGrid** logo. -## Configure SendGrid for Sending Email + ![Select Email Provider](/media/articles/dashboard/emails/providers/emails-providers-list.png) -1. Sign up for a [SendGrid](https://sendgrid.com) account, or login. (If you have a Microsoft Azure subscription you can get a free account in the Azure Marketplace). +4. Provide a **From** email address, enter the SendGrid **API Key** you previously copied, and click **Save**: -2. Go to **Settings > API Keys** and click **Create API Key**. -3. Provide a name for your key and enable **Full Access** for **Mail Send** permissions. Click **Save**. + ![Enter SendGrid Email Provider Values](/media/articles/dashboard/emails/providers/emails-providers-settings-sendgrid.png) - ![](/media/articles/email/providers/sendgrid-permissions.png) +You can now send a test email using the **Send Test Email** button. If you have configured everything correctly, you will receive a confirmation email. If you do not receive an email after a few minutes, please check your [Auth0 logs](${manage_url}/#/logs) for any failures. -4. Copy the API key provided. +The SendGrid [Email Activity](https://sendgrid.com/logs/index) page will now display delivery insights for all emails that have been sent to your users. - ![](/media/articles/email/providers/sendgrid-key.png) +## Configure SparkPost -5. Go to the [Custom Email Provider](${manage_url}/#/emails/provider) page of the Auth0 dashboard. Click **Use my own Email Provider** and click the **SendGrid** logo. +1. Sign up for a [SparkPost](https://www.sparkpost.com/) account, or log in. -6. Provide a **From** email and enter your previously obtained **SendGrid API Key**: +2. Navigate to SparkPost [Sending Domains](https://app.sparkpost.com/account/sending-domains), and add your custom domain. SparkPost allows sending emails from only verified domains. - ![](/media/articles/email/providers/sendgrid-dashboard.png) +3. Navigate to SparkPost [Account API Keys](https://app.sparkpost.com/account/credentials), and click **New API key**. Save this key value and ensure it has `Transmissions: Read/Write` access. Copy this key value. +4. Navigate to Auth0 [Custom Email Providers](${manage_url}/#/emails/provider). Activate the **Use my own email provider** toggle, and click the **SparkPost** logo. -Now you can send a test email using the **SEND TEST EMAIL** button on the [Custom Email Provider](${manage_url}/#/emails/provider) page of the Auth0 dashboard. If you have configured everything correctly, you will receive a confirmation email: + ![Select Email Provider](/media/articles/dashboard/emails/providers/emails-providers-list.png) + +5. Provide a **From** email address, enter the SparkPost **API Key** you previously copied, select your **Region**, and click **Save**: + + ![Enter SparkPost Email Provider Values](/media/articles/dashboard/emails/providers/emails-providers-settings-sparkpost.png) + +::: warning +If you are changing to the EU region in an account that was already configured for the US region, you must replace the **API Key** in Auth0 with a Sparkpost EU API Key. +::: -![](/media/articles/email/providers/sendgrid-test.png) +You can now send a test email using the **Send Test Email** button. If you have configured everything correctly, you will receive a confirmation email. If you do not receive an email after a few minutes, please check your [Auth0 logs](${manage_url}/#/logs) for any failures. ::: note -If you do not receive an email after a few minutes, please check your [dashboard logs](${manage_url}/#/logs) for any failures. +If you haven't registered a custom domain with SparkPost, you can send a maximum of five test emails from the `sparkpostbox.com` domain. For more info, see SparkPost's [Transmissions: The Sandox Domain](https://developers.sparkpost.com/api/transmissions.html#header-the-sandbox-domain). ::: -The [Email Activity](https://sendgrid.com/logs/index) page in SendGrid will now display all emails which have been sent to your users and the delivery status of each message. +The SparkPost [Message Events](https://app.sparkpost.com/reports/message-events) page will now display delivery insights for all emails that have been sent to your users. -![](/media/articles/email/providers/email-sendgrid-monitoring.png) +## Configure Mailgun -## Configure SparkPost for Sending Email +1. Sign up for a [Mailgun](https://mailgun.com) account, or log in. -1. Sign up for a [SparkPost](https://www.sparkpost.com/) account, or login. Go to the [Account API Keys page](https://app.sparkpost.com/account/credentials) and click **New API key**. Save this key value. The key must have `Transmissions: Read/Write` access. +2. Navigate to Mailgun **Sending > Domains**, and add your custom domain. Mailgun allows sending emails from only verified domains. - ![](/media/articles/email/providers/sparkpost-api-key-creation.png) +3. Navigate to Mailgun **Settings > API Keys**. Your API key was created when you signed up for your account; copy it from **Private API Key**. -2. Go to the [Custom Email Provider](${manage_url}/#/emails/provider) page of the Auth0 dashboard. Click **Use my own Email Provider** and click the **SparkPost** logo. +4. Navigate to Auth0 [Custom Email Providers](${manage_url}/#/emails/provider). Activate the **Use my own email provider** toggle, and click the **Mailgun** logo. -3. Enter your previously obtained SparkPost `API Key`: + ![Select Email Provider](/media/articles/dashboard/emails/providers/emails-providers-list.png) - ![](/media/articles/email/providers/sparkpost-set-key.png) +5. Provide a **From** email address, enter the **Domain** you previously added to Mailgun, enter the Mailgun **API Key** you previously copied, select your **Region**, and click **Save**: -Now you can send a test email using the **SEND TEST EMAIL** button on the [Custom Email Provider](${manage_url}/#/emails/provider) page of the Auth0 dashboard. Note that SparkPost only allows sending emails from verified domains. To verify a custom domain go to the [Sending Domains page](https://app.sparkpost.com/account/sending-domains) and add your custom domain. Alternatively, you can send test emails from the `sparpostbox.com` domain, but this is limited to only five test emails. See the [relevant SparkPost docs](https://developers.sparkpost.com/api/transmissions.html#header-the-sandbox-domain) for details. + ![Enter Mailgun Email Provider Values](/media/articles/dashboard/emails/providers/emails-providers-settings-mailgun.png) -If you don't receive an email after a few minutes, please check your [dashboard logs](${manage_url}/#/logs) for any failures. +You can now send a test email using the **Send Test Email** button. If you have configured everything correctly, you will receive a confirmation email. If you do not receive an email after a few minutes, please check your [Auth0 logs](${manage_url}/#/logs) for any failures. -The [Message Events](https://app.sparkpost.com/reports/message-events) page in SparkPost will now display all emails which have been sent to your users, including the delivery status of each message. +The [Mailgun Dashboard](https://app.mailgun.com/app/dashboard) will now display delivery insights for all emails that have been sent to your users. -![](/media/articles/email/providers/sparkpost-message-events.png) +## Configure a custom SMTP server -## Configure a Custom SMTP Server for Sending Email +When using your own SMTP server to send email, the server must: -You can use your own SMTP server to send email. There are three requirements for the SMTP server: +* support LOGIN [authentication](https://en.wikipedia.org/wiki/SMTP_Authentication). +* support [TLS](https://en.wikipedia.org/wiki/STARTTLS) 1.0 or higher. +* use a certificate signed by a public certificate authority (CA). -* It must support LOGIN [authentication](https://en.wikipedia.org/wiki/SMTP_Authentication). -* It must support [TLS](https://en.wikipedia.org/wiki/STARTTLS) 1.0 or higher. -* It must use a certificate signed by a public certificate authority (CA). +If your SMTP server meets these criteria, then: -To be able to use your own SMTP server: +1. Navigate to Auth0 [Custom Email Providers](${manage_url}/#/emails/provider). Activate the **Use my own email provider** toggle, and click the **SMTP** logo. -1. Open the [Custom Email Provider](${manage_url}/#/emails/provider) page of the Auth0 dashboard. -2. Click on **Use my own Email Provider**. -3. Click the **SMTP** logo. -4. Enter your SMTP server `Host`, `Port`, `Username` and `Password` in the appropriate fields: + ![Select Email Provider](/media/articles/dashboard/emails/providers/emails-providers-list.png) - ![](/media/articles/email/providers/enter-smtp-data.png) +2. Provide a **From** email address, then enter your SMTP server **Host**, **Port**, **Username**, and **Password**, and click **Save**: -5. Click **Save**. + ![Enter Custom SMTP Email Provider Values](/media/articles/dashboard/emails/providers/emails-providers-settings-smtp.png) ::: note -Common ports include 25 and 587. Please avoid using port 25 if you can, since many providers have limitations on this port. +Common ports include 25 and 587. Please avoid using port 25 if you can because many providers have limitations on this port. ::: -Now you can send a test email using the **SEND TEST EMAIL** button on the [Custom Email Provider](${manage_url}/#/emails/provider) page of the Auth0 dashboard. If you don't receive an email after a few minutes, please check your [dashboard logs](${manage_url}/#/logs) for any failures. +You can now send a test email using the **Send Test Email** button. If you have configured everything correctly, you will receive a confirmation email. If you do not receive an email after a few minutes, please check your [Auth0 logs](${manage_url}/#/logs) for any failures. ::: panel Test services -SMTP makes it easy to setup test services that allow you to test that your setup is working without spamming your users. For more information, see: [Set up a Test SMTP Provider](/email/testing) . +SMTP makes it easy to set up test services that allow you to test that your setup is working without spamming your users. For more info, see [Set Up a Test SMTP Provider](/email/testing). ::: ## Keep reading diff --git a/articles/email/spa-redirect.md b/articles/email/spa-redirect.md index 3795331b9c..ff000c99f5 100644 --- a/articles/email/spa-redirect.md +++ b/articles/email/spa-redirect.md @@ -1,5 +1,10 @@ --- description: How to work around the limitation of single-page application email redirects. +topics: + - email + - spa +contentType: how-to +useCase: customize-emails --- # Single-Page App Email Redirect Issue @@ -29,7 +34,7 @@ For example, with the above URL, the app will be routed to `/` instead of `/#/re ## Using a Query String Parameter -To work around this limitation of SPA frameworks, it is recommended to use a server-side callback URL as the **redirect To** URL with a `route` parameter that preserves the SPA app route for the redirect. Once in this server-side URL, simply redirect to the SPA route saved in the `route` parameter along with rest of the query string. +To work around this limitation of SPA frameworks, it is recommended to use a server-side callback URL as the **redirect To** URL with a `route` parameter that preserves the SPA app route for the redirect. Once in this server-side URL, simply redirect to the SPA route saved in the `route` parameter along with rest of the query string. 1. Add a server-side URL as the **redirect To** URL with a `route` parameter that records the SPA route for the redirect. diff --git a/articles/email/templates.md b/articles/email/templates.md index 93b41b4047..cc7a76a95c 100644 --- a/articles/email/templates.md +++ b/articles/email/templates.md @@ -1,40 +1,90 @@ --- description: The Emails section of the Auth0 dashboard allows you to customize your emails with Liquid templating syntax. +topics: + - email +contentType: how-to +useCase: customize-emails +toc: true --- # Customizing Your Emails ::: warning -You must setup your own email provider using a [third-party service](/email/providers) ([Amazon SES](https://aws.amazon.com/ses/), [Mandrill](https://www.mandrill.com/signup/) or [SendGrid](https://sendgrid.com/pricing)) or a [custom provider](/email/custom) to be able to customize your emails. +You must set up your own email provider using a [third-party service](/email/providers) (such as Amazon SES, Mandrill, SendGrid, SparkPost, Mailgun, or a custom SMTP provider) to be able to customize your emails. ::: -The [Emails](${manage_url}/#/emails) dashboard allows you to customize your emails, including templating with some user attributes [using Liquid syntax](#email-templates). This can include references to the context of the current application or user. +Auth0 provides an [Emails](${manage_url}/#/emails) dashboard that allows you to customize your HTML-based emails, including templating with some contextual attributes [using Liquid syntax](/email/liquid-syntax). This can include references to the context of the current application or user. ![](/media/articles/email/index/emails-fields.png) ::: note -Only one template can be used for each template type (for example, only one template for change password emails). +Only one template can be used for each template type (for example, only one template for verify emails). ::: -## Configuring *From*, *Subject*, *Redirect To*, and *URL Lifetime* +At this time, Auth0 does not support plaintext/text-based emails. -For each type of email, you can customize the **From Address**, the **Subject**, the **Redirect To** and the **URL Lifetime**. +## Configuring email templates -### From Address +You can customize the **From Address**, the **Subject**, and the **Message** body for each email template. You can use [Liquid Syntax](/email/liquid-syntax) to dynamically generate content, with access to a number of contextual variables that will be replaced with the relevant values when rendering the email messages. + +### Common variables + +You can access the following common variables when using Liquid Syntax in the **From Address**, **Subject** and **Message** fields: + +* The `application` object, with access to the standard client properties like + * `application.name` + * `application.clientID` +* `connection.name` (except in the **Multi-factor Enrollment Email**) +* The `user` object, with access to the following properties: + * `user.email` + * `user.email_verified` + * `user.picture` + * `user.nickname` + * `user.given_name` + * `user.family_name` + * `user.name` + * `user.app_metadata` - stores information (such as a user's support plan, security roles, or access control groups) that can impact a user's core functionality, such as how an application functions or what the user can access. + * `user.user_metadata` - stores user attributes (such as user preferences) that do not impact a user's core functionality. +* Tenant-related information (defined in the [Tenant Settings](${manage_url}/#/tenant)): + * `tenant` - the raw tenant name + * `friendly_name` + * `support_email` + * `support_url` + +Variables are referenced using the `{{ variable_name }}` syntax in Liquid. E.g.: + +```text +Hello {{ user.name }}. Welcome to {{ application.name }} from {{ friendly_name }}. +``` +Note that the attributes available for the `user` object will depend on the type of connection being used. + +::: note +Individual email templates define additional variables that are appropriate for the specific template. Be sure to check out the [individual templates descriptions](#individual-templates-descriptions) below. +::: + +For those emails where the user needs to follow a link to take action, you can also configure the **URL Lifetime** and **Redirect To** URL destination after the action is completed. Liquid Syntax is also supported in the **Redirect To** URL field, but only three variables are supported: + +* `application.name` +* `application.clientID` +* `application.callback_domain` + +See [Configuring the Redirect To URL](#configuring-the-redirect-to-url) for more details. + +### Configuring the From Address Users will see the sender's address in the **From Address** field when receiving an email from Auth0. If you do not configure a **From Address** for your emails your emails will be sent from the email address of the first owner of your Auth0 account. ::: note -For security purposes, you may not send customized emails from any `@auth0.com` address. If you are a PSaaS Appliance user, you may configure a similar domain blacklist. +For security purposes, you may not send customized emails from any `@auth0.com` address. If you are a Private Cloud user, you may configure a similar domain blacklist. ::: -The **From Address** field supports the following macros: +The **From Address** field supports all the [common variables](#common-variables) for templates, but these are the most commonly used: -* `{application.name}` -* `{connection.name}` +* `application.name` +* `friendly_name` (for the tenant's defined friendly name) -You can use these macros to set the display name of the **From Address** to something that relates to the application for which the user signed up. For example, the field could display `{application.name} `, as opposed to simply ``. +You can use these variables to set the display name of the **From Address** to something that relates to the application for which the user signed up. For example, the field could display `{{ application.name }} `, as opposed to simply ``. You must add the [Sender Policy Framework (SPF)](http://en.wikipedia.org/wiki/Sender_Policy_Framework) and [DomainKeys Identified Mail (DKIM)](http://en.wikipedia.org/wiki/DKIM) DNS records to your domain's zone file to allow Auth0 to send digitally-signed emails on your behalf. Without these records, the emails may end up in your users' junkmail folders. Additionally, your users may see the following as the **From Address**: @@ -44,7 +94,13 @@ MyApp support@mail128-21.atl41.mandrillapp.com on behalf of MyApp support@fabrik #### SPF Configuration -You can configure the SPF by adding a TXT record to your domain's zone file. You should set the host name to `@`, or leave it empty, depending on the provider. +You can configure the SPF by adding a TXT record to your domain's zone file. You should set the host name to `@`, or leave it empty, depending on the provider. The value of the record should look something like the following. + +```text +"v=spf1 include:spf.mandrillapp.com -all" +``` + +If you already have an SPF record you can simply add `include:spf.mandrillapp.com` to the existing record. #### DKIM Configuration @@ -60,74 +116,78 @@ and the value to: v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrLHiExVd55zd/IQ/J/mRwSRMAocV/hMB3jXwaHH36d9NaVynQFYV8NaWi69c1veUtRzGt7yAioXqLj7Z4TeEUoOLgrKsn8YnckGs9i3B3tVFB+Ch/4mPhXWiNfNdynHWBcPcbJ8kjEQ2U8y78dHZj1YeRXXVvWob2OaKynO8/lQIDAQAB; ``` -### Subject +### Configuring the Subject -You can use the following macros with the **Subject** field: +The **Subject** field supports all the [common variables](#common-variables) for templates, including: -* `{application.name}` -* `{connection.name}` -* `{user.email}` +* `application.name` +* `user.email` (and other properties of the `user` object) If the **Subject** field is empty, Auth0 will auto-populate this text depending on what type of email you are sending. For example, one subject line might be "*Verify your email.*" -### Redirect To URL +### Configuring the URL Lifetime + +The **Verification Email**, **Change Password** and **Blocked Account Email** contain links which allow users to verify their email address when signing up, confirm their password change, or unblock a blocked account respectively. -You can redirect users to a specific page on the **Allowed Callback URL** using the following: +You can modify the lifetime of this link for security purposes. By default, the lifetime is 432,000 seconds (five days). + +If users click on an expired link and a **Redirect To** URL is configured, they will be redirected to the configured **Redirect To** URL. The following text will be appended to the query string: ```text -{application.callback_domain}/result_page +http://myapplication.com/my_page/?email=john%contoso.com&message=Access%20expired.&success=false ``` -If your application has multiple **Allowed Callback URLs** configured, Auth0 will use the first URL listed. +### Configuring the Redirect To URL -#### Dynamic Redirect To URLs +The **Redirect To** URL is an optional destination to redirect the user to after the relevant action (verify account, reset password, unblock account) was performed. -You can set up a different Redirect To URLs based on your Client ID. For example: +::: panel Redirect URLs +With the Classic Experience, you can provide a URL to which users are redirected after they reset their password. Auth0 sends a success indicator and a message to the URL. -```text -{% if application.clientID == '${account.clientId}' %} http://jwt.io {% else %} http://auth0.com {% endif %} -``` - -::: note -For some single-page apps, the redirect to url can sometimes contain a hash that may be removed. This results in the **redirect To** url not working as expected. For more information, see: [Single-Page App Email Redirect Issue](/email/spa-redirect). +With the New Experience, Auth0 redirects users to the [default log in route](/universal-login/default-login-url) when the user succeeds in resetting the password. If not, Auth0 handles the errors as part of the Universal Login flow and ignores the redirect URL provided in the email template. ::: -### URL Lifetime +**Only the following three variables** are available on the **Redirect To** URL: -The **Verification Email** and **Change Password Confirmation Email** contain links which allow users to verify their email address when signing up, or confirm their password change, respectively. +* `application.name` (or its synonym `client.name`) +* `application.clientID` +* `application.callback_domain` (or its synonym `client.callback_domain`) + +The `application.callback_domain` variable will contain the origin of the **first** URL listed in the application's **Allowed Callback URL** list. This lets you redirect users to a path of the application that triggered the action by using a syntax like this: -You can modify the lifetime of this link for security purposes. By default, the lifetime is 432,000 seconds (five days). +```text +{{ application.callback_domain }}/result_page +``` -If users click on an expired link and a **Redirect To** URL is configured, they will be redirected to the configured **Redirect To** URL. The following text will be appended to the query string: +Note that while the variable is called `callback_domain`, it is really an *origin*, so it includes the protocol in addition to the domain, e.g. `https://myapp.com`. + +If your application has multiple **Allowed Callback URLs** configured, Auth0 will use the first URL listed. You can also provide a default origin using Liquid syntax: ```text -http://myapplication.com/my_page/?email=john%contoso.com&message=Access%20expired.&success=false +{{ application.callback_domain | default: "https://my-default-domain.com" }}/result_page ``` -## Email Templates +#### Dynamic Redirect To URLs -### Multilingual Email Templates +You can set up a different Redirect To URLs based on your application name. For example: -User attributes are available from the **Verification Email**, **Welcome Email**, **Change Password Confirmation Email** and **Blocked Account Email** templates. +```text +{% if application.name == 'JWT.io' %} https://jwt.io {% else %} https://auth0.com {% endif %} +``` -The available attributes vary depending on the syntax used. +Because the application name is encoded for security, you should always use an encoded value (especially if your application name contains a character that changes once encoded). For example, you'll want to use `My%20App` instead of `My App`. + +::: note +For some single-page apps, the redirect to url can sometimes contain a hash that may be removed. This results in the **redirect To** url not working as expected. For more information, see: [Single-Page App Email Redirect Issue](/email/spa-redirect). +::: -#### HTML + Liquid syntax -Liquid syntax is the currently supported templating syntax to use when accessing user attributes in your email templates. Here are the attributes available to you: +### Configuring the Message Body -* `email` -* `email_verified` -* `picture` -* `name` -* `nickname` -* `given_name` -* `family_name` -* `app_metadata` - stores information (such as a user's support plan, security roles, or access control groups) that can impact a user's core functionality, such as how an application functions or what the user can access. -* `user_metadata` - stores user attributes (such as user preferences) that do not impact a user's core functionality. +Message bodies have HTML content, and Liquid syntax is the currently supported templating syntax to use. You can use all the [common variables](#common-variables) plus variables defined in each [individual template](#individual-templates-descriptions). -[Learn more about `app_metadata` and `user_metadata`](/metadata) +#### Multilingual Email Templates -For example, you can refer to attributes in the template to control flow as follows: +You can use Liquid syntax along with properties from the user object to alter the content based on the user preferred language. For example: ```text {% if user.user_metadata.lang == 'es' %} @@ -149,72 +209,73 @@ To assist your template development, we've added a custom `{% debug %}` liquid t Use of Markdown in email templates has been deprecated, so you will no longer be able to add new Markdown formatting. If you have an existing template in Markdown, you will be able to toggle from Markdown to Liquid, but changing this setting will result in you losing any existing Markdown, as well as the ability to use Markdown. ::: -The use of Markdown in email templating has been **deprecated**, and is only available for templates which were already using Markdown as the templating syntax. The available attributes for Markdown syntax are: - -* `email` -* `email_verified` -* `picture` -* `name` -* `nickname` -* `given_name` -* `family_name` +The use of Markdown in email templating has been **deprecated**, and is only available for templates which were already using Markdown as the templating syntax. +The Markdown syntax uses a `@@variable@@` format for variable substitution. The available variables are similar to those mentioned above for Liquid syntax. -For example, you can refer to attributes in the template as follows: +For example, you can refer to a user in the template as follows: ```text Hello @@user.given_name@@ @@user.family_name@@ ``` -### Verification Email +## Individual Templates Descriptions -When users sign-up or login for the first time, they will be sent a verification email. Clicking on the verification link in the email sets the 'email verified' property of their user profile to `true`. +### Verification Email (Using Link) -The following macros are available in the **Verification Email** template: +If you turn on the **Verification Email**, users who sign up on a database connection will receive a message asking to confirm their email address by clicking on a URL included in the message. -* `{application.name}` -* `{connection.name}` -* `{user.email}` +In addition to the [common variables](#common-variables) available for all email templates, the **Verification Email** provides the `url` variable that refers to the URL that the user will have to click. You will use it in the **Message** field to create a link that the user can follow, as in this example: -If you configure a **Redirect To** URL, the user will be directed to this URL after clicking the verification link. The following will be appended to the query string: - -```text -http://myapplication.com/my_page/ - ?email=john%40contoso.com - &message=Your%20email%20was%20verified.%20You%20can%20continue%20using%20the%20application. - &success=true +```html +Confirm my account ``` +#### Redirect To Results for the Verification Email Template -### Welcome Email +You can [configure a **Redirect To** URL](#configuring-redirect-to) to send the users to after the email verification action was attempted. By default, Auth0 includes the following parameters: -Once a user verifies their email address, they will receive a **Welcome Email**. If you turn off the **Verification Email** feature, the **Welcome Email** will be sent to the user when they sign-up (or login for the first time). +* `success` with value `true` or `false` indicating whether the email verification was successful +* `message` with an additional description of the outcome. Some possible values are: + * `Your email was verified. You can continue using the application.` (with `success=true`) + * `This URL can be used only once` (with `success=false`) + * `Access expired.` (with `success=false`) + * `User account does not exist or verification code is invalid.` (with `success=false`) + * `This account is already verified.` (with `success=false`) +* `email` if `Include Email In Redirect` is enabled in the template. By default, `email` is not included -The following macros are available in the **Welcome Email** template: +The target URL handler should be prepared to gracefully handle other possible messages as well. -* `{application.name}` -* `{connection.name}` -* `{user.email}` +### Verification Email (Using Code) -### Change Password Confirmation Email +Azure AD and ADFS connections support an [email verification flow](/connections/azuread-email-verification#email-verification-flow-for-azure-ad/adfs- connections) using a one-time-use code. If you enable this feature, users will be prompted to enter the code before continuing the authentication flow. -If a user requests a password change, they will receive a **Change Password Confirmation Email**. Until the user clicks the verification link contained in the email, the password will remain unchanged. -If a user requests a password change, this email will be sent. The password will not be changed until the user follows the verification link in the email. @@url@@ (or {{ url }} if you are using the HTML + Liquid syntax) is a placeholder for the verification link. +### Welcome Email -The following macros are available in the **Change Password Confirmation** email template: +Once a user verifies their email address, they will receive a **Welcome Email**. If you turn off the **Verification Email** feature, the **Welcome Email** will be sent to the user when they sign-up (or login for the first time). -* `{application.name}` -* `{connection.name}` -* `{user.email}` +### Change Password Email -This email template has a [**Redirect To** URL field](#redirect-to-url), which contains the URL the user will be directed to URL after clicking the verification link. The following will be appended to the query string: +If a user requests a password change, they will receive a **Change Password** that contains a URL link. When the user clicks on the link, a [Password Reset page](/universal-login/password-reset) will be presented to enter the new password. -```text -http://myapplication.com/my_page/ - ?success=true - &message=You%20can%20now%20login%20to%20the%20application%20with%20the%20new%20password. +In addition to the [common variables](#common-variables) available for all email templates, the **Change Password** has the `url` variable that refers to the URL that the user will have to click. You will use it in the **Message** field to create a link that the user can follow, as in this example: + +```html +Click here to change your password ``` -This template also has a **URL Lifetime** field which is the lifetime of the URL in seconds. The default is 432000 seconds (5 days). +#### Redirect To Results for the Change Password Template + +You can [configure a **Redirect To** URL](#configuring-redirect-to) to send the users to after the password change action was attempted. By default, Auth0 includes the following parameters: + +* `success` with value `true` or `false` indicating whether the password change was successful +* `message` with an additional description of the outcome. Some possible values are: + * `You can now login to the application with the new password.` (with `success=true`) + * `This URL can be used only once` (with `success=false`) + * `Access expired.` (with `success=false`) + * `The operation cannot be completed. Please try again.` (with `success=false`) +* `email` if `Include Email In Redirect` is enabled in the template. By default, `email` is not included + +The target URL handler should be prepared to gracefully handle other possible messages as well. ### Blocked Account Email @@ -222,21 +283,88 @@ If a user attempts to login ten or more times unsuccessfully from the same IP ad If the user successfully logs in before they exhaust their ten allowed attempts, the counter is reset. -The following macros are available in the **Blocked Account Email** template: +In addition to the [common variables](#common-variables) available for all email templates, the following ones are available in the **Blocked Account Email** template: * `user.source_ip` * `user.city` * `user.country` -* `application.name` -* `connection.name` -### Password Breach Alert +This template also provides the `url` variable that should be used to create the link that the user needs to follow. E.g.: + +```html +Click here to unblock your account +``` + +#### Redirect To Results for the Blocked Account Email Template + +You can [configure a **Redirect To** URL](#configuring-redirect-to) to send the users to after the account unblocking action was attempted. When redirecting, Auth0 will include the following parameters: + +* `email` indicating the email of the user +* `success` with value `true` or `false` indicating whether the account unblocking was successful +* `message` with an additional description of the outcome. Some possible values are: + * `Your account has been unblocked.` (with `success=true`) + * `This URL can be used only once` (with `success=false`) + * `Access expired.` (with `success=false`) + +The target URL handler should be prepared to gracefully handle other possible messages as well. + +### Password Breach Alert Email This email type is sent whenever Auth0 detects that the user is trying to access the application using a password that has been leaked by a third party. These emails are only set after enabling **Breached Password Detection** in the [Anomaly Detection](${manage_url}/#/anomaly) section of the dashboard. -The following macros are available in the **Password Breach Alert** template: +Learn more about [Breached Password Detection](/anomaly-detection#breached-password-detection) + +### Multi-factor Authentication Enrollment Email + +This email will be generated when an multi-factor authentication enrollment invitation is sent. The message will contain a link that, when visited, will show the MFA enrollment experience. + +Besides the [common variables](#common-variables) available for all email templates, the `link` variable is available in this email type, containing the URL that you will use to construct the link for this action, as in this example: + +```html +Enroll your MFA device +``` -* `{application.name}` -* `{connection.name}` +Do note that, unlike other email templates, the correct variable name is `link` and not `url`. Also, the `connection.name` variable is not available on this email template type. + +### Verification Code for Email MFA + +This email will be generated when you use email as a MFA method and request a verification code to be sent. + +In addition to the [common variables](#common-variables) available, the template provides a `code` variable to render the code used for MFA verification. E.g.: + +```html +
      Your code is: {{ code }}
      +``` + +### Passwordless Email + +Unlike the previous email templates types, this email template is not configured from the Email Templates section. Instead, it's part of the [settings for the Email Passwordless Connection](${manage_url}/#/connections/passwordless). + +The Passwordless Email is sent when a passwordless access is requested, either by code (the user receives a code that types in the application) or by a link (the user clicks on a link and is taken directly to the application). + +You can use all the [common variables](#common-variables) available in all templates, plus the following variables defined specifically for the **Passwordless Email** template: + +* `send`, which will contain a value of `link`, `link_ios`, `link_android` or `code` depending on the type of passwordless email requested. +* `code` with the one-time-use code to access the application +* `link` with the link that can be clicked by the user to gain access to the application (only for link-type passwordless emails) +* `request_language` will have the language code of the user request, if available +* `operation`, which will be `change_email` if this is a passwordless email change operation. + +The default template uses the above variables to do something like this: + +```html + +{% if operation == 'change_email' %} +

      Your email address has been updated.

      +{% else %} + + {% if send == 'link' or send == 'link_ios' or send == 'link_android' %} +

      Click and confirm that you want to sign in to {{ application.name }}. This link will expire in five minutes.

      + Sign in to {{ application.name }} + {% elsif send == 'code' %} +

      Your verification code is: {{ code }}

      + {% endif %} +{% endif %} +``` -[Learn more about Breached Password Detection](/anomaly-detection#breached-password-detection) +Note that in the Passwordless Email template only the `email` property of the `user` object is available. diff --git a/articles/email/testing.md b/articles/email/testing.md index 7644627193..827791ceba 100644 --- a/articles/email/testing.md +++ b/articles/email/testing.md @@ -1,5 +1,10 @@ --- description: Auth0 recommends you setup a fake SMTP server while in development or testing. +topics: + - email + - smtp +contentType: how-to +useCase: customize-emails --- # Set Up a Test SMTP Provider @@ -16,6 +21,8 @@ You can either: Once you have either your own SMTP server set up or a test service available, you can provide its credentials the way you typically would for a [custom email provider](/email/providers#configure-a-custom-smtp-server-for-sending-email). +<%= include('../_includes/_email-domain-blacklist') %> + ## Resources to Consider ::: next-steps diff --git a/articles/errors/dbconnections/self_change_password.md b/articles/errors/dbconnections/self_change_password.md deleted file mode 100644 index 7f83c2fcfd..0000000000 --- a/articles/errors/dbconnections/self_change_password.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -description: Error messages for the self change password API. -public: false ---- -# Self Change Password Errors - -Below you will find the errors codes and possible solutions to various errors that can occur with the self change password api. - -## Error Format - -Error messages are returned in the standard format: - -```json -{ - "error": "error_code", - "error_description": "the description of the error.", - "error_uri": "https://auth0.com/docs/errors/dbconnections/self_change_password" -} -``` - - -## Error Codes - -### `invalid_request` - -This error results when you supply invalid parameters. Error messages will describe the issue such as a required parameter or invalid format. - - -### `invalid_user_password` - -This error results from a bad `username`/`email` and `old_password` combination being sent. Retry the request with the correct username and `old_password`. - - -### `change_password_error` - -This error results from various conditions with the underlying identity provider. Generally, this happens when you are using a custom database and have not implemented the change password script. diff --git a/articles/errors/deprecation-errors.md b/articles/errors/deprecation-errors.md index 95ab54074c..f3b68bb35f 100644 --- a/articles/errors/deprecation-errors.md +++ b/articles/errors/deprecation-errors.md @@ -2,6 +2,14 @@ title: Deprecation Error Reference description: A listing of errors and descriptions relating to deprecations. toc: true +topics: + - errors + - deprecation +contentType: + - reference + - concept + - how-to +useCase: error-management --- # Deprecation Error Reference @@ -9,11 +17,11 @@ When Auth0 features are deprecated, there may be errors or notices in the tenant ## How to search logs for deprecation warnings -There are two different ways to search for warning messages showing usage of deprecated features: The Dashboard or the Management API. Note that in either case, the [log retention period](/logs#how-long-is-log-file-data-available-) is governed by the subscription level of your account. +There are two different ways to search for warning messages showing usage of deprecated features: The Dashboard or the Management API. Note that in either case, the [log retention period](/logs/references/log-data-retention) is governed by the subscription level of your account. ### Search logs via the Dashboard -If your application uses a deprecated feature, a Deprecation Notice message will show up in the Logs section of the [Dashboard](/${manage_url}). +If your application uses a deprecated feature, a Deprecation Notice message will show up in the Logs section of the [Dashboard](${manage_url}/#/). ::: note In order to not overwhelm the logs with repetitive messages, deprecation notes will only be shown once per hour (the first time it occurs within that hour) rather than for each authentication transaction involving the deprecated feature. @@ -39,7 +47,7 @@ Customers can also use the Management API to search through logs for such messag To check your logs using the Management API, go to the [Management API](/api/management/v2). -If you have not already done so, [get and set up your API token](/api/management/v2/tokens#get-a-token-manually) in the API explorer. +If you have not already done so, [get and get an API token](/api/management/v2/tokens). ![Management API - Token Setup](/media/articles/errors/libraries/management-api-set-token.png) @@ -56,7 +64,7 @@ Click on the **TRY** button. If successful, you should see a screen similar to t * The results will match one of the messages + descriptions below. * The **Client ID** field in the results will indicate which application (client) on your tenant is using the deprecated feature. -## Deprecation Messages +## Deprecation Log Messages ### up-idp-initiated @@ -66,11 +74,10 @@ Click on the **TRY** button. If successful, you should see a screen similar to t | Cause | Resolution | | --- | --- | -| You are using a legacy version of embedded Lock or Auth0.js SDK. | [Migrate to Universal Login](/guides/login/migration-embedded-universal) if possible or [upgrade to Lock v11 / Auth0.js v9](/migrations#introducing-lock-v11-and-auth0-js-v9) (Reference guide for [Lock v11](/libraries/lock/v11) and for [Auth0.js v9](/libraries/auth0js/v9)). | -| Calling /login endpoint directly. | Migrate to use a form of the [/authorize endpoint](/api/authentication?http#login) as the start of authentication transactions. | -| Users bookmarking the login URL and trying to initiate login from that bookmarked link at a later time. | Educate users to bookmark instead the place in your app to which they want to return (such as the home page). Depending on your design choices, and if there's no valid session for the user in the app, the app will either start the authorization process or show a login button. | -| Users hitting the back button in the middle of a login transaction. | Educate users to start the login transaction again, starting from the initial login button/link, rather than using the back or forward button. | +| You are using a legacy version of embedded Lock or Auth0.js SDK. | Migrate away from the deprecated library versions as soon as possible. | | Calling the /usernamepassword/login endpoint directly. | Use the Lock or Auth0.js libraries instead. | +| Automatic monitoring tools making requests to login page | If you have an automatic monitoring tool making requests to the login page, the tool will likely not preserve state correctly and will cause the Legacy Lock API error to occur in your logs. Use of the tool should either be discontinued, or accounted for when considering causes of the log notices. | +| Coding errors in a customized [Universal Login Page](/universal-login) | Make sure the `state` and `_csrf` fields are passed to Lock or Auth0.js in your customized login page. They are by default included in the `config.internalOptions` object, but if this is removed during customization, the error occurs. | ### ssodata @@ -81,3 +88,7 @@ Click on the **TRY** button. If successful, you should see a screen similar to t | Cause | Resolution | | --- | --- | | Either calling the /ssodata directly or using old versions of embedded Lock or Auth0.js SDK to call a function which called the /ssodata endpoint. | [Migrate to Universal Login](/guides/login/migration-embedded-universal) or [migrate to Lock v11 or Auth0.js v9](/migrations#introducing-lock-v11-and-auth0-js-v9). | + +## Legacy Lock API troubleshooting + +Tenant log entries regarding the Legacy Lock API may include the referrer and information about the SDK used. This information can be used to see if any of your applications use outdated libraries. diff --git a/articles/errors/libraries/auth0-js/invalid-token.md b/articles/errors/libraries/auth0-js/invalid-token.md deleted file mode 100644 index 324b61a753..0000000000 --- a/articles/errors/libraries/auth0-js/invalid-token.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -public: true ---- - -# Errors with code 'invalid_token' - -## Parsing an HS256-Signed ID Token Without an Access Token - -**Error Message**: The ID Token cannot be validated because it was signed using the HS256 algorithm and public applications (such as a browser) can’t store secrets. Please read the associated doc for ways to fix this. - -### Why this error occurred - -Beginning with **auth0.js version 9** and **Lock version 11**, when ID Tokens are signed with HS256, they are discarded and a call to **/userinfo** is made to retrieve user information. - -Calling **/userinfo** requires an Access Token. If you don't ask for an Access Token when authenticating, you will receive the following error: - -``` -The id_token cannot be validated because it was signed with the HS256 algorithm -and public applications (like a browser) can’t store secrets. -Please read the associated doc for possible ways to fix this. -``` - -### Ways to fix this error - -There are two ways to fix the error: - -1. **(RECOMMENDED)** Change the application signature algorithm to RS256 instead of HS256. -2. Change the value of your **responseType** parameter to **token id_token** (instead of the default), so that you receive an Access Token in the response. - -To change the application signature algorithm to RS256 instead of HS256: - - 1. Go to [Dashboard > Applications]({$manage_url}/#/applications) - 1. Select your application - 1. Scroll to the bottom of the **Settings** tab, and click **Show Advanced Settings** - 1. Open up the **OAuth** tab. Change the value of **JsonWebToken Signature Algorithm** to **RS256** - 1. Scroll to the bottom of the page and click **Save Changes** - - If you proceed with this option and you are using the ID Token to call your APIs, be sure to change your server code so that it validates tokens using the RS256 algorithm instead of HS256. Note that using ID Tokens to call APIs [is not recommended](/api-auth/why-use-access-tokens-to-secure-apis). - diff --git a/articles/errors/managment-v2/placeholder.md b/articles/errors/managment-v2/placeholder.md deleted file mode 100644 index 87f2df24fb..0000000000 --- a/articles/errors/managment-v2/placeholder.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -public: false ---- - -# Management API Errors \ No newline at end of file diff --git a/articles/errors/oauth/placeholder.md b/articles/errors/oauth/placeholder.md deleted file mode 100644 index 38f51cf4dd..0000000000 --- a/articles/errors/oauth/placeholder.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -public: false ---- - -# OAuth Errors \ No newline at end of file diff --git a/articles/errors/saml/placeholder.md b/articles/errors/saml/placeholder.md deleted file mode 100644 index 93cc830499..0000000000 --- a/articles/errors/saml/placeholder.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -public: false ---- - -# SAML Errors \ No newline at end of file diff --git a/articles/errors/wsfed/placeholder.md b/articles/errors/wsfed/placeholder.md deleted file mode 100644 index b8afff3b6c..0000000000 --- a/articles/errors/wsfed/placeholder.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -public: false ---- - -# WS-Fed Errors \ No newline at end of file diff --git a/articles/extend-integrate/index.md b/articles/extend-integrate/index.md new file mode 100644 index 0000000000..9c187be647 --- /dev/null +++ b/articles/extend-integrate/index.md @@ -0,0 +1,60 @@ +--- +classes: topic-page +title: Extend & Integrate +description: Learn how to extend the functionality of Auth0's base product and integrate Auth0 with other applications and services. +topics: + - extensions + - integrations +contentType: index +useCase: + - integrate-third-party-apps + - integrate-analytics + - integrate-marketing + - integrate-saas-sso + - extensibility-extensions +--- + +
      +
      +

      Extend & Integrate

      +

      + Learn how to extend the functionality of Auth0's base product and integrate Auth0 with other applications and services. + +

      \ No newline at end of file diff --git a/articles/extensions/_includes/_batch-size.md b/articles/extensions/_includes/_batch-size.md new file mode 100644 index 0000000000..139198c627 --- /dev/null +++ b/articles/extensions/_includes/_batch-size.md @@ -0,0 +1,16 @@ +### Batch size + +When setting your **BATCH_SIZE**, please keep the following information in mind. + +During each time frame/window (defined by your chosen **Schedule**), outstanding logs will be batched into groups and sent. The size of each group is determined by the **BATCH_SIZE** value. + +In other words, during each window, `NUM_BATCHES` batches of logs will be sent based on the following logic: + +``` +IF (NUM_LOGS modulo 100 == 0): + NUM_BATCHES = (NUM_LOGS / BATCH_SIZE) +ELSE: + NUM_BATCHES = (NUM_LOGS / BATCH_SIZE) + 1 +``` + +In the `ELSE` case, the last batch will have < 100 logs. \ No newline at end of file diff --git a/articles/extensions/_includes/_deployment-extension.md b/articles/extensions/_includes/_deployment-extension.md new file mode 100644 index 0000000000..7c3441a6bd --- /dev/null +++ b/articles/extensions/_includes/_deployment-extension.md @@ -0,0 +1,3 @@ +::: note +The deployment extension accepts an application name instead of the client ID in the `client_id` property. It will try to match the name to an existing application before creating the Client Grant. +::: \ No newline at end of file diff --git a/articles/extensions/_includes/_embedded-clients-array.md b/articles/extensions/_includes/_embedded-clients-array.md new file mode 100644 index 0000000000..f47346cf5e --- /dev/null +++ b/articles/extensions/_includes/_embedded-clients-array.md @@ -0,0 +1,3 @@ +::: note +The `enabled_clients` array, when used directly with the Management API v2, is a list of client IDs for which the connection is enabled. As an added convenience, the deployment extension will attempt to match entries in the `enabled_clients` array by client name and replace them with the appropriate client ID when a match is found, allowing you to specify `"my-client-name"` instead of `"my-client-id"` to refer to each application. +::: \ No newline at end of file diff --git a/articles/extensions/_includes/_use-default-error.md b/articles/extensions/_includes/_use-default-error.md new file mode 100644 index 0000000000..e98dfdcebc --- /dev/null +++ b/articles/extensions/_includes/_use-default-error.md @@ -0,0 +1,3 @@ +::: note +The `error_page` cannot be enabled/disabled. To use the default error page, remove the content of `error_page.html`. +::: diff --git a/articles/extensions/_troubleshoot-webhooks.md b/articles/extensions/_troubleshoot-webhooks.md index d0f173d98f..fe0a389dc8 100644 --- a/articles/extensions/_troubleshoot-webhooks.md +++ b/articles/extensions/_troubleshoot-webhooks.md @@ -6,7 +6,7 @@ However, there are certainly alternatives to the inefficient process we detailed 1. Check the [Logs](/logs) section of the [Dashboard](${manage_url}/#/logs) for helpful messages. -1. Analyze the requests your webhook is making using a tool like [Hookbin](https://hookbin.com/) or [Mockbin](http://mockbin.org/). +1. Analyze the requests your webhook is making using a tool like [Mockbin](http://mockbin.org/), [Beeceptor](https://beeceptor.com/), or (self-hosted) [RequestBin](https://github.com/Runscope/requestbin). 1. Mock requests using cURL or [Postman](https://www.getpostman.com/) diff --git a/articles/extensions/account-link.md b/articles/extensions/account-link.md index f5691e01b4..6c7e6f8a74 100644 --- a/articles/extensions/account-link.md +++ b/articles/extensions/account-link.md @@ -1,8 +1,14 @@ --- -toc: true description: The Account Link extension allows users with two accounts with the same email to be prompted to link them. +topics: + - extensions + - account-linking +contentType: + - how-to + - concept +useCase: extensibility-extensions --- -# Account Link +# Account Link Extension The **Account Link** extension prompts users that may have created a second account by mistake to link the new account with their old one on their first login. The user may choose to either link the two accounts or keep them separate if it was intentional. @@ -10,9 +16,7 @@ The **Account Link** extension prompts users that may have created a second acco To install this extension, click on the __Account Link__ box in the list of provided extensions on the [Extensions](${manage_url}/#/extensions) page of the dashboard. The __Install Extension__ window will open. -![Install Account Link Extension](/media/articles/extensions/account-link/install-extension.png) - -The extension will create a new **Application** named `auth0-account-link` to use internally and a new **Rule** to redirect users to the extension if they login with a new account that has an email matching an existing account. +The extension will create a new **Application** named `auth0-account-link` to use internally and a new **Rule** to redirect users to the extension if they login with a new account that has an email matching an existing account. This application needs to have enabled all the connections that you want to perform account linking with. ## Setup @@ -22,11 +26,11 @@ We recommend changing the name of the default application used for the extension ### Updating the Login Page -By default, Auth0's [universal login](/hosted-pages/login) allows a user to both login and sign up as one may expect. However, when the account linking asks you to authenticate your primary account in order to link it with the new account, providing a sign up option can be confusing for users. +By default, Auth0's [Universal Login](/universal-login) allows a user to both login and sign up as one may expect. However, when the account linking asks you to authenticate your primary account in order to link it with the new account, providing a sign up option can be confusing for users. To prevent this, we send over a query parameter to let the login page know that it should hide the **Sign Up** option. In order for this query parameter to take effect, however, we must first customize the login page. -First go to your [Dashboard](${manage_url}) and click on **Hosted Pages**. It should open to the login page by default. +First go to your [Dashboard](${manage_url}) and click on **Universal Login**. It should open to the login page by default. If it is not already enabled, toggle the **Customize Login Page** to enable the custom editor below. In the editor we're going to add a new line to the Lock config. @@ -42,6 +46,10 @@ Then save your changes and attempt to link an account. You'll notice that the ** ![Account Linking Hosted Page](/media/articles/extensions/account-link/hosted-page-example.png) +:::note +Hiding the Signup link is not supported in the New Universal Login Experience. +::: + ## Customization At installation, or any time after by clicking the **Settings** icon for the Account Link Extension, you can add a URL to a custom stylesheet if you would like to customize the extension page to look a bit different from the default theme. @@ -50,10 +58,6 @@ At installation, or any time after by clicking the **Settings** icon for the Acc ## Administration Panel -::: warning -This feature is available in version 2.0 and up. -::: - You can customize your account linking login page and widget using the extension administration panel. Go to **Dashboard > Extensions > Installed Extensions > Auth0 Account Link**. @@ -71,3 +75,25 @@ Do not remove `{{ ExtensionCSS }}`, `{{ CustomCSS }}`, `{{ Auth0Widget }}`, or ` ::: ![Widget Settings](/media/articles/extensions/account-link/widget-settings.png) + +## Custom domains + +If you're using a custom domain, you'll need to update the **auth0-account-link-extension** [rule](/rules) that is automatically created when you installed the extension. (You can find this rule in your Dashboard by going to **Rules** using the left-hand navigation bar). + +By default, line 27 of the rule is `issuer: auth0.domain`. You will need to change this to `issuer: "myCustomDomain.com"`, making sure to omit the protocol portion of the URL. + +:::note +Uninstalling/reinstalling, as well as updating, the extension may override this change. +::: + +## How does the extension work? + +The extension triggers after authentication, when there is an existing user account using a different provider but with an email address that is the same as that of the user who just authenticated. + +For example, if a user logs in with their Facebook account using the email `john@acme.com`, and then later authenticates with Google using the same email address, they will be prompted with a page like this: + +![Account Linking Extension](/media/articles/extensions/account-link/account-linking-extension.png) + +The extension does not automatically link users with the same email, even if emails are verified. Verified emails are not enough evidence to prove that the user can currently authenticate to both accounts. + +If the user clicks **Continue**, they will be redirected to Facebook to authenticate. If the user is already logged in, Facebook will redirect back to the application, and the user will be automatically linked. If they are not logged in, they will be prompted first to authenticate with their Facebook credentials. Then, the account will be linked with the Google account after Facebook redirects back to Auth0. This process ensures that it is the same user who has the credentials to authenticate to both accounts. This allows the accounts to be linked safely without fear of linking accounts incorrectly. diff --git a/articles/extensions/adldap-connector.md b/articles/extensions/adldap-connector.md index 9ae21de4d5..3d4b011dee 100644 --- a/articles/extensions/adldap-connector.md +++ b/articles/extensions/adldap-connector.md @@ -1,8 +1,14 @@ --- description: This page explains the Auth0 AD/LDAP Connector Health Monitor Extension and how to install and configure it. +topics: + - extensions + - ad/ldap-connector +contentType: + - how-to +useCase: extensibility-extensions --- -# Auth0 Extension: Auth0 AD/LDAP Connector Health Monitor +# Auth0 AD/LDAP Connector Health Monitor The Auth0 AD/LDAP Connector Health Monitor exposes an API endpoint of your choice so that you can monitor your AD/LDAP connectors. diff --git a/articles/extensions/application-insight.md b/articles/extensions/application-insight.md index c02af1f1b1..b530aa911f 100644 --- a/articles/extensions/application-insight.md +++ b/articles/extensions/application-insight.md @@ -1,52 +1,45 @@ --- description: This page explains how to configure and install Auth0's Logs to Application Insights extension. +topics: + - extensions + - application-insights +contentType: + - how-to +useCase: extensibility-extensions --- - # Auth0 Logs to Application Insights The *Auth0 Logs to Application Insights* is a scheduled job takes all of your Auth0 logs and exports them to [Application Insights](https://azure.microsoft.com/en-us/services/application-insights/). ## Configure the Extension -To install and configure this extension, click on the __Auth0 Logs to Application Insights__ box in the list of provided extensions on the [Extensions](${manage_url}/#/extensions) page of the [dashboard](${manage_url}). The __Install Extension__ window pops open. - -![Install Extension](/media/articles/extensions/appinsights/ext-mgmt-appinsights.png) +To install and configure this extension, click on the __Auth0 Logs to Application Insights__ box in the list of provided extensions on the [Extensions](${manage_url}/#/extensions) page of the [Dashboard](${manage_url}). -At this point you should set the following configuration variables: +The __Install Extension__ window pops open, and you will be asked to set the following configuration variables: - __Schedule__: The frequency with which logs should be exported. -- __Batch_Size__: TThe amount of logs to be read on each execution. Maximun is 100. -- __AppInsights_Instrumentation_Key__: The Application Insights instrumentation key. - - Once you have provided the appropriate values for the above fields, click __Install__ to proceed. - -## Retrieve the required information from Application Insights - -Let's see how we can retrieve the __AppInsights_Instrumentation_Key__ information. +- __Batch_Size__: The amount of logs to be read on each execution. Maximum is 100. +- __Start_From__: The ID of the log that you want to start sending from +- __Slack_Incoming_Webhook_URL__: The Slack webhook URL that you want to use to receive notifications regarding your log-sending process +- __Slack_Send_Success__: If yes, Auth0 will send verbose notifications to Slack +- __Log_Level__: The log level of events to be sent; Auth0 will send all logs at the selected above and higher +- __Log_Types__: The types of logs you want send; leave blank to send all log events +- __AppInsights_Instrumentation_Key__: The Application Insights instrumentation key (see the following section for information on obtaining the instrumentation key if you do not already have it) -1. Login to your [Azure Portal](https://portal.azure.com/#) and add a new _Application Insights_ instance in your subscription. To do so click __New__ and search for `Application Insights`. + When done, click __Install__ to proceed. -![New Application Insights instance](/media/articles/extensions/appinsights/new-appinsights.png) + <%= include('./_includes/_batch-size') %> -2. Click __Create__ and fill in the required information, such as the name of your instance, the application type and the resource group. Click __Create__ to trigger the provisioning process. - -![Configure Application Insights instance](/media/articles/extensions/appinsights/conf-appinsights.png) - -3. Once the provisioning is complete (after a few seconds usually) you can get the __Instrumentation Key__ from the Properties page. - -![Application Insights Properties](/media/articles/extensions/appinsights/appinsights-properties.png) - -4. Copy this value and head back to your [Auth0 dashboard](${manage_url}). Set it at the __AppInsights_Instrumentation_Key__ field. Save your changes. +## Retrieve the required information from Application Insights +When configuring the extension, you'll be asked by Auth0 to provide the [instrumentation key](https://docs.microsoft.com/en-us/azure/azure-monitor/app/create-new-resource#copy-the-instrumentation-key) for Application Insights. You will need to have [created an Application Insights resource](https://docs.microsoft.com/en-us/azure/azure-monitor/app/create-new-resource#copy-the-instrumentation-key) with Azure before you can obtain this value. ## Use Your Installed Extension -To view all scheduled jobs, navigate to the [Extensions](${manage_url}/#/extensions) page of the [dashboard](${manage_url}), click on the __Installed Extensions__ link, and select the __Auth0 Logs to Application Insights__ line. There you can see the job you just created, modify its state by toggling the __State__ switch, see when the next run is due and what was the result of the last execution. - -![View Cron Jobs](/media/articles/extensions/appinsights/view-cron-jobs.png) +To view all scheduled jobs, navigate to the [Extensions](${manage_url}/#/extensions) page of the [Dashboard](${manage_url}). Click on the __Installed Extensions__ link, and select the __Auth0 Logs to Application Insights__ line. -You can view more details by clicking on the job you created. In this page you can view details for each execution, reschedule, access realtime logs, and more. +There, you can see the job you just created, modify its state by toggling the __State__ switch, and see when the next run is due and what was the result of the last execution. -![View Cron Details](/media/articles/extensions/appinsights/view-cron-details.png) +You can view more details by clicking on the job you created. On this page you can view details for each execution, reschedule, access real-time logs, and more. -That's it, you are done! You can now navigate to your [Azure Portal](https://portal.azure.com/#) and view your [Auth0 Logs](${manage_url}/#/logs). +At this point, you can navigate to your [Azure Portal](https://portal.azure.com/#) to view your [Auth0 Logs](${manage_url}/#/logs). diff --git a/articles/extensions/authentication-api-debugger.md b/articles/extensions/authentication-api-debugger.md index 195143f5d5..bb6b1fdf26 100644 --- a/articles/extensions/authentication-api-debugger.md +++ b/articles/extensions/authentication-api-debugger.md @@ -1,5 +1,11 @@ --- description: This page explains how to use the Authentication API Debugger +topics: + - extensions + - auth-api-debugger +contentType: + - how-to +useCase: extensibility-extensions --- # Authentication API Debugger Extension diff --git a/articles/extensions/authentication-api-webhooks.md b/articles/extensions/authentication-api-webhooks.md index a4a05f6797..b1fe440de1 100644 --- a/articles/extensions/authentication-api-webhooks.md +++ b/articles/extensions/authentication-api-webhooks.md @@ -1,5 +1,11 @@ --- description: This page explains how to configure and install Auth0's Authentication API Webhooks extension. +topics: + - extensions + - auth-api-webhooks +contentType: + - how-to +useCase: extensibility-extensions --- # Auth0 Authentication API Webhooks @@ -11,12 +17,14 @@ The Auth0 Authentication API Webhooks Extension is a scheduled job that allows y To complete installation of this extension, click on the Auth0 Authentication API Webhooks box in the list of provided extensions on the Extensions page of the Management Portal. In the "Install Extension" window that then pops open, you will be asked to provide the following configuration variables: - __Schedule__: The frequency with which the job runs -- __Auth0_Domain__: The domain of your Auth0 app -- __Auth0_Global_Client_ID__: The Client ID of your Auth0 app -- __Auth0_Global_Client_Secret__: The Client Secret of your Auth0 app -- __Auth0_API_Endpoints__: The specific Auth0 Management API endpoints you want to monitor/call -- __Webhook URL__: The URL of your webhook -- __Webhook_Concurrent_Calls__: The maximum number of concurrent calls that will be made to your webhook +- __Batch_Size__: The amount of logs the extension will attempt to read and send on each execution. Extension could send multiple batches per run, depending on amount of time necessary to process. Maximum batch size is 100. +- __Webhook_URL__: The URL of your webhook +- __Authorization__: String to be added as `Authorization` header. +- __Send_as_Batch__: If enabled, the extension will send the whole batch of logs to the webhook in a single request. Otherwise, extension sends logs one-by-one to webhook. Only disable if your webhook does not support batched messages. +- __Webhook_Concurrent_Calls__: The maximum number of concurrent calls that will be made to your webhook. +- __Start_From__: Log Checkpoint to start from. +- __Slack_Incoming_Webhook_URL__: Extension can report statistics and possible failures to the Slack. +- __Slack_Send_Success__: If enabled, extension will be sending messages on each run. Otherwise - only on fails. - __Log_Level__: The minimal log level of events that you would like sent - __Log_Types__: The specific events for which logs should be exported @@ -64,4 +72,4 @@ Here is an example of the payload that will be sent: } ``` -<%= include('./_troubleshoot-webhooks') %> \ No newline at end of file +<%= include('./_troubleshoot-webhooks') %> diff --git a/articles/extensions/authorization-extension/v1/index.md b/articles/extensions/authorization-extension/v1/index.md index 75935b5d39..eefc569539 100644 --- a/articles/extensions/authorization-extension/v1/index.md +++ b/articles/extensions/authorization-extension/v1/index.md @@ -1,5 +1,12 @@ --- description: This page explains how to setup and manage the Authorization Extension v1. +topics: + - extensions + - authorization_v1 +contentType: + - tutorial + - concept +useCase: extensibility-extensions --- # Auth0 Authorization Extension v1 @@ -8,7 +15,7 @@ description: This page explains how to setup and manage the Authorization Extens This document covers an outdated version. We recommend you to [upgrade to v2](/extensions/authorization-extension/v2). ::: -The Auth0 Authorization Extension provides user authorization support in Auth0. Version 1 of the extension supports authorizations using Groups. Upgrade to [version 2](/extensions/authorization-extension) to support authorizations with Roles and Permissions. +The Auth0 Authorization Extension provides user authorization support in Auth0. Version 1 of the extension supports authorizations using Groups. Upgrade to [version 2](/extensions/authorization-extension) to support authorizations with Roles and Permissions. ## Setting Up a New Authorization Extension diff --git a/articles/extensions/authorization-extension/v2/api-access.md b/articles/extensions/authorization-extension/v2/api-access.md index 211293e8de..c724cb1f4c 100644 --- a/articles/extensions/authorization-extension/v2/api-access.md +++ b/articles/extensions/authorization-extension/v2/api-access.md @@ -1,10 +1,21 @@ --- title: Enabling API Access to the Authorization Extension description: How to enable API access to the Authorization Extension +topics: + - extensions + - authorization_v2 +contentType: + - how-to + - concept +useCase: extensibility-extensions --- # Authorization Extension: API Access -Once configured and set up, your extension should contain users, as well as groups, roles, and permissions. You can automate provisioning and query the authorization context of your users in real-time if you enable API access to your extension. +::: note +<%= include('../../../_includes/_rbac_methods') %> +::: + +Once configured and set up, your extension should contain users, as well as groups, roles, and permissions. You can automate provisioning and query the authorization context of your users in real-time if you enable API access to your extension. ## Enable API Access @@ -34,27 +45,27 @@ You'll be redirected to the **Quick Start** page of the Application, where you c Since this is the first time you're working with the API and Application together, you'll see a message that says, "This application is not authorized for this API." To authorize the application for use with the API, click **Navigate to the API and Authorize**. -![Application Quick Start Page](/media/articles/extensions/authorization/application-quick-start.png) +![Application Quick Start Page](/media/articles/extensions/authorization/client-quick-start.png) You'll see a list of Machine to Machine Applications you can use with your API. Click the slider next to the Application you just created to authorize it. -![Authorize Application](/media/articles/extensions/authorization/applications-for-api.png) +![Authorize Application](/media/articles/extensions/authorization/clients-for-api.png) Once you've authorized the Application, you'll see the **Grant ID**. You can also select the **Scopes** to be granted to the Application. The scopes you grant depends on the endpoints you want to access. For example, you'd grant `read:users` to [get all users](hapi/authorization-extension#get-all-users). If you make any changes to the scopes, click **Update** to save. -![Scopes](/media/articles/extensions/authorization/application-scopes.png) +![Scopes](/media/articles/extensions/authorization/client-scopes.png) ### Get the Access Token -To access the API, you'll need to [ask for and obtain the appropriate token](https://auth0.com/docs/api-auth/tutorials/client-credentials#ask-for-a-token). +To access the API, you'll need to [ask for and obtain the appropriate token](/flows/guides/client-credentials/call-api-client-credentials#request-token). ### Call the API You can call the API via: -* An HTTML request +* An HTML request * A cURL command You can also find detailed information about the endpoints, as well as samples on how to call each endpoint using the three methods above, in the [Authorization Extension API Explorer](/api/authorization-extension). @@ -71,4 +82,4 @@ Click over to the **Explorer** page for the API documentation. * [Use the Authorization Extension's Data in Rules](/extensions/authorization-extension/v2/rules) * [Import/Export Data](/extensions/authorization-extension/v2/import-export-data) * [Troubleshoot Errors](/extensions/authorization-extension/v2/troubleshooting) -::: \ No newline at end of file +::: diff --git a/articles/extensions/authorization-extension/v2/implementation/configuration.md b/articles/extensions/authorization-extension/v2/implementation/configuration.md index 56e6a5a7fc..8182bf0e25 100644 --- a/articles/extensions/authorization-extension/v2/implementation/configuration.md +++ b/articles/extensions/authorization-extension/v2/implementation/configuration.md @@ -2,10 +2,21 @@ title: Configuring the Authorization Extension description: How to configure the Authorization Extension toc: true +topics: + - extensions + - authorization_v2 +contentType: + - how-to + - concept +useCase: extensibility-extensions --- # Authorization Extension: Configuration +::: note +<%= include('../../../../_includes/_rbac_methods') %> +::: + Before the extension can enforce your authorization logic, you'll need to configure how it will behave during the login transaction. Your configuration settings will be captured in a [rule](/rules) that's executed during runtime. ## Configure the Extension @@ -18,7 +29,13 @@ This brings you to the **Rule Configuration** section of the **Configuration** p ![Configuration page](/media/articles/extensions/authorization/configuration.png) -All of the changes you make in the sections under **Token Contents**, such as those related to groups, roles, and permissions, will be reflected in the rule you export at the completion of this step. +All of the changes you make in the sections under **Token Contents**, such as those related to groups, roles, and permissions, will be reflected in the rule you export at the completion of this step. + +### ApiKey + +The rule is using ApiKey to communicate with the Authorization Extension API and can be used only to get the policy. ApiKey is stored as a rule config and it will be created automatically when the rule is published. You can rotate the ApiKey by pressing the "Rotate" button. It will update the rule config automatically. + +![ApiKey config](/media/articles/extensions/authorization/apikey-config.png) ## Add Authorization Information to the Token Issued @@ -68,4 +85,4 @@ You can open it up to see the exact rules configuration. * [Use the Authorization Extension's Data in Rules](/extensions/authorization-extension/v2/rules) * [Troubleshoot Errors](/extensions/authorization-extension/v2/troubleshooting) * [Set Up the Authorization Extension](/extensions/authorization-extension/v2/implementation/setup) -::: \ No newline at end of file +::: diff --git a/articles/extensions/authorization-extension/v2/implementation/installation.md b/articles/extensions/authorization-extension/v2/implementation/installation.md index a324a556d6..5d74a9501f 100644 --- a/articles/extensions/authorization-extension/v2/implementation/installation.md +++ b/articles/extensions/authorization-extension/v2/implementation/installation.md @@ -2,16 +2,27 @@ title: Installing the Authorization Extension description: How to install the Authorization Extension toc: true +topics: + - extensions + - authorization_v2 +contentType: + - how-to + - concept +useCase: extensibility-extensions --- # Authorization Extension: Installation +::: note +<%= include('../../../../_includes/_rbac_methods') %> +::: + This doc walks you through the process of installing the Authorization Extension. Before you begin, make sure that you have an existing [application](/application) that can be used with the Authorization Extension. Currently, you can use the following types of applications: * Native * Regular Web Applications -* Single Page Applications +* Single-Page Applications Applications without an assigned type or Machine to Machine Applications cannot be used with this extension. @@ -73,7 +84,7 @@ This extension has limitations in terms of performance and is not meant to be us ``` ::: note -Amazon S3 is a file-based storage platform, which means it writes in parallel. This may cause issues, but the extension's storage logic attempts to take this into account. However, if you automate the creation of groups/roles/permissions, we suggest that you do so using sequential calls to the API. +Amazon S3 is a file-based storage platform, which means it writes in parallel. This may cause issues, but the extension's storage logic attempts to take this into account. However, if you automate the creation of groups/roles/permissions, we suggest that you do so using sequential calls to the API. ::: ![Install Authorization Extension](/media/articles/extensions/authorization/app-install-v2.png) diff --git a/articles/extensions/authorization-extension/v2/implementation/setup.md b/articles/extensions/authorization-extension/v2/implementation/setup.md index 12599f5f7a..513be6bc06 100644 --- a/articles/extensions/authorization-extension/v2/implementation/setup.md +++ b/articles/extensions/authorization-extension/v2/implementation/setup.md @@ -2,11 +2,22 @@ title: Setting Up the Authorization Extension description: How to set up the Authorization Extension toc: true +topics: + - extensions + - authorization_v2 +contentType: + - how-to + - concept +useCase: extensibility-extensions --- # Authorization Extension: Setup -In this paragraph, we'll briefly cover the basics of users, groups, roles, and permissions. +::: note +<%= include('../../../../_includes/_rbac_methods') %> +::: + +In this article we'll cover the basics of users, groups, roles, and permissions. Let's say that you have an application that is accessible to everyone within your corporation. The **users** are the individuals to whom you'd like to grant access to your application. @@ -39,7 +50,7 @@ Rather than assigning both permissions to groups/users, you can roll the two (al ## Users -The **Users** section lists all the current users of your applications. You can use this to search for and select a specific user to see their profile, view or edit their group affiliations, and view or edit their roles. +The **Users** section lists all the current users of your applications. Here you can find a specific user, see their profile, change their group affiliations, and change their roles. ![Users Section](/media/articles/extensions/authorization/users.png) @@ -105,7 +116,7 @@ You can create different types of Roles such as: Expense Admins, Expense Manager ![Roles](/media/articles/extensions/authorization/roles.png) -To add a role, click the **CREATE ROLE** button from the **Roles** section of the dashboard. Then choose the application this Role applies to (such as Expense Management Tool) and then add a name of the role (such as Expense Admins) and a description of the role. Then select the permissions you wish to grant to this role. If you haven't yet created your permissions you can add them later to an exisiting Role. +To add a role, click the **CREATE ROLE** button from the **Roles** section of the dashboard. Then choose the application this Role applies to (such as Expense Management Tool) and then add a name of the role (such as Expense Admins) and a description of the role. Then select the permissions you wish to grant to this role. If you haven't yet created your permissions you can add them later to an existing Role. ![Add a New Role](/media/articles/extensions/authorization/add-role.png) diff --git a/articles/extensions/authorization-extension/v2/import-export-data.md b/articles/extensions/authorization-extension/v2/import-export-data.md index d540b48fc7..2486b60091 100644 --- a/articles/extensions/authorization-extension/v2/import-export-data.md +++ b/articles/extensions/authorization-extension/v2/import-export-data.md @@ -1,14 +1,25 @@ --- title: Importing Data Into and Exporting Data from the Authorization Extension description: How to import/export Authorization Extension Data +topics: + - extensions + - authorization_v2 +contentType: + - how-to + - concept +useCase: extensibility-extensions --- # Authorization Extension: Import/Export Data +::: note +<%= include('../../../_includes/_rbac_methods') %> +::: + You can import new data from or export existing authorization data to a JSON file. This can be useful when moving environments. ::: warning -Roles and permissions are linked to specific applications. If you export your JSON file and import it into a different environment, you will need to change the client ID for these records. +Roles and permissions are linked to specific applications. If you export your JSON file and import it into a different environment, you will need to change the client ID for these records. ::: You can get to the **Import/Export** section by clicking **Configuration** on the drop-down menu accessible by clicking on your tenant name at the top right of the **Authorization Dashboard**. diff --git a/articles/extensions/authorization-extension/v2/index.md b/articles/extensions/authorization-extension/v2/index.md index 34520d7d2a..90af84435f 100644 --- a/articles/extensions/authorization-extension/v2/index.md +++ b/articles/extensions/authorization-extension/v2/index.md @@ -3,13 +3,61 @@ toc: true classes: topic-page title: Authorization Extension description: Control user authorization behavior during runtime with the Authorization Extension +topics: + - extensions + - authorization_v2 +contentType: + - how-to + - concept +useCase: extensibility-extensions --- # Authorization Extension -The Authorization Extension provides support for user authorization via Groups, Roles, and Permissions. You can define the expected behavior during the login process, and your configuration settings will be captured in a [rule](/rules) that's executed during runtime. +::: panel Breaking Changes +Authorization Extension 2.6 contains breaking changes that result from changed logic for storing and handling the API Key; these require you to perform additional steps upon upgrade, as detailed below. Failing to complete these steps will result in either an `InvalidApiKey` or `You are not allowed to access this application` error on rule execution. For more info, see the [changelog](https://github.com/auth0/auth0-authorization-extension/blob/master/CHANGELOG.md). -You can store authorization data like groups, roles, or permissions in the outgoing token issued by Auth0. Your application can then consume this information by inspecting the token and take appropriate actions based on the user's current authorization context. +Upgrades from version 2.6 or later do not have breaking changes and require no further action. + +**If you are upgrading from a version before 2.6, you must:** + +Upgrade the Authorization Extension + +1. Navigate to the [Extensions](${manage_url}/#/extensions) page in the [Auth0 Dashboard](${manage_url}), and click the **Installed Extensions** tab. +2. Locate **Auth0 Authorization**, click **Upgrade**, and confirm. Wait for the upgrade to complete. + +Rotate the extension's API Key + +1. Click on **Auth0 Authorization** to open the extension. +2. From the dropdown menu in the top-right of the extension dashboard, select **Configuration**. +3. Locate the **API Key** section, and click **Rotate**. + +Republish the extension's Rule + +1. Click **Publish Rule**. + +Delete the old extension Rule, if it exists + +1. Navigate to the [Rules](${manage_url}/#/rules) page in the [Auth0 Dashboard](${manage_url}) +2. Locate the `auth0-authz` rule. If it does not exist, you are done.; otherwise, continue with these steps: +3. Locate the `auth0-authorization-extension` rule and drag it into the position below the `auth0-authz` rule. +4. Check that the `auth0-authz` rule: + * was authored by the Authorization Extension and has not been modified manually + * will not change the authorization flow in a way that will grant access or privileges to undesired users if it is removed +5. If the above conditions are true, use the toggle to disable the `auth0-authz` rule. After verifying that everything works appropriately, you can decide whether to leave the rule disabled or remove it entirely. +::: + +::: note +<%= include('../../../_includes/_rbac_methods') %> +::: + +<%= include('../../../_includes/_rbac_vs_extensions') %> + +The Authorization Extension provides support for user authorization via Groups, Roles, and Permissions. You can define the expected behavior during the login process, and your configuration settings will be captured in a [rule](/rules) that's executed during runtime. + +With the Authorization Extension, you can store authorization data like groups, roles, or permissions in the outgoing token issued by Auth0. Your application can then consume this information by inspecting the token and take appropriate actions based on the user's current authorization context. + +With the Authorization Extension, roles and permissions are set on a per-application basis. If you need the same roles or permissions on another application, you'll have to create them separately. Conversely, the [Authorization Core](/authorization/concepts/core-vs-extension) feature set provides much more flexibility with roles and permissions. ## Get Started diff --git a/articles/extensions/authorization-extension/v2/migration.md b/articles/extensions/authorization-extension/v2/migration.md index 4ef03613c2..fb2d873770 100644 --- a/articles/extensions/authorization-extension/v2/migration.md +++ b/articles/extensions/authorization-extension/v2/migration.md @@ -1,10 +1,21 @@ --- title: Installing the Authorization Extension v2 description: How to install the Authorization Extension v2 +topics: + - extensions + - authorization_v2 +contentType: + - how-to + - concept +useCase: extensibility-extensions --- # Authorization Extension: Migrate from Version 1 to Version 2 +::: note +<%= include('../../../_includes/_rbac_methods') %> +::: + ::: warning Migrating from Version 1 to Version 2 is a breaking change ::: diff --git a/articles/extensions/authorization-extension/v2/rules.md b/articles/extensions/authorization-extension/v2/rules.md index 4a01391891..5a9fc25412 100644 --- a/articles/extensions/authorization-extension/v2/rules.md +++ b/articles/extensions/authorization-extension/v2/rules.md @@ -2,22 +2,33 @@ title: Using Rules with the Authorization Extension description: How to use information from the extension in rules toc: true +topics: + - extensions + - authorization_v2 +contentType: + - how-to + - concept +useCase: extensibility-extensions --- # Authorization Extension: Rules +::: note +<%= include('../../../_includes/_rbac_methods') %> +::: + You can use [rules](/rules) with the Authorization Extension to do things like: -* Add [custom claims](/scopes/current#custom-claims) to the issued token -* Determining the user's group membership, roles and permissions +* Add [custom claims](/tokens/concepts/jwt-claims#custom-claims) to the issued token +* Determining the user's group membership, roles and permissions * Storing the user's groups, roles and permissions info as [part of the `app_metadata`](/extensions/authorization-extension/v2/configuration#persistence) -* Adding the user's groups, roles and permissions to the [outgoing token]((/extensions/authorization-extension/v2/configuration#token-contents)) (which can be requested via the `openid groups permissions roles` scope) +* Adding the user's groups, roles and permissions to the [outgoing token](/extensions/authorization-extension/v2/configuration#token-contents) (which can be requested via the `openid groups permissions roles` scope) Because the above logic is part of a rule, it will only be executed in the context of a login. If users are added to or removed from a group, this change will only be reflected in Auth0 after the user's next login. ## Add Custom Claims to the Issued Token -If you'd like to add custom claims to your tokens, you can do so by creating additional [rule](/rules) that allows the Authorization Extension to do so. +If you'd like to add custom claims to your tokens, you can do so by creating additional [rule](/rules) that allows the Authorization Extension to do so. Custom claims should be [namespaced](/tokens/guides/create-namespaced-custom-claims). ::: note You should [limit the number of claims](/extensions/authorization-extension/v2/configuration#data-limitations) you add to the token. @@ -48,7 +59,7 @@ You can also write rules that are executed after the Authorization Extension rul ### Step 1: Set the Application Metadata's `required_roles` -In this step, you'll set the Application's metadata with it's roles, which are groups of permissions that you've grouped together to create a specific set of functionality. You can think of this step as "tagging" the Application so that the rules you'll set up in the next step know which Application to act on. +In this step, you'll set the Application's metadata with its roles, which are groups of permissions that you've grouped together to create a specific set of functionality. You can think of this step as "tagging" the Application so that the rules you'll set up in the next step know which Application to act on. ⁠⁠⁠⁠1. To set the `context.clientMetadata` field with `required_roles`, begin by selecting the application you want to work with [in the dashboard](${manage_url}/#/applications). @@ -101,4 +112,4 @@ function (user, context, callback) { * [Import/Export Data](/extensions/authorization-extension/v2/import-export-data) * [Troubleshoot Errors](/extensions/authorization-extension/v2/troubleshooting) * [Enable API Access to the Extension](/extensions/authorization-extension/v2/api-access) -::: \ No newline at end of file +::: diff --git a/articles/extensions/authorization-extension/v2/troubleshooting.md b/articles/extensions/authorization-extension/v2/troubleshooting.md index 479c325880..2d54316712 100644 --- a/articles/extensions/authorization-extension/v2/troubleshooting.md +++ b/articles/extensions/authorization-extension/v2/troubleshooting.md @@ -1,18 +1,32 @@ --- -title: Troubleshooting the Authorization Extension -description: How to troubleshoot the Authorization Extension +title: Troubleshoot the Authorization Extension +description: Learn how to troubleshoot the Authorization Extension, +topics: + - extensions + - authorization_v2 +contentType: + - how-to +useCase: extensibility-extensions --- -# Authorization Extension: Troubleshoot Issues +# Troubleshoot the Authorization Extension + +::: note +<%= include('../../../_includes/_rbac_methods') %> +::: The following are some issues you might see when setting up the Authorization Extension, as well as some tips to help you identify the cause. ## The authentication results in a token that contains groups information, but not roles or permissions information. -If this happens, chances are that you created roles and permissions for one application, but your users are authenticating using another application. For example, let's say that you created all your roles/permissions against Website A. However, you also create another website application in Auth0 for Website B. Then, you use the `client_id` and `client_secret` for Website B, instead of those for Website A, in your app. +If this happens, chances are that you created roles and permissions for one application, but your users are authenticating using another application. For example, let's say that you created all your roles/permissions against Website A. However, you also create another website application in Auth0 for Website B. Then, you use the `client_id` and `client_secret` for Website B, instead of those for Website A, in your app. Alternatively, you might see this if you click the **Try** button in the Auth0 Dashboard on a Connection that contains one of your users. This will execute an authentication flow using the Auth0 _global application_, but this is not the same as the application you configured in the extension. ## My application is not shown in the drop-down menu when setting up the extension. -The supported application types for the Authorization extension are: **Native**, **Single Page Web Applications** and **Regular Web Applications**. Applications with no type assigned and **Machine to Machine Applications** are not supported. \ No newline at end of file +The supported application types for the Authorization extension are: **Native**, **Single-Page Web Applications** and **Regular Web Applications**. Applications with no type assigned and **Machine to Machine Applications** are not supported. + +## I upgraded to v2 and my users get an error upon login + +If you see the error `You are not allowed to access this application`, most probably there is some conflict with the old rule. Turn off the persistence settings, delete the existing rule, re-enable the settings, and test again. diff --git a/articles/extensions/azure-blob-storage.md b/articles/extensions/azure-blob-storage.md index 150b17c26c..d4c14196f0 100644 --- a/articles/extensions/azure-blob-storage.md +++ b/articles/extensions/azure-blob-storage.md @@ -1,5 +1,12 @@ --- description: This page explains how to configure and use Auth0's extension for Auth0 Logs to Azure Blob Storage. +topics: + - extensions + - azure + - blob-storage +contentType: + - how-to +useCase: extensibility-extensions --- # Auth0 Logs to Azure Blob Storage @@ -26,6 +33,8 @@ At this point you should set the following configuration variables: Once you have provided this information, click the *Install* button to finish installing the extension. +<%= include('./_includes/_batch-size') %> + ## Retrieve the required information from Azure Portal We need the following information: Account Name, Account Key, and Container Name. Let's see how we can retrieve these values from Azure Portal. @@ -36,7 +45,9 @@ Log into your Azure account and click on __Storage accounts__ on the left-hand s The __Account Name__ is the name of your storage account, the one we created is named `azureauth0logs`. -This value should be set as __Storage_Account_Name__. +This value should be set as __Storage_Account_Name__. + +The value **Kind** should be set as **Storage**. ![Azure Storage Account Name](/media/articles/extensions/azure/storage-accnt-name.png) @@ -54,8 +65,7 @@ Click on the __Access keys__ tab. Here you can find the value for __Storage_Acco Now that you have retrieved all three values head back to the [Auth0 dashboard](${manage_url}) and set them at the corresponding fields. You 're done! - -## Use Your Installed Extension +## Use installed Extension To view all scheduled jobs, navigate to the [Extensions](${manage_url}/#/extensions) page, click on the __Installed Extensions__ link, and select the __Auth0 Logs to Azure Blob Storage__ line. There you can see the job you just created, modify its state by toggling the __State__ switch, see when the next run is due and what was the result of the last execution. diff --git a/articles/extensions/bitbucket-deploy.md b/articles/extensions/bitbucket-deploy.md index c05a2580fc..c597432fed 100644 --- a/articles/extensions/bitbucket-deploy.md +++ b/articles/extensions/bitbucket-deploy.md @@ -1,11 +1,17 @@ --- toc: true description: The Bitbucket Deployments extension allows you to deploy Rules and Database Connection scripts from Bitbucket to Auth0. +topics: + - extensions + - bitbucket-deployments +contentType: + - how-to +useCase: extensibility-extensions --- # Bitbucket Deployments -The **Bitbucket Deployments** extension allows you to deploy [Rules](/rules) and Database Connection scripts from Bitbucket to Auth0. You can configure a Bitbucket repository, keep all of your Rules and Database Connection scripts there, and have them automatically deployed to Auth0 whenever you push changes to your repository. +The **Bitbucket Deployments** extension allows you to deploy [rules](/rules), rules configs, connections, database connection scripts, clients, client grants, resource servers, Universal Login pages and email templates from Bitbucket to Auth0. You can configure a Bitbucket repository, keep all of your Rules and Database Connection scripts there, and have them automatically deployed to Auth0 whenever you push changes to your repository. ## Configure the Extension @@ -15,11 +21,17 @@ To install and configure this extension, click on the **Bitbucket Deployments** Set the following configuration variables: -* **BITBUCKET_REPOSITORY**: the repository from which you want to deploy your Rules and Database Connection scripts (this can be either a public or private repository); -* **BITBUCKET_BRANCH**: the branch the extension will monitor for changes; -* **BITBUCKET_USER**: the username used to access the Bitbucket account; -* **BITBUCKET_PASSWORD**: the password associated with the username used to access the Bitbucket account; -* **SLACK_INCOMING_WEBHOOK**: the Webhook URL for Slack used to notify you of successful and failed deployments. +* **REPOSITORY**: The repository from which you want to deploy your Rules and Database Connection scripts. This can be either a public or private repository +* **BRANCH**: The branch the extension will monitor for changes +* **USER**: The username used to access the Bitbucket account. Make sure you use the username, and not the email +* **PASSWORD**: The user password or an app password you create through the Bitbucket settings to grant permissions to certain apps (`Repositories: Read` permission is required) +* **BASE_DIR**: The base directory, where all your tenant settings are stored +* **AUTO_REDEPLOY**: If enabled, the extension redeploys the last successful configuration in the event of a deployment failure. Manual deployments and validation errors does not trigger auto-redeployment +* **SLACK_INCOMING_WEBHOOK**: The Webhook URL for Slack used to notify you of successful and failed deployments + +::: note +Some of the configuration variables were changed in version **2.6.0** of this extension. If you are updating the extension from a prior version, make sure that you update your configuration accordingly. +::: Once you have provided this information, click **Install**. @@ -45,7 +57,16 @@ You can find details on how to configure a webhook at [Creating Webhooks](https: Once you have set up the webhook in Bitbucket using the provided information, you are ready to start committing to your repository. -With each commit you push to your configured Bitbucket repository, the webhook will call the extension to initiate a deployment if changes were made to the `rules` and/or the `database-connection` folders. +With each commit you push to your configured Bitbucket repository, the webhook will call the extension to initiate a deployment if changes were made to one of these folders: +- `clients` +- `grants` +- `emails` +- `resource-servers` +- `connections` +- `database-connections` +- `rules-configs` +- `rules` +- `pages` The **Deploy** button on the **Deployments** tab of the extension allows you to manually deploy the Rules and Database Connection scripts that you already have in your Bitbucket repository. This is useful if your repository already contains items that you want to deploy once you have set up the extension or if you have accidentally deleted some scripts in Auth0 and need to redeploy the latest version of your repository. @@ -70,22 +91,55 @@ For a generic Custom Database Connection, only the `login.js` script is required You can find examples in [the Auth0 Samples repository](https://github.com/auth0-samples/github-source-control-integration/tree/master/database-connections/my-custom-db). While the samples were authored for GitHub, it will work for a Bitbucket integration as well. -### Deploy Hosted Pages +#### Deploy Database Connection Settings + +To deploy Database Connection settings, you must create `database-connections/[connection-name]/database.json`. + +_This will work only for Auth0 connections (strategy === auth0); for non-Auth0 connections use `connections`._ + +_Support for using `settings.json` has been deprecated in favor of `database.json` since v3.1.1 of the extension and may be dropped in a future release._ + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Connections/patch_connections_by_id) for more info on allowed attributes for Connections. + +### Deploy Connections + +To deploy a connection, you must create a JSON file under the `connections` directory of your Bitbucket repository. Example: + +__facebook.json__ +```json +{ + "name": "facebook", + "strategy": "facebook", + "enabled_clients": [ + "my-client" + ], + "options": {} +} +``` + +<%= include('./_includes/_embedded-clients-array') %> + +_This will work only for non-Auth0 connections (`strategy !== auth0`); for Auth0 connections, use `database-connections`._ + +For more info on the allowed attributes for connections, see the [Post Connections endpoint] (/api/management/v2#!/Connections/post_connections). + +### Deploy Universal Login Pages + +The supported pages are: -The supported hosted pages are: - `error_page` - `guardian_multifactor` - `login` - `password_reset` -To deploy a page, you must create an HTML file under the `pages` directory of your Bitbucket repository. For each HTML page you need to create a JSON file (with the same name) that will be used to mark the page as enabled or disabled. For example, in order to deploy an `error_page`, you would create two files: +To deploy a page, you must create an HTML file under the `pages` directory of your Bitbucket repository. For each HTML page, you need to create a JSON file (with the same name) that will be used to mark the page as enabled or disabled. For example, to deploy a `password_reset`, you would create two files: ```text -your-bitbucket-repo/pages/error_page.html -your-bitbucket-repo/pages/error_page.json +your-bitbucket-repo/pages/password_reset.html +your-bitbucket-repo/pages/password_reset.json ``` -To enable the page the `error_page.json` would contain the following: +To enable the page, the `password_reset.json` would contain the following: ```json { @@ -93,9 +147,11 @@ To enable the page the `error_page.json` would contain the following: } ``` +<%= include('./_includes/_use-default-error') %> + ### Deploy Rules -To deploy a rule, you must first create a JavaScript file under the `rules` directory of your Bitbucket repository. Each Rule must be in its own `.js` file. +To deploy a rule, you must first create a JavaScript file under the `rules` directory of your Bitbucket repository. Each Rule must be in its own JavaScript file. For example, if you create the file `rules/set-country.js`, the extension will create a Rule in Auth0 with the name `set-country`. @@ -103,10 +159,6 @@ For example, if you create the file `rules/set-country.js`, the extension will c If you plan to use source control integration for an existing account, first rename your Rules in Auth0 to match the name of the files you will be deploying to this directory. ::: -You can mark rules as manual. In that case, the source control extension will not delete or update them. To mark a rule navigate to the **Rules Configuration** tab of the **Bitbucket Integration** page. Toggle the **Manual Rule** switch for the rules you want to mark as manual. Click **Update Manual Rules** to save your changes. - -![](/media/articles/extensions/bitbucket-deploy/manual-rules.png) - You can control the Rule order and status (`enabled`/`disabled`) by creating a JSON file with the same name as your JavaScript file. For this example, you would create a file named `rules/set-country.json`. __set-country.js__ @@ -120,7 +172,7 @@ function (user, context, callback) { ``` __set-country.json__ -```javascript +```json { "enabled": false, "order": 15, @@ -132,7 +184,158 @@ You can find a `login_success` example in [the Auth0 Samples repository](https:/ #### Set Rule Order -To avoid conflicts, you are cannot set multiple Rules of the same order. However, you can create a JSON file for each rule, and within each file, assign a value for `order`. We suggest using number values that allow for reordering with less risk for conflict. For example, assign a value of `10` to the first Rule and `20` to the second Rule, rather than using values of `1` and `2`, respectively). +To avoid conflicts, you cannot set multiple Rules of the same order. However, you can create a JSON file for each rule, and within each file, assign a value for `order`. We suggest using number values that allow for reordering with less risk of conflict. For example, assign a value of `10` to the first Rule and `20` to the second Rule, rather than using values of `1` and `2`, respectively). + +### Deploy Rules Configs + +To deploy a rule config, you must create a JSON file under the `rules-configs` directory of your Bitbucket repository. Example: + +__secret_number.json__ +```json +{ + "key": "secret_number", + "value": 42 +} +``` + +### Deploy Clients + +To deploy a client, you must create a JSON file under the `clients` directory of your Bitbucket repository. Example: + +__my-client.json__ +```json +{ + "name": "my-client" +} +``` + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Clients/post_clients) for more info on allowed attributes for Clients and Client Grants. + +### Deploy Clients Grants + +You can specify the client grants for each client by creating a JSON file in the `grants` directory. + +__my-client-api.json__ +```json +{ + "client_id": "my-client", + "audience": "https://myapp.com/api/v1", + "scope": [ + "read:users" + ] +} +``` + +<%= include('./_includes/_deployment-extension') %> + +### Deploy Resource Servers + +To deploy a resource server, you must create a JSON file under the `resource-servers` directory of your Bitbucket repository. Example: + +__my-api.json__ +```json +{ + "name": "my-api", + "identifier": "https://myapp.com/api/v1", + "scopes": [ + { + "value": "read:users", + "description": "Allows getting user information" + } + ] +} +``` + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Resource_Servers/post_resource_servers) for more info on allowed attributes for Resource Servers. + +### Deploy Email Provider + +To deploy an email provider, you must create `provider.json` file under the `emails` directory of your Bitbucket repository. Example: + +__provider.json__ +```json +{ + "name": "smtp", + "enabled": true, + "credentials": { + "smtp_host": "smtp.server.com", + "smtp_port": 25, + "smtp_user": "smtp_user", + "smtp_pass": "smtp_secret_password" + } +} +``` + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Emails/patch_provider) for more info on allowed attributes for Email Provider. + +### Deploy Email Templates + +The supported email templates are: +- `verify_email` +- `reset_email` +- `welcome_email` +- `blocked_account` +- `stolen_credentials` +- `enrollment_email` +- `mfa_oob_code` + +To deploy an email template, you must create an HTML file under the `emails` directory of your Bitbucket repository. For each HTML file, you need to create a JSON file (with the same name) with additional options for that template. For example, to deploy a `blocked_account` template, you would create two files: + +```text +your-bitbucket-repo/emails/blocked_account.html +your-bitbucket-repo/emails/blocked_account.json +``` + +__blocked_account.json__ +```json +{ + "template": "blocked_account", + "from": "", + "subject": "", + "resultUrl": "", + "syntax": "liquid", + "body": "./blocked_account.html", + "urlLifetimeInSeconds": 432000, + "enabled": true +} +``` + +## Excluded records + +You can exclude the following records from the deployment process: `rules`, `clients`, `databases`, `connections` and `resourceServers`. If excluded, the records will not be modified by deployments. + +![](/media/articles/extensions/deploy-extensions/excluded-rules.png) + +## Keywords Mapping + +Beginning with version **3.0.0**, you can use keywords mapping to manage your secrets and tenant-based environment variables. + +There are two ways to use the keyword mappings. You can either wrap the key using `@` symbols (e.g., `@@key@@`), or you can wrap the key using `#` symbols (e.g., `##key##`). + + - If you use `@` symbols, your value will be converted from a JavaScript object or value to a JSON string. + + - If you use `#` symbols, Auth0 will perform a literal replacement. + +This is useful for something like specifying different variables across your environments. For example, you could specify different JWT timeouts for your Development, QA/Testing, and Production environments. + +Refer to the snippets below for sample implementations: + +__Client.json__ +```json +{ + ... + "callbacks": [ + "##ENVIRONMENT_URL##/auth/callback" + ], + "jwt_configuration": { + "lifetime_in_seconds": ##JWT_TIMEOUT##, + "secret_encoded": true + } + ... +} +``` + +![](/media/articles/extensions/deploy-extensions/mappings.png) ## Track Deployments diff --git a/articles/extensions/cloudwatch.md b/articles/extensions/cloudwatch.md new file mode 100644 index 0000000000..c68d6e3624 --- /dev/null +++ b/articles/extensions/cloudwatch.md @@ -0,0 +1,69 @@ +--- +description: How to install and configure the Auth0 Logs to CloudWatch extension. +topics: + - extensions + - cloudwatch +contentType: + - how-to +useCase: extensibility-extensions +--- + +# Auth0 Logs to CloudWatch + +The **Auth0 Logs to CloudWatch** extension is a scheduled job that exports your Auth0 logs to [CloudWatch](https://aws.amazon.com/cloudwatch/). Amazon CloudWatch is a monitoring and management service built for developers, system operators, site reliability engineers (SRE), and IT managers. + +## Configure the Extension + +To install and configure this extension, click on the **Auth0 Logs to CloudWatch** box in the list of provided extensions on the [Extensions](${manage_url}/#/extensions) page of the [Management Portal](${manage_url}). The **Install Extension** window pops open. + +At this point you should set the following configuration variables: + +| Parameter | Description | +|:-----------------|:------------| +| **Schedule** | The frequency with which logs should be exported. The schedule can be customized even further after creation. | +| **BATCH_SIZE** | The amount of logs to be read on each execution. Maximun, and default, is `100`. | +| **START_FROM** | The checkpoint ID of the log from where you want to start. | +| **SLACK_INCOMING_WEBHOOK** | The Slack incoming webhook URL used to send relevant updates. | +| **SLACK_SEND_SUCCESS** | Toggle for sending verbose notifications to Slack. | +| **LOG_LEVEL** | The minimal log level of events that you would like sent to CloudWatch. | +| **LOG_TYPES** | The events for which logs should be exported. | +| **CLOUDWATCH_LOG_GROUP_NAME**
      Required | CloudWatch log group name, created in CloudWatch. | +| **CLOUDWATCH_LOG_STREAM_NAME**
      Required | CloudWatch log stream name. | +| **AWS_ACCESS_KEY_ID**
      Required | AWS access key ID | +| **AWS_SECRET_KEY**
      Required | AWS secret key | +| **AWS_REGION**
      Required | Your AWS region | + +### Required permissions + +Extension requires these AWS permissions in order to send logs to CloudWatch: +- `logs:PutLogEvents` +- `logs:DescribeLogStreams` + +Once you have provided this information, click the _Install_ button to finish installing the extension. + +<%= include('./_includes/_batch-size') %> + +## Use the Extension + +You can monitor activity by logging into the extension. There you can find reports on most recent runs. Reports contains amount of logs processed and errors, if any. + +## Replay Logs + +In the event of a CloudWatch failure or service interruption you can replay the logs starting from the failed log. + +To replay logs: + +1. Get the checkpoint ID of the failed log. +2. Go to the Auth0 Logs to CloudWatch extension settings. +3. Enter the checkpoint in the **START_FROM** field. +4. Click the **Save** button to replay the failed logs. + +## Slack Integration + +To set up [Slack](https://slack.com/) integration, provide an [Incoming Webhook URL](https://api.slack.com/incoming-webhooks) to the **SLACK_INCOMING_WEBHOOK** field in the Auth0 Logs to CloudWatch [extension settings](${manage_url}/#/extensions). + +![Slack Settings](/media/articles/extensions/logstash/slack-settings.png) + +The extension sends failed transaction notifications to Slack with the checkpoint code displayed in the message. You can also enable verbose notifications by turning on the `SLACK_SEND_SUCCESS` setting. + +![Slack Message](/media/articles/extensions/logstash/slack-message.png) diff --git a/articles/extensions/custom-social-extensions.md b/articles/extensions/custom-social-extensions.md index f1170c6b98..436b0117c4 100644 --- a/articles/extensions/custom-social-extensions.md +++ b/articles/extensions/custom-social-extensions.md @@ -1,35 +1,38 @@ --- description: How to configure a Custom Social Connection to your Auth0 app. toc: true +topics: + - extensions + - custom-social-connections +contentType: + - how-to +useCase: extensibility-extensions --- # Auth0 Extension: Custom Social Connections -The Custom Social Connections extension allows you to easily manage multiple social connections. +The Custom Social Connections extension allows you to manage multiple social connections easily. -## Set Up a New Social Connection +## Set Up a New Social Connection Extension -To install the Custom Social Connection app, click on the **Custom Social Connections** box on the main [Extensions](${manage_url}/#/extensions) page of the Management Portal. You will be prompted to install the app. -![](/media/articles/extensions/installing-custom-social-connections.png) +To install the Custom Social Connections extension, log in to the Dashboard and go to [Extensions](${manage_url}/#/extensions). Click the **Custom Social Connections** box. You will be prompted to install the app. -At this point, you will see the app listed under the **Installed Extensions** tab. +When the extension has been installed, you'll be redirected to a page that lists your extension under **Installed Extensions** tab. -![](/media/articles/extensions/installed-custom-social-extension.png) +## Configure the Social Connection Extension settings Once you have installed the app, you will need to configure it to work with whichever social providers you require. To do so, click on the **Custom Social Connections** link listed under **Installed Extensions**. You will be asked to authorize the Custom Social Connections app. After you do so, the **New Connection** window will open. -![](/media/articles/extensions/custom-social-connections.png) +Click the slider next to the social provider(s) you want to set up. The slider will turn from grey to green, indicating that a connection to that provider exists. -Click the slider next to the social provider you want to set up. The slider will turn from grey to green, indicating that a connection to that provider exists. For additional information on how each individual provider handles authentication, see that provider's documentation. +For information on how each provider handles authentication, see that provider's documentation. -### Configure the Social Connection Settings +### Settings configuration -The **New Connection** window contains two tabs: **Settings** and **Apps**: - -![](/media/articles/extensions/new-custom-social-connection.png) +As soon as you enable a specific social connection, Auth0 displays a pop-up **New Connection** window that contains two tabs: **Settings** and **Apps**. You will need to update these tabs accordingly so that your connection works as expected. #### New Connection: Settings @@ -39,16 +42,16 @@ The Settings page is used to provide the information required to set up the soci - __Client ID__: The provider's client ID; - __Client Secret__: The provider's client secret; - __Authorization URL__: The URL where the transaction begins and authorization occurs; -- __Token URL__: The URL used to exchange the code generated from the information you provide for an access_token; +- __Token URL__: The URL used to exchange the code generated from the information you provide for an Access Token; - __Scope__: The scope parameters for which you want access rights; - __Fetch User Profile Script__: The JS function that returns the user profile and associated information. It will be auto-generated with the appropriate fields depending on the chosen provider. - __Custom Headers__: An optional JSON object that lets you provide custom headers to be included in the HTTP calls to the provider. Should be in the format of: ``` { - "Header1" : "Value", - "Header2" : "Value" - // ... + "Header1" : "Value", + "Header2" : "Value" + // ... } ``` @@ -58,18 +61,18 @@ After you have provided values for the required fields, click **Save**. Once you have successfully configured the connection, you will be presented with a list of apps associated with your Auth0 tenant under the **Apps** tab of the **New Connection** window. -Using the slider, enable this social connection for the apps that you want to use it with. +Using the slider, enable this social connection for the apps that you want to use it with. **If you do not enable *any* of the listed apps, you will not be able to use the connection.** Once you have enabled/disabled the appropriate apps, click **Save**. ### Provide your Callback URL to the Identity Provider -The callback URL is the URL that is invoked by the provider after the authentication request has finished. +The callback URL is the URL that is invoked by the provider after the authentication request has finished. Your provider will ask you to provide this URL at some point during the setup process. Use this value for the **Callback URL**: `https://${account.namespace}/login/callback` -Depending on the provider, this field can be referred to by different names. Sometimes called a **Redirect URI** the callback URL may also be be referred to as: "Valid OAuth redirect URI", "Authorized redirect URI", "Allowed Return URL" or something similar. +Depending on the provider, this field can be referred to by different names. Sometimes called a **Redirect URI**, the callback URL may also be referred to as: "Valid OAuth redirect URI," "Authorized redirect URI," "Allowed Return URL," or something similar. ## Use your new connection @@ -85,13 +88,13 @@ Lock does not currently support displaying buttons for custom social connections ## Optional: Set up Basic Authentication -By default, when invoking the __Token URL__ to exchange the authentication code for an access_token, Auth0 will provide the `client ID` and `client secret` as part of the body of the POST. Some identity providers require [HTTP Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication), which involves providing those same credentials in a HTTP header. +By default, when invoking the __Token URL__ to exchange the authentication code for an Access Token, Auth0 will provide the `client ID` and `client secret` as part of the body of the POST. Some identity providers require [HTTP Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication), which involves providing those same credentials in an HTTP header. -If the identity provider requires Basic Authentication, you can be use the __Custom Headers__ setting with a JSON object like this: +If the identity provider requires Basic Authentication, you can use the __Custom Headers__ setting with a JSON object like this: ``` { - "Authorization" : "Basic xxxxxxxx" + "Authorization" : "Basic xxxxxxxx" } ``` @@ -99,14 +102,10 @@ If the identity provider requires Basic Authentication, you can be use the __Cus ``` { - "Authorization" : "Basic MTIzNDU2OmFiY2RlZg==" + "Authorization" : "Basic MTIzNDU2OmFiY2RlZg==" } ``` ## Additional Steps -Depending on which social providers you are you using, there may be additional steps in the provider configuration to enable the connection. - -### WordPress - -You will need to add the associated **Plugin** in WordPress for the social connection. For example, to enable login with Slack the Slack plugin will need to be enabled in WordPress (make sure you’re logged in as an Administrator). \ No newline at end of file +Depending on which social providers you are you using, there may be additional steps in the provider configuration to enable the connection. Please refer to the provider-specific documentation for clarifying details. diff --git a/articles/extensions/delegated-admin/hooks.md b/articles/extensions/delegated-admin/hooks.md deleted file mode 100644 index 9cc6360457..0000000000 --- a/articles/extensions/delegated-admin/hooks.md +++ /dev/null @@ -1,319 +0,0 @@ ---- -description: How to customize the behavior of the Delegated Administration extension using Hooks -toc: true ---- - -# Delegated Administration: Hooks - -If you are a user with the `Delegated Admin - Administrator` role in your User Profile, log in to the Delegated Administration Dashboard, and click on your name in the top right corner, you'll see a *Configure* option. On the Configuration page, you can manage the different Hooks and queries that allow you to customize the behavior of the Delegated Administration extension. - -![](/media/articles/extensions/delegated-admin/dashboard-configuration.png) - -## Hooks Signature - -Hooks always have the following signature: - -```js -function(ctx, callback) { - // First do some work - ... - - // Done - return callback(null, something); -} -``` - -The context object will expose a few helpers and information about the current request. The following methods and properties are available in every Hook. - -**1. Logging** - - To add a message to the Webtask logs (which you can view using the [Realtime Webtask Logs](/extensions/realtime-webtask-logs) extension), call the `log` method: - - ```js - ctx.log('Hello there', someValue, otherValue); - ``` - -**2. Caching** - - To cache something (such as a long list of departments), you can store it on the context's `global` object. This object will be available until the Webtask container recycles. - - ```js - ctx.global.departments = [ 'IT', 'HR', 'Finance' ]; - ``` - -**3. Custom Data** - - You can store custom data within the extension. This is field is limited to 400kb of data. - - ```js - var data = { - departments: [ 'IT', 'HR', 'Finance' ] - }; - - ctx.write(data) - .then(function() { - ... - }) - .catch(function(err) { - ... - }); - ``` - - To read the data: - - ```js - ctx.read() - .then(function(data) { - ... - }) - .catch(function(err) { - ... - }); - ``` - -**4. Payload and Request** - - Each Hook exposes the current payload and/or request with specific information. The request will always contain information about the user that is logged into the Users Dashboard: - - ```js - var currentUser = ctx.request.user; - ``` - -**5. Remote Calls** - - If you want to call an external service (such as an API) to validate data or to load memberships, you can do this using the `request` module. - - ```js - function(ctx, callback) { - var request = require('request'); - request('http://api.mycompany.com/departments', function (error, response, body) { - if (error) { - return callback(error); - } - - ... - }); - } - ``` - -## The Filter Hook - -By default, users with the **Delegated Admin - User** role see *all* users associated with the Auth0 account. However, you can filter the data users see using the **Filter Hook**. - -### The Hook contract: - - - `ctx`: The context object - - `callback(error, query)`: The callback to which you can return an error or the [lucene query](/api/management/v2/query-string-syntax) used when filtering the users. The extension will send this query to the [`GET Users` endpoint](/api/management/v2#!/Users/get_users) of the Management API - -### Example - -If **Kelly** manages the Finance department, she should only see the users that are also part of the Finance department. We'll filter the users with respect to the department of the current user. - -```js -function(ctx, callback) { - // Get the department from the current user's metadata. - var department = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; - if (!department || !department.length) { - return callback(new Error('The current user is not part of any department.')); - } - - // The IT department can see all users. - if (department === 'IT') { - return callback(); - } - - // Return the lucene query. - return callback(null, 'app_metadata.department:"' + department + '"'); -} -``` - -::: panel-warning Using Special Characters -Do not use single quotes, double quotes, or any other special characters (such as `+` or `-`) in any term on which you'll want to filter. This might cause issues with the Lucene query. -::: - -If you do not configure this Hook, the search returns **all users**. - -## The Access Hook - -While the **Filter Hook** only applies filtering logic you'll need a second layer of logic to determine if the current user is allowed to access a specific user. This is what the **Access Hook** allows you to do, determine if the current user is allowed to read, delete, block, or unblock a specific user. - -### The Hook contract: - - - `ctx`: The context object - - `payload`: The payload object - - `action`: The current action (eg: `delete:user`) that is being executed - - `user`: The user on which the action is being executed - - `callback(error)`: The callback to which you can return an error if access is denied - -Example: **Kelly** manages the Finance department and she should only be able to access users within her department. - -```js -function(ctx, callback) { - if (ctx.payload.action === 'delete:user') { - return callback(new Error('You are not allowed to delete users.')); - } - - // Get the department from the current user's metadata. - var department = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; - if (!department || !department.length) { - return callback(new Error('The current user is not part of any department.')); - } - - // The IT department can access all users. - if (department === 'IT') { - return callback(); - } - - ctx.log('Verifying access:', ctx.payload.user.app_metadata.department, department); - - if (!ctx.payload.user.app_metadata.department || ctx.payload.user.app_metadata.department !== department) { - return callback(new Error('You can only access users within your own department.')); - } - - return callback(); -} -``` - -If this hook is not configured all users will be accessible. - -Supported action names: - - - `read:user` - - `delete:user` - - `reset:password` - - `change:password` - - `change:username` - - `change:email` - - `read:devices` - - `read:logs` - - `remove:multifactor-provider` - - `block:user` - - `unblock:user` - - `send:verification-email` - -#### Create Hook - -Whenever new users are created you'll want these users to be assigned to the group/department/vendor/... of the current user. This is what the **Create Hook** allows you to configure. - -Hook contract: - - - `ctx`: The context object. - - `payload`: The payload object. - - `memberships`: An array of memberships that were selected in the UI when creating the user. - - `email`: The email address of the user. - - `password`: The password of the user. - - `connection`: The name of the user. - - `callback(error, user)`: The callback to which you can return an error and the user object that should be sent to the Management API. - -Example: **Kelly** manages the Finance department. When she creates users, these users should be assigned to her department. - -```js -function(ctx, callback) { - if (!ctx.payload.memberships || ctx.payload.memberships.length === 0) { - return callback(new Error('The user must be created within a department.')); - } - - // Get the department from the current user's metadata. - var currentDepartment = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; - if (!currentDepartment || !currentDepartment.length) { - return callback(new Error('The current user is not part of any department.')); - } - - // If you're not in the IT department, you can only create users within your own department. - // IT can create users in all departments. - if (currentDepartment !== 'IT' && ctx.payload.memberships[0] !== currentDepartment) { - return callback(new Error('You can only create users within your own department.')); - } - - // This is the payload that will be sent to API v2. You have full control over how the user is created in API v2. - return callback(null, { - email: ctx.payload.email, - password: ctx.payload.password, - connection: ctx.payload.connection, - app_metadata: { - department: ctx.payload.memberships[0] - } - }); -} -``` - -::: warning -Auth0 only supports user creation with Database Connections. -::: - -## The Memberships Query Hook - -When creating a new user, the UI shows a drop-down where you can choose the membership(s) you want assigned to a user. These memberships are then defined using the **Memberships Query**. - -### The Hook contract: - - - `ctx`: The context object - - `callback(error, { createMemberships: true/false, memberships: [ ...] })`: The callback to which you can return an error and an object containing the membership configuration - -Example: Users of the IT department should be able to create users in other departments. Users from other departments should only be able to create users for their own departments. - -```js -function(ctx, callback) { - var currentDepartment = ctx.payload.user.app_metadata.department; - if (!currentDepartment || !currentDepartment.length) { - return callback(null, [ ]); - } - - if (currentDepartment === 'IT') { - return callback(null, [ 'IT', 'HR', 'Finance', 'Marketing' ]); - } - - return callback(null, [ ctx.payload.user.app_metadata.department ]); -} -``` - -**Notes**: - -* Because you can only use this query in the UI, you'll need to assign memberships using the *Create Users* function if you need to enforce the assigning of users to specific departments. -* If there is only one membership possible, this field will not show in the UI. - -You can allow the end user to enter any value `memberships` by setting `createMemberships` to true. - -```js -function(ctx, callback) { - var currentDepartment = ctx.payload.user.app_metadata.department; - if (!currentDepartment || !currentDepartment.length) { - return callback(null, [ ]); - } - - return callback(null, { - createMemberships: ctx.payload.user.app_metadata.department === 'IT' ? true : false, - memberships: [ ctx.payload.user.app_metadata.department ] - }); -} -``` - -## The Settings Query Hook - -The **Settings Query** allows you to customize the look and feel of the extension. - -### The Hook contract - - - `ctx`: The context object - - `callback(error, settings)`: The callback to which you can return an error and a settings object - -Example: - -```js -function(ctx, callback) { - var department = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; - - return callback(null, { - // Only these connections should be visible in the connections picker. - // If only one connection is available, the connections picker will not be shown in the UI. - connections: [ 'Username-Password-Authentication', 'My-Custom-DB' ], - // The dictionary allows you to overwrite the title of the dashboard and the "Memberships" label in the Create User dialog. - dict: { - title: department ? department + ' User Management' : 'User Management Dashboard', - memberships: 'Departments' - }, - // The CSS option allows you to inject a custom CSS file depending on the context of the current user (eg: a different CSS for every customer) - css: (department && department !== 'IT') && 'https://rawgit.com/auth0-extensions/auth0-delegated-administration-extension/master/docs/theme/fabrikam.css' - }); -} -``` diff --git a/articles/extensions/delegated-admin/index.md b/articles/extensions/delegated-admin/index.md deleted file mode 100644 index 995602bc43..0000000000 --- a/articles/extensions/delegated-admin/index.md +++ /dev/null @@ -1,173 +0,0 @@ ---- -description: The Delegated Administration extension allows you to expose the Users dashboard to a group of users, without allowing them access to the dashboard. -url: /extensions/delegated-admin -toc: true ---- - -# Delegated Administration - -The **Delegated Administration** extension allows you to grant a select group of people administrative permissions to the [Users page](${manage_url}/#/users) without providing access to any other area. This is done by exposing the [Users Dashboard](${manage_url}/#/users) as an Auth0 application. - -:::panel PSaaS Appliance Availability -The Delegated Administration extension is available for [PSaaS Appliance](/appliance) customers who are running build `10755` or later, and have User Search enabled. -::: - -Prior to configuring the extension, you will need to: - -* [Create and configure an Auth0 Application](#create-an-application) -* [Enable a Connection on the Application](#enable-a-connection-on-the-application) -* [Add a user to the Connection](#add-a-user-to-the-new-connection) - -## Create an Application - -The first step is to create the Application that the extension exposes to those who should have administrative privileges to the Users page. - -After you've logged into the [Management Dashboard](${manage_url}), navigate to [Applications](${manage_url}/#/applications) and click on **+Create Application**. Provide a name for your Application (such as `Users Dashboard`) and set the Application type to `Single Page Web Applications`. Click **Create** to proceed. - -![Create an Application](/media/articles/extensions/delegated-admin/create-client.png) - -### Configure Application Settings - -Once you've created your Application, you'll need to make the following Application configuration changes. - -Click on the **Settings** tab and set the **Allowed Callback URLs**. This varies based on your location: - -| Location | Allowed Callback URL | -| --- | --- | -| USA | `https://${account.tenant}.us.webtask.io/auth0-delegated-admin/login` | -| Europe | `https://${account.tenant}.eu.webtask.io/auth0-delegated-admin/login` | -| Australia | `https://${account.tenant}.au.webtask.io/auth0-delegated-admin/login` | - -You will also need to configure the **Allowed Logout URLs**: - -| Location | Allowed Logout URL | -| --- | --- | -| USA | `https://${account.tenant}.us.webtask.io/auth0-delegated-admin` | -| Europe | `https://${account.tenant}.eu.webtask.io/auth0-delegated-admin` | -| Australia | `https://${account.tenant}.au.webtask.io/auth0-delegated-admin` | - -Copy the **Client ID** value. - -Navigate to **Settings > Show Advanced Settings > OAuth** and paste the **Client ID** value to the **Allowed APPs / APIs** field. - -Next, set the **JsonWebToken Signature Algorithm** to `RS256`, and make sure the **OIDC Conformant** toggle is disabled. - -::: note -The **Delegated Administration** extension requires applications to disable the **OIDC Conformant** flag. After turning off **OIDC Conformant** on the dashboard, ensure your application's authentication code is updated as well. -::: - -![Change Advanced OAuth Settings](/media/articles/extensions/delegated-admin/oauth-settings.png) - -Click **Save Changes** to proceed. - -### Enable a Connection on the Application - -When you create a new Application, Auth0 enables all [Connections](/identityproviders) associated with your tenant by default. For the purposes of this tutorial, we will disable all Connections (this helps keep our Application secure, since no one can add themselves using one of our existing Connections), create a new Database Connection, and enable only the newly-created Database Connection. However, you can choose to use any type of Connection. - -#### Disable All Existing Connections - -Switch over to the Application's **Connections** tab and disable all the Connections using the associated switches. - -#### Create a New Connection - -In the navigation pane of the Management Dashboard, click on **Connections** > [Database Connections](${manage_url}/#/connections/database). - -On the Database Connections page, click on **+Create DB Connection**. Provide a name for your Connection, such as `Helpdesk`. - -Click **Save** to proceed. - -![Create DB Connection](/media/articles/extensions/delegated-admin/create-connection.png) - -Navigate to the **Settings** tab of your new Connection and enable the **Disable Sign Ups** option. For security reasons, this ensures that even users who have the link to our Connection cannot sign themselves up. - -![Disable Sign Ups](/media/articles/extensions/delegated-admin/disable-signup.png) - -Under the **Applications Using This Connection** section, enable this Connection for your `Users Dashboard` Application. - -### Add a User to the New Connection - -You will need to add at least one user to your Connection. You can do this via the [Users page](${manage_url}/#/users), where you can specify the Connection for the user during the configuration process. - -### Assign Roles to Users - -Auth0 grants the user(s) in your Connection access to the Delegated Administration extension based on their roles: - -- **Delegated Admin - User**: Grants permission to search for users, create users, open users and execute actions on these users (such as `delete`, `block`, and so on); - -- **Delegated Admin - Administrator**: In addition to all of the rights a user has, administrators can see all logs in the tenant and configure Hooks. - -To use the extension, users must have either of these roles defined in one of the following fields of their user profiles: - -* `user.roles` -* `user.app_metadata.roles` -* `user.app_metadata.authorization.roles` - -You can set these fields manually or via [rules](/rules). - -#### Set User Roles via Rules - -This rule gives users from the `IT Department` the `Delegated Admin - Administrator` role and users from `Department Managers` are the `Delegated Admin - User` role. - -```js -function (user, context, callback) { - if (context.clientID === 'CLIENT_ID') { -   if (user.groups && user.groups.indexOf('IT Department') > -1) { - user.roles = user.roles || [ ]; - user.roles.push('Delegated Admin - Administrator'); - return callback(null, user, context); - } else if (user.app_metadata && user.app_metadata.isDepartmentManager && user.app_metadata.department && user.app_metadata.department.length) { - user.roles = user.roles || [ ]; - user.roles.push('Delegated Admin - User'); - return callback(null, user, context); - } - - return callback(new UnauthorizedError('You are not allowed to use this application.')); - } - - callback(null, user, context); -} -``` - -## Install the Extension - -Now that we've created and configured an Application, a Connection, and our users, we can install and configure the extension itself. - -On the Management Dashboard, navigate to the [Extensions](${manage_url}/#/extensions) page. Click on the **Delegated Administration** box in the list of provided extensions. The **Install Extension** window will open. - -![Install Extension](/media/articles/extensions/delegated-admin/install-extension.png) - -Set the following configuration variables: - -- **EXTENSION_CLIENT_ID**: The **Client ID** value of the Application you will use. You can find this value on the **Settings** page of your Application. - -- **TITLE** (optional): Set a title for your Application. It will be displayed at the header of the page. - -- **CUSTOM_CSS** (optional): Provide a CSS script to customize the look and feel of your Application. - -Once done, click **Install**. Your extension is now ready to use! - -If you navigate back to the [Applications](${manage_url}/#/applications) view, you will see that the extension automatically created an additional application called `auth0-delegated-admin`. - -![](/media/articles/extensions/delegated-admin/two-clients.png) - -Because the application is authorized to access the [Management API](/api/management/v2), you shouldn't modify it. - -## Use the Extension - -To access your newly created users dashboard, navigate to [**Extensions**](${manage_url}/#/extensions) > **Installed Extensions** > **Delegated Administration Dashboard**. - -A new tab will open to display the login prompt. - -![](/media/articles/extensions/delegated-admin/login-prompt.png) - -Because we disabled signups for this Connection during the configuration period, the login screen doesn't display a Sign Up option. - -Once you provide valid credentials, you'll be redirected to the *Delegated Administration Dashboard*. - -![](/media/articles/extensions/delegated-admin/standard-dashboard.png) - -## Keep Reading - -* [Customizing the Delegated Administration Extension Using Hooks](/extensions/delegated-admin/hooks) - -* [Managing Users in the Delegated Administration Extension Dashboard](/extensions/delegated-admin/manage-users) diff --git a/articles/extensions/delegated-admin/index.yml b/articles/extensions/delegated-admin/index.yml new file mode 100644 index 0000000000..96e0fc8807 --- /dev/null +++ b/articles/extensions/delegated-admin/index.yml @@ -0,0 +1,9 @@ +versioning: + baseUrl: extensions/delegated-admin + current: v3 + versions: + - v2 + - v3 + defaultArticles: + v2: index + v3: index \ No newline at end of file diff --git a/articles/extensions/delegated-admin/manage-users.md b/articles/extensions/delegated-admin/manage-users.md deleted file mode 100644 index e5f1cbf662..0000000000 --- a/articles/extensions/delegated-admin/manage-users.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -description: How to manage users in the Delegated Administration extension -toc: true ---- - -# Delegated Administration: Manage Users - -In the Application exposed by the Delegated Administration extension, there are two views available: *Users* and *Logs*. On the *Users* view, you can see the display and modify users associated with your Auth0 account. - -By default, all users are displayed, but you can filter the displayed list by configuring a [filter hook](/extensions/delegated-admin/hooks#the-filter-hook). - -## Available User Actions in the Delegated Administration Dashboard - -The table below lists the options you can perform on users, as well as information on whether the option is available via the [Management Dashboard](${manage_url}/#/) and/or the Delegated Administration extension. To limit the number of options someone with access to the Dashboard exposed by the Delegated Administration extension, configure an [access hook](#access-hook). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Action Available in the Management Dashboard Available in the Delegated Administration Extension
      Create UserYesYes
      Contact UserYesNo
      Sign in as User (Impersonation)YesNo
      Block UserYesYes
      Delete UserYesYes
      Send Verification EmailYesYes
      Change EmailYesYes
      Change PasswordYesYes
      Reset PasswordNoYes
      - -Notice the new *Reset Password* option available via the extension. This option will send an email to the user allowing them to choose a new password. To do this click on a user and select *Actions > Reset Password*. - -![](/media/articles/extensions/delegated-admin/reset-pass-01.png) - -This will send an email to the user, containing a link to change the password. - -If your profile indicates that you have the `Delegated Admin - Administrator` role, the *Logs* view allows you to see a list of authentications made by your users (this tab is only visible to users with the `Delegated Admin - Administrator` role). The contents of this view are a subset of the data displayed in the [Logs Dashboard](${manage_url}/#/logs). The Log Dashboard also displays data on administrative actions taken in the Dashboard. - -## Create Users - -You can create a new user by selecting the **+ Create User** button on the *Users* view. You need to specify are email and password. Depending on your role, you may not be able to set the *Department* to which the new user belongs. - -For example, users with the `Delegated Admin - Administrator` role can see the **Department** field and select any of its values. - -![](/media/articles/extensions/delegated-admin/create-user-admin.png) - -On the other hand, Kelly who has the `Delegated Admin - User` role and belongs to the Finance department cannot see this field. The user she creates will be automatically assigned to the Finance department. - -![](/media/articles/extensions/delegated-admin/create-user-kelly.png) diff --git a/articles/extensions/delegated-admin/v2/hooks.md b/articles/extensions/delegated-admin/v2/hooks.md new file mode 100644 index 0000000000..b9a7b57ce6 --- /dev/null +++ b/articles/extensions/delegated-admin/v2/hooks.md @@ -0,0 +1,323 @@ +--- +description: How to customize the behavior of the Delegated Administration extension using Hooks +toc: true +topics: + - extensions + - delegated-admin + - hooks +--- + +# Delegated Administration: Hooks + +If you are a user with the `Delegated Admin - Administrator` role in your User Profile, log in to the Delegated Administration Dashboard, and click on your name in the top right corner, you'll see a *Configure* option. On the Configuration page, you can manage the different Hooks and queries that allow you to customize the behavior of the Delegated Administration extension. + +![](/media/articles/extensions/delegated-admin/dashboard-configuration.png) + +## Hooks Signature + +Hooks always have the following signature: + +```js +function(ctx, callback) { + // First do some work + ... + + // Done + return callback(null, something); +} +``` + +The context object will expose a few helpers and information about the current request. The following methods and properties are available in every Hook. + +**1. Logging** + + To add a message to the Webtask logs (which you can view using the [Realtime Webtask Logs](/extensions/realtime-webtask-logs) extension), call the `log` method: + + ```js + ctx.log('Hello there', someValue, otherValue); + ``` + +**2. Caching** + + To cache something (such as a long list of departments), you can store it on the context's `global` object. This object will be available until the Webtask container recycles. + + ```js + ctx.global.departments = [ 'IT', 'HR', 'Finance' ]; + ``` + +**3. Custom Data** + + You can store custom data within the extension. This is field is limited to 400kb of data. + + ```js + var data = { + departments: [ 'IT', 'HR', 'Finance' ] + }; + + ctx.write(data) + .then(function() { + ... + }) + .catch(function(err) { + ... + }); + ``` + + To read the data: + + ```js + ctx.read() + .then(function(data) { + ... + }) + .catch(function(err) { + ... + }); + ``` + +**4. Payload and Request** + + Each Hook exposes the current payload and/or request with specific information. The request will always contain information about the user that is logged into the Users Dashboard: + + ```js + var currentUser = ctx.request.user; + ``` + +**5. Remote Calls** + + If you want to call an external service (such as an API) to validate data or to load memberships, you can do this using the `request` module. + + ```js + function(ctx, callback) { + var request = require('request'); + request('http://api.mycompany.com/departments', function (error, response, body) { + if (error) { + return callback(error); + } + + ... + }); + } + ``` + +## The Filter Hook + +By default, users with the **Delegated Admin - User** role see *all* users associated with the Auth0 account. However, you can filter the data users see using the **Filter Hook**. + +### The Hook contract: + + - `ctx`: The context object + - `callback(error, query)`: The callback to which you can return an error or the [lucene query](/api/management/v2/query-string-syntax) used when filtering the users. The extension will send this query to the [`GET Users` endpoint](/api/management/v2#!/Users/get_users) of the Management API + +### Example + +If **Kelly** manages the Finance department, she should only see the users that are also part of the Finance department. We'll filter the users with respect to the department of the current user. + +```js +function(ctx, callback) { + // Get the department from the current user's metadata. + var department = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; + if (!department || !department.length) { + return callback(new Error('The current user is not part of any department.')); + } + + // The IT department can see all users. + if (department === 'IT') { + return callback(); + } + + // Return the lucene query. + return callback(null, 'app_metadata.department:"' + department + '"'); +} +``` + +::: panel-warning Using Special Characters +Do not use single quotes, double quotes, or any other special characters (such as `+` or `-`) in any term on which you'll want to filter. This might cause issues with the Lucene query. +::: + +If you do not configure this Hook, the search returns **all users**. + +## The Access Hook + +While the **Filter Hook** only applies filtering logic you'll need a second layer of logic to determine if the current user is allowed to access a specific user. This is what the **Access Hook** allows you to do, determine if the current user is allowed to read, delete, block, or unblock a specific user. + +### The Hook contract: + + - `ctx`: The context object + - `payload`: The payload object + - `action`: The current action (eg: `delete:user`) that is being executed + - `user`: The user on which the action is being executed + - `callback(error)`: The callback to which you can return an error if access is denied + +Example: **Kelly** manages the Finance department and she should only be able to access users within her department. + +```js +function(ctx, callback) { + if (ctx.payload.action === 'delete:user') { + return callback(new Error('You are not allowed to delete users.')); + } + + // Get the department from the current user's metadata. + var department = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; + if (!department || !department.length) { + return callback(new Error('The current user is not part of any department.')); + } + + // The IT department can access all users. + if (department === 'IT') { + return callback(); + } + + ctx.log('Verifying access:', ctx.payload.user.app_metadata.department, department); + + if (!ctx.payload.user.app_metadata.department || ctx.payload.user.app_metadata.department !== department) { + return callback(new Error('You can only access users within your own department.')); + } + + return callback(); +} +``` + +If this hook is not configured all users will be accessible. + +Supported action names: + + - `read:user` + - `delete:user` + - `reset:password` + - `change:password` + - `change:username` + - `change:email` + - `read:devices` + - `read:logs` + - `remove:multifactor-provider` + - `block:user` + - `unblock:user` + - `send:verification-email` + +#### Create Hook + +Whenever new users are created you'll want these users to be assigned to the group/department/vendor/... of the current user. This is what the **Create Hook** allows you to configure. + +Hook contract: + + - `ctx`: The context object. + - `payload`: The payload object. + - `memberships`: An array of memberships that were selected in the UI when creating the user. + - `email`: The email address of the user. + - `password`: The password of the user. + - `connection`: The name of the user. + - `callback(error, user)`: The callback to which you can return an error and the user object that should be sent to the Management API. + +Example: **Kelly** manages the Finance department. When she creates users, these users should be assigned to her department. + +```js +function(ctx, callback) { + if (!ctx.payload.memberships || ctx.payload.memberships.length === 0) { + return callback(new Error('The user must be created within a department.')); + } + + // Get the department from the current user's metadata. + var currentDepartment = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; + if (!currentDepartment || !currentDepartment.length) { + return callback(new Error('The current user is not part of any department.')); + } + + // If you're not in the IT department, you can only create users within your own department. + // IT can create users in all departments. + if (currentDepartment !== 'IT' && ctx.payload.memberships[0] !== currentDepartment) { + return callback(new Error('You can only create users within your own department.')); + } + + // This is the payload that will be sent to API v2. You have full control over how the user is created in API v2. + return callback(null, { + email: ctx.payload.email, + password: ctx.payload.password, + connection: ctx.payload.connection, + app_metadata: { + department: ctx.payload.memberships[0] + } + }); +} +``` + +::: warning +Auth0 only supports user creation with Database Connections. +::: + +## The Memberships Query Hook + +When creating a new user, the UI shows a drop-down where you can choose the membership(s) you want assigned to a user. These memberships are then defined using the **Memberships Query**. + +### The Hook contract: + + - `ctx`: The context object + - `callback(error, { createMemberships: true/false, memberships: [ ...] })`: The callback to which you can return an error and an object containing the membership configuration + +Example: Users of the IT department should be able to create users in other departments. Users from other departments should only be able to create users for their own departments. + +```js +function(ctx, callback) { + var currentDepartment = ctx.payload.user.app_metadata.department; + if (!currentDepartment || !currentDepartment.length) { + return callback(null, [ ]); + } + + if (currentDepartment === 'IT') { + return callback(null, [ 'IT', 'HR', 'Finance', 'Marketing' ]); + } + + return callback(null, [ ctx.payload.user.app_metadata.department ]); +} +``` + +**Notes**: + +* Because you can only use this query in the UI, you'll need to assign memberships using the *Create Users* function if you need to enforce the assigning of users to specific departments. +* If there is only one membership possible, this field will not show in the UI. + +You can allow the end user to enter any value `memberships` by setting `createMemberships` to true. + +```js +function(ctx, callback) { + var currentDepartment = ctx.payload.user.app_metadata.department; + if (!currentDepartment || !currentDepartment.length) { + return callback(null, [ ]); + } + + return callback(null, { + createMemberships: ctx.payload.user.app_metadata.department === 'IT' ? true : false, + memberships: [ ctx.payload.user.app_metadata.department ] + }); +} +``` + +## The Settings Query Hook + +The **Settings Query** allows you to customize the look and feel of the extension. + +### The Hook contract + + - `ctx`: The context object + - `callback(error, settings)`: The callback to which you can return an error and a settings object + +Example: + +```js +function(ctx, callback) { + var department = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; + + return callback(null, { + // Only these connections should be visible in the connections picker. + // If only one connection is available, the connections picker will not be shown in the UI. + connections: [ 'Username-Password-Authentication', 'My-Custom-DB' ], + // The dictionary allows you to overwrite the title of the dashboard and the "Memberships" label in the Create User dialog. + dict: { + title: department ? department + ' User Management' : 'User Management Dashboard', + memberships: 'Departments' + }, + // The CSS option allows you to inject a custom CSS file depending on the context of the current user (eg: a different CSS for every customer) + css: (department && department !== 'IT') && 'https://rawgit.com/auth0-extensions/auth0-delegated-administration-extension/master/docs/theme/fabrikam.css' + }); +} +``` diff --git a/articles/extensions/delegated-admin/v2/index.md b/articles/extensions/delegated-admin/v2/index.md new file mode 100644 index 0000000000..79818e9038 --- /dev/null +++ b/articles/extensions/delegated-admin/v2/index.md @@ -0,0 +1,196 @@ +--- +description: The Delegated Administration extension allows you to expose the Users dashboard to a group of users, without allowing them access to the dashboard. +toc: true +topics: + - extensions + - delegated-admin +contentType: + - how-to + - concept + - index +useCase: extensibility-extensions +--- + +# Delegated Administration + +The **Delegated Administration** extension allows you to grant a select group of people administrative permissions to the [Users page](${manage_url}/#/users) without providing access to any other area. This is done by exposing the [Users Dashboard](${manage_url}/#/users) as an Auth0 application. + +Prior to configuring the extension, you will need to: + +* [Create and configure an Auth0 Application](#create-an-application) +* [Enable a Connection on the Application](#enable-a-connection-on-the-application) +* [Add a user to the Connection](#add-a-user-to-the-new-connection) + +## Create an Application + +The first step is to create the Application that the extension exposes to those who should have administrative privileges to the Users page. + +After you've logged into the [Management Dashboard](${manage_url}), navigate to [Applications](${manage_url}/#/applications) and click on **+Create Application**. Provide a name for your Application (such as `Users Dashboard`) and set the Application type to `Single-Page Web Applications`. Click **Create** to proceed. + +![Create an Application](/media/articles/extensions/delegated-admin/create-client.png) + +### Configure Application Settings + +Once you've created your Application, you'll need to make the following Application configuration changes. + +Click on the **Settings** tab and set the **Allowed Callback URLs**. This varies based on your location: + +If you are using Node 8: + +| Location | Allowed Callback URL | +| --- | --- | +| USA | `https://${account.tenant}.us8.webtask.io/auth0-delegated-admin/login` | +| Europe | `https://${account.tenant}.eu8.webtask.io/auth0-delegated-admin/login` | +| Australia | `https://${account.tenant}.au8.webtask.io/auth0-delegated-admin/login` | + +If you are using Node 12: + +| Location | Allowed Callback URL | +| --- | --- | +| USA | `https://${account.tenant}.us12.webtask.io/auth0-delegated-admin/login` | +| Europe | `https://${account.tenant}.eu12.webtask.io/auth0-delegated-admin/login` | +| Australia | `https://${account.tenant}.au12.webtask.io/auth0-delegated-admin/login` | + +You will also need to configure the **Allowed Logout URLs**: + +If you are using Node 8: + +| Location | Allowed Logout URL | +| --- | --- | +| USA | `https://${account.tenant}.us8.webtask.io/auth0-delegated-admin` | +| Europe | `https://${account.tenant}.eu8.webtask.io/auth0-delegated-admin` | +| Australia | `https://${account.tenant}.au8.webtask.io/auth0-delegated-admin` | + +If you are using Node 12: + +| Location | Allowed Logout URL | +| --- | --- | +| USA | `https://${account.tenant}.us12.webtask.io/auth0-delegated-admin` | +| Europe | `https://${account.tenant}.eu12.webtask.io/auth0-delegated-admin` | +| Australia | `https://${account.tenant}.au12.webtask.io/auth0-delegated-admin` | + +Copy the **Client ID** value. + +Navigate to **Settings > Show Advanced Settings > OAuth** and paste the **Client ID** value to the **Allowed APPs / APIs** field. + +Next, set the **JsonWebToken Signature Algorithm** to `RS256`, and make sure the **OIDC Conformant** toggle is disabled. + +::: note +The **Delegated Administration** extension requires applications to disable the **OIDC Conformant** flag. After turning off **OIDC Conformant** on the dashboard, ensure your application's authentication code is updated as well. +::: + +![Change Advanced OAuth Settings](/media/articles/extensions/delegated-admin/oauth-settings.png) + +Click **Save Changes** to proceed. + +### Enable a Connection on the Application + +When you create a new Application, Auth0 enables all [Connections](/identityproviders) associated with your tenant by default. For the purposes of this tutorial, we will disable all Connections (this helps keep our Application secure, since no one can add themselves using one of our existing Connections), create a new Database Connection, and enable only the newly-created Database Connection. However, you can choose to use any type of Connection. + +#### Disable All Existing Connections + +Switch over to the Application's **Connections** tab and disable all the Connections using the associated switches. + +#### Create a New Connection + +In the navigation pane of the Management Dashboard, click on **Connections** > [Database Connections](${manage_url}/#/connections/database). + +On the Database Connections page, click on **+Create DB Connection**. Provide a name for your Connection, such as `Helpdesk`. + +Click **Save** to proceed. + +![Create DB Connection](/media/articles/extensions/delegated-admin/create-connection.png) + +Navigate to the **Settings** tab of your new Connection and enable the **Disable Sign Ups** option. For security reasons, this ensures that even users who have the link to our Connection cannot sign themselves up. + +![Disable Sign Ups](/media/articles/extensions/delegated-admin/disable-signup.png) + +Under the **Applications Using This Connection** section, enable this Connection for your `Users Dashboard` Application. + +### Add a User to the New Connection + +You will need to add at least one user to your Connection. You can do this via the [Users page](${manage_url}/#/users), where you can specify the Connection for the user during the configuration process. + +### Assign Roles to Users + +Auth0 grants the user(s) in your Connection access to the Delegated Administration extension based on their roles: + +- **Delegated Admin - User**: Grants permission to search for users, create users, open users and execute actions on these users (such as `delete`, `block`, and so on); + +- **Delegated Admin - Administrator**: In addition to all of the rights a user has, administrators can see all logs in the tenant and configure Hooks. + +To use the extension, users must have either of these roles defined in one of the following fields of their user profiles: + +* `user.app_metadata.roles` +* `user.app_metadata.authorization.roles` + +You can set these fields manually or via [rules](/rules). + +#### Set User Roles via Rules + +This rule gives users from the `IT Department` the `Delegated Admin - Administrator` role and users from `Department Managers` are the `Delegated Admin - User` role. + +```js +function (user, context, callback) { + if (context.clientID === 'CLIENT_ID') { + // If you are using Node 8, uncomment the following line + //const namespace = 'https://${account.tenant}.us8.webtask.io/auth0-delegated-admin'; + //If you are using Node 12, uncomment the following line + //const namespace = 'https://${account.tenant}.us12.webtask.io/auth0-delegated-admin'; +   if (user.groups && user.groups.indexOf('IT Department') > -1) { + context.idToken[namespace] = { roles: [ 'Delegated Admin - Administrator' ] }; + return callback(null, user, context); + } else if (user.app_metadata && user.app_metadata.isDepartmentManager && user.app_metadata.department && user.app_metadata.department.length) { + context.idToken[namespace] = { roles: [ 'Delegated Admin - User' ] }; + return callback(null, user, context); + } + + return callback(new UnauthorizedError('You are not allowed to use this application.')); + } + + callback(null, user, context); +} +``` + +## Install the Extension + +Now that we've created and configured an Application, a Connection, and our users, we can install and configure the extension itself. + +On the Management Dashboard, navigate to the [Extensions](${manage_url}/#/extensions) page. Click on the **Delegated Administration** box in the list of provided extensions. The **Install Extension** window will open. + +![Install Extension](/media/articles/extensions/delegated-admin/install-extension.png) + +Set the following configuration variables: + +- **EXTENSION_CLIENT_ID**: The **Client ID** value of the Application you will use. You can find this value on the **Settings** page of your Application. + +- **TITLE** (optional): Set a title for your Application. It will be displayed at the header of the page. + +- **CUSTOM_CSS** (optional): Provide a CSS script to customize the look and feel of your Application. + +Once done, click **Install**. Your extension is now ready to use! + +If you navigate back to the [Applications](${manage_url}/#/applications) view, you will see that the extension automatically created an additional application called `auth0-delegated-admin`. + +![](/media/articles/extensions/delegated-admin/two-clients.png) + +Because the application is authorized to access the [Management API](/api/management/v2), you shouldn't modify it. + +## Use the Extension + +To access your newly created users dashboard, navigate to [**Extensions**](${manage_url}/#/extensions) > **Installed Extensions** > **Delegated Administration Dashboard**. + +A new tab will open to display the login prompt. + +![](/media/articles/extensions/delegated-admin/login-prompt.png) + +Because we disabled signups for this Connection during the configuration period, the login screen doesn't display a Sign Up option. + +Once you provide valid credentials, you'll be redirected to the *Delegated Administration Dashboard*. + +![](/media/articles/extensions/delegated-admin/standard-dashboard.png) + +## Keep Reading + +* [Customize the Delegated Administration Extension Using Hooks](/extensions/delegated-admin/hooks) +* [Manage Users in the Delegated Administration Extension Dashboard](/extensions/delegated-admin/manage-users) diff --git a/articles/extensions/delegated-admin/v2/manage-users.md b/articles/extensions/delegated-admin/v2/manage-users.md new file mode 100644 index 0000000000..83625916d1 --- /dev/null +++ b/articles/extensions/delegated-admin/v2/manage-users.md @@ -0,0 +1,92 @@ +--- +description: How to manage users in the Delegated Administration extension +toc: true +topics: + - extensions + - delegated-admin + - users +contentType: + - how-to + - concept +useCase: extensibility-extensions +--- + +# Delegated Administration: Manage Users + +In the Application exposed by the Delegated Administration extension, there are two views available: *Users* and *Logs*. On the *Users* view, you can see the display and modify users associated with your Auth0 account. + +By default, all users are displayed, but you can filter the displayed list by configuring a [filter hook](/extensions/delegated-admin/hooks#the-filter-hook). + +## Available User Actions in the Delegated Administration Dashboard + +The table below lists the options you can perform on users, as well as information on whether the option is available via the [Management Dashboard](${manage_url}/#/) and/or the Delegated Administration extension. To limit the number of options someone with access to the Dashboard exposed by the Delegated Administration extension, configure an [access hook](#access-hook). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Action Available in the Management Dashboard Available in the Delegated Administration Extension
      Create UserYesYes
      Contact UserYesNo
      Block UserYesYes
      Delete UserYesYes
      Send Verification EmailYesYes
      Change EmailYesYes
      Change PasswordYesYes
      Reset PasswordNoYes
      + +Notice the new *Reset Password* option available via the extension. This option will send an email to the user allowing them to choose a new password. To do this click on a user and select *Actions > Reset Password*. + +![](/media/articles/extensions/delegated-admin/reset-pass-01.png) + +This will send an email to the user, containing a link to change the password. + +If your profile indicates that you have the `Delegated Admin - Administrator` role, the *Logs* view allows you to see a list of authentications made by your users (this tab is only visible to users with the `Delegated Admin - Administrator` role). The contents of this view are a subset of the data displayed in the [Logs Dashboard](${manage_url}/#/logs). The Log Dashboard also displays data on administrative actions taken in the Dashboard. + +## Create Users + +You can create a new user by selecting the **+ Create User** button on the *Users* view. You need to specify are email and password. Depending on your role, you may not be able to set the *Department* to which the new user belongs. + +For example, users with the `Delegated Admin - Administrator` role can see the **Department** field and select any of its values. + +![](/media/articles/extensions/delegated-admin/create-user-admin.png) + +On the other hand, Kelly who has the `Delegated Admin - User` role and belongs to the Finance department cannot see this field. The user she creates will be automatically assigned to the Finance department. + +![](/media/articles/extensions/delegated-admin/create-user-kelly.png) diff --git a/articles/extensions/delegated-admin/v3/_session-timeout.md b/articles/extensions/delegated-admin/v3/_session-timeout.md new file mode 100644 index 0000000000..3ddda0e079 --- /dev/null +++ b/articles/extensions/delegated-admin/v3/_session-timeout.md @@ -0,0 +1,3 @@ +::: panel Session Timeout +By default, token expiration time is 10 hours. However, when using Delegated Administration, Auth0 doesn't save a token to cookies or `sessionStorage` for security reasons, so you will need to start a new session on each page reload. +::: diff --git a/articles/extensions/delegated-admin/v3/hooks/_stepnav.html b/articles/extensions/delegated-admin/v3/hooks/_stepnav.html new file mode 100644 index 0000000000..38681ec1e0 --- /dev/null +++ b/articles/extensions/delegated-admin/v3/hooks/_stepnav.html @@ -0,0 +1,14 @@ +
      + <% if (typeof prev !== 'undefined') { %> +
      +
      Go Back
      + ${prev[0]} +
      + <% } %> + <% if (typeof next !== 'undefined') { %> +
      +
      Delegated Admin
      + ${next[0]} +
      + <% } %> +
      \ No newline at end of file diff --git a/articles/extensions/delegated-admin/v3/hooks/access.md b/articles/extensions/delegated-admin/v3/hooks/access.md new file mode 100644 index 0000000000..e6010a7e5f --- /dev/null +++ b/articles/extensions/delegated-admin/v3/hooks/access.md @@ -0,0 +1,79 @@ +--- +description: How to use the Access Hook with the Delegated Administration extension +topics: + - extensions + - delegated-admin + - users + - hooks +contentType: + - how-to + - concept +useCase: extensibility-extensions +--- +# Delegated Administration Hooks: The Access Hook + +Because the [Filter Hook](/extensions/delegated-admin/v3/hooks/filter) only applies filtering logic, you'll need a second layer of logic to determine if the current user (or the person acting as the administrator) is allowed to access a specific user. + +The **Access Hook** allows you to determine if the current user is allowed to read, delete, block, unblock, or update a specific user. + +## The Hook Contract + + - **ctx**: The context object + - **payload**: The payload object + - **action**: The current action (eg: **delete:user**) that is being executed + - **user**: The user on which the action is being executed + - **callback(error)**: The callback to which you can return an error if access is denied + +## Sample Usage + +Kelly manages the Finance department, and she should only be able to access users within her department. + +```js +function(ctx, callback) { + if (ctx.payload.action === 'delete:user') { + return callback(new Error('You are not allowed to delete users.')); + } + + // Get the department from the current user's metadata. + var department = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; + if (!department || !department.length) { + return callback(new Error('The current user is not part of any department.')); + } + + // The IT department can access all users. + if (department === 'IT') { + return callback(); + } + + ctx.log('Verifying access:', ctx.payload.user.app_metadata.department, department); + + if (!ctx.payload.user.app_metadata.department || ctx.payload.user.app_metadata.department !== department) { + return callback(new Error('You can only access users within your own department.')); + } + + return callback(); +} +``` + +## Notes + +If this hook is not configured, all users will be accessible to the current user. + +The Hook supports the following action names (which you set using as the value for **ctx.payload.action**: + +- **read:user** +- **delete:user** +- **reset:password** +- **change:password** +- **change:username** +- **change:email** +- **read:devices** +- **read:logs** +- **remove:multifactor-provider** +- **block:user** +- **unblock:user** +- **send:verification-email** + +<%= include('./_stepnav', { + prev: ["Delegated Admin: Hooks", "/extensions/delegated-admin/hooks"] +}) %> \ No newline at end of file diff --git a/articles/extensions/delegated-admin/v3/hooks/filter.md b/articles/extensions/delegated-admin/v3/hooks/filter.md new file mode 100644 index 0000000000..c0deeadf43 --- /dev/null +++ b/articles/extensions/delegated-admin/v3/hooks/filter.md @@ -0,0 +1,61 @@ +--- +description: How to use the Filter Hook with the Delegated Administration extension +topics: + - extensions + - delegated-admin + - users + - hooks +contentType: + - how-to + - concept +useCase: extensibility-extensions +--- +# Delegated Administration Hooks: The Filter Hook + +By default, users with the **Delegated Admin - User** role see *all* users associated with the Auth0 account. However, you can filter the data users see using the **Filter Hook**. + +## The Hook Contract + + - **ctx**: The context object + - **callback(error, query)**: The callback to which you can return an error or the [lucene query](/api/management/v2/query-string-syntax) used when filtering the users. The extension will send this query to the [**GET Users** endpoint](/api/management/v2#!/Users/get_users) of the Management API + +### Sample Usage + +If Kelly manages the Finance department, she should only see the users that are also part of the Finance department. We'll filter the users with respect to the department of the current user (which, in this case, is the Finance department and Kelly, respectively). + +```js +function(ctx, callback) { + // Get the department from the current user's metadata. + var department = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; + if (!department || !department.length) { + return callback(new Error('The current user is not part of any department.')); + } + + // The IT department can see all users. + if (department === 'IT') { + return callback(); + } + + // Return the lucene query. + return callback(null, 'app_metadata.department:"' + department + '"'); +} +``` + +### Search Engine Override + +You can override the default search engine by specifying your choice in the response. + +```js + // Return the lucene query. + return callback(null, { query: 'app_metadata.department:"' + department + '"', searchEngine: 'v2' }); +``` + +## Notes + +Do not use single quotes, double quotes, or any other special characters (such as **+** or **-**) in terms on which you'll want to filter. This may cause issues with the Lucene query. + +If you do not configure this Hook, the search returns **all users**. + +<%= include('./_stepnav', { + prev: ["Delegated Admin: Hooks", "/extensions/delegated-admin/hooks"] +}) %> diff --git a/articles/extensions/delegated-admin/v3/hooks/index.md b/articles/extensions/delegated-admin/v3/hooks/index.md new file mode 100644 index 0000000000..737643c706 --- /dev/null +++ b/articles/extensions/delegated-admin/v3/hooks/index.md @@ -0,0 +1,182 @@ +--- +description: How to customize the behavior of the Delegated Administration extension using Hooks +toc: true +topics: + - extensions + - delegated-admin + - users + - hooks +contentType: + - how-to + - concept + - index +useCase: extensibility-extensions +--- + +# Delegated Administration: Hooks + +If you're a user assigned the **Delegated Admin - Administrator** role, you can manage the different Hooks and queries that allow you to customize the behavior of the Delegated Administration extension. + +To access the configuration area: + +1. Log in to the Delegated Administration Dashboard +2. Click on your name in the top right corner. You'll see a drop-down menu; click on the **Configure** option. + +The **Configuration** page to which you're redirected is where you can manage your Hooks and queries. + +## Hooks Signature + +Hooks always have the following signature: + +```js +function(ctx, callback) { + // First do some work + ... + + // Done + return callback(null, something); +} +``` + +The context (**ctx**) object will expose a few helpers and information about the current request. The following methods and properties are available in every Hook: + +* Logging +* Caching +* Custom Data +* Payload and Request +* Remote Calls + +### Logging + +To add a message to the Webtask logs (which you can view using the [Realtime Webtask Logs](/extensions/realtime-webtask-logs) extension), call the **log** method: + +```js +ctx.log('Hello there', someValue, otherValue); + ``` + +### Caching + +To cache something (such as a long list of departments), you can store it on the context's **global** object. This object will be available until the Webtask container recycles. + +```js +ctx.global.departments = [ 'IT', 'HR', 'Finance' ]; +``` + +### Custom Data + +You can store custom data within the extension. This field is limited to 400kb of data. + +```js +var data = { +departments: [ 'IT', 'HR', 'Finance' ] +}; + +ctx.write(data) +.then(function() { + ... +}) +.catch(function(err) { + ... +}); +``` + +To read the data: + +```js +ctx.read() +.then(function(data) { + ... +}) +.catch(function(err) { + ... +}); +``` + +### Payload and Request + +Each Hook exposes the current payload or request with specific information. The request will always contain information about the user that is logged into the Users Dashboard: + +```js +var currentUser = ctx.request.user; +``` + +### Remote Calls + +If you want to call an external service (such as an API) to validate data or to load memberships, you can do this using the `request` module. + +```js +function(ctx, callback) { +var request = require('request'); + request('http://api.mycompany.com/departments', function (error, response, body) { + if (error) { + return callback(error); + } + + ... + }); +} +``` + +### The Hook contract: + + - `ctx`: The context object + - `payload`: The payload object + - `action`: The current action (for example, `delete:user`) that is being executed + - `user`: The user on which the action is being executed + - `callback(error)`: The callback to which you can return an error if access is denied + +Example: Kelly manages the Finance department, and she should only be able to access users within her department. + +```js +function(ctx, callback) { + if (ctx.payload.action === 'delete:user') { + return callback(new Error('You are not allowed to delete users.')); + } + + // Get the department from the current user's metadata. + var department = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; + if (!department || !department.length) { + return callback(new Error('The current user is not part of any department.')); + } + + // The IT department can access all users. + if (department === 'IT') { + return callback(); + } + + ctx.log('Verifying access:', ctx.payload.user.app_metadata.department, department); + + if (!ctx.payload.user.app_metadata.department || ctx.payload.user.app_metadata.department !== department) { + return callback(new Error('You can only access users within your own department.')); + } + + return callback(); +} +``` + +If this hook is not configured, all users will be accessible. + +Supported action names: + + - `read:user` + - `delete:user` + - `reset:password` + - `change:password` + - `change:username` + - `change:email` + - `read:devices` + - `read:logs` + - `remove:multifactor-provider` + - `block:user` + - `unblock:user` + - `send:verification-email` + +## Available Hooks + +The following Hooks are available for use with your Delegated Administration extension: + +* [The Access Hook](/extensions/delegated-admin/v3/hooks/access) +* [The Filter Hook](/extensions/delegated-admin/v3/hooks/filter) +* [The Memberships Query Hook](/extensions/delegated-admin/v3/hooks/membership) +* [The Settings Query Hook](/extensions/delegated-admin/v3/hooks/settings) +* [The Write Hook](/extensions/delegated-admin/v3/hooks/write) \ No newline at end of file diff --git a/articles/extensions/delegated-admin/v3/hooks/membership.md b/articles/extensions/delegated-admin/v3/hooks/membership.md new file mode 100644 index 0000000000..5d0799bce1 --- /dev/null +++ b/articles/extensions/delegated-admin/v3/hooks/membership.md @@ -0,0 +1,65 @@ +--- +description: How to use the Memberships Query Hook with the Delegated Administration extension +topics: + - extensions + - delegated-admin + - users + - hooks +contentType: + - how-to + - concept +useCase: extensibility-extensions +--- +# Delegated Administration Hooks: The Memberships Query Hook + +When creating a new user, the User Interface shows a drop-down where you can choose the membership(s) you want assigned to a user. These memberships are then defined using the **Memberships Query Hook**. + +## The Hook Contract + + - **ctx**: The context object + - **callback(error, { createMemberships: true/false, memberships: [ ...] })**: The callback to which you can return an error and an object containing the membership configuration + +## Sample Usage + +Users of the IT department should be able to create users in other departments. Users from other departments should only be able to create users for their departments. + +```js +function(ctx, callback) { + var currentDepartment = ctx.payload.user.app_metadata && ctx.payload.user.app_metadata.department; + if (!currentDepartment || !currentDepartment.length) { + return callback(null, [ ]); + } + + if (currentDepartment === 'IT') { + return callback(null, [ 'IT', 'HR', 'Finance', 'Marketing' ]); + } + + return callback(null, [ ctx.payload.user.app_metadata.department ]); +} +``` + +## Notes + +Because you can only use this query in the UI, you'll need to assign memberships using the **Write Hook** if you need to enforce rules regarding the assignment of users to specific departments. + +If there is only one membership group possible, the Memberships field will not show in the UI. + +You can allow the end user to enter any value into the **memberships** field by setting **createMemberships** to true: + +```js +function(ctx, callback) { + var currentDepartment = ctx.payload.user.app_metadata.department; + if (!currentDepartment || !currentDepartment.length) { + return callback(null, [ ]); + } + + return callback(null, { + createMemberships: ctx.payload.user.app_metadata.department === 'IT' ? true : false, + memberships: [ ctx.payload.user.app_metadata.department ] + }); +} +``` + +<%= include('./_stepnav', { + prev: ["Delegated Admin: Hooks", "/extensions/delegated-admin/hooks"] +}) %> diff --git a/articles/extensions/delegated-admin/v3/hooks/settings.md b/articles/extensions/delegated-admin/v3/hooks/settings.md new file mode 100644 index 0000000000..2a032aaaba --- /dev/null +++ b/articles/extensions/delegated-admin/v3/hooks/settings.md @@ -0,0 +1,354 @@ +--- +description: How to use the Settings Query Hook with the Delegated Administration extension +toc: true +topics: + - extensions + - delegated-admin + - users + - hooks +contentType: + - how-to + - concept +useCase: extensibility-extensions +--- +# Delegated Administration Hooks: The Settings Query Hook + +The **Settings Query Hook** allows you to customize the look and feel of the Delegated Admin extension. + +## The Hook Contract + + - **ctx**: The context object + - **request.user**: The user currently logged in + - **locale**: The locale (as inferred from the URL) -- `https://${account.tenant}.us.webtask.io/auth0-delegated-admin/en/users` will set **locale** to `en`. + - **callback(error, settings)**: The callback to which you can return an error and a settings object + +## Sample Usage + +```js +function(ctx, callback) { + var department = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; + + return callback(null, { + // Only these connections should be visible in the connections picker. If only one connection is available, the connections picker will not be shown in the UI. + connections: [ 'Username-Password-Authentication', 'My-Custom-DB' ], + // The dictionary allows you to overwrite the title of the dashboard and the "Memberships" label in the Create User dialog. + dict: { + title: department ? department + ' User Management' : 'User Management Dashboard', + memberships: 'Departments', + menuName: ctx.request.user.name + }, + // The CSS option allows you to inject a custom CSS file depending on the context of the current user (eg: a different CSS for every customer) + css: (department && department !== 'IT') && 'https://rawgit.com/auth0-extensions/auth0-delegated-administration-extension/master/docs/theme/fabrikam.css', + // This option allows you to restrict creating new users + canCreateUser: (department === 'IT') + }); +} +``` + +### Properties + +- **connections**: The list of the connections this admin is allowed to create and edit users within +- **dict**: The dictionary allows you to overwrite the title of the dashboard and the **Memberships** label in the Create User dialog + - **dict.title**: The title to display at the top of the UI + - **dict.memberships**: The label to set for memberships fields + - **dict.menuName**: The name to set for the upper right-hand dropdown menu + - **dict.logoutUrl**: An alternate URL for the logout menu option +- **userFields**: An array of user fields (see [Custom Fields](#custom-fields)) +- **css**: A string URL to import CSS +- **altcss**: A string URL to import a second set of CSS. You can use this to specify things like accessibility CSS for larger fonts. The user will be presented with a menu item allowing them to toggle this set of CSS on/off +- **languageDictionary**: A string URL or Dictionary Object (see [Localization](#localization)) +- **suppressRawData**: Set to **true** to skip pages that show raw JSON +- **errorTranslator**: A function that translates error messages based on localization. Example: `(function (error, languageDictionary) { return languageDictionary.customErrors[error] || error; }).toString()` +- **canCreateUser**: A boolean flag. If set to `false`, removes `Create User` button and forbids creating new users, `true` by default. + +## Custom Fields + +Beginning with version 3.0 of the Delegated Admin Extension, you can define custom fields and specify their values. Custom fields can be stored in the **user metadata** and **app metadata** fields accessible during the user creation or update processes. + +You may also customize existing fields defined by Auth0, such as email, username, name, and connection. + +To utilize custom fields, you must: + +- Add your list of **userFields** to the Settings Query Hook +- Implement a [Write Hook](/extensions/delegated-admin/v3/hooks/write). Custom Fields require the use of the [Write Hook](/extensions/delegated-admin/v3/hooks/write) to properly update `user_metadata` and `app_metadata`. You must [update the user object passed to the callback function](/extensions/delegated-admin/v3/hooks/write#sample-usage) with the `user_metadata` and `app_metadata` from the context (`ctx` object) provided to the hook. + +Sample schema for **userFields**: + +```js +userFields: [ + { + "property": string, // required + "label": string, + "sortProperty": string, + "display": true || function.toString(), + "search": false || { + "display": true || function.toString() + "listOrder": 1, + "listSize": string(###%), // e.g. 15% + "filter": boolean, + "sort": boolean + }, + "edit": false || { + "display": true || function.toString() + "type": "text || select || password || hidden", + "component": "InputText || Input Combo || InputMultiCombo || InputSelectCombo", + "options": Array(string) || Array ({ "value": string, "label": string }), + "disabled": true || false, + "validationFunction": function.toString() + }, + "create": false || { + "display": true || function.toString() + "type": "text || select || password || hidden", + "component": "InputText || Input Combo || InputMultiCombo || InputSelectCombo", + "options": Array(string) || Array ({ "value": string, "label": string }), + "disabled": true || false, + "validationFunction": function.toString() + } + }, + ... +] +``` + +- **property** (**required**): The property name of the **ctx.payload** object for the Write hook. In the Write hook, `"property": "app_metadata.dbId"` sets `ctx.payload.app_metadata.dbId` +- **label**: The label that will be used when adding a label to the field on the user info page, create page, edit profile page, or search page +- **sortProperty**: If sorting by a different field than this for the search table, use this field. Dot notation is allowed. +- **display**: true || false || stringified => This is the default display value. If not overridden in search, edit, or create, it will use this value. + - if `true` will just return `user.` + - Default: if `false` this value will not be displayed on any page (unless overridden in search, edit, or create) + - if stringified function: executes function to get the value to display. Example: `(function display(user, value, languageDictionary) { return moment(value).fromNow(); }).toString()` +- **search**: false || object => This describes how this field will behave on the search page + - Default: if `false` will not show up in the search table + - **search.display**: This will override the default display value + - **search.listOrder**: This will specify the column order for the search display table + - **search.listSize**: This will specify the default width of the column + - **search.filter**: This will specify whether to allow this field to be search in the search dropdown. Default is false. + - **search.sort**: This will specify whether this column is sortable. Use sortProperty if you want to sort by a field other than property. Default is false. +- **edit**: false || object => This describes whether the field shows up on the edit dialogs. If not a default field and set to an object, this will show up in the `Change Profile` page on the User Actions dropdown on the user page. + - Default: if `false` will not show up on any edit/update page + - **edit.display**: This will override the default display value + - **edit.required**: set to true to fail if it does not have a value. Default is false. + - **edit.type** **required**: text || select || password + - **edit.component**: InputText || Input Combo || InputMultiCombo || InputSelectCombo + - **InputText** (default): A simple text box + - **InputCombo**: A searchable dropdown, single value only + - **InputMultiCombo**: A searchable dropdown, with multiple values allowed + - **InputSelectCombo**: A select dropdown of options + - **edit.options**: if component is one of InputCombo, InputMultiCombo, InputSelectCombo, the option values need to be specified. + - **Array(string)**: An array of values (the label and value fields will be set to the same value) + - **Array({ "value": string, "label": string })**: Allows you to set separate values for the value and label. NOTE: This will result in the value in the write hook having the same value, but it can be trimmed down to just the value in the write hook. + - Server-side validation will ensure that any value specified for this field appears in the options array + - **edit.disabled**: `true` if the component should be read only; default is false + - **edit.validateFunction**: stringified function for validation. Note that this validation function will run on both the server- and client-side. Example: `(function validate(value, values, context, languageDictionary) { if (value...) return 'something went wrong'; return false; }).toString()` +- **create**: false || object => This describes whether the field shows up on the create dialog. + - Default: if `false` will not show up on the create page + - **create.placeholder**: Provide placeholder text to show when input is empty. + - **create.required**: set to true to fail if it does not have a value. Default is false. + - **create.type** **required**: text || select || password + - **create.component**: InputText || Input Combo || InputMultiCombo || InputSelectCombo + - **InputText** (default): A text box. Default for type text and password. + - **InputCombo**: A searchable dropdown, single value only + - **InputMultiCombo**: A searchable dropdown, with multiple values allowed + - **InputSelectCombo**: A select dropdown of options + - **create.options**: if component is one of InputCombo, InputMultiCombo, InputSelectCombo, the option values need to be specified. + - **Array(string)**: A simple array of values, label and value will be set to the same + - **Array({ "value": string, "label": string })**: Allows you to set separate values for both the value and label. NOTE: This will result in the value in the write hook having the same value, but it can be trimmed down to just the value in the write hook. + - The server side validation will ensure that any value specified for this field is in the options array. + - **create.disabled**: true if component should be read only, default is false + - **create.validateFunction**: stringified function for checking the validation + - Example: `(function validate(value, values, context, languageDictionary) { if (value...) return 'something went wrong'; return false; }).toString()` + - This validation function will run on both the server- and client-side. + +## Pre-Defined Fields + +There are a set of pre-defined, searchable fields for default behavior. + +You can override the default behavior by adding the field as a userField and then overriding the behavior you would like to change. This would often be done to suppress a field by setting the display to false. + +### Search Fields + +- **name**: A constructed field from other fields: default display function: `(function(user, value) { return (value || user.nickname || user.email || user.user_id); }).toString()` +- **email**: email address or N/A +- **last_login_relative**: The last login time +- **logins_count**: The number of logins +- **connection**: Their database connection + +### User Info Fields: + +- **user_id**: The user ID +- **name**: The user's name +- **username**: The user's username +- **email**: The user's email +- **identity.connection**: The connection value +- **isBlocked**: Whether or not the user is blocked +- **blocked_for**: Whether or not the user has anomaly detection blocks +- **last_ip**: What the last IP was the user used to log in +- **logins_count**: How many times the user has logged in +- **currentMemberships**: The list of memberships for this user +- **created_at**: How long ago the user was created. +- **updated_at**: How long ago the user was updated. +- **last_login**: How long ago the user last logged in. + +### Create and Edit User Fields + +- **connection**: The user's database +- **password**: The new password +- **repeatPassword**: A repeat of the user's password +- **email**: The user's email +- **username**: The user's username + +### Sample Usage + +```js +function(ctx, callback) { + var department = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; + + return callback(null, { + // Only these connections should be visible in the connections picker. + // If only one connection is available, the connections picker will not be shown in the UI. + connections: [ 'Username-Password-Authentication', 'My-Custom-DB' ], + // The dictionary allows you to overwrite the title of the dashboard and the "Memberships" label in the Create User dialog. + dict: { + title: department ? department + ' User Management' : 'User Management Dashboard', + memberships: 'Departments' + }, + // User Fields are the custom fields that can be displayed in create and edit, and can also be used for searching, and can be used to customize the view user page + userFields: [ + { + "label": "Connection", + "property": "connection", + "display": false, + "create": false, + "edit": false, + "search": false + }, + { + "label": "First Name", + "property": "user_metadata.given_name", + "display": true, + "create": { + "type": "text" + }, + "edit": { + "type": "text" + }, + "search": { + "listSize": "10%", + "listOrder": 0 + } + }, + { + "label": "Last Name", + "property": "user_metadata.family_name", + "display": true, + "create": { + "type": "text" + }, + "edit": { + "type": "text" + }, + "search": { + "listSize": "10%", + "listOrder": 1, + "sort": true + } + } + ], + // The CSS option allows you to inject a custom CSS file depending on the context of the current user (eg: a different CSS for every customer) + css: (department && department !== 'IT') && 'https://rawgit.com/auth0-extensions/auth0-delegated-administration-extension/master/docs/theme/fabrikam.css' + }); +} +``` + +## Localization + +Beginning with version 3.0 of the Delegated Admin Extension, you can provide a language dictionary for use with localization. The language dictionary is used only for static page content - for field level content, you must use **userFields** labels. + +::: note +Localization is aimed at those working with non-administrative functions when managing users. Auth0 currently does not support localization on any of the Configuration pages. +::: + +To specify the locale, you can use the path. For example: https://${account.tenant}.us.webtask.io/auth0-delegated-admin/en/users will set context.locale to `en` in the settings query. + +The **languageDictionary** is set as part of the settings query, which allows you to: + +* Explicitly define **languageDictionary** +* Provide URL to fetch the contents for the **languageDictionary** parameter + +Here is a sample of what a [complete Language Dictionary file](https://rawgit.com/auth0-extensions/auth0-delegated-administration-extension/master/tests/utils/en.json) looks like. + +### Example: Providing a Link to a Language Dictionary File + +```js +function(ctx, callback) { + var department = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; + + return callback(null, { + // Only these connections should be visible in the connections picker. + // If only one connection is available, the connections picker will not be shown in the UI. + connections: [ 'Username-Password-Authentication', 'My-Custom-DB' ], + // The dictionary allows you to overwrite the title of the dashboard and the "Memberships" label in the Create User dialog. + dict: { + title: department ? department + ' User Management' : 'User Management Dashboard', + memberships: 'Departments' + }, + // User Fields are the custom fields that can be displayed in create and edit, and can also be used for searching, and can be used to customize the view user page + userFields: [ + { + "label": "Conexión", + "property": "connection", + }, + { + "label": "Correo Electrónico", + "property": "email", + }, + ... + ], + // The CSS option allows you to inject a custom CSS file depending on the context of the current user (eg: a different CSS for every customer) + css: (department && department !== 'IT') && 'https://rawgit.com/auth0-extensions/auth0-delegated-administration-extension/master/docs/theme/fabrikam.css', + languageDictionary: 'https://your-cdn.com/locale/es.json' + }); +} +``` + +### Example: Providing a Language Dictionary Object + +```js +function(ctx, callback) { + var department = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; + + return callback(null, { + // Only these connections should be visible in the connections picker. + // If only one connection is available, the connections picker will not be shown in the UI. + connections: [ 'Username-Password-Authentication', 'My-Custom-DB' ], + // The dictionary allows you to overwrite the title of the dashboard and the "Memberships" label in the Create User dialog. + dict: { + title: department ? department + ' User Management' : 'User Management Dashboard', + memberships: 'Departments' + }, + // User Fields are the custom fields that can be displayed in create and edit, and can also be used for searching, and can be used to customize the view user page + userFields: [ + { + "label": "Conexión", + "property": "connection", + }, + { + "label": "Correo Electrónico", + "property": "email", + }, + ... + ], + // The CSS option allows you to inject a custom CSS file depending on the context of the current user (eg: a different CSS for every customer) + css: (department && department !== 'IT') && 'https://rawgit.com/auth0-extensions/auth0-delegated-administration-extension/master/docs/theme/fabrikam.css', + languageDictionary: { + loginsCountLabel: 'Cantidad de Logins:', + searchBarPlaceholder: 'Busqueda de usuarios usando la sintaxis de Lucene', + deviceNameColumnHeader: 'Dispositivo', + ... + } + }); +} +``` + +<%= include('./_stepnav', { + prev: ["Delegated Admin: Hooks", "/extensions/delegated-admin/hooks"] +}) %> diff --git a/articles/extensions/delegated-admin/v3/hooks/write.md b/articles/extensions/delegated-admin/v3/hooks/write.md new file mode 100644 index 0000000000..d545e8f82b --- /dev/null +++ b/articles/extensions/delegated-admin/v3/hooks/write.md @@ -0,0 +1,89 @@ +--- +description: How to use the Write Hook with the Delegated Administration extension +topics: + - extensions + - delegated-admin + - users + - hooks +contentType: + - how-to + - concept +useCase: extensibility-extensions +--- +# Delegated Administration Hooks: The Write Hook + +The Write Hook, which runs anytime you create or update a user, allows you to do things like: + +* Changing the user's password +* Changing the user's email address +* Updating the user's profile + +You can also use the Write Hook to set default values for newly-created users automatically. For example, you might want to automatically assign a user to the same group, department, or vendor as the ones to which you've been assigned. + +::: warning +Auth0 only supports user creation with Database Connections. +::: + +## The Hook Contract + + - **ctx**: The context object. + - **request.originalUser**: The current user's values where the **payload** is the new set of fields. Only available when the method is **update** + - **payload**: The payload object + - **memberships**: An array of memberships that were selected in the UI when creating the user + - **email**: The email address of the user + - **password**: The password of the user + - **connection**: The name of the database connection + - **app_metadata**: The data that's included if a Custom Field being modified is saved in `app_metadata`. + - **user_metadata**: The data that's included if a Custom Field being modified is saved in `user_metadata`. + - **userFields**: The user fields array (if specified in the [settings query](#the-settings-query-hook)) + - **method**: Either **create** or **update** depending on whether this is being called as a result of a create or an update call + - **callback(error, user)**: The callback to which you can return an error and the user object that should be sent to the Management API + +## Sample Usage + +Kelly manages the Finance department. When she creates users, these users should be assigned as members of the Finance department. + +```js +function(ctx, callback) { + var newProfile = { + email: ctx.payload.email, + password: ctx.payload.password, + connection: ctx.payload.connection, + user_metadata: ctx.payload.user_metadata, + app_metadata: { + department: ctx.payload.memberships && ctx.payload.memberships[0], + ...ctx.payload.app_metadata + } + }; + + if (!ctx.payload.memberships || ctx.payload.memberships.length === 0) { + return callback(new Error('The user must be created within a department.')); + } + + // Get the department from the current user's metadata. + var currentDepartment = ctx.request.user.app_metadata && ctx.request.user.app_metadata.department; + if (!currentDepartment || !currentDepartment.length) { + return callback(new Error('The current user is not part of any department.')); + } + + // If you're not in the IT department, you can only create users within your own department. + // IT can create users in all departments. + if (currentDepartment !== 'IT' && ctx.payload.memberships[0] !== currentDepartment) { + return callback(new Error('You can only create users within your own department.')); + } + + if (ctx.method === 'update') { + // If updating, only set the fields we need to send + Object.keys(newProfile).forEach(function(key) { + if (newProfile[key] === ctx.request.originalUser[key]) delete newProfile[key]; + }); + } + + // This is the payload that will be sent to API v2. You have full control over how the user is created in API v2. + return callback(null, newProfile); +} +``` + +<%= include('./_stepnav', { + prev: ["Delegated Admin: Hooks", "/extensions/delegated-admin/hooks"] +}) %> diff --git a/articles/extensions/delegated-admin/v3/index.md b/articles/extensions/delegated-admin/v3/index.md new file mode 100644 index 0000000000..55e03b3f4e --- /dev/null +++ b/articles/extensions/delegated-admin/v3/index.md @@ -0,0 +1,117 @@ +--- +title: Delegated Administration Extension +description: Learn about Auth0's Delegated Administration Extension, which allows you to expose the Users section of the Auth0 Dashboard to a select group of users without allowing them access to the rest of the Dashboard. +toc: true +topics: + - extensions + - delegated-admin +contentType: + - how-to + - concept + - index +useCase: extensibility-extensions +--- + +# Delegated Administration Extension + +The **Delegated Administration Extension (DAE)** allows you to grant a select group of people administrative permissions to the [Users page](${manage_url}/#/users) of the Auth0 Dashboard without providing access to any other area. This guide will show you how to do this by exposing the [Users area](${manage_url}/#/users) as an Auth0 application. + +## Steps + +To set up the Delegate Administration Extension (DAE), you must: + +1. [Register an Application with Auth0](#register-an-application-with-auth0) +2. [Create a database connection](#create-a-database-connection) +3. [Disable all other connections for your Auth0 Application](#disable-all-other-connections-for-your-auth0-application) +4. [Create a user for the database connection](#create-a-user-for-the-database-connection) +5. [Assign roles to the user](#assign-roles-to-the-user) +6. [Install and configure the extension](#install-and-configure-the-extension) +7. [Use the extension](#use-the-extension) + +### Register an Application with Auth0 + +First, you must create the Application that the Delegated Administration Extension will expose to those who should have administrative privileges for the Users page. To do this, [create a delegated admin application](/dashboard/guides/extensions/delegated-admin-create-app) in Auth0. + +When finished, make sure to note the application's **Client ID**. + +### Create a database connection + +In this example, a database connection will serve as the source of your users who are allowed access to the Users area. To configure this, [create a database connection](/dashboard/guides/connections/set-up-connections-database). + +While setting up your connection, make sure you use the following settings: + +* For connection name, use an appropriate name, such as `HelpDesk`. +* Enable the **Disable Sign Ups** toggle, which, for security purposes, will ensure that even users who have the link to the database connection cannot sign themselves up. + +### Disable all other connections for your Auth0 Application + +By default, Auth0 enables all connections associated with your tenant when you create a new Application. For this example, we will disable all connections other than our newly-created database connection. This will help keep the application secure because no one will be able to add themselves using one of our existing connections. + +To configure this, [update application connections](/dashboard/guides/applications/update-app-connections). + +### Create a user for the database connection + +To continue, you must [create at least one user](/dashboard/guides/users/create-users) and attach it to your connection. + +### Assign roles to the user + +<%= include('../../../_includes/_rbac_vs_extensions') %> + +Auth0 grants access to the Delegated Administration Extension (DAE) for the user(s) attached to your connection based on their roles. DAE-specific roles include: + +- **Delegated Admin - User**: Grants permission to search for users, create users, open users, and execute actions on users (e.g., `delete`, `block`). + +- **Delegated Admin - Administrator**: Grants all the rights of **Delegated Admin - User**, plus the ability to see all logs in the tenant and configure Hooks. + +- **Delegated Admin - Auditor**: Grants permission to search for users and view user information, but does not allow any changes to be made. This role also changes the UI to remove action-based buttons. + +- **Delegated Admin - Operator**: Grants permission to access user management and logs, but does not allow access to the extension configuration section. + +When working with roles, we recommend that you use the Authorization Core feature set: + +1. [Create DAE roles](/dashboard/guides/roles/create-roles). The names of the roles you create must match the names of the [pre-defined DAE roles above](#assign-roles-to-users). + +2. [Assign the DAE role to a user manually](/dashboard/guides/users/assign-roles-users), then add the user roles to the DAE namespace in the ID Token using the following rule, remembering to replace the `CLIENT_ID` placeholder with your delegated admin application's **Client ID**. + +```js +function (user, context, callback) { + if (context.clientID === 'CLIENT_ID') { + const namespace = 'https://example.com/auth0-delegated-admin'; + context.idToken[namespace] = { + roles: (context.authorization || {}).roles + }; + } + callback(null, user, context); +} +``` + +See this guide with more [information about creating rules](/dashboard/guides/rules/create-rules). + +::: note +Your claim should be [namespaced](/tokens/guides/create-namespaced-custom-claims). +::: + +::: note +Using Authorization Core will define roles in the `context.authorization` object. + +If you choose not to use Authorization Core, you should define DAE roles in one of the following fields on the user profile: + +* `user.app_metadata.roles` +* `user.app_metadata.authorization.roles` +::: + +## Install and configure the extension + +Now that we've created and configured an application, a connection, and our user, we can [install and configure the Delegated Admin Extension](/dashboard/guides/extensions/delegated-admin-install-extension) itself. + +## Use the extension + +Once installed, you are ready to [use the Delegated Admin Extension](/dashboard/guides/extensions/delegated-admin-use-extension). + +<%= include('./_session-timeout.md') %> + +## Keep reading + +* [Customizing the Delegated Administration Extension using Hooks](/extensions/delegated-admin/hooks) + +* [Managing users in the Delegated Administration Dashboard](/extensions/delegated-admin/manage-users) diff --git a/articles/extensions/delegated-admin/v3/manage-users.md b/articles/extensions/delegated-admin/v3/manage-users.md new file mode 100644 index 0000000000..b943aaf9a0 --- /dev/null +++ b/articles/extensions/delegated-admin/v3/manage-users.md @@ -0,0 +1,106 @@ +--- +description: How to manage users in the Delegated Administration extension +toc: true +topics: + - extensions + - delegated-admin + - users +contentType: + - how-to + - concept +useCase: extensibility-extensions +--- + +# Delegated Administration: Manage Users + +In the Application exposed by the Delegated Administration extension, there are two views available: *Users* and *Logs*. On the *Users* view, you can see the display and modify users associated with your Auth0 account. + +By default, all users are displayed, but you can filter the displayed list by configuring a [filter hook](/extensions/delegated-admin/v3/hooks/filter). + +## Available User Actions in the Delegated Administration Dashboard + +The table below lists the options you can perform on users, as well as information on whether the option is available via the [Management Dashboard](${manage_url}/#/) and/or the Delegated Administration extension. To limit the number of options someone with access to the Dashboard exposed by the Delegated Administration extension, configure an [access hook](/extensions/delegated-admin/v3/hooks/access). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Action Available in the Management Dashboard Available in the Delegated Administration Extension
      Create UserYesYes
      Contact UserYesNo
      Block UserYesYes
      Delete UserYesYes
      Send Verification EmailYesYes
      Change EmailYesYes
      Change PasswordYesYes
      Reset PasswordNoYes
      Change ProfileYesYes
      Remove MFANoYes
      + +The *Change Profile* option is available only if you have configured custom fields. + +Notice the new *Reset Password* option available via the extension. This option will send an email to the user allowing them to choose a new password. To do this click on a user and select *Actions > Reset Password*. + +![](/media/articles/extensions/delegated-admin/reset-pass-01.png) + +This will send an email to the user, containing a link to change the password. + +If your profile indicates that you have the `Delegated Admin - Administrator` role, the *Logs* view allows you to see a list of authentications made by your users (this tab is only visible to users with the `Delegated Admin - Administrator` role). The contents of this view are a subset of the data displayed in the [Logs Dashboard](${manage_url}/#/logs). The Log Dashboard also displays data on administrative actions taken in the Dashboard. + +## Create Users + +You can create a new user by selecting the **+ Create User** button on the *Users* view. You need to specify are email and password. Depending on your role, you may not be able to set the *Department* to which the new user belongs. + +For example, users with the `Delegated Admin - Administrator` role can see the **Department** field and select any of its values. + +![](/media/articles/extensions/delegated-admin/create-user-admin.png) + +On the other hand, Kelly who has the `Delegated Admin - User` role and belongs to the Finance department cannot see this field. The user she creates will be automatically assigned to the Finance department. + +![](/media/articles/extensions/delegated-admin/create-user-kelly.png) + +<%= include('./_session-timeout.md') %> diff --git a/articles/extensions/deploy-cli/_includes/_limitations.md b/articles/extensions/deploy-cli/_includes/_limitations.md new file mode 100644 index 0000000000..3f26e0cdb8 --- /dev/null +++ b/articles/extensions/deploy-cli/_includes/_limitations.md @@ -0,0 +1,3 @@ +### Limitations + +Some of the settings cannot be exported, such as `rulesConfigs` values. After exporting, you may need to update the values in `tenant.yaml` if you see schema-related errors during the import process. diff --git a/articles/extensions/deploy-cli/_includes/_strip-option.md b/articles/extensions/deploy-cli/_includes/_strip-option.md new file mode 100644 index 0000000000..ab0a70fece --- /dev/null +++ b/articles/extensions/deploy-cli/_includes/_strip-option.md @@ -0,0 +1 @@ +When importing objects into Auth0 tenants, Auth0 generates new IDs. To avoid import failure, identifier fields are stripped from the Auth0 objects on export by default. To override this behavior, use `--export_ids` or `AUTH0_EXPORT_IDENTIFIERS: true`. diff --git a/articles/extensions/deploy-cli/_includes/_upgrade-v4.md b/articles/extensions/deploy-cli/_includes/_upgrade-v4.md new file mode 100644 index 0000000000..beab3977fd --- /dev/null +++ b/articles/extensions/deploy-cli/_includes/_upgrade-v4.md @@ -0,0 +1,9 @@ +::: panel Upgrading to Deploy CLI Tool v4 +Upgrading to Deploy CLI Tool v4 requires that the **auth0-deploy-cli-extension** application be granted the following additional permissions (scopes) for the Auth0 Management API: `create:hooks`, `read:hooks`, `update:hooks`, and `delete:hooks`. Upgrading the **Auth0 Deploy CLI** extension will take care of this automatically. To upgrade the extension: + +1. Navigate to the [Extensions](${manage_url}/#/extensions) page in the [Auth0 Dashboard](${manage_url}), and click the **Installed Extensions** tab. + +2. Locate **Auth0 Deploy CLI**, click **Upgrade**, and confirm. Wait for the upgrade to complete. + +If necessary, you can check and [manually modify required scopes](/extensions/deploy-cli/guides/create-deploy-cli-application-manually#modify-deploy-cli-application-scopes). +::: \ No newline at end of file diff --git a/articles/extensions/deploy-cli/guides/call-deploy-cli-programmatically.md b/articles/extensions/deploy-cli/guides/call-deploy-cli-programmatically.md new file mode 100644 index 0000000000..4347f51a29 --- /dev/null +++ b/articles/extensions/deploy-cli/guides/call-deploy-cli-programmatically.md @@ -0,0 +1,67 @@ +--- +title: Call Deploy CLI Tool Programmatically +description: Learn how call the Auth0 Deploy Command Line Interface (CLI) programmatically. +topics: + - extensions + - deploy-cli +contentType: + - how-to +useCase: extensibility-extensions +--- +# Call Deploy CLI Tool Programmatically + +You can call the CLI tool programmatically as shown in the following example: + +```js +import { deploy, dump } from 'auth0-deploy-cli'; + +const config = { + AUTH0_DOMAIN: process.env.AUTH0_DOMAIN, + AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET, + AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID, + AUTH0_ALLOW_DELETE: false +}; + + +// Export Tenant Config +dump({ + output_folder: 'path/to/yaml/or/directory', // Input file for directory, change to .yaml for YAML + base_path: basePath, // Allow to override basepath, if not take from input_file + config_file: configFile, // Option to a config json + config: configObj, // Option to sent in json as object + strip, // Strip the identifier field for each object type + secret // Optionally pass in auth0 client secret separate from config +}) + .then(() => console.log('yey dump was successful')) + .catch(err => console.log(`Oh no, something went wrong. <%= "Error: ${err}" %>`)); + + +// Import tenant config +deploy({ + input_file: 'path/to/yaml/or/directory', // Input file for directory, change to .yaml for YAML + base_path: basePath, // Allow to override basepath, if not take from input_file + config_file: configFile, // Option to a config json + config: configObj, // Option to sent in json as object + env, // Allow env variable mappings from process.env + secret // Optionally pass in auth0 client secret separate from config +}) + .then(() => console.log('yey deploy was successful')) + .catch(err => console.log(`Oh no, something went wrong. <%= "Error: ${err}" %>`)); +``` + +## Troubleshooting + +The `auth0-deploy-cli` tool uses the Management API to pass through objects for create, update, and delete actions. + +You may occasionally see `Bad Request` and `Payload validation` errors returned by the Management API. These errors usually mean the object you're working with has attributes which are not writable or no longer available. This can happen when you are exporting from an older Auth0 tenant and importing into a newly-created tenant. + +If this is the case, update your configuration to support the new object format used by Auth0. + +## Keep reading + +* [Install the Deploy CLI Tool](/extensions/deploy-cli/guides/install-deploy-cli) +* [Incorporate Deploy CLI into Build Environment](/extensions/deploy-cli/guides/incorporate-deploy-cli-into-build-environment) +* [Import/Export Tenant Configuration to a Directory Structure](/extensions/deploy-cli/guides/import-export-directory-structure) +* [Import/Export Tenant Configuration to a YAML File](/extensions/deploy-cli/guides/import-export-yaml-file) +* [Deploy CLI Tool Options](/extensions/deploy-cli/references/deploy-cli-options) +* [Troubleshooting Deploy CLI Tool](/extensions/deploy-cli/references/troubleshooting) \ No newline at end of file diff --git a/articles/extensions/deploy-cli/guides/create-deploy-cli-application-manually.md b/articles/extensions/deploy-cli/guides/create-deploy-cli-application-manually.md new file mode 100644 index 0000000000..89ca93dd16 --- /dev/null +++ b/articles/extensions/deploy-cli/guides/create-deploy-cli-application-manually.md @@ -0,0 +1,114 @@ +--- +title: Create and Configure the Deploy CLI Application Manually +description: Learn how to create and configure the Deploy CLI application for use with the Deploy CLI tool. This can be done programmatically using the Auth0 Deploy CLI extension. +topics: + - extensions + - deploy-cli + - dashboard +contentType: + - how-to +useCase: extensibility-extensions +--- +# Create and Configure the Deploy CLI Application Manually + +To use the Deploy CLI tool, your tenant must be configured appropriately. + +::: note +Generally, you do this programmatically by [installing the **Auth0 Deploy CLI** extension](/extensions/deploy-cli/guides/install-deploy-cli#install-the-deploy-cli-extension), which will create and configure an Application that is authorized to call the Management API. +::: + +Sometimes, you may wish to create and configure this application manually. At a later time, you may also want to modify scopes for an application that has been created previously. + +## Create the Initial Deploy CLI Application + +To create and configure the initial Deploy CLI Application: + +1. Navigate to the [Applications](${manage_url}/#/applications) page in the [Auth0 Dashboard](${manage_url}), and click **+ Create Application**. + +2. Enter `auth0-deploy-cli-extension` as the name for your Application, select **Machine to Machine Applications**, and click **Create**. + +![Select Application Name and Type](/media/articles/applications/create-client-popup.png) + +3. When asked which API you want to call from your application, select **Auth0 Management API**. + +![Select API](/media/articles/applications/m2m-select-api.png) + +4. Select the [required scopes](#required-scopes) to enable them for your Application, and click **Authorize**. These scopes will be issued as part of your Application's Access Token. + +![Select Scopes](/media/articles/applications/m2m-select-scopes.png) + +## Modify Deploy CLI Application Scopes +To modify permissions (scopes) for an application that has been created previously: + +1. Navigate to the [Applications](${manage_url}/#/applications) page in the [Auth0 Dashboard](${manage_url}/), and click the `auth0-deploy-cli-extension` application. + +![View Applications](/media/articles/extensions/deploy-cli/deploy-cli-app-list.png) + +2. Click the **APIs** tab, expand the **Auth0 Management API**, and enable any [required scopes](#required-scopes) that appear to have been disabled. + +![Enable Permissions](/media/articles/extensions/deploy-cli/deploy-cli-enable-permissions.png) + +::: warning +If the APIs tab is not visible: + +1. For **Application Type**, and select **Machine to Machine**. + +2. Click **Save Changes**, then refresh the page. The APIs tab should now be visible. +::: + +## Required Scopes + +The following scopes are required to be enabled on the `auth0-deploy-cli-extension` Application to ensure it is configured for proper access to the Management API. + + - read:client_grants + - create:client_grants + - delete:client_grants + - update:client_grants + - read:clients + - update:clients + - delete:clients + - create:clients + - read:client_keys + - update:client_keys + - delete:client_keys + - create:client_keys + - read:connections + - update:connections + - delete:connections + - create:connections + - read:resource_servers + - update:resource_servers + - delete:resource_servers + - create:resource_servers + - read:rules + - update:rules + - delete:rules + - create:rules + - read:hooks + - create:hooks + - update:hooks + - delete:hooks + - read:rules_configs + - update:rules_configs + - delete:rules_configs + - read:email_provider + - update:email_provider + - delete:email_provider + - create:email_provider + - read:tenant_settings + - update:tenant_settings + - read:grants + - delete:grants + - read:guardian_factors + - update:guardian_factors + - read:email_templates + - create:email_templates + - update:email_templates + - read:roles + - create:roles + - delete:roles + - update:roles + - read:prompts + - update:prompts + - read:branding + - update:branding \ No newline at end of file diff --git a/articles/extensions/deploy-cli/guides/import-export-directory-structure.md b/articles/extensions/deploy-cli/guides/import-export-directory-structure.md new file mode 100644 index 0000000000..cc16fc1cf4 --- /dev/null +++ b/articles/extensions/deploy-cli/guides/import-export-directory-structure.md @@ -0,0 +1,175 @@ +--- +title: Import/Export Tenant Configuration to Directory Structure +description: Understand how the Auth0 Deploy Command Line Interface (CLI) tool works. +topics: + - extensions + - deploy-cli +contentType: + - how-to +useCase: extensibility-extensions +--- +# Import/Export Tenant Configuration to Directory Structure + +The `auth0-deploy-cli` tool includes a **directory option** that allows you to export and import an existing Auth0 tenant configuration into a predefined directory structure. + +::: note +For information on how the files are expected to be laid out to work with the source control configuration utilities, see [GitHub Deployments](/extensions/github-deploy). +::: + +## Import tenant configuration + +1. Copy `config.json.example`, making sure to replace the placeholder values with the values specific to your configuration. + + ```json + { + "AUTH0_DOMAIN": ".auth0.com", + "AUTH0_CLIENT_ID": "", + "AUTH0_CLIENT_SECRET": "", + "AUTH0_KEYWORD_REPLACE_MAPPINGS": { + "AUTH0_TENANT_NAME": "", + "ENV": "DEV" + }, + "AUTH0_ALLOW_DELETE": false, + "AUTH0_EXCLUDED_RULES": [ + "rule-1-name", + "rule-2-name" + ], + "INCLUDED_PROPS": { + "clients": [ "client_secret" ] + }, + "EXCLUDED_PROPS": { + "connections": [ "options.client_secret" ] + } + } + ``` + +Use the `client ID` and secret from your newly-created client (the client is named `auth0-deploy-cli-extension` if you used the extension). + +By default, the tool merges with your current environment variables and overrides the `config.json` file (which has the same top key). You can use the `--no-env` option to disable the override via the command line. + +You can either set the environment variables, or you can place the values in a configuration file anywhere on the file system that is accessible by the CLI tool. + +2. Deploy using the following command: + +```bash +a0deploy import --config_file config.json --input_file . +``` + +### Example: configuration file + +Here is an example of a `config.json` file: + +```json +{ + "AUTH0_DOMAIN": "", + "AUTH0_CLIENT_SECRET": "", + "AUTH0_CLIENT_ID": "", + "AUTH0_KEYWORD_REPLACE_MAPPINGS": { + "YOUR_ARRAY_KEY": [ + "http://localhost:8080", + "https://somedomain.com" + ], + "YOUR_STRING_KEY": "some environment specific string" + }, + "AUTH0_ALLOW_DELETE": false, + "INCLUDED_PROPS": { + "clients": [ "client_secret" ] + }, + "EXCLUDED_PROPS": { + "connections": [ "options.client_secret" ] + }, + "AUTH0_EXCLUDED_RULES": [ "auth0-account-link-extension" ], + "AUTH0_EXCLUDED_CLIENTS": [ "auth0-account-link" ], + "AUTH0_EXCLUDED_RESOURCE_SERVERS": [ "SSO Dashboard API" ], + "AUTH0_EXCLUDED_DEFAULTS": ["emailProvider"] +} +``` + +## Export tenant configuration + +To export your current tenant configuration, run a command that's similar to: + +`a0deploy export --config_file config.json --format directory --output_folder path/to/export` + +<%= include('../_includes/_strip-option') %> + +<%= include('../_includes/_limitations') %> + +For more information, see [Environment Variables and Keyword Mappings](/extensions/deploy-cli/references/environment-variables-keyword-mappings). + +### Directory structure example + +Here is a sample of what the export directory structure looks like (for full details on everything that can be included, please refer to the [extension's repository](https://github.com/auth0/auth0-deploy-cli/tree/master/examples/directory): + +``` +repository => + clients + client1.json + client2.json + connections + connection1.json + database-connections + connection1 + database.json + create.js + delete.js + get_user.js + login.js + verify.js + emails + provider.json + verify_email.json + verify_email.html + welcome_email.json + welcome_email.html + grants + grant1.json + pages + login.html + login.json + password_reset.html + password_reset.json + resource-servers + resource_server1.json + resource_server2.json + rules + rule1.js + rule1.json + rule2.js + rules-configs + env_param1.json + some_secret1.json + hooks + hook1.js + hook1.json + guardian + factors + sms.json + email.json + otp.json + push-notification.json + provider + sms-twilio.json + templates + sms.json +``` + +::: note +To add hook secrets to your environment, add secrets in the .json configuration file (in this example, hook1.json) as follows: + +```json +"secrets": { + "api-key": "my custom api key" +} +``` + +The `secrets` object cannot be nested, so remember to prefix your secrets. +::: + +## Keep reading + +* [Incorporate Deploy CLI into Build Environment](/extensions/deploy-cli/guides/incorporate-deploy-cli-into-build-environment) +* [Call Deploy CLI Tool Programmatically](/extensions/deploy-cli/guides/call-deploy-cli-programmatically) +* [Deploy CLI Tool Options](/extensions/deploy-cli/references/deploy-cli-options) +* [Import/Export Tenant Configuration to a YAML File](/extensions/deploy-cli/guides/import-export-yaml-file) +* [Troubleshooting Deploy CLI Tool](/extensions/deploy-cli/references/troubleshooting) diff --git a/articles/extensions/deploy-cli/guides/import-export-yaml-file.md b/articles/extensions/deploy-cli/guides/import-export-yaml-file.md new file mode 100644 index 0000000000..e66ab2e842 --- /dev/null +++ b/articles/extensions/deploy-cli/guides/import-export-yaml-file.md @@ -0,0 +1,272 @@ +--- +title: Import/Export Tenant Configuration to YAML File +description: Learn how to use the YAML option of the Auth0-deploy-cli tool. +topics: + - extensions + - deploy-cli +contentType: + - how-to +useCase: extensibility-extensions +--- +# Import/Export Tenant Configuration to YAML File + +The `auth0-deploy-cli` tool's **YAML option** supports the exporting to and importing of an Auth0 tenant configuration using a [YAML](http://yaml.org/) file. You can find an [example config file and other examples of using `auth0-deploy-cli`](https://github.com/auth0/auth0-deploy-cli/) in the Github repo. + +## Import tenant configuration + +To import an Auth0 tenant configuration: + +1. Copy `config.json.example`, making sure to replace the placeholder values with the values specific to your configuration. + + ```json + { + "AUTH0_DOMAIN": ".auth0.com", + "AUTH0_CLIENT_ID": "", + "AUTH0_CLIENT_SECRET": "", + "AUTH0_KEYWORD_REPLACE_MAPPINGS": { + "AUTH0_TENANT_NAME": "", + "ENV": "DEV" + }, + "AUTH0_ALLOW_DELETE": false, + "AUTH0_EXCLUDED_RULES": [ + "rule-1-name", + "rule-2-name" + ], + "INCLUDED_PROPS": { + "clients": [ "client_secret" ] + }, + "EXCLUDED_PROPS": { + "connections": [ "options.client_secret" ] + } + } + ``` + + Use the `client ID` and secret from your newly-created client (the client is named `auth0-deploy-cli-extension` if you used the extension). + + By default, the tool merges with your current environment variables and overrides the `config.json` file (which has the same top key). You can use the `--no-env` option to disable the override via the command line. + + You can either set the environment variables, or you can place the values in a configuration file anywhere on the file system that is accessible by the CLI tool. + +2. Deploy using the following command: + + ```bash + a0deploy import --config_file config.json --input_file tenant.yaml + ``` + +### Example: configuration file + +Here is the example of a `config.json` file: + +```json +{ + "AUTH0_DOMAIN": "", + "AUTH0_CLIENT_SECRET": "", + "AUTH0_CLIENT_ID": "", + "AUTH0_KEYWORD_REPLACE_MAPPINGS": { + "YOUR_ARRAY_KEY": [ + "http://localhost:8080", + "https://somedomain.com" + ], + "YOUR_STRING_KEY": "some environment specific string" + }, + "AUTH0_ALLOW_DELETE": false, + "INCLUDED_PROPS": { + "clients": [ "client_secret" ] + }, + "EXCLUDED_PROPS": { + "connections": [ "options.client_secret" ], + "emailProvider": ["name", "credentials", "default_from_address", "enabled"] + }, + "AUTH0_EXCLUDED_RULES": [ "auth0-account-link-extension" ], + "AUTH0_EXCLUDED_CLIENTS": [ "auth0-account-link" ], + "AUTH0_EXCLUDED_RESOURCE_SERVERS": [ "SSO Dashboard API" ], + "AUTH0_EXCLUDED_DEFAULTS": ["emailProvider"] +} +``` + +### Import configuration example + +The following is an example of an import config file called `tenant.yaml` (for full details on everything that can be included, please refer to the [extension's repository](https://github.com/auth0/auth0-deploy-cli/tree/master/examples/directory): + +```yaml +tenant: + # Any tenant settings can go here https://auth0.com/docs/api/management/v2#!/Tenants/get_settings + friendly_name: 'Auth0 Deploy Example' + +pages: + - name: "login" + html: "pages/login.html" + + - name: "password_reset" + html: "pages/password_reset.html" + + - name: "guardian_multifactor" + html: "pages/guardian_multifactor.html" + enabled: false + + - name: "error_page" + html: "pages/error_page.html" + +clients: + - + name: "My SPA" + app_type: "spa" + # Add other client settings https://auth0.com/docs/api/management/v2#!/Clients/post_clients + - + name: "My M2M" + app_type: "non_interactive" + # Add other client settings https://auth0.com/docs/api/management/v2#!/Clients/post_clients + +databases: + - name: "users" + enabled_clients: + - "My SPA" + options: + enabledDatabaseCustomization: true + customScripts: + login: "databases/users/login.js" + create: "databases/users/create.js" + delete: "databases/users/delete.js" + get_user: "databases/users/get_user.js" + change_email: "databases/users/change_email.js" + change_password: "databases/users/change_password.js" + verify: "databases/users/verify.js" + +connections: + - name: "myad-waad" + strategy: "waad" + enabled_clients: + - "My SPA" + options: + tenant_domain: 'office.com' + client_id: 'some_client_id' + client_secret: 'some_client_secret' + domain: 'office.com' + waad_protocol: 'openid-connect' + api_enable_users: true + basic_profile: true + ext_profile: true + ext_groups: true + # Add other connection settings (https://auth0.com/docs/api/management/v2#!/Connections/post_connections) + +rules: + - name: "Common-Functions" + order: 10 + script: "rules/enrich_tokens.js" + +rulesConfigs: + # Key/Value pairs for Rule configuration settings + - key: "SOME_SECRET" + value: 'some_key' + +hooks: + - name: "Client Credentials Exchange" + triggerId: "credentials-exchange" + enabled: true + secrets: + api-key: "my custom api key" + dependencies: + bcrypt: "3.0.6" + script: "hooks/client-credentials-exchange.js" + +resourceServers: + - + name: "My API" + identifier: "https://##ENV##.myapp.com/api/v1" + scopes: + - value: "update:account" + description: "update account" + - value: "read:account" + description: "read account" + # Add other resource server settings (https://auth0.com/docs/api/management/v2#!/Resource_Servers/post_resource_servers) + +emailProvider: + name: "smtp" + enabled: true + credentials: + smtp_host: "smtp.mailtrap.io" + smtp_port: 2525 + smtp_user: "smtp_user" + smtp_pass: "smtp_secret_password" + +emailTemplates: + - template: "verify_email" + enabled: true + syntax: "liquid" + from: "test@email.com" + subject: "something" + body: "emails/change_email.html" + + - template: "welcome_email" + enabled: true + syntax: "liquid" + from: "test@email.com" + subject: "something" + body: "emails/change_email.html" + +clientGrants: + - client_id: "My M2M" + audience: "https://##ENV##.myapp.com/api/v1" + scope: + - "update:account" + +guardianFactors: + - name: sms + enabled: true + - name: push-notification + enabled: true + - name: otp + enabled: true + - name: email + enabled: false + - name: duo + enabled: false + +guardianFactorProviders: + - name: sms + provider: twilio + auth_token: "some_token" + sid: "some_sid" + messaging_service_sid: "some_message_sid" + +guardianFactorTemplates: + - name: sms + enrollment_message: >- + {{code}} is your verification code for {{tenant.friendly_name}}. Please + enter this code to verify your enrollment. + verification_message: '{{code}} is your verification code for {{tenant.friendly_name}}' + +roles: + - name: Admin + description: App Admin + permissions: + - permission_name: 'update:account' + resource_server_identifier: 'https://##ENV##.myapp.com/api/v1' + - permission_name: 'read:account' + resource_server_identifier: 'https://##ENV##.myapp.com/api/v1' + - name: User + description: App User + permissions: + - permission_name: 'read:account' + resource_server_identifier: 'https://##ENV##.myapp.com/api/v1' +``` + +## Export tenant configuration + +To export your current tenant configuration, run a command that's similar to: + +`a0deploy export --config_file config.json --format yaml --output_folder path/to/export` + +<%= include('../_includes/_strip-option') %> + +<%= include('../_includes/_limitations') %> + +For more information, see [Environment Variables and Keyword Mappings](/extensions/deploy-cli/references/environment-variables-keyword-mappings). + +## Keep reading + +* [Incorporate Deploy CLI into Build Environment](/extensions/deploy-cli/guides/incorporate-deploy-cli-into-build-environment) +* [Call Deploy CLI Tool Programmatically](/extensions/deploy-cli/guides/call-deploy-cli-programmatically) +* [Deploy CLI Tool Options](/extensions/deploy-cli/references/deploy-cli-options) +* [Import/Export Tenant Configuration to a Directory Structure](/extensions/deploy-cli/guides/import-export-directory-structure) +* [Troubleshooting Deploy CLI Tool](/extensions/deploy-cli/references/troubleshooting) diff --git a/articles/extensions/deploy-cli/guides/incorporate-deploy-cli-into-build-environment.md b/articles/extensions/deploy-cli/guides/incorporate-deploy-cli-into-build-environment.md new file mode 100644 index 0000000000..d535b82f6f --- /dev/null +++ b/articles/extensions/deploy-cli/guides/incorporate-deploy-cli-into-build-environment.md @@ -0,0 +1,73 @@ +--- +title: Incorporate Deploy CLI into Build Environment +description: Learn how to incorporate the Deploy CLI tool into your build environment. +topics: + - extensions + - deploy-cli +contentType: + - how-to +useCase: extensibility-extensions +--- +# Incorporate Deploy CLI into Build Environment + +Auth0 offers a Deploy CLI tool that we recommend you incorporate into your build system. The Deploy CLI tool allows you to: + +* Deploy using the command line +* Create a repository to store your deployment configuration +* Create a set of configuration files for each environment (e.g., development, production) +* Have a deployment build for each environment that updates a local copy of the deployment configuration repository on your continuous integration server + +## Auth0 tenant layout + +We recommend that you have a separate Auth0 tenant/account for each environment you have. For example, you might have the following environments and Auth0 tenants: + +| Environment | Tenant | +| - | - | +| Development | *fabrikam-dev* | +| Testing | *fabrikam-uat* | +| Staging | *fabrikam-staging* | +| Production | *fabrikam-prod* | + +### Your deploy configuration repository + +Your configuration repository should contain a specific set of files based on how you've chosen to import/export your tenant configuration information: + +* [Directory Structure](/extensions/deploy-cli/guides/import-export-directory-structure) +* [YAML File](/extensions/deploy-cli/guides/import-export-yaml-file) + +You should have at least one branch for each tenant/account in your repository, which allows you to make changes without deploying them (the changes would only deploy when you merged your branch into the master, or primary, branch). With this setup, you can have a continuous integration task for each environment that automatically deploys changes to the targeted environment whenever the master branch receives updates. + +Your workflow would, therefore, look something like this: + +1. Make changes to development. +2. Merge changes to testing (or `uat`). +3. Test changes to `uat`. When ready, move and merge the changes to `staging`. +4. Test `staging`. When ready, move and merge the changes to `production`. + +You may want to set your production environment to deploy only when triggered manually. + +### Your continuous integration (CI) server configuration + +Your CI server should have a different deploy task and config for each environment. Since each tenant/account needs to have the `auth0-deploy-cli-extension` installed and using a different domain, client ID, and secret, you will need to create individual configurations -- this has the bonus of helping you avoid accidental deployments to the wrong environment. + +The deploy task should do the following: + + 1. Update the local repo to include the latest changes (each environment should have its own branch of the repository that can later be merged with other branches) + 1. If there are changes, call `a0deploy`. + 1. Run a suite of tests to confirm configuration is working. + 1. (Optional) Merge to next branch (e.g. `development` to `uat` or `uat` to `staging`. + +### Use keyword mappings to handle differences between the environments + +You should not have to store differences between environments in the Deploy Configuration Repository. Use the keyword mappings to allow the repository to be environment agnostic, and save the differences in the separate `config.json` files for each environment on the CI server. + +For more information, see [Environment Variables and Keyword Mappings](/extensions/deploy-cli/references/environment-variables-keyword-mappings). + +## Keep reading + +* [Install the Deploy CLI Tool](/extensions/deploy-cli/guides/install-deploy-cli) +* [Call Deploy CLI Tool Programmatically](/extensions/deploy-cli/guides/call-deploy-cli-programmatically) +* [Deploy CLI Tool Options](/extensions/deploy-cli/references/deploy-cli-options) +* [Import/Export Tenant Configuration to a Directory Structure](/extensions/deploy-cli/guides/import-export-directory-structure) +* [Import/Export Tenant Configuration to a YAML File](/extensions/deploy-cli/guides/import-export-yaml-file) +* [Troubleshooting Deploy CLI Tool](/extensions/deploy-cli/references/troubleshooting) diff --git a/articles/extensions/deploy-cli/guides/install-deploy-cli.md b/articles/extensions/deploy-cli/guides/install-deploy-cli.md new file mode 100644 index 0000000000..fd08de5bcf --- /dev/null +++ b/articles/extensions/deploy-cli/guides/install-deploy-cli.md @@ -0,0 +1,81 @@ +--- +title: Install and Configure the Deploy CLI Tool +description: Learn how to install and configure the Deploy CLI tool. +topics: + - extensions + - deploy-cli +contentType: + - how-to +useCase: extensibility-extensions +--- +# Install and Configure the Deploy CLI Tool + +This guide will show you how to install the Deploy CLI tool and configure it using the Deploy CLI extension. To do this, you must: + +1. [Install the Deploy CLI Tool](#install-the-deploy-cli-tool) +2. [Install the Deploy CLI Extension](#install-the-deploy-cli-extension) +3. [Configure the Deploy CLI Tool](#configure-the-deploy-cli-tool) +4. [Run the Deploy CLI Tool](#run-the-deploy-cli-tool) + +You can also upgrade from a previous version of the tool. The `auth0-deploy-cli` tool was completely rewritten from version 1 to [version 2 or later](/extensions/deploy-cli/references/whats-new), which means that it is not backwards compatible. Please consider the following when upgrading: + +- The directory structure and format has changed to allow for additional object types. +- The command line parameters have changed to allow for additional options, such as export. + +## Install the Deploy CLI Tool + +To install the Deploy CLI Tool, use the command-line interface to run: + +```bash +npm i -g auth0-deploy-cli +``` + +## Install the Deploy CLI Extension + +The Deploy CLI tool must be authorized to call the Management API. To do this, the **Auth0 Deploy CLI** extension configures your tenant by creating and configuring an application named **auth0-deploy-cli-extension** and authorizing it for use with the Management API. Later, you will use the Client ID and Secret from this application to configure the Deploy CLI Tool. + +1. Navigate to the [Extensions](${manage_url}/#/extensions) page in the [Auth0 Dashboard](${manage_url}), locate the **Auth0 Deploy CLI** extension, and click the extension. + +![Find Deploy CLI Extension](/media/articles/extensions/deploy-cli/deploy-cli-find-extension.png) + +2. Click **Install**. + +![Install Deploy CLI Extension](/media/articles/extensions/deploy-cli/deploy-cli-install-extension.png) + +3. From the list of installed extensions, click **Auth0 Deploy CLI**, then click **Accept** to consent to allow the extension to access your data. + +::: note +If necessary, you can also [manually create and configure the **auth0-deploy-cli-extension** application](/extensions/deploy-cli/guides/create-deploy-cli-application-manually#create-the-initial-deploy-cli-application) and [manually modify required scopes](/extensions/deploy-cli/guides/create-deploy-cli-application-manually#modify-deploy-cli-application-scopes). +::: + +## Configure the Deploy CLI Tool + +To configure the Deploy CLI tool to use the Deploy CLI application, create a **config.json** file, including the **Client ID** and **Client Secret** from the **auth0-deploy-cli-extension** application. You can find this application on the [Applications](${manage_url}/#/applications) page in the [Auth0 Dashboard](${manage_url}). + +```json +{ + "AUTH0_DOMAIN": "${account.namespace}", + "AUTH0_CLIENT_ID": "${account.clientId}", + "AUTH0_CLIENT_SECRET": "YOUR_CLIENT_SECRET", + "AUTH0_KEYWORD_REPLACE_MAPPINGS": { "AUTH0_TENANT_NAME": "${account.tenant}" }, + "AUTH0_ALLOW_DELETE": false, + "AUTH0_EXCLUDED_RULES": [ "rule-1-name" ] +} +``` + +## Run the Deploy CLI Tool + +To run the Deploy CLI Tool, use the command-line interface to run: + +```bash +a0deploy export --config_file config.json --format yaml --output_folder +``` + +## Keep reading + +* [Incorporate Deploy CLI into Build Environment](/extensions/deploy-cli/guides/incorporate-deploy-cli-into-build-environment) +* [Call Deploy CLI Tool Programmatically](/extensions/deploy-cli/guides/call-deploy-cli-programmatically) +* [Deploy CLI Tool Options](/extensions/deploy-cli/references/deploy-cli-options) +* [Import/Export Tenant Configuration to a Directory Structure](extensions/deploy-cli/guides/import-export-directory-structure) +* [Import/Export Tenant Configuration to a YAML File](/extensions/deploy-cli/guides/import-export-yaml-file) +* [Troubleshooting the Deploy CLI Tool](/extensions/deploy-cli/references/troubleshooting) diff --git a/articles/extensions/deploy-cli/index.md b/articles/extensions/deploy-cli/index.md new file mode 100644 index 0000000000..627f5ead21 --- /dev/null +++ b/articles/extensions/deploy-cli/index.md @@ -0,0 +1,91 @@ +--- +title: Deploy CLI Tool +description: Understand how the Auth0 Deploy CLI tool works. +topics: + - extensions + - deploy-cli +contentType: + - index +useCase: extensibility-extensions +--- +# Deploy CLI Tool + +Auth0 supports continuous integration and deployment (CI/CD) of Auth0 tenants through our [source control extensions](/extensions#deploy-hosted-pages-rules-and-database-connections-scripts-from-external-repositories) and integration into existing CI/CD pipelines using the Deploy CLI tool. + +The Deploy CLI tool (`auth0-deploy-cli`) supports two methods to import and export the following Auth0 tenant configuration objects: + +- Tenant settings +- Rules (including secrets/settings) +- Hooks +- Hook Secrets +- Connections +- Custom databases +- Clients/applications +- Resource servers (APIs) +- Pages +- Email templates and providers +- Guardian settings + +You can export the data to a predefined [directory structure](/extensions/deploy-cli/guides/import-export-directory-structure) or a [YAML configuration file](/extensions/deploy-cli/guides/import-export-yaml-file). You can call the tool [programmatically](/extensions/deploy-cli/guides/call-deploy-cli-programmatically). You can also use the tool to replace environment variables. + +::: warning +This tool can be destructive to your Auth0 tenant. Please ensure you have read the documentation and tested the tool on a development tenant before using it in production. +::: + +## Upgrade to latest version + +For version 5, the `auth0-deploy-cli` tool was updated to add support for Node.js v14 and drop support for Node.js versions earlier than v8. + +If you are upgrading `auth0-deploy-cli` from versions earlier than v4, please upgrade the **Auth0 Deploy CLI** extension by following the instructions for [Deploy CLI Tool v4](#deploy-cli-tool-v4) below. + +## Previous versions + +Features released in previous versions of the Deploy CLI Tool are listed below. For a complete list of changes, see the [changelog](https://github.com/auth0/auth0-deploy-cli/blob/master/CHANGELOG.md). + + +### Deploy CLI Tool v4 + +For version 4, the `auth0-deploy-cli` tool was updated to add support for Hooks and Hook Secrets. + +<%= include('./_includes/_upgrade-v4') %> + + +### Deploy CLI Tool v3 + +For version 3, the `auth0-deploy-cli` tool was updated to include the following changes. + +- Added options to the config: + - INCLUDED_PROPS: Enables export of properties that are excluded by default (e.g., client_secret) + - EXCLUDED_PROPS: Provides ability to exclude any unwanted properties from exported objects +- Removed `--strip` option from `export` command. IDs will now be stripped by default; to override, use `--export_ids` or `AUTH0_EXPORT_IDENTIFIERS: true`. + +### Deploy CLI Tool v2 + +For version 2, the `auth0-deploy-cli` tool was updated to include the following changes. + +- Added YAML support +- Added support for export (deprecation of separate auth0 dump tool) +- Delete support - The tool will, if configured via `AUTH0_ALLOW_DELETE`, delete objects if does not exist within the deploy configuration. +- Support for additional Auth0 objects + - Connections including Social, Enterprise and Passwordless configurations. + - Improved support for database connections and associated configuration. + - Email Templates + - Email Provider + - Client Grants + - Rule Configs (Import Only) + - Guardian config + - Better support for pages + - Tenant level settings +- Added support to be called programmatically +- Improved logging +- To simplify the tool the slack hook was removed. You can invoke the tool programmatically to support calling your own hooks +- Support referencing clients by their name vs client_id (automatic mapping during export/import) +- Simplified to support future Auth0 object types + +### Keep reading + +* [Install the Deploy CLI Tool](/extensions/deploy-cli/guides/install-deploy-cli) +* [Incorporate Deploy CLI into Build Environment](/extensions/deploy-cli/guides/incorporate-deploy-cli-into-build-environment) +* [Deploy CLI Tool Options](/extensions/deploy-cli/references/deploy-cli-options) +* [Environment Variables and Keyword Mappings](/extensions/deploy-cli/references/environment-variables-keyword-mappings) +* [Troubleshooting Deploy CLI Tool](/extensions/deploy-cli/references/troubleshooting) diff --git a/articles/extensions/deploy-cli/references/deploy-cli-options.md b/articles/extensions/deploy-cli/references/deploy-cli-options.md new file mode 100644 index 0000000000..0e11c2e000 --- /dev/null +++ b/articles/extensions/deploy-cli/references/deploy-cli-options.md @@ -0,0 +1,43 @@ +--- +title: Deploy CLI Options +description: Describes the Auth0 Deploy CLI tool options. +topics: + - extensions + - deploy-cli +contentType: + - index + - concept +useCase: extensibility-extensions +--- +# Deploy CLI Options + +The following options are supported by the Deploy CLI tool `a0deploy`. + +## Commands + +- `a0deploy import` Deploy Configuration +- `a0deploy export` Export Auth0 Tenant Configuration + +## Options +- `--help` Show help `[boolean]` +- `--version` Show version number `[boolean]` +- `--debug, -d` Dump extra debug information. `[string] [default: false]` +- `--proxy_url, -p` A url for proxying requests, only set this if you are behind a proxy. `[string]` + +## Examples + +``` + a0deploy export --config_file config.json --strip --format yaml --output_folder path/to/export Dump Auth0 config to folder in YAML format + a0deploy export --config_file config.json --strip --format directory --output_folder path/to/export Dump Auth0 config to folder in directory format + a0deploy import --config_file config.json --input_file tenant.yaml Deploy Auth0 via YAML + a0deploy import --config_file config.json --input_file path/to/files Deploy Auth0 via Path +``` + +## Keep reading + +* [Install the Deploy CLI Tool](/extensions/deploy-cli/guides/install-deploy-cli) +* [Incorporate Deploy CLI into Build Environment](/extensions/deploy-cli/guides/incorporate-deploy-cli-into-build-environment) +* [Import/Export Tenant Configuration to a Directory Structure](/extensions/deploy-cli/guides/import-export-directory-structure) +* [Import/Export Tenant Configuration to a YAML File](/extensions/deploy-cli/guides/import-export-yaml-file) +* [Call Deploy CLI Tool Programmatically](/extensions/deploy-cli/guides/call-deploy-cli-programmatically) +* [Troubleshooting Deploy CLI Tool](/extensions/deploy-cli/references/troubleshooting) diff --git a/articles/extensions/deploy-cli/references/environment-variables-keyword-mappings.md b/articles/extensions/deploy-cli/references/environment-variables-keyword-mappings.md new file mode 100644 index 0000000000..6aba3d3e09 --- /dev/null +++ b/articles/extensions/deploy-cli/references/environment-variables-keyword-mappings.md @@ -0,0 +1,70 @@ +--- +title: Environment Variables and Keyword Mappings +description: Describes environmental variables and keyword mappings for exporting tenant configurations. +topics: + - extensions + - deploy-cli +contentType: + - reference +useCase: extensibility-extensions +--- +# Environment Variables and Keyword Mappings + +The mappings allow you to do the following: + +* Use the same configuration file for all of your environments (e.g. dev, uat, staging, and prod). + +* Replace certain values in your configuration repo with environment-specific values. There are two ways to use the keyword mappings: You can either wrap the key in `@@key@@` or `##key##`. + + - If you use the `@` symbols, it will do a `JSON.stringify` on your value before replacing it. So if it is a string, it will add quotes. and if it is an array or object, it will add braces. + + - If you use the `#` symbol instead, it will just do a literal replacement; it will not add quotes or brackets. + +::: note +By default the tool also merges your current environment variables and overrides the **AUTH0_KEYWORD_REPLACE_MAPPINGS** which have the same top key. You can disable this via the command line with the `--no-env` option. +::: + +For example, you could specify a different JWT timeout in your dev environment, and then use prod for testing and a different environment URL. + +See the examples below. + +## `Client.json` + +```json +{ + ... + "callbacks": [ + "##ENVIRONMENT_URL##/auth/callback" + ], + "jwt_configuration": { + "lifetime_in_seconds": ##JWT_TIMEOUT##, + "secret_encoded": true + } + ... +} +``` + +## Dev `Config.json` + +```json +"AUTH0_KEYWORD_REPLACE_MAPPINGS": { + "ENVIRONMENT_URL": "http://dev.fabrikam.com", + "JWT_TIMEOUT": 120, + ... +} +``` + +## Prod `Config.json` + +```json +"AUTH0_KEYWORD_REPLACE_MAPPINGS": { + "ENVIRONMENT_URL": "http://fabrikam.com", + "JWT_TIMEOUT": 3600, + ... +} +``` + +## Keep reading + +* [Import/Export Tenant Configuration to a Directory Structure](/extensions/deploy-cli/guides/import-export-directory-structure) +* [Import/Export Tenant Configuration to a YAML file](/extensions/deploy-cli/guides/import-export-yaml-file) diff --git a/articles/extensions/deploy-cli/references/troubleshooting.md b/articles/extensions/deploy-cli/references/troubleshooting.md new file mode 100644 index 0000000000..935ad27372 --- /dev/null +++ b/articles/extensions/deploy-cli/references/troubleshooting.md @@ -0,0 +1,30 @@ +--- +title: Troubleshoot the Deploy CLI Tool +description: Describes troubleshooting information for the Auth0 Deploy Command Line Interface (CLI) tool. +topics: + - extensions + - deploy-cli +contentType: + - index + - concept +useCase: extensibility-extensions +--- +# Troubleshoot the Deploy CLI tool + +## Warning log entries after a Google Apps connection is recreated + +**Symptoms**: you see warnings in the logs with messages like `Unable to get extended attributes: unauthorized` or `Unable to get groups: unauthorized`. + +When you first create a Google Apps connection and enable one of the checkboxes to get extended information about the user, you'll need to go through a consent flow by having a Google Apps administrator follow the link under the "Setup instructions" button next to the connection. After completing this flow, some token information is stored on the connection's `options` object that is used to retrieve extended information when a user logs in. + +If you have a Google Apps connection, you'll need to ensure that the consent flow is completed before exporting the connection information using the CLI. By doing this, the necessary tokens will be included in the exported script and the administrator won't have to go through the consent flow every time the connection is recreated. + +::: warning +The tokens stored in the connection's `options` object is sensitive information that should be treated securely as any other system credential. +::: + +## Keep reading + +* [Deploy CLI Tool Overview](/extensions/deploy-cli) +* [Import/Export Tenant Configuration to a Directory Structure](/extensions/deploy-cli/guides/import-export-directory-structure) +* [Import/Export Tenant Configuration to a YAML File](/extensions/deploy-cli/guides/import-export-yaml-file) diff --git a/articles/extensions/deploy-cli/references/whats-new.md b/articles/extensions/deploy-cli/references/whats-new.md new file mode 100644 index 0000000000..d6126e729d --- /dev/null +++ b/articles/extensions/deploy-cli/references/whats-new.md @@ -0,0 +1,72 @@ +--- +title: What's New in Deploy CLI Tool +description: Learn about features released in new versions of the Auth0 Deploy Command Line Interface (CLI) tool. +public: false +topics: + - extensions + - deploy-cli +contentType: + - index + - concept +useCase: extensibility-extensions +--- +# What's New in Deploy CLI Tool + +Features released in each version of the Deploy CLI Tool are listed below. For a complete list of changes, see the [changelog](https://github.com/auth0/auth0-deploy-cli/blob/master/CHANGELOG.md). + +## Deploy CLI Tool v5 + +For version 5, the `auth0-deploy-cli` tool was updated to include the following changes. + +- Updated dependencies and deprecated support for Node.js versions earlier than 8 + +- Allowed excluding default values for emailProvider with `AUTH0_EXCLUDED_DEFAULTS` + +- For pages, fixed error when dumping error_page without html property + +## Deploy CLI Tool v4 + +For version 4, the `auth0-deploy-cli` tool was updated to include the following changes. + +- Added support for Hooks and Hook Secrets + +<%= include('../_includes/_upgrade-v4') %> + +## Deploy CLI Tool v3 + +For version 3, the `auth0-deploy-cli` tool was updated to include the following changes. + +- Added options to the config: + - INCLUDED_PROPS: Enables export of properties that are excluded by default (e.g., client_secret) + - EXCLUDED_PROPS: Provides ability to exclude any unwanted properties from exported objects +- Removed `--strip` option from `export` command. IDs will now be stripped by default; to override, use `--export_ids` or `AUTH0_EXPORT_IDENTIFIERS: true`. + +## Deploy CLI Tool v2 + +For version 2, the `auth0-deploy-cli` tool was updated to include the following changes. + +- Added YAML support +- Added support for export (deprecation of separate auth0 dump tool) +- Delete support - The tool will, if configured via `AUTH0_ALLOW_DELETE`, delete objects if does not exist within the deploy configuration. +- Support for additional Auth0 objects + - Connections including Social, Enterprise and Passwordless configurations. + - Improved support for database connections and associated configuration. + - Email Templates + - Email Provider + - Client Grants + - Rule Configs (Import Only) + - Guardian config + - Better support for pages + - Tenant level settings +- Added support to be called programmatically +- Improved logging +- To simplify the tool the slack hook was removed. You can invoke the tool programmatically to support calling your own hooks +- Support referencing clients by their name vs client_id (automatic mapping during export/import) +- Simplified to support future Auth0 object types + +## Keep reading + +* [Deploy CLI Tool Overview](/extensions/deploy-cli) +* [Import/Export Tenant Configuration to a Directory Structure](/extensions/deploy-cli/guides/import-export-directory-structure) +* [Import/Export Tenant Configuration to a YAML File](/extensions/deploy-cli/guides/import-export-yaml-file) +* [Troubleshooting Deploy CLI Tool](/extensions/deploy-cli/references/troubleshooting) diff --git a/articles/extensions/github-deploy.md b/articles/extensions/github-deploy.md index 4ec8797d06..b12669f988 100644 --- a/articles/extensions/github-deploy.md +++ b/articles/extensions/github-deploy.md @@ -1,11 +1,21 @@ --- toc: true description: The GitHub Deployments extension allows you to deploy rules and database connection scripts from GitHub to Auth0. +topics: + - extensions + - github-deployments +contentType: + - how-to +useCase: extensibility-extensions --- -# Github Deployments +# GitHub Deployments -The **GitHub Deployments** extension allows you to deploy [rules](/rules) and database connection scripts from GitHub to Auth0. You can configure a GitHub repository, keep all your rules and database connection scripts there, and have them automatically deployed to Auth0 each time you push to your repository. +The **GitHub Deployments** extension allows you to deploy [rules](/rules), rules configs, connections, database connection scripts, clients, client grants, resource servers, hosted pages and email templates from GitHub to Auth0. You can configure a GitHub repository, keep all your rules and database connection scripts there, and have them automatically deployed to Auth0 each time you push to your repository. + +::: note +You can use the `auth0-deploy-cli` tool to export and import tenant configuration data to a directory structure or a YAML file. For more information, see [Deploy CLI Tool Overview](/extensions/deploy-cli). +::: ## Configure the extension @@ -15,13 +25,18 @@ To install and configure this extension, click on the __GitHub Deployments__ box Set the following configuration variables: -- **GITHUB_REPOSITORY**: The repository from which you want to deploy rules and database scripts. This can be either a public or private repository. -- **GITHUB_BRANCH**: The branch that the extension will monitor for commits. -- **GITHUB_TOKEN**: Your GitHub personal Access Token. Follow the instructions at [Creating an Access Token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/#creating-a-token) to create a token with `repo` scope. -- **GITHUB_HOST**: The public accessible GitHub Enterprise _(version 2.11.3 and later)_ host name, no value is required when using github.com (optional). -- **GITHUB_API_PATH**: GitHub Enterprise API path prefix, no value is required when using github.com (optional). -- **SLACK_INCOMING_WEBHOOK_URL**: The Webhook URL for Slack, used in order to receive Slack notifications for successful and failed deployments (optional). +* **REPOSITORY**: The repository from which you want to deploy rules and database scripts. This can be either a public or private repository. +* **BRANCH**: The branch that the extension will monitor for commits. +* **HOST**: The public accessible GitHub Enterprise _(version 2.11.3 and later)_ hostname, no value is required when using github.com (optional). +* **API_PATH**: GitHub Enterprise API path prefix, no value is required when using github.com (optional). +* **TOKEN**: Your GitHub Personal Access Token. Follow the instructions at [Creating an Access Token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/#creating-a-token) to create a token with `repo` scope. +* **BASE_DIR**: The base directory, where all your tenant settings are stored +* **AUTO_REDEPLOY**: If enabled, the extension redeploys the last successful configuration in the event of a deployment failure. Manual deployments and validation errors does not trigger auto-redeployment +* **SLACK_INCOMING_WEBHOOK_URL**: The Webhook URL for Slack, used to receive Slack notifications for successful and failed deployments (optional). +::: note +Some of the configuration variables were changed in version **2.6.0** of this extension. If you are updating the extension from a prior version, make sure that you update your configuration accordingly. +::: Once you have provided this information, click **Install**. @@ -47,19 +62,28 @@ You can find details on how to configure a webhook at [Creating Webhooks](https: ## Deployment -Once you have setup the webhook in GitHub using the provided information, you are ready to start committing to your repository. +Once you have set up the webhook in GitHub using the provided information, you are ready to start committing to your repository. -With each commit you push to your configured GitHub repository, if changes were made in the `rules` or `database-connection` folders, the webhook will call the extension to initiate a deployment. +With each commit you push to your configured GitHub repository, the webhook will call the extension to initiate a deployment if changes were made to one of these folders: +- `clients` +- `grants` +- `emails` +- `resource-servers` +- `connections` +- `database-connections` +- `rules-configs` +- `rules` +- `pages` -The __Deploy__ button on the **Deployments** tab of the extension allows you to manually deploy the rules and database connection scripts you already have in your GitHub repository. This is useful if you already have a repository filled with scripts that you want to deploy once you have setup the extension, or if you have accidentally deleted some scripts in Auth0 and need to redeploy the latest version of your repository. +The __Deploy__ button on the **Deployments** tab of the extension allows you to manually deploy the rules and database connection scripts you already have in your GitHub repository. This is useful if you already have a repository filled with scripts that you want to deploy once you have set up the extension, or if you have accidentally deleted some scripts in Auth0 and need to redeploy the latest version of your repository. ::: panel-warning Deleting Rules and Scripts from GitHub To maintain a consistent state, the extension will always do a full redeployment of the contents of these folders. Any rules or database connection scripts that exist in Auth0 but not in your GitHub repository will be __deleted__. ::: -### Deploy database connection scripts +### Deploy Database Connection scripts -In order to deploy database connection scripts, you must first create a directory under `database-connections`. The name of the directory must __exactly__ match the name of your [database connection](${manage_url}/#/connections/database) in Auth0. Of course, you can create as many directories as you have database connections. +To deploy database connection scripts, you must first create a directory under `database-connections`. The name of the directory must __exactly__ match the name of your [database connection](${manage_url}/#/connections/database) in Auth0. Of course, you can create as many directories as you have database connections. Under the created directory, create one file for every script you want to use. The allowed scripts are: @@ -76,22 +100,55 @@ If you enabled the migration feature, you will also need to provide the `get_use You can find an example in [this GitHub repository](https://github.com/auth0-samples/github-source-control-integration/tree/master/database-connections/my-custom-db). -### Deploy Hosted Pages +#### Deploy Database Connection settings + +To deploy Database Connection settings, you must create `database-connections/[connection-name]/database.json`. + +_This will work only for Auth0 connections (`strategy === auth0`); for non-Auth0 connections use `connections`._ + +_Support for using `settings.json` has been deprecated in favor of `database.json` since v3.1.1 of the extension and may be dropped in a future release._ + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Connections/patch_connections_by_id) for more info on allowed attributes for Connections. + +### Deploy Connections + +To deploy a connection, you must create a JSON file under the `connections` directory of your GitHub repository. Example: + +__facebook.json__ +```json +{ + "name": "facebook", + "strategy": "facebook", + "enabled_clients": [ + "my-client" + ], + "options": {} +} +``` + +<%= include('./_includes/_embedded-clients-array') %> + +_This will work only for non-Auth0 connections (`strategy !== auth0`); for Auth0 connections, use `database-connections`._ + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Connections/post_connections) for more info on allowed attributes for Connections. + +### Deploy Universal Login Pages + +The supported pages are: -The supported hosted pages are: - `error_page` - `guardian_multifactor` - `login` - `password_reset` -To deploy a page, you must create an HTML file under the `pages` directory of your GitHub repository. For each HTML page you need to create a JSON file (with the same name) that will be used to mark the page as enabled or disabled. For example, in order to deploy an `error_page`, you would create two files: +To deploy a page, you must create an HTML file under the `pages` directory of your GitHub repository. For each HTML page, you need to create a JSON file (with the same name) that will be used to mark the page as enabled or disabled. For example, to deploy a `password_reset`, you would create two files: ```text -your-github-repo/pages/error_page.html -your-github-repo/pages/error_page.json +your-github-repo/pages/password_reset.html +your-github-repo/pages/password_reset.json ``` -To enable the page the `error_page.json` would contain the following: +To enable the page, the `password_reset.json` would contain the following: ```json { @@ -99,9 +156,11 @@ To enable the page the `error_page.json` would contain the following: } ``` +<%= include('./_includes/_use-default-error') %> + ### Deploy rules -In order to deploy a rule, you must first create a JavaScript file under the `rules` directory of your GitHub repository. Each rule must be in its own `.js` file. +To deploy a rule, you must first create a JavaScript file under the `rules` directory of your GitHub repository. Each rule must be in its own JavaScript file. For example, if you create the file `rules/set-country.js`, then the extension will create a rule in Auth0 with the name `set-country`. @@ -109,10 +168,6 @@ For example, if you create the file `rules/set-country.js`, then the extension w If you plan to use Source Control integration for an existing account, first rename your rules in Auth0 to the same name of the files you will be deploying to this directory. ::: -You can mark rules as manual. In that case, the source control extension will not delete or update them. To mark a rule, navigate to the **Rules Configuration** tab of the GitHub Integration page. Toggle the **Manual Rule** switch for the rules you want to mark as manual. Click **Update Manual Rules** to save your changes. - -![Manual Rules](/media/articles/extensions/github-deploy/manual-rules.png) - You can control the rule order and status (`enabled`/`disabled`) by creating a JSON file with the same name as your JavaScript file. For this example, you would create a file named `rules/set-country.json`. __set-country.js__ @@ -126,7 +181,7 @@ function (user, context, callback) { ``` __set-country.json__ -```javascript +```json { "enabled": false, "order": 15, @@ -140,6 +195,157 @@ You can find examples in [this GitHub repository](https://github.com/auth0-sampl Multiple rules of the same order are not allowed. To avoid conflicts, you can create a JSON file for each rule and assign a value for `order`. If you leave enough space between these values, re-ordering them without conflicts will be easier. For example, if you have three rules, instead of setting their order to `1`, `2`, `3`, you can set them to `10`, `20`, `30`. This way, to move the `30` rule before the `20`, you can simply change its `order` to any value between `11` and `19`. +### Deploy Rules Configs + +To deploy a rule config, you must create a JSON file under the `rules-configs` directory of your GitHub repository. Example: + +__secret_number.json__ +```json +{ + "key": "secret_number", + "value": "42" +} +``` + +### Deploy Clients + +To deploy a client, you must create a JSON file under the `clients` directory of your GitHub repository. Example: + +__my-client.json__ +```json +{ + "name": "my-client" +} +``` + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Clients/post_clients) for more info on allowed attributes for Clients and Client Grants. + +### Deploy Clients Grants + +You can specify the client grants for each client by creating a JSON file in the `grants` directory. + +__my-client-api.json__ +```json +{ + "client_id": "my-client", + "audience": "https://myapp.com/api/v1", + "scope": [ + "read:users" + ] +} +``` + +<%= include('./_includes/_deployment-extension') %> + +### Deploy Resource Servers + +To deploy a resource server, you must create a JSON file under the `resource-servers` directory of your GitHub repository. Example: + +__my-api.json__ +```json +{ + "name": "my-api", + "identifier": "https://myapp.com/api/v1", + "scopes": [ + { + "value": "read:users", + "description": "Allows getting user information" + } + ] +} +``` + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Resource_Servers/post_resource_servers) for more info on allowed attributes for Resource Servers. + +### Deploy Email Provider + +To deploy an email provider, you must create `provider.json` file under the `emails` directory of your GitHub repository. Example: + +__provider.json__ +```json +{ + "name": "smtp", + "enabled": true, + "credentials": { + "smtp_host": "smtp.server.com", + "smtp_port": 25, + "smtp_user": "smtp_user", + "smtp_pass": "smtp_secret_password" + } +} +``` + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Emails/patch_provider) for more info on allowed attributes for Email Provider. + +### Deploy Email Templates + +The supported email templates are: +- `verify_email` +- `reset_email` +- `welcome_email` +- `blocked_account` +- `stolen_credentials` +- `enrollment_email` +- `mfa_oob_code` + +To deploy an email template, you must create an HTML file under the `emails` directory of your GitHub repository. For each HTML file, you need to create a JSON file (with the same name) with additional options for that template. For example, to deploy a `blocked_account` template, you would create two files: + +```text +your-github-repo/emails/blocked_account.html +your-github-repo/emails/blocked_account.json +``` + +__blocked_account.json__ +```json +{ + "template": "blocked_account", + "from": "", + "subject": "", + "resultUrl": "", + "syntax": "liquid", + "body": "./blocked_account.html", + "urlLifetimeInSeconds": 432000, + "enabled": true +} +``` + +## Excluded records + +You can exclude the following records from the deployment process: `rules`, `clients`, `databases`, `connections` and `resourceServers`. If excluded, the records will not be modified by deployments. + +![](/media/articles/extensions/deploy-extensions/excluded-rules.png) + +## Keywords Mapping + +Beginning with version **3.0.0**, you can use keywords mapping to manage your secrets and tenant-based environment variables. + +There are two ways to use the keyword mappings. You can either wrap the key using `@` symbols (e.g., `@@key@@`), or you can wrap the key using `#` symbols (e.g., `##key##`). + + - If you use `@` symbols, your value will be converted from a JavaScript object or value to a JSON string. + + - If you use `#` symbols, Auth0 will perform a literal replacement. + +This is useful for something like specifying different variables across your environments. For example, you could specify different JWT timeouts for your Development, QA/Testing, and Production environments. + +Refer to the snippets below for sample implementations: + +__Client.json__ +```json +{ + ... + "callbacks": [ + "##ENVIRONMENT_URL##/auth/callback" + ], + "jwt_configuration": { + "lifetime_in_seconds": ##JWT_TIMEOUT##, + "secret_encoded": true + } + ... +} +``` + +![](/media/articles/extensions/deploy-extensions/mappings.png) + ## Track deployments To track your deployments, navigate to the [extensions](${manage_url}/#/extensions) page, click on the row for the __GitHub Deployments__ extension, and select the __Deployments__ tab. You will see a list of all deployments, both successful and failed. diff --git a/articles/extensions/gitlab-deploy.md b/articles/extensions/gitlab-deploy.md index 30512c819d..48909fdc18 100644 --- a/articles/extensions/gitlab-deploy.md +++ b/articles/extensions/gitlab-deploy.md @@ -1,63 +1,79 @@ --- toc: true description: The GitLab Deployments extension allows you to deploy Rules, Hosted Pages and Database Connection scripts from GitLab to Auth0. +topics: + - extensions + - gitlab-deployments +contentType: + - how-to +useCase: extensibility-extensions --- # GitLab Deployments -The **GitLab Deployments** extension allows you to deploy [Rules](/rules), Database Connection scripts and hosted pages from GitLab to Auth0. You can configure a GitLab repository, keep all of your scripts there, and have them automatically deployed to Auth0 whenever you push changes to your repository. +The **GitLab Deployments** extension allows you to deploy [rules](/rules), rules configs, connections, database connection scripts, clients, client grants, resource servers, hosted pages and email templates from GitLab to Auth0. You can configure a GitLab repository, keep all of your scripts there, and have them automatically deployed to Auth0 whenever you push changes to your repository. -## Configure the Auth0 Extension +## Configure the Auth0 extension -To install and configure this extension, click on the **GitLab Deployments** box in the list of provided extensions on the [Extensions](${manage_url}/#/extensions) page of the Auth0 Management Dashboard. The **Install Extension** window will open. +1. To install and configure this extension, click on the **GitLab Deployments** box in the list of provided extensions on the [Extensions](${manage_url}/#/extensions) page of the Auth0 Management Dashboard. The **Install Extension** window will open. ![Install extension popup window](/media/articles/extensions/gitlab-deploy/install-extension.png) -Set the following configuration variables: +2. Set the following configuration variables: -* **GITLAB_REPOSITORY**: The name of your GitLab repository. -* **GITLAB_BRANCH**: The branch of your GitLab repository your extension should monitor. -* **GITLAB_URL**: The url of your GitLab instance, in case of gitlab.com use `https://gitlab.com` -* **GITLAB_TOKEN**: The personal Access Token to your GitLab repository for this account. For details on how to configure one refer to [Configure a GitLab Token](configure-a-gitlab-token). +* **REPOSITORY**: The name of your GitLab repository. +* **BRANCH**: The branch of your GitLab repository your extension should monitor. +* **URL**: The URL of your GitLab instance, in case of gitlab.com use `https://gitlab.com` +* **TOKEN**: The personal Access Token to your GitLab repository for this account. To learn how to configure one, see [Configure a GitLab Token](#configure-a-gitlab-token). +* **BASE_DIR**: The base directory, where all your tenant settings are stored. If you want to keep your tenant settings under `org/repo/tenant/production`, `org/repo` goes to the `REPOSITORY` and `tenant/production` - to `BASE_DIR` +* **AUTO_REDEPLOY**: If enabled, the extension redeploys the last successful configuration in the event of a deployment failure. Manual deployments and validation errors does not trigger auto-redeployment * **SLACK_INCOMING_WEBHOOK**: The URL used to integrate with Slack to deliver notifications. -Once you have provided this information, click **Install**. +::: note +Some of the configuration variables were changed in version **2.7.0** of this extension. If you are updating the extension from a prior version, make sure that you update your configuration accordingly. +::: -### Configure a GitLab Token +3. Once you have provided this information, click **Install**. -Log in to your [GitLab](https://about.gitlab.com/) account and navigate to [Profile Settings > Access Tokens](https://gitlab.com/profile/personal_access_tokens). +### Configure a GitLab token -Create a new Access Token for Auth0. Make sure you copy the generated value and save it locally because you will not be able to access it again once you navigate away from this page. +1. Log in to your [GitLab](https://about.gitlab.com/) account and navigate to [Profile Settings > Access Tokens](https://gitlab.com/profile/personal_access_tokens). + +2. Create a new Access Token for Auth0. Make sure you copy the generated value and save it locally because you will not be able to access it again once you navigate away from this page. + +::: panel-warning API access +Make sure that you create the token with the `api` permission in Gitlab settings (this grants complete read/write access to the API). If your Gitlab token does not contain the necessary permissions, you may receive a "rejecting request of a tenant under quarantine" message because there was some uncaught error in the extension causing the Webtask context to be quarantined. +::: ![Generate a personal Access Token](/media/articles/extensions/gitlab-deploy/new-access-token.png) -Go back to the [Extensions](${manage_url}/#/extensions) page and set this value at the **Gitlab_Token** configuration variable. +3. Go back to the [Extensions](${manage_url}/#/extensions) page and set this value at the **Gitlab_Token** configuration variable. -## Authorize Access +## Authorize access -Navigate to the [Extensions](${manage_url}/#/extensions) page and click on the **Installed Extensions** tab. +1. Navigate to the [Extensions](${manage_url}/#/extensions) page and click on the **Installed Extensions** tab. ![](/media/articles/extensions/gitlab-deploy/installed-extensions-view.png) -Click on the row for the **GitLab Deployments** extension. The first time you click on your installed extension, you will be asked to grant it to access your GitLab account. +2. Click on the row for the **GitLab Deployments** extension. The first time you click on your installed extension, you will be asked to grant it to access your GitLab account. ![](/media/articles/extensions/gitlab-deploy/user-consent.png) -Once you agree, you will be directed to the **GitLab Integration** page. +3. Once you agree, you will be directed to the **GitLab Integration** page. ![](/media/articles/extensions/gitlab-deploy/gitlab-integration-page.png) -Copy the **Payload URL** and **Secret** values. You will use them in order to configure the GitLab Webhook in the next step. +4. Copy the **Payload URL** and **Secret** values. You will use them to configure the GitLab Webhook in the next step. ## Configure the GitLab Webhook Once you have configured your Auth0 Extension, you will need to configure the GitLab Webhook to complete the integration. -In your GitLab Repository, click on the gear icon near the top right of the page to open the menu. Click on **Webhooks**. +1. In your GitLab repository, click on the gear (Settings) icon. In the menu that appears, click on **Integrations**. This brings up the Webhook configuration area. ![](/media/articles/extensions/gitlab-deploy/gitlab-settings-menu.png) -Set the following configuration variables: +2. Set the following configuration variables: * **URL**: Set the value of the **Payload URL** from the previous step. * **Secret Token**: Set the value of the **Secret** from the previous step. @@ -66,30 +82,36 @@ Set the following configuration variables: ![](/media/articles/extensions/gitlab-deploy/gitlab-add-webhook.png) -Click **Add Webhook** to save your changes. +3. Scroll down, and click **Add Webhook** to save your changes. ## Deployment Once you have set up the webhook in GitLab using the provided information, you are ready to start committing to your repository. -Your repository should have a predefined structure: -- Rules are expected to be found under `rules` directory. -- Database connections are expected to be found under `database-connections` directory. -- Hosted pages are expected to be found under `pages` directory. - -With each commit you push to your configured GitLab repository, the webhook will call the extension to initiate a deployment if changes were made to these predefined directories. +With each commit you push to your configured GitLab repository, the webhook will call the extension to initiate a deployment if changes were made to one of these folders: +- `clients` +- `grants` +- `emails` +- `resource-servers` +- `connections` +- `database-connections` +- `rules-configs` +- `rules` +- `pages` -The **Deploy** button on the **Deployments** tab of the extension allows you to manually deploy the Rules, Pages and Database Connection scripts that you already have in your GitLab repository. This is useful if your repository already contains items that you want to deploy once you have set up the extension or if you have accidentally deleted some scripts in Auth0 and need to redeploy the latest version of your repository. +The **Deploy** button on the **Deployments** tab of the extension allows you to manually deploy the Rules, Pages, and Database Connection scripts that you already have in your GitLab repository. This is useful if your repository already contains items that you want to deploy once you have set up the extension or if you have accidentally deleted some scripts in Auth0 and need to redeploy the latest version of your repository. ::: panel-warning Full Deployment -To maintain a consistent state, the extension will always do a full deployment of the contents of these folders. **Any rules, pages or database connection scripts that exist in Auth0 but not in your GitHub repository will be deleted**. +To maintain a consistent state, the extension will always do a full deployment of the contents of these folders. **Any rules, pages, or database connection scripts that exist in Auth0 but not in your GitHub repository will be deleted**. + +To delete existing settings when AUTH0_ALLOW_DELETE is set to yes, corresponding folders must be present and contain configuration files; settings will not be deleted for missing folders or empty folders. We recommend setting up all configurations, since we are unable to provide data restores at this time. ::: -### Deploy Database Connection Scripts +### Deploy Database Connection scripts -To deploy Database Connection scripts, you must first create a directory under `database-connections`. The name of the directory must match **exactly** the name of your [database connection](${manage_url}/#/connections/database) in Auth0. You can create as many directories as you have Database Connections. +1. To deploy Database Connection scripts, you must first create a directory under `database-connections`. The name of the directory must match **exactly** the name of your [database connection](${manage_url}/#/connections/database) in Auth0. You can create as many directories as you have Database Connections. -Under the created directory, create one file for each script you want to use. The allowed scripts are: +2. Under the created directory, create one file for each script you want to use. The allowed scripts are: - `get_user.js` - `create.js` @@ -102,7 +124,41 @@ For a generic Custom Database Connection, only the `login.js` script is required You can find examples in [the Auth0 Samples repository](https://github.com/auth0-samples/github-source-control-integration/tree/master/database-connections/my-custom-db). While the samples were authored for GitHub, it will work for a GitLab integration as well. -### Deploy Hosted Pages +### Deploy Database Connection settings + +To deploy Database Connection settings, you must create `database-connections/[connection-name]/database.json`. + +_This will work only for Auth0 connections (`strategy === auth0`), for non-Auth0 connections use `connections`._ + +_Support for using `settings.json` has been deprecated in favor of `database.json` since v3.1.1 of the extension and may be dropped in a future release._ + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Connections/patch_connections_by_id) for more info on allowed attributes for Connections. + + + +### Deploy Connections + +To deploy a connection, you must create a JSON file under the `connections` directory of your GitLab repository. Example: + +__facebook.json__ +```json +{ + "name": "facebook", + "strategy": "facebook", + "enabled_clients": [ + "my-client" + ], + "options": {} +} +``` + +<%= include('./_includes/_embedded-clients-array') %> + +_This will work only for non-Auth0 connections (`strategy !== auth0`); for Auth0 connections, use `database-connections`._ + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Connections/post_connections) for more info on allowed attributes for Connections. + +### Deploy hosted pages The supported hosted pages are: - `error_page` @@ -110,14 +166,14 @@ The supported hosted pages are: - `login` - `password_reset` -To deploy a page, you must create an HTML file under the `pages` directory of your GitLab repository. For each HTML page you need to create a JSON file (with the same name) that will be used to mark the page as enabled or disabled. For example, in order to deploy an `error_page`, you would create two files: +To deploy a page, you must create an HTML file under the `pages` directory of your GitLab repository. For each HTML page, you need to create a JSON file (with the same name) that will be used to mark the page as enabled or disabled. For example, to deploy a `password_reset`, you would create two files: ```text -your-gitlab-repo/pages/error_page.html -your-gitlab-repo/pages/error_page.json +your-bitbucket-repo/pages/password_reset.html +your-bitbucket-repo/pages/password_reset.json ``` -To enable the page the `error_page.json` would contain the following: +To enable the page, the `password_reset.json` would contain the following: ```json { @@ -125,9 +181,11 @@ To enable the page the `error_page.json` would contain the following: } ``` -### Deploy Rules +<%= include('./_includes/_use-default-error') %> + +### Deploy rules -To deploy a rule, you must first create a JavaScript file under the `rules` directory of your GitLab repository. Each Rule must be in its own `.js` file. +To deploy a rule, you must first create a JavaScript file under the `rules` directory of your GitLab repository. Each Rule must be in its own JavaScript file. For example, if you create the file `rules/set-country.js`, the extension will create a Rule in Auth0 with the name `set-country`. @@ -135,10 +193,6 @@ For example, if you create the file `rules/set-country.js`, the extension will c If you plan to use source control integration for an existing account, first rename your Rules in Auth0 to match the name of the files you will be deploying to this directory. ::: -You can mark rules as manual. In that case, the source control extension will not delete or update them. To mark a rule navigate to the *Rules Configuration* tab of the **GitLab Integration** page. Toggle the **Manual Rule** switch for the rules you want to mark as manual. Click **Update Manual Rules** to save your changes. - -![Mark rules as manual](/media/articles/extensions/gitlab-deploy/manual-rule.png) - You can also control the Rule order and status (`enabled`/`disabled`) by creating a JSON file with the same name as your JavaScript file. For this example, you would create a file named `rules/set-country.json`. __set-country.js__ @@ -152,7 +206,7 @@ function (user, context, callback) { ``` __set-country.json__ -```javascript +```json { "enabled": false, "order": 15, @@ -162,19 +216,172 @@ __set-country.json__ You can find a `login_success` example in [the Auth0 Samples repository](https://github.com/auth0-samples/github-source-control-integration/tree/master/rules). While the sample was authored for GitHub, it will work for a GitLab integration as well. -#### Set Rule Order +#### Set rule order -To avoid conflicts, you are cannot set multiple Rules of the same order. However, you can create a JSON file for each rule, and within each file, assign a value for `order`. We suggest using number values that allow for reordering with less risk for conflict. For example, assign a value of `10` to the first Rule and `20` to the second Rule, rather than using values of `1` and `2`, respectively). +To avoid conflicts, you cannot set multiple Rules of the same order. However, you can create a JSON file for each rule, and within each file, assign a value for `order`. We suggest using number values that allow for reordering with less risk of conflict. For example, assign a value of `10` to the first Rule and `20` to the second Rule, rather than using values of `1` and `2`, respectively). -#### Set the Stage +#### Set the stage -After you deploy a Rule, you cannot change its stage, or the area where the Rule executes. +After you deploy a Rule, you cannot change its stage or the area where the Rule executes. If you need the rule to execute in a different stage, you must create a new Rule with the updated stage and delete the original Rule. -Please note that you may have only a single Rule for the `user_registration` and `login_failure` stages. +::: note +You may have only a single Rule for the `user_registration` and `login_failure` stages. +::: + +### Deploy Rules Configs + +To deploy a rule config, you must create a JSON file under the `rules-configs` directory of your GitLab repository. Example: + +__secret_number.json__ +```json +{ + "key": "secret_number", + "value": 42 +} +``` + +### Deploy Clients + +To deploy a client, you must create a JSON file under the `clients` directory of your GitLab repository. Example: + +__my-client.json__ +```json +{ + "name": "my-client" +} +``` + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Clients/post_clients) for more info on allowed attributes for Clients and Client Grants. + +### Deploy Clients Grants + +You can specify the client grants for each client by creating a JSON file in the `grants` directory. + +__my-client-api.json__ +```json +{ + "client_id": "my-client", + "audience": "https://myapp.com/api/v1", + "scope": [ + "read:users" + ] +} +``` + +<%= include('./_includes/_deployment-extension') %> + +### Deploy Resource Servers + +To deploy a resource server, you must create a JSON file under the `resource-servers` directory of your GitLab repository. Example: + +__my-api.json__ +```json +{ + "name": "my-api", + "identifier": "https://myapp.com/api/v1", + "scopes": [ + { + "value": "read:users", + "description": "Allows getting user information" + } + ] +} +``` + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Resource_Servers/post_resource_servers) for more info on allowed attributes for Resource Servers. + +### Deploy Email Provider + +To deploy an email provider, you must create `provider.json` file under the `emails` directory of your GitLab repository. Example: + +__provider.json__ +```json +{ + "name": "smtp", + "enabled": true, + "credentials": { + "smtp_host": "smtp.server.com", + "smtp_port": 25, + "smtp_user": "smtp_user", + "smtp_pass": "smtp_secret_password" + } +} +``` + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Emails/patch_provider) for more info on allowed attributes for Email Provider. + +### Deploy Email Templates + +The supported email templates are: +- `verify_email` +- `reset_email` +- `welcome_email` +- `blocked_account` +- `stolen_credentials` +- `enrollment_email` +- `mfa_oob_code` + +To deploy an email template, you must create an HTML file under the `emails` directory of your GitLab repository. For each HTML file, you need to create a JSON file (with the same name) with additional options for that template. For example, to deploy a `blocked_account` template, you would create two files: + +```text +your-gitlab-repo/emails/blocked_account.html +your-gitlab-repo/emails/blocked_account.json +``` + +__blocked_account.json__ +```json +{ + "template": "blocked_account", + "from": "", + "subject": "", + "resultUrl": "", + "syntax": "liquid", + "body": "./blocked_account.html", + "urlLifetimeInSeconds": 432000, + "enabled": true +} +``` + +## Excluded records + +You can exclude the following records from the deployment process: `rules`, `clients`, `databases`, `connections` and `resourceServers`. If excluded, the records will not be modified by deployments. + +![](/media/articles/extensions/deploy-extensions/excluded-rules.png) + +## Keywords Mapping + +Beginning with version **3.0.0**, you can use keywords mapping to manage your secrets and tenant-based environment variables. + +There are two ways to use the keyword mappings. You can either wrap the key using `@` symbols (e.g., `@@key@@`), or you can wrap the key using `#` symbols (e.g., `##key##`). + + - If you use `@` symbols, your value will be converted from a JavaScript object or value to a JSON string. + + - If you use `#` symbols, Auth0 will perform a literal replacement. + +This is useful for something like specifying different variables across your environments. For example, you could specify different JWT timeouts for your Development, QA/Testing, and Production environments. + +Refer to the snippets below for sample implementations: + +__Client.json__ +```json +{ + ... + "callbacks": [ + "##ENVIRONMENT_URL##/auth/callback" + ], + "jwt_configuration": { + "lifetime_in_seconds": ##JWT_TIMEOUT##, + "secret_encoded": true + } + ... +} +``` + +![](/media/articles/extensions/deploy-extensions/mappings.png) -## Track Deployments +## Track deployments To track your deployments, navigate to the [Extensions](${manage_url}/#/extensions) page, click on the row for the **GitLab Deployments** extension, and select the **Deployments** tab. You will see a list of all deployments. diff --git a/articles/extensions/index.md b/articles/extensions/index.md index 1fe3f26f3d..fdfa06a1bd 100644 --- a/articles/extensions/index.md +++ b/articles/extensions/index.md @@ -1,62 +1,79 @@ --- description: Extensions enable you to install applications or run commands/scripts that extend the functionality of Auth0. toc: true +topics: + - extensions +contentType: + - index +useCase: extensibility-extensions --- # Auth0 Extensions -Auth0 Extensions enable you to install applications (such as [Webtasks](https://webtask.io/)) or run commands/scripts that extend the functionality of the Auth0 base product. +Auth0 Extensions enable you to install applications or run commands/scripts that extend the functionality of the Auth0 base product. Each extension is separate from all other extensions. Auth0 defines extensions per tenant, so data is stored by the pair `tenant\extension`. -## Using an Extension +## Pre-defined extensions -Auth0 provides the following pre-defined extensions, and they are available for installation via the [Dashboard](${manage_url}). To use one or more of the following apps, you must provide the required configuration information and finish installing the extensions. +Auth0 provides a selection of pre-defined extensions, which you can install via the [Dashboard](${manage_url}/extensions). -![Auth0 Extensions](/media/articles/extensions/auth0-provided-extensions.png) +### Authorization -## What types of actions can I do with extensions? +- [Auth0 Authorization Extension](/extensions/authorization-extension): Manage authorizations for users with groups, roles, and permissions. We recommend that you use our [Authorization Core](/authorization/guides/how-to) feature set instead, which is being expanded to match the functionality of the Authorization Extension and improves performance and scalability. For a comparison, see [Authorization Core vs. Authorization Extension](/authorization/concepts/core-vs-extension). -### Manage the authorizations for Users using Groups, Roles and Permissions -- [Auth0 Authorization Extension](/extensions/authorization-extension) +- [Delegated Administration](/extensions/delegated-admin): Allow a select group of people to manage users without providing access to any other area of the Dashboard. -### Easily manage custom social connections -- [Custom Social Connections Extension](/extensions/custom-social-extensions) +### Connections + +- [Custom Social Connections Extension](/extensions/custom-social-extensions): Configure and manage custom social identity providers. + +- [Single Sign-on (SSO) Dashboard Extension](extensions/sso-dashboard): Create a Single Sign-on (SS0) dashboard that allows users to sign into any of multiple listed enterprise applications. + +### Manage users + +- [Users Import / Export](/extensions/user-import-export): Bulk import and export database users. + +### Extend and integrate + +Use your own custom webhooks in conjunction with Auth0 APIs: -### Go through the audit logs and call the appropriate webhook for specific API event triggers - [Auth0 Management API Webhooks](/extensions/management-api-webhooks) - [Auth0 Authentication API Webhooks](/extensions/authentication-api-webhooks) -### Test various endpoints of the Auth0 Authentication API +### Deployment and source control + +Keep history and deploy [rules](/rules), [database connection](/connections/database) scripts and other assets from external repositories: + +- [GitHub Deployments Extension](/extensions/github-deploy) +- [Bitbucket Deployments Extension](/extensions/bitbucket-deploy) +- [GitLab Deployments Extension](/extensions/gitlab-deploy) +- [Visual Studio Team Services Deployments Extension](/extensions/visual-studio-team-services-deploy) +- [Deploy CLI Tool Extension](/extensions/deploy-cli) + +### Troubleshoot + +Test Auth0 API endpoints: + - [Authentication API Debugger Extension](/extensions/authentication-api-debugger) -### Monitor your AD/LDAP connectors -- [Auth0 AD/LDAP Connector Health Monitor](/extensions/adldap-connector) +### Monitor + +- [Auth0 AD/LDAP Connector Health Monitor](/extensions/adldap-connector): Monitor your [AD/LDAP Connectors](/connector/overview). -### Import or Export existing users -- [Users Import / Export](/extensions/user-import-export) +- [Real-time Webtask Logs](/extensions/realtime-webtask-logs): Access real-time Webtask logs. + +### Logs export + +Export Auth0 logs to external services: -### Export Auth0 logs to an external service - [Auth0 Logs to Application Insights](/extensions/application-insight) +- [Auth0 Logs to AWS Cloudwatch](/extensions/cloudwatch) - [Auth0 Logs to Azure Blob Storage](/extensions/azure-blob-storage) +- [Auth0 Logs to Logentries](/extensions/logentries) - [Auth0 Logs to Loggly](/extensions/loggly) +- [Auth0 Logs to Logstash](/extensions/logstash) +- [Auth0 Logs to Mixpanel](/extensions/mixpanel) - [Auth0 Logs to Papertrail](/extensions/papertrail) - [Auth0 Logs to Sumo Logic](/extensions/sumologic) - [Auth0 Logs to Splunk](/extensions/splunk) -- [Auth0 Logs to Logstash](/extensions/logstash) -- [Auth0 Logs to Mixpanel](/extensions/mixpanel) -- [Auth0 Logs to Logentries](/extensions/logentries) - -### Access to real-time webtask logs -- [Real-time Webtask Logs](/extensions/realtime-webtask-logs) - -### Expose the Users dashboard to a group of users without allowing them access to the dashboard -- [Delegated Administration](/extensions/delegated-admin) - -### Deploy hosted pages, rules, and database connections scripts from external repositories -- [GitHub Deployments Extension](/extensions/github-deploy) -- [Bitbucket Deployments Extension](/extensions/bitbucket-deploy) -- [GitLab Deployments Extension](/extensions/gitlab-deploy) -- [Visual Studio Team Services Deployments Extension](/extensions/visual-studio-team-services-deploy) -### Create a SSO dashboard with multiple enterprise applications -- [SSO Dashboard Extension](extensions/sso-dashboard) diff --git a/articles/extensions/logentries.md b/articles/extensions/logentries.md index 277e5be9eb..b7b7f7188a 100644 --- a/articles/extensions/logentries.md +++ b/articles/extensions/logentries.md @@ -1,5 +1,11 @@ --- description: How to enable and use the Logentries extension. +topics: + - extensions + - logentries +contentType: + - how-to +useCase: extensibility-extensions --- # Auth0 Logs to Logentries @@ -14,13 +20,15 @@ To install and configure this extension, click on the _Auth0 Logs to Logentries_ At this point you should set the following configuration variables: - **Schedule**: The frequency with which logs should be exported. The schedule can be customized even further after creation. -- **BATCH_SIZE**: The ammount of logs to be read on each execution. Maximun is 100. +- **BATCH_SIZE**: The amount of logs to be read on each execution. Maximun is 100. - **LOGENTRIES_TOKEN**: The Logentries Token for your log set to which the Auth0 logs will be exported. - **LOG_LEVEL**: The minimal log level of events that you would like sent to Logentries. - **LOG_TYPES**: The events for which logs should be exported. If you want you can send only events with a specific type (for example, failed logins). Once you have provided this information, click the *Install* button to finish installing the extension. +<%= include('./_includes/_batch-size') %> + ## Retrieve the required information from Logentries In order to acquire the *LOGENTRIES_TOKEN* information, navigate to [Logentries](https://logentries.com) and login to your account or register for a new one. From the menu on the left select *Logs > Add New Log*. diff --git a/articles/extensions/loggly.md b/articles/extensions/loggly.md index fe5b0b24e2..d2d5f5d778 100644 --- a/articles/extensions/loggly.md +++ b/articles/extensions/loggly.md @@ -1,5 +1,11 @@ --- description: How to install and configure the Auth0 Logs to Loggly Extension. +topics: + - extensions + - loggly +contentType: + - how-to +useCase: extensibility-extensions --- # Auth0 Logs to Loggly @@ -29,6 +35,8 @@ You can find the __Global Client ID__ and __Global Client Secret__ information a Once you have provided this information, click the *Install* button to finish installing the extension. +<%= include('./_includes/_batch-size') %> + ## Retrieve the required information from Loggly Let's see how we can retrieve the __Loggly_Customer_Token__ information. diff --git a/articles/extensions/logstash.md b/articles/extensions/logstash.md index ff1fa04426..ba02d1b161 100644 --- a/articles/extensions/logstash.md +++ b/articles/extensions/logstash.md @@ -1,5 +1,11 @@ --- description: How to install and configure the Auth0 Logs to Logstash extension. +topics: + - extensions + - logstash +contentType: + - how-to +useCase: extensibility-extensions --- # Auth0 Logs to Logstash @@ -17,7 +23,7 @@ At this point you should set the following configuration variables: | Parameter | Description | |:-----------------|:------------| | **Schedule** | The frequency with which logs should be exported. The schedule can be customized even further after creation. | -| **BATCH_SIZE** | The ammount of logs to be read on each execution. Maximun, and default, is `100`. | +| **BATCH_SIZE** | The amount of logs to be read on each execution. Maximun, and default, is `100`. | | **LOGSTASH_URL**
      Required | Your Logstash URL as defined for use with `logstash-input-http` plugin. | | **LOGSTASH_INDEX**
      Required | Your Logstash Index to which the logs will be routed. | | **LOGSTASH_TOKEN** | The token required for your Logstash deployments that will be included in the querystring. | @@ -31,6 +37,12 @@ At this point you should set the following configuration variables: Once you have provided this information, click the _Install_ button to finish installing the extension. +<%= include('./_includes/_batch-size') %> + +### Using extension with ElasticSearch + +The extension is sending logs to the logstash instance as they are, including `_id`, which cannot be accepted by ElasticSearch. To fix that, you need rename `_id` to something else. You can do that by adding pipeline with `filter { mutate { rename => { "_id" => "log_id" } } }`. + ## Use the Extension To view all scheduled jobs, navigate to the [Extensions](${manage_url}/#/extensions) page of the [Management Portal](${manage_url}), click on the **Installed Extensions** link, and select the **Auth0 Logs to Logstash** line. @@ -45,7 +57,7 @@ You can view more details by clicking on the job you created. In this page you c ## Replay Logs -In the event of a Logstash failure or service interuption you can replay the logs starting from the failed log. +In the event of a Logstash failure or service interruption you can replay the logs starting from the failed log. To replay logs: diff --git a/articles/extensions/management-api-webhooks.md b/articles/extensions/management-api-webhooks.md index 88ed2f20b0..cb81a4d5e8 100644 --- a/articles/extensions/management-api-webhooks.md +++ b/articles/extensions/management-api-webhooks.md @@ -1,5 +1,11 @@ --- description: How to install and configure the Auth0 Management API Webhooks Extension. +topics: + - extensions + - management-api-webhooks +contentType: + - how-to +useCase: extensibility-extensions --- # Auth0 Extension: Auth0 Management API Webhooks @@ -10,13 +16,16 @@ The Auth0 Management API Webhooks Extension allows you to use your own custom we To complete installation of this extension, click on the Auth0 Management API Webhooks box in the list of provided extensions on the Extensions page of the Management Portal. In the "Install Extension" window that then pops open, you will be asked to provide the following configuration variables: -- __Schedule__: The frequency with which the webhook runs; -- __Auth0_Domain__: The domain of your Auth0 app; -- __Auth0_Global_Client_ID__: The Auth0 Global Client ID; -- __Auth0_Global_Client_Secret__: The Auth0 Global Client Secret; -- __Auth0_API_Endpoints__: The specific Auth0 Management API endpoints you want to monitor/call; -- __Webhook URL__: The URL of your webhook; +- __Schedule__: The frequency with which the job runs +- __Batch_Size__: The amount of logs the extension will attempt to read and send on each execution. Extension could send multiple batches per run, depending on amount of time necessary to process. +- __Auth0_API_Endpoints__: The specific Auth0 Management API endpoints you want to monitor/call +- __Webhook_URL__: The URL of your webhook +- __Authorization__: String to be added as `Authorization` header. +- __Send_as_Batch__: If enabled, the extension will send the whole batch of logs to the webhook in a single request. Otherwise, extension sends logs one-by-one to webhook. Only disable if your webhook does not support batched messages. - __Webhook_Concurrent_Calls__: The maximum number of concurrent calls that will be made to your webhook. +- __Start_From__: Log Checkpoint to start from. +- __Slack_Incoming_Webhook_URL__: Extension can report statistics and possible failures to the Slack. +- __Slack_Send_Success__: If enabled, extension will be sending messages on each run. Otherwise - only on fails. Once you have provided the required pieces of information, click "Install" to finish installing the extension. @@ -74,4 +83,4 @@ Here is an example of the payload that will be sent: } ``` -<%= include('./_troubleshoot-webhooks') %> \ No newline at end of file +<%= include('./_troubleshoot-webhooks') %> diff --git a/articles/extensions/mixpanel.md b/articles/extensions/mixpanel.md index 3c5d4254b4..681af41310 100644 --- a/articles/extensions/mixpanel.md +++ b/articles/extensions/mixpanel.md @@ -1,42 +1,53 @@ --- description: How to configure and use the Auth0 Logs to Mixpanel extension. +topics: + - extensions + - mixpanel +contentType: + - how-to +useCase: extensibility-extensions --- # Auth0 Logs to Mixpanel The Auth0 Logs to Mixpanel is a scheduled job that takes all of your Auth0 logs and exports them to [Mixpanel](https://mixpanel.com). -## Configuring the Extension +## Step 1: Get the required information from Mixpanel -To install and configure this extension, click on the **Auth0 Logs to Mixpanel** box in the list of provided extensions on the [Extensions](${manage_url}/#/extensions) page of the [Auth0 Dashboard](${manage_url}). The **Install Extension** window pops open. +First you need to get some required information from Mixpanel: the Token and API Key that Auth0 will use to connect and push logs. -![](/media/articles/extensions/mixpanel/extension-mgmt-mixpanel.png) +1. Go to [Mixpanel](https://mixpanel.com) +1. Click on your [Account Settings](https://mixpanel.com/account/) +1. Click on the **Projects** tab +1. Copy the **Token** and **API Key** information. These map respectively to the **MIXPANEL_TOKEN** and **MIXPANEL_KEY** variables that you will set in the next step -At this point you should set the following configuration variables: +![Get keys from Mixpanel](/media/articles/extensions/mixpanel/mixpanel-project-info.png) + +## Step 2: Configure Auth0 + +Go to [Dashboard > Extensions](${manage_url}/#/extensions) and click on the **Auth0 Logs to Mixpanel** box in the list of provided extensions. + +The **Install Extension** window pops open. + +![Install Auth0 Extension](/media/articles/extensions/mixpanel/extension-mgmt-mixpanel.png) + +Set the following configuration variables: - **Schedule**: The frequency with which logs should be exported. The schedule can be customized even further after creation. - **MIXPANEL_TOKEN**: The Mixpanel Token for your mixpanel project to which the Auth0 logs will be exported. - **MIXPANEL_KEY**: The Mixpanel API Key for your mixpanel project to which the Auth0 logs will be exported. -- **BATCH_SIZE**: The ammount of logs to be read on each execution. Maximun is 20. +- **BATCH_SIZE**: The amount of logs to be read on each execution. Maximum is 20. - **LOG_LEVEL**: The minimal log level of events that you would like sent to Mixpanel. - **LOG_TYPES**: The events for which logs should be exported. If you want you can send only events with a specific type (for example, failed logins). Once you have provided this information, click the **Install** button to finish installing the extension. -## Retrieve the required information from Mixpanel - -In order to acquire the **MIXPANEL_TOKEN** and **MIXPANEL_KEY** information, navigate to [Mixpanel](https://mixpanel.com) and click on your [Account Settings](https://mixpanel.com/account/). Click on the **Projects** tab. You now need to copy the **Token** and **API Key** information. These map respectively to the **MIXPANEL_TOKEN** and **MIXPANEL_KEY** variables. - -![](/media/articles/extensions/mixpanel/mixpanel-project-info.png) - -## Using Your Installed Extension - -To view all scheduled jobs, navigate to the [Extensions](${manage_url}/#/extensions) page of the [Auth0 Dashboard](${manage_url}), click on the **Installed Extensions** link, and select the **Auth0 Logs to Mixpanel** line. There you can see the job you just created, modify its state by toggling the **State** switch, see when the next run is due and what was the result of the last execution. +<%= include('./_includes/_batch-size') %> -![](/media/articles/extensions/mixpanel/view-cron-jobs.png) +## Use your extension -You can view more details by clicking on the job you created. In this page you can view details for each execution, reschedule, access realtime logs, and more. +To view all jobs, navigate to [Dashboard > Extensions](${manage_url}/#/extensions), click on the **Installed Extensions** link, and select the **Auth0 Logs to Mixpanel** line. There you can see the alls job and failed jobs. You can also view the logs of these runs. -![](/media/articles/extensions/mixpanel/view-cron-details.png) +You can create a cron webtask (that will run every 10 minutes) or view more details around existing cron webtasks. In the terminal, you can view details for each execution, reschedule, access realtime logs, and more. That's it, you are done! You can now navigate to [Mixpanel](https://mixpanel.com) and view your [Auth0 Logs](${manage_url}/#/logs). diff --git a/articles/extensions/papertrail.md b/articles/extensions/papertrail.md index b38c4951d0..d8aef88e25 100644 --- a/articles/extensions/papertrail.md +++ b/articles/extensions/papertrail.md @@ -1,5 +1,11 @@ --- description: How to configure and retrieve information from the Auth0 Logs to Papertrail extension. +topics: + - extensions + - papertrail +contentType: + - how-to +useCase: extensibility-extensions --- # Auth0 Logs to Papertrail @@ -12,35 +18,33 @@ To install and configure this extension, click on the _Auth0 Logs to Papertrail_ ![](/media/articles/extensions/papertrail/extension-mgmt-papertrail.png) -At this point you should set the following configuration variables: +At this point, you should set the following configuration variables: - **Schedule**: The frequency with which logs should be exported. The schedule can be customized even further after creation. -- **BATCH_SIZE**: The ammount of logs to be read on each execution. Maximun is 100. +- **BATCH_SIZE**: The number of logs per batch (up to a maximum of 100). Note that logs are batched before sending, with multiple batches sent each time the extension runs. +- **START_FROM**: The Checkpoint ID of the log from which you want the extension to start sending. +- **SLACK_INCOMING_WEBHOOK_URL**: The Incoming Webhook URL used to report statistics and events to your Slack account/channel. +- **SLACK_SEND_SUCCESS**: If yes, enables verbose notifications to Slack. Useful for troubleshooting. +- **LOG_LEVEL**: The minimal log level of events that you would like sent to Papertrail. +- **LOG_TYPES**: The events for which logs should be exported. - **PAPERTRAIL_HOST**: The destination hostname for your logs. - **PAPERTRAIL_PORT**: The destination port for your logs. - **PAPERTRAIL_SYSTEM**: The destination system for your logs. -- **LOG_LEVEL**: The minimal log level of events that you would like sent to Papertrail; -- **LOG_TYPES**: The events for which logs should be exported. Once you have provided this information, click the *Install* button to finish installing the extension. -## Retrieve the required information from Papertrail - -In order to configure a new system for Auth0 logs and acquire the *PAPERTRAIL_HOST* and *PAPERTRAIL_PORT* information, follow the next steps: -1. Login to [Papertrail](https://papertrailapp.com) and navigate to your [Dashboard](https://papertrailapp.com/dashboard). -2. Click the *Add Systems* button. +<%= include('./_includes/_batch-size') %> -![](/media/articles/extensions/papertrail/papertrail-new-system-01.png) +## Retrieve the required information from Papertrail -3. Your log destination is created! Copy the URL and Port information displayed with the message *Your systems & apps will log to*. These map respectively to the *PAPERTRAIL_HOST* and *PAPERTRAIL_PORT* variables. +To configure a new system for Auth0 logs and acquire the *PAPERTRAIL_HOST* and *PAPERTRAIL_PORT* information: -![](/media/articles/extensions/papertrail/papertrail-new-system-02.png) +1. Login to [Papertrail](https://papertrailapp.com). You'll be directed to the **quick start and tour** page. +2. Click the *Add your first system* button. -If you already have a system you want to use, follow the next steps: -1. Login to [Papertrail](https://papertrailapp.com) and navigate to your [Settings > Log Destinations](https://papertrailapp.com/account/destinations). -2. Locate the system you want to use and copy the URL and Port information. These map respectively to the *PAPERTRAIL_HOST* and *PAPERTRAIL_PORT* variables. +You'll get redirected again, and at the top of the page, you will see a message that says something like **Your logs will go to logs4.papertrailapp.com:12345 and appear in Events.**. The log destination displayed is where your logs will go. The log and port information map to the *PAPERTRAIL_HOST* (i.e., `logs4.papertrailapp.com`) and *PAPERTRAIL_PORT* (i.e., `12345`) variables Auth0 asked for, respectively. -![](/media/articles/extensions/papertrail/papertrail-existing-system.png) +Per Papertrail, "no explicit configuration is required...just start sending logs. When Papertrail receives a message from a hostname that is not already present in your account, the system will be automatically added." ## Using Your Installed Extension @@ -48,16 +52,12 @@ If you already have a system you want to use, follow the next steps: ![](/media/articles/extensions/papertrail/view-cron-jobs.png) -You can view more details by clicking on the job you created. In this page you can view details for each execution, reschedule, access realtime logs, and more. +You can view more details by clicking on the job you created. In this page, you can view details for each execution, reschedule, access realtime logs, and more. ![](/media/articles/extensions/papertrail/view-cron-details.png) -That's it, you are done! You can now navigate to [Papertrail](https://papertrailapp.com) and view your [Auth0 Logs](${manage_url}/#/logs), by selecting the configured system. - -![](/media/articles/extensions/papertrail/auth0-logs-at-papertrail-01.png) +That's it, you are done! You can now navigate to [Papertrail](https://papertrailapp.com) and view your [Auth0 Logs](${manage_url}/#/logs) under **Events**. ::: note -You may have noticed that we didn't set a value for *PAPERTRAIL_SYSTEM*. This variable, when not set by the user, takes the default value of `auth0-logs`. As you can see in the previous screenshot, this is how our system will be displayed in the Papertrail dashboard. +You may have noticed that we didn't set a value for *PAPERTRAIL_SYSTEM*. This variable, when not set by the user, takes the default value of `auth0-logs`. This is how Auth0's logs will be displayed and referred to in the Papertrail dashboard. ::: - -![](/media/articles/extensions/papertrail/auth0-logs-at-papertrail-02.png) diff --git a/articles/extensions/realtime-webtask-logs.md b/articles/extensions/realtime-webtask-logs.md index 5cd0e514c2..7aa762f9c7 100644 --- a/articles/extensions/realtime-webtask-logs.md +++ b/articles/extensions/realtime-webtask-logs.md @@ -1,12 +1,18 @@ --- description: How to configure, use debug rules using the Real-time Webtask Logs extension. +topics: + - extensions + - realtime-webtask-logs +contentType: + - how-to +useCase: extensibility-extensions --- # Real-time Webtask Logs -_Real-time Webtask Logs_ is an extension that displays all logs in real-time for all custom code in your account. This includes all `console.log` output and exceptions. +_Real-time Webtask Logs_ is an extension that displays all logs in real-time for the custom code in your account. This includes all `console.log` output and exceptions. -## Configuring the Extension +## Configuring the extension To install and configure this extension, click on the _Real-time Webtask Logs_ box in the list of provided extensions on the [Extensions](${manage_url}/#/extensions) page of the [Management Portal](${manage_url}). The _Install Extension_ window pops open. @@ -14,15 +20,23 @@ To install and configure this extension, click on the _Real-time Webtask Logs_ b Click the _Install_ button. -## Using Your Installed Extension +## Using your installed extension To view your installed extension, navigate to the [Extensions](${manage_url}/#/extensions) page of the [Management Portal](${manage_url}), click on the _Installed Extensions_ link, and select the _Real-time Webtask Logs_ line. You can view the logs in full screen by selecting the _FULL SCREEN MODE_ button. Press `Escape` to exit full screen mode. ![](/media/articles/extensions/realtime-webtask-logs/view-realtime-logs.png) -To clear the logs and start fresh select the the red _CLEAR CONSOLE_ button at the bottom right. +To clear the logs and start fresh select the red _CLEAR CONSOLE_ button at the bottom right. -## Debugging Rules +## Secure logging + +Because the Webtask Logs extension uses the users request, logging sensitive information is a concern of which you should be mindful. + +For example, your custom database scripts work with the `user` object extensively. The `user` object may contain sensitive information, and logging the complete object may lead to its disclosure to the Webtask Logs extension. + +Obviously, Auth0 strongly discourages such practices. These actions could lead to the disclosure of your users' sensitive information. **We caution you to be aware of the objects that you log and to ensure sensitive information is not logged** + +## Debugging rules The _Real-time Webtask Logs_ extension can be used to debug any [Rules](/rules) in your implementation. This includes all `console.log` output and exceptions. Let's follow a simple _hello world_ example. @@ -42,8 +56,6 @@ You are now ready to run this rule. Before you do so, open a new tab and navigat ![](/media/articles/extensions/realtime-webtask-logs/view-rules-example.png) -That's it, you are done! - ## Additional Information - [Rules debugging](/rules#debugging) - [Real-time Auth0 Webtask Logs GitHub repository](https://github.com/auth0/auth0-extension-realtime-logs) diff --git a/articles/extensions/segment.md b/articles/extensions/segment.md new file mode 100644 index 0000000000..3c47b20290 --- /dev/null +++ b/articles/extensions/segment.md @@ -0,0 +1,54 @@ +--- +description: How to install and configure the Auth0 Logs to Segment Extension. +topics: + - extensions + - segment +contentType: + - how-to +useCase: extensibility-extensions +--- +# Auth0 Logs to Segment + +The *Auth0 Logs to Segment* is a scheduled job that takes all of your Auth0 logs and exports them to [Segment](https://www.segment.com/). + +## Configure the Extension + +To install and configure this extension, click on the __Auth0 Logs to Segment__ box in the list of provided extensions on the [Extensions](${manage_url}/#/extensions) page of the [dashboard](${manage_url}). The __Install Extension__ window pops open. + +At this point you should set the following configuration variables: + +| Parameter | Description | +|:-----------------|:------------| +| **Schedule** | The frequency with which logs should be exported. The schedule can be customized even further after creation. | +| **BATCH_SIZE** | The amount of logs to be read on each execution. Maximun, and default, is `100`. | +| **START_FROM** | The checkpoint ID of the log from where you want to start. | +| **SLACK_INCOMING_WEBHOOK** | The Slack incoming webhook URL used to send relevant updates. | +| **SLACK_SEND_SUCCESS** | Toggle for sending verbose notifications to Slack. | +| **SEGMENT_KEY** | Your segment key. | + +Once you have provided this information, click the _Install_ button to finish installing the extension. + +<%= include('./_includes/_batch-size') %> + +## Use the Extension + +You can monitor activity by logging into the extension. There you can find reports on most recent runs. Reports contains amount of logs processed and errors, if any. + +## Replay Logs + +In the event of a Segment failure or service interruption you can replay the logs starting from the failed log. + +To replay logs: + +1. Get the checkpoint ID of the failed log. +2. Go to the Auth0 Logs to Segment extension settings. +3. Enter the checkpoint in the **START_FROM** field. +4. Click the **Save** button to replay the failed logs. + +## Slack Integration + +To set up [Slack](https://slack.com/) integration, provide an [Incoming Webhook URL](https://api.slack.com/incoming-webhooks) to the **SLACK_INCOMING_WEBHOOK** field in the Auth0 Logs to Segment [extension settings](${manage_url}/#/extensions). + +The extension sends failed transaction notifications to Slack with the checkpoint code displayed in the message. You can also enable verbose notifications by turning on the `SLACK_SEND_SUCCESS` setting. + +![Slack Message](/media/articles/extensions/logstash/slack-message.png) diff --git a/articles/extensions/splunk.md b/articles/extensions/splunk.md index ddf68bbc81..62facb383e 100644 --- a/articles/extensions/splunk.md +++ b/articles/extensions/splunk.md @@ -1,8 +1,14 @@ --- -description: How to configure and retrieve information using the Auth0 Logs to Splunk extension. +description: Learn how to configure and retrieve information using the Auth0 Logs to Splunk extension. +topics: + - extensions + - splunk +contentType: + - how-to +useCase: extensibility-extensions --- -# Auth0 Logs to Splunk +# Export Logs to Splunk Using the Auth0 Extension The _Auth0 Logs to Splunk_ is a scheduled job that takes all of your Auth0 logs and exports them to [Splunk](http://www.splunk.com/). @@ -15,16 +21,19 @@ To install and configure this extension, click on the _Auth0 Logs to Splunk_ box At this point you should set the following configuration variables: - **Schedule**: How often the job will run. The schedule can be customized even further after creation. +- **START_FROM**: The checkpoint ID of the log from where you want to start. The value will be the log id (GUID). - **SPLUNK_URL**: Your Splunk Cloud URL. - **SPLUNK_TOKEN**: Your Splunk Token. - **SPLUNK_COLLECTOR_PORT**: The Port of your HTTP Collector Endpoint. - **SPLUNK_COLLECTOR_PATH**: The [HTTP Collector Endpoint](http://dev.splunk.com/view/event-collector/SP-CAAAE7H) to be used. If you use the `/raw` endpoint, make sure to append a channel as a querystring parameter, like this: `/services/collector/raw?channel=FE0ECFAD-13D5-401B-847D-77833BD77131`. More information can be found in the [Splunk documentation](http://dev.splunk.com/view/event-collector/SP-CAAAE8Y). -- **BATCH_SIZE**: The ammount of logs to be read on each execution. Maximun is 100. +- **BATCH_SIZE**: The amount of logs to be read on each execution. Maximum is 100. - **LOG_LEVEL**: The minimal log level of events that you would like sent to Splunk. - **LOG_TYPES**: The events for which logs should be exported. Once you have provided this information, click the *Install* button to finish installing the extension. +<%= include('./_includes/_batch-size') %> + ## Retrieve the required information from Splunk The HTTP Event Collector (HEC) is an endpoint that lets you send application events into Splunk Enterprise using the HTTP or Secure HTTP (HTTPS) protocols. In order to configure a new HTTP Event Collector for Auth0 logs and acquire the URL, Token and Port information, follow the next steps: @@ -65,7 +74,7 @@ curl -k https://:8088/services/collector -H 'Authorization: Splunk The `` value is based on your _Splunk Cloud URL_. When creating requests to Splunk Cloud, you must add a prefix to the URI of the hostname according to your subscription. For self-service Splunk Cloud plans, pre-pend the hostname with `input-`. For all other Splunk Cloud plans, pre-pend the hostname with `http-inputs-`. For this example we have subscribed for a self-service Splunk Cloud plan, so we will use the `input-` prefix. You can find more details [here](http://dev.splunk.com/view/event-collector/SP-CAAAE7F). ::: -As a response you should receive the followins JSON: +As a response you should receive the following JSON: ```json { diff --git a/articles/extensions/sso-dashboard.md b/articles/extensions/sso-dashboard.md index 3e61af5cdc..3d732fd70d 100644 --- a/articles/extensions/sso-dashboard.md +++ b/articles/extensions/sso-dashboard.md @@ -1,135 +1,45 @@ --- -title: "Auth0 Extension: Single Sign-On (SSO) Dashboard" -description: This page explains how to configure and utilize the SSO Dashboard Extension. -toc: true +description: Understand how the SSO Dashboard Extension enables you to manage SSO login for your users on multiple enterprise applications. +classes: topic-page +topics: + - extensions + - sso-dashboard + - sso +contentType: + - concept +useCase: + - extensibility-extensions + - setup-multiple-applications + - setup-sso-dashboard --- -# Auth0 Extension: Single Sign-On (SSO) Dashboard +# Auth0 Single Sign-On Dashboard Extension -The **SSO Dashboard** extension allows you to create a dashboard with multiple enterprise applications that can be enabled for single sign-on for your users for login. +The **Single Sign-on (SSO) Dashboard** is a web application designed to solve a problem familiar to many people. Organizations of all sizes maintain a variety of different applications to handle various business functions like accounting, HR, development, support, etc. Remembering usernames and passwords and login URLs for all of your applications can be cumbersome. With this extension, you can simplify the authentication experience by enabling SSO login for your users on multiple enterprise applications. It allows you to create a list of all the cloud services for which a user can authenticate with SSO logins. -The SSO dashboard supports two types of users: -**Users**- who will login to the dashboard to then select an application to sign into with SSO. -**Admins**- can login to configure the applications that are visible to the users. This guide is intended for Dashboard Admins. +::: note +A user should not be able to access, from the dashboard or otherwise, the service provider without having appropriate permissions (groups/roles) to do so. Ideally, these users would not see any service provider they are not granted access to on the dashboard. +::: -[View this Extension on GitHub](https://github.com/auth0-extensions/auth0-sso-dashboard-extension) +The SSO Dashboard supports two types of users: +- **Users** who can login to the dashboard to select an application to sign into with SSO. +- **Admins** who can configure applications visible to the users. -## Create an application +To setup and configure this extension, do the following steps: -Let's start with creating a new application. Navigate to [Applications](${manage_url}/#/applications) and click on the **+Create Application** button. Set a name and choose **Single Page Web Applications** application type. Click on **Create**. - -![](/media/articles/extensions/sso-dashboard/create-client.png) - -Click on the *Settings* tab and set the **Allowed Callback URLs**. This varies based on your location. - -The login URL for **Admins**: - -| Location | Allowed Callback URL | -| --- | --- | -| USA | `https://${account.tenant}.us.webtask.io/auth0-sso-dashboard/admins/login` | -| Europe | `https://${account.tenant}.eu.webtask.io/auth0-sso-dashboard/admins/login` | -| Australia | `https://${account.tenant}.au.webtask.io/auth0-sso-dashboard/admins/login` | - -The login URL for **Users**: - -| Location | Allowed Callback URL | -| --- | --- | -| USA | `https://${account.tenant}.us.webtask.io/auth0-sso-dashboard/login` | -| Europe | `https://${account.tenant}.eu.webtask.io/auth0-sso-dashboard/login` | -| Australia | `https://${account.tenant}.au.webtask.io/auth0-sso-dashboard/login` | - -Copy the **Client ID** value. - -Navigate to *Settings > Show Advanced Settings > OAuth* and paste the **Client ID** value to the **Allowed APPs / APIs** field. - -Set the **JsonWebToken Signature Algorithm** to *RS256*. - -![](/media/articles/extensions/delegated-admin/set-rs256.png) - -Save your changes. - -### Application connections - -By default all the connection types are enabled for users to be able to login into the SSO Dashbboard. If you would like to change this, navigate to the *Connections* tab for the Application. - -## Install the extension - -We are now ready to setup our new extension. But first, head back to your newly created Application and copy the **Client ID** value. - -To install and configure this extension, click on the **SSO Dashboard** box in the list of provided extensions on the [Extensions](${manage_url}/#/extensions) page of the dashboard. The **Install Extension** window will open. - -![Install SSO Dashboard Extension](/media/articles/extensions/sso-dashboard/install-extension.png) - -Set the following configuration variables: - -- **EXTENSION_CLIENT_ID**: This is the **Client ID** of the application you have created in the [Applications](${manage_url}/#/applications) that you wish to use this extension with. -- **TITLE**: This the custom title that will appear at the top of the SSO Dashboard page. -- **CUSTOM_CSS** *Optional*: This field that can contain a link to custom CSS you can use to style the look of your SSO Dashboard page. - -Once you have provided this information, click **INSTALL**. - -If you navigate back to the [Applications](${manage_url}/#/applications) view, you will see that there has been an additional application created. - -![New created Application](/media/articles/extensions/sso-dashboard/new-client.png) - -The `auth0-sso-dashboard` application is created automatically when you install the extension. It's an application authorized to access the [Management API](/api/management/v2) and you shouldn't modify it. - -## Use the extension - -Navigate to the [Extensions](${manage_url}/#/extensions) page and click on the **Installed Extensions** tab. - -Click on the row for the **SSO Dashboard** extension. The first time you click on your installed extension, you will be asked to grant it the required permissions. - -Once you agree, you will be directed to your custom **SSO Dashboard** page, which will have the **TITLE** you provided at the top of the page, and if you provided a custom CSS file that styling will be applied. - -![Your Custom SSO Dashboard](/media/articles/extensions/sso-dashboard/dashboard.png) - -To login into the dashboard: - -For **Admins** use `https://${account.tenant}..webtask.io/auth0-sso-dashboard/admins/login` or through the Dashboard. - -For **Users** use `https://${account.tenant}..webtask.io/auth0-sso-dashboard/login`. - -### Add a new application - -To add a new application to your dashboard to be used for single sign-on, go to the **Settings** page of the dashboard by clicking on the link on the upper right corner of the page and click **Settings** from the dropdown. - -Then click on the **CREATE APP** button to add a new application. - -![Dashboard Settings](/media/articles/extensions/sso-dashboard/settings.png) - -You will then need to enter the following fields for the new application: - -* **Type**: This field is a dropdown where you select the either SAML, OpenID-Connect, or WS-Federation depending on the type of application. -* **Application**: This is the application name of the application you have created that you wish to associate the login of users. -* **Name**: The name of the new application you are adding. -* **Logo**: Enter the url of the logo you wish to user as an icon for the application. -* **Callback**: This is one of the **Allowed Callback URLs** under your [Application Settings](${manage_url}/#/applications) of the application. -* **Connection** *Optional*: Select the connection type from the dropdown. You can add/edit your available connection types in the [Connections section of the Auth0 Management dashboard](${manage_url}/#/connections/database). If a connection is not set and the user is not logged, the user will see the Auth0 Login page. -* **Enabled**: Select this checkbox for this application to be visible (published) to your users. - -![Create a new application](/media/articles/extensions/sso-dashboard/new-app.png) - -Once completed click the **CREATE** button. - -Your new application will then appear on the **Applications** page of the SSO dashboard with any other applications that have been created. - -![SSO Dashboard Applications](/media/articles/extensions/sso-dashboard/dashboard-apps.png) - -You can click on an application here to test the connection. - -### Update an existing application - -To edit an existing application go to the **Settings** page of the dashboard by clicking on the link on the upper right corner of the page and click **Settings** from the dropdown. - -You can change whether users can see the application (if it is enabled) with the **Publish** or **Unpublish** buttons. - -You can delete an application with the **X** button, a confirmation box will popup to confirm the deletion. - -To update an application's settings, click the gear icon. - -![Change Application Settings](/media/articles/extensions/sso-dashboard/change-settings.png) - -Here you can change any of your application settings, or delete an application. +<%= include('../_includes/_topic-links', { links: [ + 'dashboard/guides/extensions/sso-dashboard-create-app', + 'dashboard/guides/extensions/sso-dashboard-install-extension', + 'dashboard/guides/extensions/sso-dashboard-add-apps', + 'dashboard/guides/extensions/sso-dashboard-update-apps', +] }) %> +## Keep reading +- [View this Extension on GitHub](https://github.com/auth0-extensions/auth0-sso-dashboard-extension) +- [Troubleshoot Extensions](/extensions/troubleshoot) +- [Understand how Single Sign-On works with Auth0](/sso/current/sso-auth0) +- Learn how to [enable SSO in Auth0](/dashboard/guides/tenants/enable-sso-tenant) +- [Understand session lifetime](/sessions/concepts/session-lifetime) +- Learn how to [configure session lifetime settings](/dashboard/guides/tenants/configure-session-lifetime-settings) +- Learn how to [log users out](/logout) diff --git a/articles/extensions/sumologic.md b/articles/extensions/sumologic.md index 7d2037cf3d..5e6a1cef8e 100644 --- a/articles/extensions/sumologic.md +++ b/articles/extensions/sumologic.md @@ -1,75 +1,99 @@ --- description: How to configure and retrieve information using the Auth0 Logs to Sumo Logic extension. +topics: + - extensions + - sumologic +contentType: + - how-to +useCase: extensibility-extensions +toc: true --- # Auth0 Logs to Sumo Logic -The _Auth0 Logs to Sumo Logic_ is a scheduled job that takes all of your Auth0 logs and exports them to [Sumo Logic](https://www.sumologic.com/). +The Auth0 Logs to Sumo Logic is a scheduled job that takes all of your Auth0 logs and exports them to [Sumo Logic](https://www.sumologic.com/). This document will guide you through the process of setting up this integration. -## Configuring the Extension +## Step 1: Create a Sumo Logic HTTP endpoint -To install and configure this extension, click on the _Auth0 Logs to Sumo Logic_ box in the list of provided extensions on the [Extensions](${manage_url}/#/extensions) page of the [Management Portal](${manage_url}). The _Install Extension_ window pops open. +1. Login to [Sumo Logic](https://www.sumologic.com/) and from the top menu select **Manage > Setup Wizard**. -![](/media/articles/extensions/sumologic/extension-mgmt-sumologic.png) +![Start the Sumo Logic setup wizard](/media/articles/extensions/sumologic/sumologic-setup-wizard.png) -At this point you should set the following configuration variables: +2. On the next screen click **Set Up Streaming Data**. -- **Schedule**: The frequency with which logs should be exported. The schedule can be customized even further after creation. -- **BATCH_SIZE**: The ammount of logs to be read on each execution. Maximun is 100. -- **SUMOLOGIC_URL**: Your Sumo Logic HTTP Collector Endpoint. -- **LOG_LEVEL**: The minimal log level of events that you would like sent to Sumo Logic. -- **LOG_TYPES**: The events for which logs should be exported. +3. At the **Select Data Type** page, select **Your Custom App**. + +![Select data type](/media/articles/extensions/sumologic/sumologic-data-type.png) + +4. Select **HTTP Source** as the way to collect the logs. + +![Select HTTP source](/media/articles/extensions/sumologic/sumologic-setup-collection.png) + +5. Modify the **Source Category** and select a time zone for your log file. Click **Continue**. -Once you have provided this information, click the *Install* button to finish installing the extension. +6. You should now be provided with a URL. This is the **HTTP Source** that Sumo Logic configured for you. Copy the value and click **Continue**. Exit the setup wizard. -## Retrieve the required information from Sumo Logic +![Get the HTTP source](/media/articles/extensions/sumologic/sumologic-http-source.png) -In order to configure a new system for Auth0 logs and acquire the *SUMOLOGIC_URL* information, follow the next steps: -1. Login to [Sumo Logic](https://www.sumologic.com/) and from the top menu select _Manage > Setup Wizard_. +7. Now head back to the Auth0 Dashboard to set the value you copied as the value for **SUMOLOGIC_URL**. -![](/media/articles/extensions/sumologic/sumologic-setup-wizard.png) +## Step 2: Configure the Extension -2. On the next screen click _Set Up Streaming Data_. -3. At the _Select Data Type_ page, select _Your Custom App_. +To install and configure this extension, go to [Dashboard > Extensions](${manage_url}/#/extensions) and click on the **Auth0 Logs to Sumo Logic** box. -![](/media/articles/extensions/sumologic/sumologic-data-type.png) +The **Install Extension** window pops open. + +![Install Auth0 extension](/media/articles/extensions/sumologic/extension-mgmt-sumologic.png) + +At this point you should set the following configuration parameters: + +- **Schedule**: The frequency with which logs should be exported. The schedule can be customized even further after creation. +- **BATCH_SIZE**: Logs are batched before sending. Multiple batches are sent each time the extension runs. Specify the number of logs per batch. Maximum is `100`. +- **SUMOLOGIC_URL**: Your Sumo Logic HTTP Collector Endpoint. Set the value you copied at the previous step. +- **LOG_LEVEL**: The minimal log level of events that you would like sent to Sumo Logic. +- **LOG_TYPES**: The events for which logs should be exported. +- **START_FROM**: The `log_id` of the log you would like to start sending from. Default is to start with the oldest available log. +- **SLACK_INCOMING_WEBHOOK_URL**: Send reports from the extension to the specific Slack webhook. +- **SLACK_SEND_SUCCESS**: Send even more stuff to Slack. Useful for troubleshooting. -4. Select _HTTP Source_ as the way to collect the logs. +Once you have provided this information, click the **Install** button to finish installing the extension. -![](/media/articles/extensions/sumologic/sumologic-setup-collection.png) +The integration between Auth0 and Sumo Logic is now in place! -5. Modify the _Source Category_ and select a time zone for your log file. Click Continue. -6. You should now be provided with a URL. This is the _HTTP Source_ that Sumo Logic configured for you. Copy the value and click _Continue_. Exit the setup wizard. +<%= include('./_includes/_batch-size') %> -![](/media/articles/extensions/sumologic/sumologic-http-source.png) +## How to view the results -7. Now head back to the Auth0 Dashboard and set the value you copied as the value for **SUMOLOGIC_URL**. +The integration you just setup, created a scheduled job that will be responsible to export the logs. -## Using Your Installed Extension +To view this scheduled job: +- Go to [Dashboard > Extensions](${manage_url}/#/extensions) +- Click on the **Installed Extensions** link +- Select the **Auth0 Logs to Sumo Logic** line. - To view all scheduled jobs, navigate to the [Extensions](${manage_url}/#/extensions) page of the [Management Portal](${manage_url}), click on the *Installed Extensions* link, and select the *Auth0 Logs to Sumo Logic* line. There you can see the job you just created, modify its state by toggling the *State* switch, see when the next run is due and what was the result of the last execution. +There you can see the job you just created, modify its state by toggling the **State** switch, see when the next run is due and what was the result of the last execution. -![](/media/articles/extensions/sumologic/view-cron-jobs.png) +![View scheduled job](/media/articles/extensions/sumologic/view-cron-jobs.png) You can view more details by clicking on the job you created. In this page you can view details for each execution, reschedule, access realtime logs, and more. -![](/media/articles/extensions/sumologic/view-cron-details.png) +![View job details](/media/articles/extensions/sumologic/view-cron-details.png) That's it, you are done! You can now navigate to [Sumo Logic](https://www.sumologic.com/) and view your [Auth0 Logs](${manage_url}/#/logs), by selecting the configured system. -![](/media/articles/extensions/sumologic/auth0-logs-at-sumologic.png) +![View Auth0 logs in Sumo Logic screen](/media/articles/extensions/sumologic/auth0-logs-at-sumologic.png) -## Auth0 Dashboard +## Use the Auth0 Dashboard Here, at Auth0, we have been using the Auth0 to Sumo Logic extension ourselves since it was first released, and it's proven to be very useful for staying on top of what's happening with our own Auth0 accounts and our internal users. Sumo Logic makes it easy to see the latest failed logins, find and alert on error messages, create charts to visualize trends, or even do complex statistical analysis on your data. To help us (and our customers) visualize these logs, we spent some time creating a dashboard. The Sumo Logic for Auth0 dashboard shows you the output of several saved searches all on one easy to read screen, and makes it easy to zoom in or drill down when something looks interesting. -![](/media/articles/extensions/sumologic/auth0-dashboard.png) +![Sumo Logic Dashboard](/media/articles/extensions/sumologic/auth0-dashboard.png) If you're a Sumo Logic customer and are interested in trying out this dashboard, you can find details on installing the Auth0 App for the Sumo Logic extension here: -[Install the Auth0 App](https://help.sumologic.com/Send_Data/Data_Types/Auth0/02Install_the_Auth0_App) +[Install the Auth0 App](https://help.sumologic.com/07Sumo-Logic-Apps/20SAML/Auth0/Auth0-App-Dashboards) Once it's available through your account, you're free to customize it, add to it, create alerts based on the searches, or really anything else that you find useful. diff --git a/articles/extensions/troubleshoot.md b/articles/extensions/troubleshoot.md new file mode 100644 index 0000000000..a42a424117 --- /dev/null +++ b/articles/extensions/troubleshoot.md @@ -0,0 +1,38 @@ +--- +description: General troubleshooting steps for extensions. +topics: + - extensions + - troubleshooting + - errors +contentType: + - how-to +useCase: + - extensibility-extensions + - troubleshooting +--- +# Troubleshoot Extensions + +If you see issues with your [extensions](/extensions), we recommend that you begin the troubleshooting process with the following two steps: + +1. Reinstall the extension. +2. Migrate to Node.js v12. + +## Reinstall the Extension + +One of the first things you can do when running into issues with an extension is to reinstall it: + +1. Go to [Dashboard > Extensions](${manage_url}/#/extensions). +2. On the **Installed Extensions** tab, delete the extension. +3. Log out of the Auth0 Dashboard. +4. Log back in to the Auth0 Dashboard. +5. Reinstall and reconfigure the extension. + +## Migrate to Node.js v12 + +We recommend changing your tenant's extensibility runtime from Node.js v8 to Node.js v12. Before updating, however, review the [migration guide](/migrations/guides/extensibility-node12) for full details on what will be affected by this change. + +You can change the Node.js runtime version by going to the **Extensibility** section in [Tenant Settings > Advanced](https://manage.auth0.com/#/tenant/advanced). + +## Contact Support + +If you are still experiencing issues with your extensions, and you need to [contact support](https://support.auth0.com/), please be sure to **include errors logs and/or [real-time Webtask logs](/extensions/realtime-webtask-logs) with your support ticket**. Errors and logs can help Auth0 support troubleshoot your issue faster. diff --git a/articles/extensions/user-import-export.md b/articles/extensions/user-import-export.md index 1b7bed87e5..45528fde69 100644 --- a/articles/extensions/user-import-export.md +++ b/articles/extensions/user-import-export.md @@ -2,18 +2,22 @@ title: User Import / Export Extension toc: true description: The User Import / Export is an extension that allows you to import / export users from or to any database you have configured in your account. +topics: + - extensions + - user-import-export +contentType: + - how-to +useCase: extensibility-extensions --- # User Import / Export -::: note -The User Import / Export extension is available in the PSaaS Appliance beginning with version `10755` when you have user search enabled. -::: - The **User Import / Export Extension** allows you to: * Bulk import your existing database users into Auth0 * Search for and export some (or all) of your Auth0 database users +For a list of user profile fields that can be imported and exported, see [User Profile Attributes](/users/references/user-profile-structure#user-profile-attributes). + You must be a Dashboard Admin to use this extension. ## Install the Extension @@ -65,20 +69,20 @@ Once you've imported your users, you can manage them individually using the [Use ### Export Users +::: note +Auth0 uses the [ndjson](http://ndjson.org/) format due to the large size of export files. Before you can import users, you'll need to convert from **ndjson** to **json** using the library of your choice (such as [jq](https://stedolan.github.io/jq/)). When exporting users intended to later be imported, user field names should be left as their defaults and not mapped to a Column Name. +::: + To export your existing Auth0 users associated with database connections, select **Export** in the left-hand navigation bar. ![](/media/articles/extensions/user-import-export/export-users.png) -You can query the users that you want to export using [Lucene query syntax](http://www.lucenetutorial.com/lucene-query-syntax.html) in the search bar. For example, to return all the users that have the `nickname` attribute you can use: `_exists_:nickname`. +Under **User Fields**, you can decide which user attributes or expressions should be included in the export. The user attribute can be a static value like `user.user_metadata.name`, or it can be a JavaScript expression like `user.user_metadata.name || user.name`. Expressions will be evaluated during the export runtime. The **column name** value is how the value will be represented in the export. -Under **Columns**, you can decide which user attributes or expressions should be included in the export. The user attribute can be a static value like `user.user_metadata.name`, or it can be a JavaScript expression like `user.user_metadata.name || user.name`. Expressions will be evaluated during the export runtime. The **column name** value is how the value will be represented in the export. - -You can use the **Add Default Columns** button to automatically select the default attributes and populate their column names (this is also a good way for you to visualize how parameters/expressions will appear). +You can click the **Add Default Fields** button to automatically select the default fields and populate their column names (this is also a good way for you to visualize how parameters/expressions will appear). You can remove extraneous attributes/expressions by clicking on its associated **trash can** icon. -![](/media/articles/extensions/user-import-export/default-columns.png) - Under **Settings**, you can: * Configure how your exported users are listed by providing a **User Attribute** by which users should be sorted (as well as whether the users should be sorted in ascending or descending order) diff --git a/articles/extensions/using-provided-extensions.md b/articles/extensions/using-provided-extensions.md index e15cadd277..6581cc99ab 100644 --- a/articles/extensions/using-provided-extensions.md +++ b/articles/extensions/using-provided-extensions.md @@ -1,5 +1,10 @@ --- description: Links and information on using Auth0's provided extensions. +topics: + - extensions +contentType: + - index +useCase: extensibility-extensions --- # Using Auth0's Provided Extensions diff --git a/articles/extensions/visual-studio-team-services-deploy.md b/articles/extensions/visual-studio-team-services-deploy.md index 7ebc668765..3c62c18309 100644 --- a/articles/extensions/visual-studio-team-services-deploy.md +++ b/articles/extensions/visual-studio-team-services-deploy.md @@ -1,10 +1,16 @@ --- -description: The Visual Studio Team Services Deployments extension allows you to deploy Rules, Hosted Pages and Database Connection scripts from Visual Studio Team Services to Auth0. +description: The Visual Studio Team Services Deployments extension allows you to deploy Rules, Universal Login pages and database connection scripts from Visual Studio Team Services to Auth0. +topics: + - extensions + - vs-team-services-deployments +contentType: + - how-to +useCase: extensibility-extensions --- # Visual Studio Team Services Deployments -The **Visual Studio Team Services Deployments** extension allows you to deploy [Rules](/rules), Database Connection scripts and hosted pages from Visual Studio Team Services to Auth0. You can configure a Visual Studio Team Services project, keep all of your scripts there, and have them automatically deployed to Auth0 whenever you push changes to your project. +The **Visual Studio Team Services Deployments** extension allows you to deploy [rules](/rules), rules configs, connections, database connection scripts, clients, client grants, resource servers, Universal Login pages and email templates from Visual Studio Team Services to Auth0. You can configure a Visual Studio Team Services project, keep all of your scripts there, and have them automatically deployed to Auth0 whenever you push changes to your project. ## Configure the Auth0 Extension @@ -14,15 +20,21 @@ To install and configure this extension, click on the **Visual Studio Team Servi Set the following configuration variables: -* **TFS_TYPE**: The type of repository, choose from TFVC or Git -* **TFS_PROJECT**: The project from which you want to deploy rules and database scripts. -* **TFS_BRANCH**: The branch we should monitor for commits. -* **TFS_INSTANCE**: Your Visual Studio Team Services instance name (without .visualstudio.com). -* **TFS_COLLECTION**: Your visualstudio collection -* **TFS_USERNAME**: Your Visual Studio Team Services username -* **TFS_TOKEN**: Your personal Access Token for Visual Studio Team Services, for details on how to configure one refer to [Configure a Personal Access Token](#configure-a-personal-access-token) below. +* **TYPE**: The type of repository, choose from TFVC or Git +* **REPOSITORY**: The project from which you want to deploy rules and database scripts. To use a specific repository within a project, format your input value as follows: `projectName/repoName`. +* **BRANCH**: The branch we should monitor for commits. +* **INSTANCE**: Your Visual Studio Team Services instance name (without .visualstudio.com). +* **COLLECTION**: Your Visual Studio collection (DefaultCollection for Azure DevOps). +* **USERNAME**: Your Visual Studio Team Services username +* **TOKEN**: Your personal Access Token for Visual Studio Team Services, for details on how to configure one refer to [Configure a Personal Access Token](#configure-a-personal-access-token) below. +* **BASE_DIR**: The base directory, where all your tenant settings are stored +* **AUTO_REDEPLOY**: If enabled, the extension redeploys the last successful configuration in the event of a deployment failure. Manual deployments and validation errors does not trigger auto-redeployment * **SLACK_INCOMING_WEBHOOK**: Webhook URL for Slack used to notify you of successful and failed deployments. +::: note +Some of the configuration variables were changed in version **2.5.0** of this extension. If you are updating the extension from a prior version, make sure that you update your configuration accordingly. +::: + Once you have provided this information, click **Install**. ## Configure a Personal Access Token @@ -41,7 +53,7 @@ Once you have provided this information, click **Install**. ![Creating the Access Token](/media/articles/extensions/visual-studio-ts/create-token.png) -5. Once the token is created, you will need to copy right away as it is not saved. Use this value as your **TFS_TOKEN**. +5. Once the token is created, you will need to save its value manually right away. Use this value as your **TFS_TOKEN**. ![Copy Access Token](/media/articles/extensions/visual-studio-ts/copy-token.png) @@ -59,11 +71,11 @@ Once you agree, you will be directed to the **Visual Studio Team Services Integr ![Visual Studio Team Services Integration Page](/media/articles/extensions/visual-studio-ts/vsts-integration.png) -Copy the **Payload URL** and **HTTP headers** values. You will use them in order to configure the Visual Studio Team Services Webhook in the next step. +Copy the **Payload URL** and **HTTP headers** values. You will use them to configure the Visual Studio Team Services Webhook in the next step. ## Configure the Visual Studio Team Services Webhook -Once you have configured your Auth0 Extension, you will need to configure the the Visual Studio Team Services Webhook to complete the integration. +Once you have configured your Auth0 Extension, you will need to configure the Visual Studio Team Services Webhook to complete the integration. In your Visual Studio Team Services account, go to **Overview** and click on the name the project being used for the integration, then click **Service Hooks**. @@ -73,7 +85,7 @@ Then click the link **Create the first subscription for this project**. Then sel ![Select Web Hooks](/media/articles/extensions/visual-studio-ts/web-hooks.png) -Then click the **Next** button, choose the trigger for the event and the filters are optional. Then click **Next**. +Then click the **Next** button, choose the trigger for the event, and the filters are optional. Then click **Next**. ![Configure Web Hook](/media/articles/extensions/visual-studio-ts/configure-web-hook.png) @@ -83,14 +95,18 @@ For the **URL** field, enter the **Payload URL** from the previous step along wi Once you have set up the webhook in Visual Studio Team Services using the provided information, you are ready to start committing to your project. -Your project should have a predefined structure: -- Rules are expected to be found under `rules` directory. -- Database connections are expected to be found under `database-connections` directory. -- Hosted pages are expected to be found under `pages` directory. +With each commit you push to your configured Visual Studio Team Services project, the webhook will call the extension to initiate a deployment if changes were made to one of these folders: +- `clients` +- `grants` +- `emails` +- `resource-servers` +- `connections` +- `database-connections` +- `rules-configs` +- `rules` +- `pages` -With each commit you push to your configured Visual Studio Team Services project, the webhook will call the extension to initiate a deployment if changes were made to these predefined directories. - -The **Deploy** button on the **Deployments** tab of the extension allows you to manually deploy the Rules, Pages and Database Connection scripts that you already have in your Visual Studio Team Services project. This is useful if your project already contains items that you want to deploy once you have set up the extension or if you have accidentally deleted some scripts in Auth0 and need to redeploy the latest version of your project. +The **Deploy** button on the **Deployments** tab of the extension allows you to manually deploy the Rules, Pages, and Database Connection scripts that you already have in your Visual Studio Team Services project. This is useful if your project already contains items that you want to deploy once you have set up the extension or if you have accidentally deleted some scripts in Auth0 and need to redeploy the latest version of your project. ::: panel-warning Full Deployment To maintain a consistent state, the extension will always do a full deployment of the contents of these folders. **Any rules, pages or database connection scripts that exist in Auth0 but not in your Visual Studio Team Services project will be deleted**. @@ -113,31 +129,67 @@ For a generic Custom Database Connection, only the `login.js` script is required You can find examples in [the Auth0 Samples repository](https://github.com/auth0-samples/github-source-control-integration/tree/master/database-connections/my-custom-db). While the samples were authored for GitHub, it will work for a Visual Studio Team Services integration as well. -### Deploy Hosted Pages +#### Deploy Database Connection Settings + +To deploy Database Connection settings, you must create `database-connections/[connection-name]/database.json`. + +_This will work only for Auth0 connections (`strategy === auth0`), for non-Auth0 connections, use `connections`._ + +_Support for using `settings.json` has been deprecated in favor of `database.json` since v3.1.1 of the extension and may be dropped in a future release._ + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Connections/patch_connections_by_id) for more info on allowed attributes for Connections. + +### Deploy Connections + +To deploy a connection, you must create a JSON file under the `connections` directory of your Visual Studio Team Services project. Example: + +__facebook.json__ +```json +{ + "name": "facebook", + "strategy": "facebook", + "enabled_clients": [ + "my-client" + ], + "options": {} +} +``` + +<%= include('./_includes/_embedded-clients-array') %> + +_This will work only for non-Auth0 connections (`strategy !== auth0`), for Auth0 connections, use `database-connections`._ + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Connections/post_connections) for more info on allowed attributes for Connections. + +### Deploy Universal Login Pages + +The supported pages are: -The supported hosted pages are: - `error_page` - `guardian_multifactor` - `login` - `password_reset` -To deploy a page, you must create an HTML file under the `pages` directory of your Visual Studio Team Services project. For each HTML page you need to create a JSON file (with the same name) that will be used to mark the page as enabled or disabled. For example, in order to deploy an `error_page`, you would create two files: +To deploy a page, you must create an HTML file under the `pages` directory of your Visual Studio Team Services project. For each HTML page, you need to create a JSON file (with the same name) that will be used to mark the page as enabled or disabled. For example, to deploy a `password_reset`, you would create two files: ```text -your-project/pages/error_page.html -your-project/pages/error_page.json +your-bitbucket-repo/pages/password_reset.html +your-bitbucket-repo/pages/password_reset.json ``` -To enable the page the `error_page.json` would contain the following: +To enable the page, the `password_reset.json` would contain the following: ```json { "enabled": true } ``` + +<%= include('./_includes/_use-default-error') %> + ### Deploy Rules -To deploy a rule, you must first create a JavaScript file under the `rules` directory of your Visual Studio Team Services project. Each Rule must be in its own `.js` file. +To deploy a rule, you must first create a JavaScript file under the `rules` directory of your Visual Studio Team Services project. Each Rule must be in its own JavaScript file. For example, if you create the file `rules/set-country.js`, the extension will create a Rule in Auth0 with the name `set-country`. @@ -145,10 +197,6 @@ For example, if you create the file `rules/set-country.js`, the extension will c If you plan to use source control integration for an existing account, first rename your Rules in Auth0 to match the name of the files you will be deploying to this directory. ::: -You can mark rules as manual. In that case, the source control extension will not delete or update them. To mark a rule navigate to the **Rules Configuration** tab of the **Visual Studio Team Services Integration** page. Toggle the **Manual Rule** switch for the rules you want to mark as manual. Click **Update Manual Rules** to save your changes. - -![Mark rules as manual](/media/articles/extensions/visual-studio-ts/manual-rule.png) - You can also control the Rule order and status (`enabled`/`disabled`) by creating a JSON file with the same name as your JavaScript file. For this example, you would create a file named `rules/set-country.json`. __set-country.js__ @@ -162,7 +210,7 @@ function (user, context, callback) { ``` __set-country.json__ -```javascript +```json { "enabled": false, "order": 15, @@ -174,16 +222,167 @@ You can find a `login_success` example in [the Auth0 Samples repository](https:/ #### Set Rule Order -To avoid conflicts, you are cannot set multiple Rules of the same order. However, you can create a JSON file for each rule, and within each file, assign a value for `order`. We suggest using number values that allow for reordering with less risk for conflict. For example, assign a value of `10` to the first Rule and `20` to the second Rule, rather than using values of `1` and `2`, respectively). +To avoid conflicts, you cannot set multiple Rules of the same order. However, you can create a JSON file for each rule, and within each file, assign a value for `order`. We suggest using number values that allow for reordering with less risk of conflict. For example, assign a value of `10` to the first Rule and `20` to the second Rule, rather than using values of `1` and `2`, respectively). #### Set the Stage -After you deploy a Rule, you cannot change its stage, or the area where the Rule executes. +After you deploy a Rule, you cannot change its stage or the area where the Rule executes. If you need the rule to execute in a different stage, you must create a new Rule with the updated stage and delete the original Rule. Please note that you may have only a single Rule for the `user_registration` and `login_failure` stages. +### Deploy Rules Configs + +To deploy a rule config, you must create a JSON file under the `rules-configs` directory of your Visual Studio Team Services project. Example: + +__secret_number.json__ +```json +{ + "key": "secret_number", + "value": 42 +} +``` + +### Deploy Clients + +To deploy a client, you must create a JSON file under the `clients` directory of your Visual Studio Team Services project. Example: + +__my-client.json__ +```json +{ + "name": "my-client" +} +``` + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Clients/post_clients) for more info on allowed attributes for Clients and Client Grants. + +### Deploy Clients Grants + +You can specify the client grants for each client by creating a JSON file in the `grants` directory. + +__my-client-api.json__ +```json +{ + "client_id": "my-client", + "audience": "https://myapp.com/api/v1", + "scope": [ + "read:users" + ] +} +``` + +<%= include('./_includes/_deployment-extension') %> + +### Deploy Resource Servers + +To deploy a resource server, you must create a JSON file under the `resource-servers` directory of your Visual Studio Team Services project. Example: + +__my-api.json__ +```json +{ + "name": "my-api", + "identifier": "https://myapp.com/api/v1", + "scopes": [ + { + "value": "read:users", + "description": "Allows getting user information" + } + ] +} +``` + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Resource_Servers/post_resource_servers) for more info on allowed attributes for Resource Servers. + +### Deploy Email Provider + +To deploy an email provider, you must create `provider.json` file under the `emails` directory of your Visual Studio Team Services project. Example: + +__provider.json__ +```json +{ + "name": "smtp", + "enabled": true, + "credentials": { + "smtp_host": "smtp.server.com", + "smtp_port": 25, + "smtp_user": "smtp_user", + "smtp_pass": "smtp_secret_password" + } +} +``` + +See [Management API v2 Docs](https://auth0.com/docs/api/management/v2#!/Emails/patch_provider) for more info on allowed attributes for Email Provider. + +### Deploy Email Templates + +The supported email templates are: +- `verify_email` +- `reset_email` +- `welcome_email` +- `blocked_account` +- `stolen_credentials` +- `enrollment_email` +- `mfa_oob_code` + +To deploy an email template, you must create an HTML file under the `emails` directory of your Visual Studio Team Services project. For each HTML file, you need to create a JSON file (with the same name) with additional options for that template. For example, to deploy a `blocked_account` template, you would create two files: + +```text +your-project/emails/blocked_account.html +your-project/emails/blocked_account.json +``` + +__blocked_account.json__ +```json +{ + "template": "blocked_account", + "from": "", + "subject": "", + "resultUrl": "", + "syntax": "liquid", + "body": "./blocked_account.html", + "urlLifetimeInSeconds": 432000, + "enabled": true +} +``` + +## Excluded records + +You can exclude the following records from the deployment process: `rules`, `clients`, `databases`, `connections` and `resourceServers`. If excluded, the records will not be modified by deployments. + +![](/media/articles/extensions/deploy-extensions/excluded-rules.png) + +## Keywords Mapping + +Beginning with version **3.0.0**, you can use keywords mapping to manage your secrets and tenant-based environment variables. + +There are two ways to use the keyword mappings. You can either wrap the key using `@` symbols (e.g., `@@key@@`), or you can wrap the key using `#` symbols (e.g., `##key##`). + + - If you use `@` symbols, your value will be converted from a JavaScript object or value to a JSON string. + + - If you use `#` symbols, Auth0 will perform a literal replacement. + +This is useful for something like specifying different variables across your environments. For example, you could specify different JWT timeouts for your Development, QA/Testing, and Production environments. + +Refer to the snippets below for sample implementations: + +__Client.json__ +```json +{ + ... + "callbacks": [ + "##ENVIRONMENT_URL##/auth/callback" + ], + "jwt_configuration": { + "lifetime_in_seconds": ##JWT_TIMEOUT##, + "secret_encoded": true + } + ... +} +``` + +![](/media/articles/extensions/deploy-extensions/mappings.png) + ## Track Deployments To track your deployments, navigate to the [Extensions](${manage_url}/#/extensions) page, then **Installed Extensions** and click on the row for the **Visual Studio Team Services Deployments** extension, and select the **Deployments** tab. You will see a list of all deployments. diff --git a/articles/flows/concepts/auth-code-pkce.md b/articles/flows/concepts/auth-code-pkce.md new file mode 100644 index 0000000000..5b0677b14e --- /dev/null +++ b/articles/flows/concepts/auth-code-pkce.md @@ -0,0 +1,79 @@ +--- +title: Authorization Code Flow with Proof Key for Code Exchange (PKCE) +description: Learn how the Authorization Code flow with Proof Key for Code Exchange (PKCE) works and why you should use it for native and mobile apps. +topics: + - authorization-code + - pkce + - api-authorization + - grants + - authentication + - native-apps + - mobile-apps +contentType: concept +useCase: + - secure-api + - call-api + - add-login +--- +# Authorization Code Flow with Proof Key for Code Exchange (PKCE) + +When public clients (e.g., native and single-page applications) request Access Tokens, some additional security concerns are posed that are not mitigated by the Authorization Code Flow alone. This is because: + +**Native apps** + +* Cannot securely store a Client Secret. Decompiling the app will reveal the Client Secret, which is bound to the app and is the same for all users and devices. +* May make use of a custom URL scheme to capture redirects (e.g., MyApp://) potentially allowing malicious applications to receive an Authorization Code from your Authorization Server. + +**Single-page apps** + +* Cannot securely store a Client Secret because their entire source is available to the browser. + +To mitigate this, OAuth 2.0 provides a version of the Authorization Code Flow which makes use of a Proof Key for Code Exchange (PKCE) (defined in [OAuth 2.0 RFC 7636](https://tools.ietf.org/html/rfc7636)). + +The PKCE-enhanced Authorization Code Flow introduces a secret created by the calling application that can be verified by the authorization server; this secret is called the Code Verifier. Additionally, the calling app creates a transform value of the Code Verifier called the Code Challenge and sends this value over HTTPS to retrieve an Authorization Code. This way, a malicious attacker can only intercept the Authorization Code, and they cannot exchange it for a token without the Code Verifier. + +## How it works + +Because the PKCE-enhanced Authorization Code Flow builds upon the [standard Authorization Code Flow](/flows/concepts/auth-code), the steps are very similar. + +![Authorization Code Flow with PKCE Authentication Sequence](/media/articles/flows/concepts/auth-sequence-auth-code-pkce.png) + +1. The user clicks **Login** within the application. +2. Auth0's SDK creates a cryptographically-random `code_verifier` and from this generates a `code_challenge`. +3. Auth0's SDK redirects the user to the Auth0 Authorization Server ([**/authorize** endpoint](/api/authentication#authorization-code-grant-pkce-)) along with the `code_challenge`. +4. Your Auth0 Authorization Server redirects the user to the login and authorization prompt. +5. The user authenticates using one of the configured login options and may see a consent page listing the permissions Auth0 will give to the application. +6. Your Auth0 Authorization Server stores the `code_challenge` and redirects the user back to the application with an authorization `code`, which is good for one use. +7. Auth0's SDK sends this `code` and the `code_verifier` (created in step 2) to the Auth0 Authorization Server ([**/oauth/token** endpoint](/api/authentication?http#authorization-code-flow-with-pkce44)). +8. Your Auth0 Authorization Server verifies the `code_challenge` and `code_verifier`. +9. Your Auth0 Authorization Server responds with an ID Token and Access Token (and optionally, a Refresh Token). +10. Your application can use the Access Token to call an API to access information about the user. +11. The API responds with requested data. + +<%= include('../../_includes/_refresh_token_rotation_panel.md') %> + +## How to implement it + +The easiest way to implement the Authorization Code Flow with PKCE is to follow our [Native Quickstarts](/quickstart/native) or [Single-Page Quickstarts](/quickstart/spa). + +Depending on your application type, you can also use our mobile or single-page app SDKs: + +**Mobile** + +* [Auth0 Swift SDK](/libraries/auth0-swift) +* [Auth0 Android SDK](/libraries/auth0-android) + +**Single-page** + +* [Auth0 Single-Page App SDK](/libraries/auth0-spa-js) +* [Auth0 React SDK](/libraries/auth0-react) + +<%= include('../../_includes/_refresh_token_rotation_recommended.md') %> + +You can follow our tutorials to use our API endpoints to [Add Login Using the Authorization Code Flow with PKCE](/flows/guides/auth-code-pkce/add-login-auth-code-pkce) or [Call Your API Using the Authorization Code Flow with PKCE](/flows/guides/auth-code-pkce/call-api-auth-code-pkce). + +## Keep reading + +- Learn how to personalize your user's login experience using [rules](/rules) and [hooks](/hooks) +- Learn more about [tokens](/tokens) and [token storage](/tokens/concepts/token-storage) +- Explore [Which OAuth 2.0 Flow Should I Use?](/api-auth/which-oauth-flow-to-use) diff --git a/articles/flows/concepts/auth-code.md b/articles/flows/concepts/auth-code.md new file mode 100644 index 0000000000..a01f39b566 --- /dev/null +++ b/articles/flows/concepts/auth-code.md @@ -0,0 +1,46 @@ +--- +title: Authorization Code Flow +description: Learn how the Authorization Code flow works and why you should use it for regular web apps. +topics: + - authorization-code + - api-authorization + - grants + - authentication + - regular-web-apps +contentType: concept +useCase: + - secure-api + - call-api + - add-login +--- +# Authorization Code Flow + +Because regular web apps are server-side apps where the source code is not publicly exposed, they can use the Authorization Code Flow (defined in [OAuth 2.0 RFC 6749, section 4.1](https://tools.ietf.org/html/rfc6749#section-4.1)), which exchanges an Authorization Code for a token. Your app must be server-side because during this exchange, you must also pass along your application's Client Secret, which must always be kept secure, and you will have to store it in your client. + +## How it works + +![Authorization Code Flow Authentication Sequence](/media/articles/flows/concepts/auth-sequence-auth-code.png) + + +1. The user clicks **Login** within the regular web application. +2. Auth0's SDK redirects the user to the Auth0 Authorization Server ([**/authorize** endpoint](/api/authentication#authorization-code-grant)). +3. Your Auth0 Authorization Server redirects the user to the login and authorization prompt. +4. The user authenticates using one of the configured login options and may see a consent page listing the permissions Auth0 will give to the regular web application. +5. Your Auth0 Authorization Server redirects the user back to the application with an authorization `code`, which is good for one use. +6. Auth0's SDK sends this `code` to the Auth0 Authorization Server ([**/oauth/token** endpoint](/api/authentication?http#authorization-code-flow43)) along with the application's Client ID and Client Secret. +7. Your Auth0 Authorization Server verifies the code, Client ID, and Client Secret. +8. Your Auth0 Authorization Server responds with an ID Token and Access Token (and optionally, a Refresh Token). +9. Your application can use the Access Token to call an API to access information about the user. +10. The API responds with requested data. + +## How to implement it + +The easiest way to implement the Authorization Code Flow is to follow our [Regular Web App Quickstarts](/quickstart/webapp). + +Finally, you can follow our tutorials to use our API endpoints to [Add Login Using the Authorization Code Flow](/flows/guides/auth-code/add-login-auth-code) or [Call Your API Using the Authorization Code Flow](/flows/guides/auth-code/call-api-auth-code). + +## Keep reading + +- Learn how to personalize your user's login experience using [rules](/rules) and [hooks](/hooks) +- Learn more about [tokens](/tokens) and [token storage](/tokens/concepts/token-storage) +- Explore [Which OAuth 2.0 Flow Should I Use?](/api-auth/which-oauth-flow-to-use) \ No newline at end of file diff --git a/articles/flows/concepts/client-credentials.md b/articles/flows/concepts/client-credentials.md new file mode 100644 index 0000000000..eebe4ee5c4 --- /dev/null +++ b/articles/flows/concepts/client-credentials.md @@ -0,0 +1,42 @@ +--- +title: Client Credentials Flow +description: Learn how the Client Credentials flow works and why you should use it for machine-to-machine (M2M) apps. +topics: + - M2M + - client-credentials + - api-authorization + - grants + - authentication + - m2m-apps +contentType: concept +useCase: + - secure-api + - call-api +--- +# Client Credentials Flow + +With machine-to-machine (M2M) applications, such as CLIs, daemons, or services running on your back-end, the system authenticates and authorizes the app rather than a user. For this scenario, typical authentication schemes like username + password or social logins don't make sense. Instead, M2M apps use the Client Credentials Flow (defined in [OAuth 2.0 RFC 6749, section 4.4](https://tools.ietf.org/html/rfc6749#section-4.4)), in which they pass along their Client ID and Client Secret to authenticate themselves and get a token. + +## How it works + +![Client Credentials Flow Authentication Sequence](/media/articles/flows/concepts/auth-sequence-client-credentials.png) + + +1. Your app authenticates with the Auth0 Authorization Server using its Client ID and Client Secret ([**/oauth/token** endpoint](/api/authentication?http#client-credentials-flow)). +2. Your Auth0 Authorization Server validates the Client ID and Client Secret. +3. Your Auth0 Authorization Server responds with an Access Token. +4. Your application can use the Access Token to call an API on behalf of itself. +5. The API responds with requested data. + + +## How to implement it + +The easiest way to implement the Client Credentials Flow is to follow our [Backend Quickstarts](/quickstart/backend). + +You can also follow our tutorial to use our API endpoints to [Call Your API Using the Client Credentials Flow](/flows/guides/client-credentials/call-api-client-credentials). + +## Keep reading + +- Learn how to personalize your user's login experience using [rules](/rules) and [hooks](/hooks) +- Learn more about [tokens](/tokens) and [token storage](/tokens/concepts/token-storage) +- Explore [Which OAuth 2.0 Flow Should I Use?](/api-auth/which-oauth-flow-to-use) \ No newline at end of file diff --git a/articles/flows/concepts/device-auth.md b/articles/flows/concepts/device-auth.md new file mode 100644 index 0000000000..99eddae8b6 --- /dev/null +++ b/articles/flows/concepts/device-auth.md @@ -0,0 +1,63 @@ +--- +title: Device Authorization Flow +description: Learn how the Device Authorization flow works and why you should use it for input-constrained devices, such as smart TVs and media consoles. For use with native apps. +topics: + - input-constrained-devices + - device-flow + - api-authorization + - grants + - flows + - authorization + - mobile-apps + - desktop-apps + - native-apps +contentType: concept +useCase: + - add-login + - secure-api + - call-api +--- +# Device Authorization Flow + +With input-constrained devices that connect to the internet, rather than authenticate the user directly, the device asks the user to go to a link on their computer or smartphone and authorize the device. This avoids a poor user experience for devices that do not have an easy way to enter text. To do this, device apps use the Device Authorization Flow (ratified in [OAuth 2.0](https://tools.ietf.org/html/rfc8628)), in which they pass along their Client ID to initiate the authorization process and get a token. + +## How it works + +The Device Authorization Flow contains two different paths; one occurs on the device requesting authorization and the other occurs in a browser. The browser flow path, wherein a device code is bound to the session in the browser, occurs in parallel to part of the device flow path. + +![Device Authorization Sequence](/media/articles/flows/concepts/auth-sequence-device-auth.png) + +### Device Flow + +1. The user starts the app on the device. +2. The device app requests authorization from the Auth0 Authorization Server using its Client ID (**/oauth/device/code** endpoint). +3. The Auth0 Authorization Server responds with a `device_code`, `user_code`, `verification_uri`, `verification_uri_complete` `expires_in` (lifetime in seconds for `device_code` and `user_code`), and polling `interval`. +4. The device app asks the user to activate using their computer or smartphone. The app may accomplish this by: + - asking the user to visit the `verification_uri` and enter the `user_code` after displaying these values on-screen + - asking the user to interact with either a QR Code or shortened URL with embedded user code generated from the `verification_uri_complete` + - directly navigating to the verification page with embedded user code using `verification_uri_complete`, if running natively on a browser-based device +5. The device app begins polling your Auth0 Authorization Server for an Access Token (**/oauth/token** endpoint) using the time period specified by `interval` and counting from receipt of the last polling request's response. The device app continues polling until either the user completes the browser flow path or the user code expires. +6. When the user successfully completes the browser flow path, your Auth0 Authorization Server responds with an Access Token (and optionally, a Refresh Token). The device app should now forget its `device_code` because it will expire. +7. Your device app can use the Access Token to call an API to access information about the user. +8. The API responds with requested data. + +### Browser Flow + +1. The user visits the `verification_uri` on their computer, enters the `user_code` and confirms that the device that is being activated is displaying the `user_code`. If the user visits the `verification_uri_complete` by any other mechanism (such as by scanning a QR code), only the device confirmation will be needed. +2. Your Auth0 Authorization Server redirects the user to the login and consent prompt, if needed. +3. The user authenticates using one of the configured login options and may see a consent page asking to authorize the device app. +4. Your device app is authorized to access the API. + +## How to implement it + +The easiest way to implement the Device Authorization Flow is to follow our tutorial: [Call API Using Device Authorization Flow](/flows/guides/device-auth/call-api-device-auth). + +## Force device reauthorization + +To force the user to reauthorize a device, you must revoke the [Refresh Token](/tokens/guides/revoke-refresh-tokens) assigned to the device. To learn how, see [Unlink Devices from Users](/dashboard/guides/users/unlink-user-devices). Note that the device will not be forced to reauthorize until the current Access Token expires and the application tries to use the revoked Refresh Token. + +## Keep reading + +- Learn how to personalize your user's login experience using [rules](/rules) and [hooks](/hooks) +- Learn more about [tokens](/tokens) and [token storage](/tokens/concepts/token-storage) +- Explore [Which OAuth 2.0 Flow Should I Use?](/api-auth/which-oauth-flow-to-use) \ No newline at end of file diff --git a/articles/flows/concepts/implicit.md b/articles/flows/concepts/implicit.md new file mode 100644 index 0000000000..fd8a3d2f8f --- /dev/null +++ b/articles/flows/concepts/implicit.md @@ -0,0 +1,59 @@ +--- +title: Implicit Flow with Form Post +description: Learn how the Implicit flow with Form Post works and why you should use it for single-page apps (SPAs) that need only an ID Token to perform user authentication. +topics: + - authorization-code + - implicit + - hybrid + - api-authorization + - grants + - authentication + - SPA + - single-page apps +contentType: concept +useCase: + - secure-api + - call-api + - add-login +--- +# Implicit Flow with Form Post + +::: warning +The [OAuth 2.0 BCP](https://tools.ietf.org/html/draft-ietf-oauth-security-topics-09#section-2.1.2) states that you **should not** use the Implicit Flow to request [Access Tokens](/tokens/access-tokens) from the Authorization Server. For this reason, we recommend that you use the [Authorization Code Flow with PKCE](/flows/concepts/auth-code-pkce) if your single-page app (SPA) requires Access Tokens for [Cross-Origin Resource Sharing (CORS)](/cross-origin-authentication#what-is-cross-origin-authentication) requests (along with [Refresh Token Rotation](/tokens/concepts/refresh-token-rotation) if your SPA needs to maintain session). +::: + +As an alternative to the [Authorization Code Flow](/flows/concepts/auth-code), the OAuth 2.0 spec includes the Implicit Flow intended for Public Clients, or applications which are unable to securely store Client Secrets. As part of the authorization response, the Implicit Flow returns an Access Token rather than an Authorization Code that must be exchanged at the token endpoint. + +While this is no longer considered a best practice for requesting Access Tokens, it does offer a streamlined workflow if the application needs only an ID Token to perform user authentication. + +## How it works + +In the Implicit Flow, issued tokens are short-lived, and Refresh Tokens are not available. + +::: warning +You should use this flow for login-only use cases; if you need to request Access Tokens while logging the user in so you can call your API, use the [Authorization Code Flow with PKCE](/flows/concepts/auth-code-pkce). +::: + +![Implicit Flow with Form Post Authentication Sequence](/media/articles/flows/concepts/auth-sequence-implicit-form-post.png) + +1. The user clicks **Login** in the app. +2. Auth0's SDK redirects the user to the Auth0 Authorization Server (**/authorize** endpoint) passing along a `response_type` parameter of `id_token` that indicates the type of requested credential. It also passes along a `response_mode` parameter of `form_post` to ensure security. +3. Your Auth0 Authorization Server redirects the user to the login and authorization prompt. +4. The user authenticates using one of the configured login options and may see a consent page listing the permissions Auth0 will give to the app. +5. Your Auth0 Authorization Server redirects the user back to the app with an ID Token. + +## How to implement it + +You can use our [Express OpenID Connect SDK](https://www.npmjs.com/package/express-openid-connect) to securely implement the Implicit Flow. If you use our [Javascript SDKs](/libraries), please ensure you are implementing mitigations that are appropriate for your architecture. + +::: note +The [Auth0 Single-Page App SDK](/libraries/auth0-spa-js) and [Single-Page Quickstarts](/quickstart/spa) adhere to the new recommendations and use the [Authorization Code Flow with PKCE](/flows/concepts/auth-code-pkce). +::: + +Finally, you can follow our tutorials to use our API endpoints to [Add Login Using the Implicit Flow with Form Post](/flows/guides/implicit/add-login-implicit). + +## Keep reading + +- Learn how to personalize your user's login experience using [rules](/rules) and [hooks](/hooks) +- Learn more about [tokens](/tokens) and [token storage](/tokens/concepts/token-storage) +- Explore [Which OAuth 2.0 Flow Should I Use?](/api-auth/which-oauth-flow-to-use) \ No newline at end of file diff --git a/articles/flows/guides/auth-code-pkce/add-login-auth-code-pkce.md b/articles/flows/guides/auth-code-pkce/add-login-auth-code-pkce.md new file mode 100644 index 0000000000..03e57d2ac3 --- /dev/null +++ b/articles/flows/guides/auth-code-pkce/add-login-auth-code-pkce.md @@ -0,0 +1,68 @@ +--- +title: Add Login Using the Authorization Code Flow with PKCE +description: Learn how to add login to your native, mobile, or single-page application using the Authorization Code Flow with Proof Key for Code Exchange (PKCE). +toc: true +topics: + - api-authentication + - oidc + - authorization-code + - pkce + - native-apps + - mobile-apps + - single-page-apps +contentType: tutorial +useCase: + - add-login +--- +# Add Login Using the Authorization Code Flow with PKCE + +::: note +This tutorial will help you add login to your native, mobile, or single-page app using the Authorization Code Flow with PKCE. If you want to learn how the flow works and why you should use it, see [Authorization Code Flow with Proof Key for Code Exchange (PKCE)](/flows/concepts/auth-code-pkce). If you want to learn to call your API from a native, mobile, or single-page app, see [Call Your API Using Authorization Code Flow with PKCE](/flows/guides/auth-code-pkce/call-api-auth-code-pkce). +::: + +Auth0 makes it easy for your app to implement the Authorization Code Flow with Proof Key for Code Exchange (PKCE) using: + +* [Auth0 Mobile SDKs](/libraries#auth0-sdks) and [Auth0 Single-Page App SDK](/libraries/auth0-spa-js): The easiest way to implement the flow, which will do most of the heavy-lifting for you. Our [Mobile Quickstarts](/quickstart/native) and [Single-Page App Quickstarts](/quickstart/spa) will walk you through the process. +* Authentication API: If you prefer to roll your own, keep reading to learn how to call our API directly. + +Following successful login, your application will have access to the user's [ID Token](/tokens/concepts/id-tokens) and [Access Token](/tokens/concepts/access-tokens). The ID Token will contain basic user profile information, and the Access Token can be used to call the Auth0 /userinfo endpoint or your own protected APIs. + +## Prerequisites + +**Before beginning this tutorial:** + +* [Register your Application with Auth0](/dashboard/guides/applications/register-app-native). + * Select an **Application Type** of **Native** or **Single-Page App**, depending on your application type. + * Add an **Allowed Callback URL** of **`YOUR_CALLBACK_URL`**. Your callback URL format will vary depending on your application type and platform. For details about the format for your application type and platform, see our [Native/Mobile Quickstarts](/quickstart/native) and [Single-Page App Quickstarts](/quickstart/spa). + * Make sure your Application's **[Grant Types](/dashboard/guides/applications/update-grant-types)** include **Authorization Code**. + +## Steps + +Each time your user chooses to authenticate you will need to: + +1. [Create a code verifier](#create-a-code-verifier): +Generate a `code_verifier` that will be sent to Auth0 to request tokens. +2. [Create a code challenge](#create-a-code-challenge): +Generate a `code_challenge` from the `code_verifier` that will be sent to Auth0 to request an `authorization_code`. +3. [Authorize the user](#authorize-the-user): +Request the user's authorization and redirect back to your app with an `authorization_code`. +4. [Request Tokens](#request-tokens): +Exchange your `authorization_code` and `code_verifier` for tokens. + +Optional: [Explore Sample Use Cases](#sample-use-cases) + +<%= include('./includes/create-code-verifier') %> + +<%= include('./includes/create-code-challenge') %> + +<%= include('./includes/authorize-user-add-login') %> + +<%= include('./includes/request-tokens') %> + +<%= include('./includes/sample-use-cases-add-login') %> + +## Keep reading + +- [OAuth 2.0 framework](/protocols/oauth2) +- [OpenID Connect (OIDC) protocol](/protocols/oidc) +- [Tokens](/tokens) diff --git a/articles/flows/guides/auth-code-pkce/call-api-auth-code-pkce.md b/articles/flows/guides/auth-code-pkce/call-api-auth-code-pkce.md new file mode 100644 index 0000000000..8f737d50b0 --- /dev/null +++ b/articles/flows/guides/auth-code-pkce/call-api-auth-code-pkce.md @@ -0,0 +1,79 @@ +--- +title: Call API Using Authorization Code Flow with PKCE +description: Learn how to call your API from a native, mobile, or single-page application using the Authorization Code flow using Proof Key for Code Exchange (PKCE). +toc: true +topics: + - api-authentication + - oidc + - authorization-code + - pkce + - native-apps + - mobile-apps + - single-page-apps +contentType: tutorial +useCase: + - secure-api + - call-api +--- +# Call Your API Using the Authorization Code Flow with PKCE + +::: note +This tutorial will help you call your own API from a native, mobile, or single-page app using the Authorization Code Flow with PKCE. If you want to learn how the flow works and why you should use it, see [Authorization Code Flow with Proof Key for Code Exchange (PKCE)](/flows/concepts/auth-code-pkce). If you want to learn to add login to your native, mobile, or single-page app, see [Add Login Using Authorization Code Flow with PKCE](/flows/guides/auth-code-pkce/add-login-auth-code-pkce). +::: + +Auth0 makes it easy for your app to implement the Authorization Code Flow with Proof Key for Code Exchange (PKCE) using: + +* [Auth0 Mobile SDKs](/libraries#auth0-sdks) and [Auth0 Single-Page App SDK](/libraries/auth0-spa-js): The easiest way to implement the flow, which will do most of the heavy-lifting for you. Our [Mobile Quickstarts](/quickstart/native) and [Single-Page App Quickstarts](/quickstart/spa) will walk you through the process. +* Authentication API: If you prefer to roll your own, keep reading to learn how to call our API directly. + + +## Prerequisites + +**Before beginning this tutorial:** + +* [Register the Application with Auth0](/dashboard/guides/applications/register-app-native). + * Select an **Application Type** of **Native** or **Single-Page App**, depending on your application type. + * Add an **Allowed Callback URL** of **`YOUR_CALLBACK_URL`**. Your callback URL format will vary depending on your application type and platform. For details about the format for your application type and platform, see our [Native/Mobile Quickstarts](/quickstart/native) and [Single-Page App Quickstarts](/quickstart/spa). + * Make sure the Application's **[Grant Types](/dashboard/guides/applications/update-grant-types)** include **Authorization Code**. + * If you want your Application to be able to use [Refresh Tokens](/tokens/concepts/refresh-tokens), make sure the Application's **[Grant Types](/dashboard/guides/applications/update-grant-types)** include **Refresh Token**. + +* [Register your API with Auth0](/architecture-scenarios/mobile-api/part-2#create-the-api) + * If you want your API to receive Refresh Tokens to allow it to obtain new tokens when the previous ones expire, enable **Allow Offline Access**. + +## Steps + +1. [Create a code verifier](#create-a-code-verifier): +Generate a `code_verifier` that will be sent to Auth0 to request tokens. +2. [Create a code challenge](#create-a-code-challenge): +Generate a `code_challenge` from the `code_verifier` that will be sent to Auth0 to request an `authorization_code`. +3. [Authorize the user](#authorize-the-user): +Request the user's authorization and redirect back to your app with an `authorization_code`. +4. [Request Tokens](#request-tokens): +Exchange your `authorization_code` and `code_verifier` for tokens. +5. [Call your API](#call-your-api): +Use the retrieved Access Token to call your API. +6. [Refresh Tokens](#refresh-tokens): +Use a Refresh Token to request new tokens when the existing ones expire. + +Optional: [Explore Sample Use Cases](#sample-use-cases) + + +<%= include('./includes/create-code-verifier') %> + +<%= include('./includes/create-code-challenge') %> + +<%= include('./includes/authorize-user-call-api') %> + +<%= include('./includes/request-tokens') %> + +<%= include('./includes/call-api') %> + +<%= include('./includes/refresh-tokens') %> + +<%= include('./includes/sample-use-cases-call-api') %> + +## Keep reading + +- [OAuth 2.0 framework](/protocols/oauth2) +- [OpenID Connect (OIDC) protocol](/protocols/oidc) +- [Tokens](/tokens) diff --git a/articles/flows/guides/auth-code-pkce/includes/authorize-user-add-login.md b/articles/flows/guides/auth-code-pkce/includes/authorize-user-add-login.md new file mode 100644 index 0000000000..31591db0b8 --- /dev/null +++ b/articles/flows/guides/auth-code-pkce/includes/authorize-user-add-login.md @@ -0,0 +1,63 @@ +## Authorize the User + +Once you've created the `code_verifier` and the `code_challenge`, you'll need to get the user's authorization. This is technically the beginning of the authorization flow, and this step may include one or more of the following processes: + +* Authenticating the user; +* Redirecting the user to an Identity Provider to handle authentication; +* Checking for active Single Sign-on (SSO) sessions; +* Obtaining user consent for the requested permission level, unless consent has been previously given. + +To authorize the user, your app must send the user to the [authorization URL](/api/authentication#authorization-code-grant-pkce-), including the `code_challenge` you generated in the previous step and the method you used to generate the `code_challenge`. + + +### Example authorization URL + +```text +https://${account.namespace}/authorize? + response_type=code& + code_challenge=CODE_CHALLENGE& + code_challenge_method=S256& + client_id=${account.clientId}& + redirect_uri=YOUR_CALLBACK_URL& + scope=SCOPE& + state=STATE +``` + +#### Parameters + +| Parameter Name | Description | +|-----------------|-------------| +| `response_type` | Denotes the kind of credential that Auth0 will return (`code` or `token`). For this flow, the value must be `code`. | +| `code_challenge` | Generated challenge from the `code_verifier`. | +| `code_challenge_method` | Method used to generate the challenge (e.g., S256). The PKCE spec defines two methods, `S256` and `plain`, the former is used in this example and is the **only** one supported by Auth0 since the latter is discouraged. | +| `client_id` |Your application's Client ID. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | +| `redirect_uri` | The URL to which Auth0 will redirect the browser after authorization has been granted by the user. The Authorization Code will be available in the `code` URL parameter. You must specify this URL as a valid callback URL in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings).

      **Warning:** Per the [OAuth 2.0 Specification](https://tools.ietf.org/html/rfc6749#section-3.1.2), Auth0 removes everything after the hash and does *not* honor any fragments. | +| `scope` | Specifies the [scopes](/scopes) for which you want to request authorization, which dictate which claims (or user attributes) you want returned. These must be separated by a space. To get an ID Token in the response, you need to specify a scope of at least `openid`. If you want to return the user's full profile, you can request `openid profile`. You can request any of the [standard OpenID Connect (OIDC) scopes](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) about users, such as `email`, or [custom claims](/tokens/concepts/jwt-claims#custom-claims) conforming to a [namespaced format](/tokens/guides/create-namespaced-custom-claims). Include `offline_access` to get a Refresh Token (make sure that the __Allow Offline Access__ field is enabled in the [Application Settings](${manage_url}/#/applications)). | +| `state` | (recommended) An opaque arbitrary alphanumeric string your app adds to the initial request that Auth0 includes when redirecting back to your application. To see how to use this value to prevent cross-site request forgery (CSRF) attacks, see [Mitigate CSRF Attacks With State Parameters](/protocols/oauth2/mitigate-csrf-attacks). | +| `connection` | (optional) Forces the user to sign in with a specific connection. For example, you can pass a value of `github` to send the user directly to GitHub to log in with their GitHub account. When not specified, the user sees the Auth0 Lock screen with all configured connections. You can see a list of your configured connections on the **Connections** tab of your application. | + + +As an example, your HTML snippet for your authorization URL when adding login to your app might look like: + +```html + + Sign In + +``` + + +### Response + +If all goes well, you'll receive an `HTTP 302` response. The authorization code is included at the end of the URL: + +```text +HTTP/1.1 302 Found +Location: YOUR_CALLBACK_URL?code=AUTHORIZATION_CODE&state=xyzABC123 +``` diff --git a/articles/flows/guides/auth-code-pkce/includes/authorize-user-call-api.md b/articles/flows/guides/auth-code-pkce/includes/authorize-user-call-api.md new file mode 100644 index 0000000000..cbb11d6cfc --- /dev/null +++ b/articles/flows/guides/auth-code-pkce/includes/authorize-user-call-api.md @@ -0,0 +1,71 @@ +## Authorize the User + +Once you've created the `code_verifier` and the `code_challenge`, you'll need to get the user's authorization. This is technically the beginning of the authorization flow, and this step may include one or more of the following processes: + +* Authenticating the user; +* Redirecting the user to an Identity Provider to handle authentication; +* Checking for active Single Sign-on (SSO) sessions; +* Obtaining user consent for the requested permission level, unless consent has been previously given. + +To authorize the user, your app must send the user to the [authorization URL](/api/authentication#authorization-code-grant-pkce-), including the `code_challenge` you generated in the previous step and the method you used to generate the `code_challenge`. + + +### Example authorization URL + +```text +https://${account.namespace}/authorize? + response_type=code& + code_challenge=CODE_CHALLENGE& + code_challenge_method=S256& + client_id=${account.clientId}& + redirect_uri=YOUR_CALLBACK_URL& + scope=SCOPE& + audience=API_AUDIENCE& + state=STATE +``` + +#### Parameters + +Note that for authorizing a user when calling a custom API, you: + +- must include an audience parameter +- can include additional scopes supported by the target API + + +| Parameter Name | Description | +|-----------------|-------------| +| `response_type` | Denotes the kind of credential that Auth0 will return (`code` or `token`). For this flow, the value must be `code`. | +| `code_challenge` | Generated challenge from the `code_verifier`. | +| `code_challenge_method` | Method used to generate the challenge (e.g., S256). The PKCE spec defines two methods, `S256` and `plain`, the former is used in this example and is the **only** one supported by Auth0 since the latter is discouraged. | +| `client_id` |Your application's Client ID. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | +| `redirect_uri` | The URL to which Auth0 will redirect the browser after authorization has been granted by the user. The Authorization Code will be available in the `code` URL parameter. You must specify this URL as a valid callback URL in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings).

      **Warning:** Per the [OAuth 2.0 Specification](https://tools.ietf.org/html/rfc6749#section-3.1.2), Auth0 removes everything after the hash and does *not* honor any fragments. | +| `scope` | The [scopes](/scopes) for which you want to request authorization. These must be separated by a space. You can request any of the [standard OpenID Connect (OIDC) scopes](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) about users, such as `profile` and `email`, [custom claims](/tokens/concepts/jwt-claims#custom-claims) conforming to a [namespaced format](/tokens/guides/create-namespaced-custom-claims), or any scopes supported by the target API (e.g., `read:contacts`). Include `offline_access` to get a Refresh Token (make sure that the __Allow Offline Access__ field is enabled in the [Application Settings](${manage_url}/#/apis)). | +|`audience` | The unique identifier of the API your mobile app wants to access. Use the **Identifier** value on the [Settings](${manage_url}/#/apis) tab for the API you created as part of the prerequisites for this tutorial. | +| `state` | (recommended) An opaque arbitrary alphanumeric string your app adds to the initial request that Auth0 includes when redirecting back to your application. To see how to use this value to prevent cross-site request forgery (CSRF) attacks, see [Mitigate CSRF Attacks With State Parameters](/protocols/oauth2/mitigate-csrf-attacks). | + + +As an example, your HTML snippet for your authorization URL when calling an API might look like: + +```html + + Sign In + +``` + + +### Response + +If all goes well, you'll receive an `HTTP 302` response. The authorization code is included at the end of the URL: + +```text +HTTP/1.1 302 Found +Location: YOUR_CALLBACK_URL?code=AUTHORIZATION_CODE&state=xyzABC123 +``` diff --git a/articles/flows/guides/auth-code-pkce/includes/call-api.md b/articles/flows/guides/auth-code-pkce/includes/call-api.md new file mode 100644 index 0000000000..95c675e3c9 --- /dev/null +++ b/articles/flows/guides/auth-code-pkce/includes/call-api.md @@ -0,0 +1,15 @@ +## Call your API + +To call your API from a native/mobile application, the application must pass the retrieved Access Token as a Bearer token in the Authorization header of your HTTP request. + + + ```har +{ + "method": "GET", + "url": "https://myapi.com/api", + "headers": [ + { "name": "Content-Type", "value": "application/json" }, + { "name": "Authorization", "value": "Bearer ACCESS_TOKEN" } + ] +} +``` diff --git a/articles/flows/guides/auth-code-pkce/includes/create-code-challenge.md b/articles/flows/guides/auth-code-pkce/includes/create-code-challenge.md new file mode 100644 index 0000000000..8bd378a10c --- /dev/null +++ b/articles/flows/guides/auth-code-pkce/includes/create-code-challenge.md @@ -0,0 +1,70 @@ +## Create a Code Challenge + +Generate a `code_challenge` from the `code_verifier` that will be sent to Auth0 to request an `authorization_code`. + + +
      + +
      +
      +
      +// Dependency: Node.js crypto module
      +// https://nodejs.org/api/crypto.html#crypto_crypto
      +function sha256(buffer) {
      +    return crypto.createHash('sha256').update(buffer).digest();
      +}
      +var challenge = base64URLEncode(sha256(verifier));
      +
      +
      +
      +
      +
      +// Dependency: Apache Commons Codec
      +// https://commons.apache.org/proper/commons-codec/
      +// Import the Base64 class.
      +// import org.apache.commons.codec.binary.Base64;
      +byte[] bytes = verifier.getBytes("US-ASCII");
      +MessageDigest md = MessageDigest.getInstance("SHA-256");
      +md.update(bytes, 0, bytes.length);
      +byte[] digest = md.digest();
      +String challenge = Base64.encodeBase64URLSafeString(digest);
      +
      +
      +
      +// Dependency: Apple Common Crypto library
      +// http://opensource.apple.com//source/CommonCrypto
      +guard let data = verifier.data(using: .utf8) else { return nil }
      +var buffer = [UInt8](repeating: 0,  count: Int(CC_SHA256_DIGEST_LENGTH))
      +data.withUnsafeBytes {
      +    _ = CC_SHA256($0, CC_LONG(data.count), &buffer)
      +}
      +let hash = Data(bytes: buffer)
      +let challenge = hash.base64EncodedString()
      +    .replacingOccurrences(of: "+", with: "-")
      +    .replacingOccurrences(of: "/", with: "\_")
      +    .replacingOccurrences(of: "=", with: "")
      +    .trimmingCharacters(in: .whitespaces)
      +
      +
      +
      +// Dependency: Apple Common Crypto library
      +// http://opensource.apple.com//source/CommonCrypto
      +u_int8_t buffer[CC_SHA256_DIGEST_LENGTH * sizeof(u_int8_t)];
      +memset(buffer, 0x0, CC_SHA256_DIGEST_LENGTH);
      +NSData *data = [verifier dataUsingEncoding:NSUTF8StringEncoding];
      +CC_SHA256([data bytes], (CC_LONG)[data length], buffer);
      +NSData *hash = [NSData dataWithBytes:buffer length:CC_SHA256_DIGEST_LENGTH];
      +NSString *challenge = [[[[hash base64EncodedStringWithOptions:0]
      +                         stringByReplacingOccurrencesOfString:@"+" withString:@"-"]
      +                         stringByReplacingOccurrencesOfString:@"/" withString:@"_"]
      +                         stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"="]];
      +
      +
      +
      diff --git a/articles/flows/guides/auth-code-pkce/includes/create-code-verifier.md b/articles/flows/guides/auth-code-pkce/includes/create-code-verifier.md new file mode 100644 index 0000000000..a05a231f8b --- /dev/null +++ b/articles/flows/guides/auth-code-pkce/includes/create-code-verifier.md @@ -0,0 +1,60 @@ +## Create a Code Verifier + +Create a `code_verifier`, which is a cryptographically-random key that will eventually be sent to Auth0 to request tokens. + +
      + + +
      +
      +
      +// Dependency: Node.js crypto module
      +// https://nodejs.org/api/crypto.html#crypto_crypto
      +function base64URLEncode(str) {
      +    return str.toString('base64')
      +        .replace(/\+/g, '-')
      +        .replace(/\//g, '_')
      +        .replace(/=/g, '');
      +}
      +var verifier = base64URLEncode(crypto.randomBytes(32));
      +
      +
      +
      +// Dependency: Apache Commons Codec
      +// https://commons.apache.org/proper/commons-codec/
      +// Import the Base64 class.
      +// import org.apache.commons.codec.binary.Base64;
      +SecureRandom sr = new SecureRandom();
      +byte[] code = new byte[32];
      +sr.nextBytes(code);
      +String verifier = Base64.encodeToString(code, Base64.URL_SAFE | Base64.NO_WRAP | Base64.NO_PADDING);
      +
      +
      +
      +var buffer = [UInt8](repeating: 0, count: 32)
      +_ = SecRandomCopyBytes(kSecRandomDefault, buffer.count, &buffer)
      +let verifier = Data(bytes: buffer).base64EncodedString()
      +    .replacingOccurrences(of: "+", with: "-")
      +    .replacingOccurrences(of: "/", with: "\_")
      +    .replacingOccurrences(of: "=", with: "")
      +    .trimmingCharacters(in: .whitespaces)
      +
      +
      +
      +NSMutableData *data = [NSMutableData dataWithLength:32];
      +int result __attribute__((unused)) = SecRandomCopyBytes(kSecRandomDefault, 32, data.mutableBytes);
      +NSString *verifier = [[[[data base64EncodedStringWithOptions:0]
      +                        stringByReplacingOccurrencesOfString:@"+" withString:@"-"]
      +                        stringByReplacingOccurrencesOfString:@"/" withString:@"_"]
      +                        stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"="]];
      +
      +
      +
      + diff --git a/articles/flows/guides/auth-code-pkce/includes/refresh-tokens.md b/articles/flows/guides/auth-code-pkce/includes/refresh-tokens.md new file mode 100644 index 0000000000..0946684b81 --- /dev/null +++ b/articles/flows/guides/auth-code-pkce/includes/refresh-tokens.md @@ -0,0 +1,66 @@ +## Refresh Tokens + +You have already received a Refresh Token if you've been following this tutorial and completed the following: + +* configured your API to allow offline access +* included the `offline_access` scope when you initiated the authentication request through the [authorize](/api/authentication/reference#authorize-application) endpoint + +You can use the Refresh Token to get a new Access Token. Usually, a user will need a new Access Token only after the previous one expires or when gaining access to a new resource for the first time. It's bad practice to call the endpoint to get a new Access Token every time you call an API, and Auth0 maintains rate limits that will throttle the amount of requests to the endpoint that can be executed using the same token from the same IP. + +To refresh your token, make a `POST` request to the `/oauth/token` endpoint in the Authentication API, using `grant_type=refresh_token`. + +### Example POST to token URL + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData" : { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "refresh_token" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "refresh_token", + "value": "YOUR_REFRESH_TOKEN" + } + ] + } +} +``` + +#### Parameters + +| Parameter Name | Description | +|-----------------|-------------| +| `grant_type` | Set this to "refresh_token". | +| `client_id` | Your application's Client ID. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | +| `refresh_token` | The Refresh Token to use. | +| `scope` | (Optional) A space-delimited list of requested scope permissions. If not sent, the original scopes will be used; otherwise you can request a reduced set of scopes. Note that this must be URL encoded. | + +### Response + +If all goes well, you'll receive an `HTTP 200` response with a payload containing a new `access_token`, its lifetime in seconds (`expires_in`), granted `scope` values, and `token_type`. If the scope of the initial token included `openid`, then the response will also include a new `id_token`: + +```json +{ + "access_token": "eyJ...MoQ", + "expires_in": 86400, + "scope": "openid offline_access", + "id_token": "eyJ...0NE", + "token_type": "Bearer" +} +``` + +::: warning +You should validate your tokens before saving them. To learn how, see [Validate ID Tokens](/tokens/guides/validate-id-tokens) and [Validate Access Tokens](/tokens/guides/validate-access-tokens). +::: diff --git a/articles/flows/guides/auth-code-pkce/includes/request-tokens.md b/articles/flows/guides/auth-code-pkce/includes/request-tokens.md new file mode 100644 index 0000000000..71ee43fb40 --- /dev/null +++ b/articles/flows/guides/auth-code-pkce/includes/request-tokens.md @@ -0,0 +1,78 @@ +## Request Tokens + +Now that you have an Authorization Code, you must exchange it for tokens. Using the extracted Authorization Code (`code`) from the previous step, you will need to `POST` to the [token URL](/api/authentication#authorization-code-pkce-) sending along the `code_verifier`. + +### Example POST to token URL + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData" : { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "authorization_code" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "code_verifier", + "value": "YOUR_GENERATED_CODE_VERIFIER" + }, + { + "name": "code", + "value": "YOUR_AUTHORIZATION_CODE" + }, + { + "name": "redirect_uri", + "value": "${account.callback}" + } + ] + } +} +``` + +#### Parameters + +| Parameter Name | Description | +|-----------------|-------------| +| `grant_type` | Set this to "authorization_code". | +| `code_verifier` | The cryptographically-random key that was generated in the first step of this tutorial. | +| `code` | The `authorization_code` retrieved in the previous step of this tutorial. | +| `client_id` | Your application's Client ID. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | +| `redirect_uri` | The valid callback URL set in your Application settings. This must exactly match the `redirect_uri` passed to the authorization URL in the previous step of this tutorial. Note that this must be URL encoded. | + + +### Response + +If all goes well, you'll receive an HTTP 200 response with a payload containing `access_token`, `refresh_token`, `id_token`, and `token_type` values: + +```json +{ + "access_token":"eyJz93a...k4laUWw", + "refresh_token":"GEbRxBN...edjnXbL", + "id_token":"eyJ0XAi...4faeEoQ", + "token_type":"Bearer", + "expires_in":86400 +} +``` +::: warning +You should validate your tokens before saving them. To learn how, see [Validate ID Tokens](/tokens/guides/validate-id-tokens) and [Validate Access Tokens](/tokens/guides/validate-access-tokens). +::: + +[ID Tokens](/tokens/concepts/id-tokens) contain user information that must be [decoded and extracted](/tokens/id-tokens#id-token-payload). + +[Access Tokens](/tokens/concepts/access-token) are used to call the [Auth0 Authentication API's `/userinfo` endpoint](/api/authentication#get-user-info) or another API. If you are calling your own API, the first thing your API will need to do is [verify the Access Token](/tokens/guides/validate-access-tokens). + +[Refresh Tokens](/tokens/concepts/refresh-tokens) are used to obtain a new Access Token or ID Token after the previous one has expired. The `refresh_token` will only be present in the response if you included the `offline_access` scope and enabled __Allow Offline Access__ for your API in the Dashboard. + +::: warning +Refresh Tokens must be stored securely since they allow a user to remain authenticated essentially forever. +::: diff --git a/articles/flows/guides/auth-code-pkce/includes/sample-use-cases-add-login.md b/articles/flows/guides/auth-code-pkce/includes/sample-use-cases-add-login.md new file mode 100644 index 0000000000..e72b60344a --- /dev/null +++ b/articles/flows/guides/auth-code-pkce/includes/sample-use-cases-add-login.md @@ -0,0 +1,94 @@ +## Sample Use Cases + +### Basic Authentication Request + +This example shows the most basic request you can make when authorizing the user in step 1. It displays the Auth0 login screen and allows the user to sign in with any of your configured connections: + +```text +https://${account.namespace}/authorize? + response_type=code& + code_challenge=CODE_CHALLENGE& + code_challenge_method=S256& + client_id=${account.clientId}& + redirect_uri=YOUR_CALLBACK_URL& + scope=openid +``` + +Now, when you [request tokens](/flows/guides/auth-code-pkce/add-login-auth-code-pkce#request-tokens), your ID Token will contain the most basic claims. When you [decode the ID Token](/tokens/id-tokens#id-token-payload), it will look similar to: + +```json +{ + "iss": "https://auth0pnp.auth0.com/", + "sub": "auth0|581...", + "aud": "xvt9...", + "exp": 1478112929, + "iat": 1478076929 +} +``` + +### Request the User's Name and Profile Picture + +In addition to the usual user authentication, this example shows how to request additional user details, such as name and picture. + +To request the user's name and picture, you need to add the appropriate scopes when authorizing the user in step 3: + +```text +https://${account.namespace}/authorize? + response_type=code& + code_challenge=CODE_CHALLENGE& + code_challenge_method=S256& + client_id=${account.clientId}& + redirect_uri=YOUR_CALLBACK_URL& + scope=openid%20name%20picture& + state=STATE +``` + +Now, when you [request tokens](/flows/guides/auth-code-pkce/add-login-auth-code-pkce#request-tokens), your ID Token will contain the requested name and picture claims. When you [decode the ID Token](/tokens/id-tokens#id-token-payload), it will look similar to: + +```json +{ + "name": "auth0user@...", + "picture": "https://example.com/profile-pic.png", + "iss": "https://auth0user.auth0.com/", + "sub": "auth0|581...", + "aud": "xvt...", + "exp": 1478113129, + "iat": 1478077129 +} +``` + +### Request a User Log In with GitHub + +In addition to the usual user authentication, this example shows how to send users directly to a social identity provider, such as GitHub. For this example to work, you will first need to [configure the appropriate connection in the Auth0 Dashboard](${manage_url}/#/connections/social) and get the connection name from the **Settings** tab. + +To send users directly to the GitHub login screen, you need to pass the `connection` parameter and set its value to the connection name (in this case, `github`) when authorizing the user in step 3: + +```text +https://${account.namespace}/authorize? + response_type=code& + code_challenge=CODE_CHALLENGE& + code_challenge_method=S256& + client_id=${account.clientId}& + redirect_uri=YOUR_CALLBACK_URL& + scope=openid%20name%20picture& + state=STATE& + connection=github +``` + +Now, when you [request tokens](/flows/guides/auth-code-pkce/add-login-auth-code-pkce#request-tokens), your ID Token will contain a `sub` claim with the user's unique ID returned from GitHub. When you [decode the ID Token](/tokens/id-tokens#id-token-payload), it will look similar to: + +```json +{ + "name": "John Smith", + "picture": "https://avatars.example.com", + "email": "jsmith@...", + "email_verified": true, + "iss": "https://auth0user.auth0.com/", + "sub": "github|100...", + "aud": "xvt...", + "exp": 1478114742, + "iat": 1478078742 +} +``` + +For a list of possible connections, see [Identity Providers Supported by Auth0](/identityproviders). diff --git a/articles/flows/guides/auth-code-pkce/includes/sample-use-cases-call-api.md b/articles/flows/guides/auth-code-pkce/includes/sample-use-cases-call-api.md new file mode 100644 index 0000000000..7cfe4d986a --- /dev/null +++ b/articles/flows/guides/auth-code-pkce/includes/sample-use-cases-call-api.md @@ -0,0 +1,29 @@ +## Sample Use Cases + +### Customize Tokens + +You can use [Rules](/rules) to change the returned scopes of Access Tokens and/or add claims to Access and ID Tokens. To do so, add the following rule, which will run after the user authenticates: + +```javascript +function(user, context, callback) { + + // add custom claims to Access Token and ID Token + context.accessToken['http://foo/bar'] = 'value'; + context.idToken['http://fiz/baz'] = 'some other value'; + + // change scope + context.accessToken.scope = ['array', 'of', 'strings']; + + callback(null, user, context); +} +``` + +Scopes will be available in the token after all rules have run. + +::: panel-warning Namespacing Custom Claims +Auth0 returns profile information in a [structured claim format as defined by the OpenID Connect (OIDC) specification](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims). This means that custom claims added to ID Tokens or Access Tokens must [conform to a namespaced format](/tokens/guides/create-namespaced-custom-claims) to avoid possible collisions with standard OIDC claims. +::: + +### View Sample Application: Mobile App + API + +For an sample implementation, see the [Mobile + API](/architecture-scenarios/application/mobile-api) architecture scenario. This series of tutorials is accompanied by a code sample that you can access in [GitHub](https://github.com/auth0-samples/auth0-pnp-exampleco-timesheets). diff --git a/articles/flows/guides/auth-code/add-login-auth-code.md b/articles/flows/guides/auth-code/add-login-auth-code.md new file mode 100644 index 0000000000..e3824d399e --- /dev/null +++ b/articles/flows/guides/auth-code/add-login-auth-code.md @@ -0,0 +1,58 @@ +--- +title: Add Login Using the Authorization Code Flow +description: Learn how to add login to your regular web application using the Authorization Code Flow. +toc: true +topics: + - api-authentication + - oidc + - authorization-code + - regular-web-apps +contentType: tutorial +useCase: + - add-login +--- +# Add Login Using the Authorization Code Flow + +::: note +This tutorial will help you add login to your regular web application using the Authorization Code Flow. If you want to learn how the flow works and why you should use it, see [Authorization Code Flow](/flows/concepts/auth-code). If you want to learn to call your API from a regular web app, see [Call Your API Using the Authorization Code Flow](/flows/guides/auth-code/call-api-auth-code). +::: + +Auth0 makes it easy for your app to implement the Authorization Code Flow using: + +* [Regular Web App Quickstarts](/quickstart/webapp): The easiest way to implement the flow. +* Authentication API: If you prefer to roll your own, keep reading to learn how to call our API directly. + +Following successful login, your application will have access to the user's [ID Token](/tokens/concepts/id-tokens) and [Access Token](/tokens/concepts/access-tokens). The ID Token will contain basic user profile information, and the Access Token can be used to call the Auth0 /userinfo endpoint or your own protected APIs. + +## Prerequisites + +**Before beginning this tutorial:** + +* [Register your Application with Auth0](/dashboard/guides/applications/register-app-regular-web). + * Select an **Application Type** of **Regular Web Apps**. + * Add an **Allowed Callback URL** of **`${account.callback}`**. + * Make sure your Application's **[Grant Types](/dashboard/guides/applications/update-grant-types)** include **Authorization Code**. + + +## Steps + +1. [Authorize the user](#authorize-the-user): +Request the user's authorization and redirect back to your app with an `authorization_code`. +2. [Request Tokens](#request-tokens): +Exchange your `authorization_code` for tokens. + +Optional: [Explore Sample Use Cases](#sample-use-cases) + + +<%= include('./includes/authorize-user-add-login') %> + +<%= include('./includes/request-tokens') %> + +<%= include('./includes/sample-use-cases-add-login') %> + +## Keep reading + +- [OAuth 2.0 framework](/protocols/oauth2) +- [OpenID Connect (OIDC) protocol](/protocols/oidc) +- [Tokens](/tokens) + diff --git a/articles/flows/guides/auth-code/call-api-auth-code.md b/articles/flows/guides/auth-code/call-api-auth-code.md new file mode 100644 index 0000000000..51e879faa7 --- /dev/null +++ b/articles/flows/guides/auth-code/call-api-auth-code.md @@ -0,0 +1,68 @@ +--- +title: Call API Using the Authorization Code Flow +description: Learn how to call your own API from regular web apps using the Authorization Code Flow. +toc: true +topics: + - api-authentication + - oidc + - authorization-code + - regular-web-apps +contentType: tutorial +useCase: + - secure-api + - call-api +--- +# Call Your API Using the Authorization Code Flow + +::: note +This tutorial will help you call your own API using the Authorization Code Flow. If you want to learn how the flow works and why you should use it, see [Authorization Code Flow](/flows/concepts/auth-code). If you want to learn to add login to your regular web app, see [Add Login Using the Authorization Code Flow](/flows/guides/auth-code/add-login-auth-code). +::: + +Auth0 makes it easy for your app to implement the Authorization Code Flow using: + +* [Regular Web App Quickstarts](/quickstart/webapp): The easiest way to implement the flow. +* Authentication API: If you prefer to roll your own, keep reading to learn how to call our API directly. + + +## Prerequisites + +**Before beginning this tutorial:** + +* [Register your Application with Auth0](/dashboard/guides/applications/register-app-regular-web). + * Select an **Application Type** of **Regular Web Apps**. + * Add an **Allowed Callback URL** of **`${account.callback}`**. + * Make sure your Application's **[Grant Types](/dashboard/guides/applications/update-grant-types)** include **Authorization Code**. + * If you want your Application to be able to use [Refresh Tokens](/tokens/concepts/refresh-tokens), make sure the Application's **[Grant Types](/dashboard/guides/applications/update-grant-types)** include **Refresh Token**. + +* [Register your API with Auth0](/architecture-scenarios/mobile-api/part-2#create-the-api) + * If you want your API to receive Refresh Tokens to allow it to obtain new tokens when the previous ones expire, enable **Allow Offline Access**. + +## Steps + +1. [Authorize the user](#authorize-the-user): +Request the user's authorization and redirect back to your app with an authorization code. +2. [Request Tokens](#request-tokens): +Exchange your authorization code for tokens. +3. [Call your API](#call-your-api): +Use the retrieved Access Token to call your API. +4. [Refresh Tokens](#refresh-tokens): +Use a Refresh Token to request new tokens when the existing ones expire. + +Optional: [Explore Sample Use Cases](#sample-use-cases) + + +<%= include('./includes/authorize-user-call-api') %> + +<%= include('./includes/request-tokens') %> + +<%= include('./includes/call-api') %> + +<%= include('./includes/refresh-tokens') %> + +<%= include('./includes/sample-use-cases-call-api') %> + +## Keep reading + +- [OAuth 2.0 framework](/protocols/oauth2) +- [OpenID Connect (OIDC) protocol](/protocols/oidc) +- [Tokens](/tokens) diff --git a/articles/flows/guides/auth-code/includes/authorize-user-add-login.md b/articles/flows/guides/auth-code/includes/authorize-user-add-login.md new file mode 100644 index 0000000000..2d9c1a18ff --- /dev/null +++ b/articles/flows/guides/auth-code/includes/authorize-user-add-login.md @@ -0,0 +1,53 @@ +## Authorize the User + +To begin the flow, you'll need to get the user's authorization. This step may include one or more of the following processes: + +* Authenticating the user; +* Redirecting the user to an Identity Provider to handle authentication; +* Obtaining user consent for the requested permission level, unless consent has been previously given. + +To authorize the user, your app must send the user to the [authorization URL](/api/authentication#authorization-code-flow). + +### Example authorization URL + +```text +https://${account.namespace}/authorize? + response_type=code& + client_id=${account.clientId}& + redirect_uri=${account.callback}& + scope=SCOPE& + state=STATE +``` + +#### Parameters + +| Parameter Name | Description | +|-----------------|-------------| +| `response_type` | Denotes the kind of credential that Auth0 will return (`code` or `token`). For this flow, the value must be `code`. | +| `client_id` | Your application's Client ID. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | +| `redirect_uri` | The URL to which Auth0 will redirect the browser after authorization has been granted by the user. The Authorization Code will be available in the `code` URL parameter. You must specify this URL as a valid callback URL in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings).

      **Warning:** Per the [OAuth 2.0 Specification](https://tools.ietf.org/html/rfc6749#section-3.1.2), Auth0 removes everything after the hash and does *not* honor any fragments. | +| `scope` | Specifies the [scopes](/scopes) for which you want to request authorization, which dictate which claims (or user attributes) you want returned. These must be separated by a space. To get an ID Token in the response, you need to specify a scope of at least `openid`. If you want to return the user's full profile, you can request `openid profile`. You can request any of the [standard OpenID Connect (OIDC) scopes](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) about users, such as `email`, or [custom claims](/tokens/concepts/jwt-claims#custom-claims) conforming to a [namespaced format](/tokens/guides/create-namespaced-custom-claims). Include `offline_access` to get a Refresh Token (make sure that the __Allow Offline Access__ field is enabled in the [Application Settings](${manage_url}/#/applications)). | +| `state` | (recommended) An opaque arbitrary alphanumeric string your app adds to the initial request that Auth0 includes when redirecting back to your application. To see how to use this value to prevent cross-site request forgery (CSRF) attacks, see [Mitigate CSRF Attacks With State Parameters](/protocols/oauth2/mitigate-csrf-attacks). | +| `connection` | (optional) Forces the user to sign in with a specific connection. For example, you can pass a value of `github` to send the user directly to GitHub to log in with their GitHub account. When not specified, the user sees the Auth0 Lock screen with all configured connections. You can see a list of your configured connections on the **Connections** tab of your application. | + +As an example, your HTML snippet for your authorization URL when adding login to your app might look like: + +```html + + Sign In + +``` + +### Response + +If all goes well, you'll receive an `HTTP 302` response. The authorization code is included at the end of the URL: + +```text +HTTP/1.1 302 Found +Location: ${account.callback}?code=AUTHORIZATION_CODE&state=xyzABC123 +``` diff --git a/articles/flows/guides/auth-code/includes/authorize-user-call-api.md b/articles/flows/guides/auth-code/includes/authorize-user-call-api.md new file mode 100644 index 0000000000..69a5106534 --- /dev/null +++ b/articles/flows/guides/auth-code/includes/authorize-user-call-api.md @@ -0,0 +1,63 @@ +## Authorize the User + +To begin the flow, you'll need to get the user's authorization. This step may include one or more of the following processes: + +* Authenticating the user; +* Redirecting the user to an Identity Provider to handle authentication; +* Checking for active Single Sign-on (SSO) sessions; +* Obtaining user consent for the requested permission level, unless consent has been previously given. + +To authorize the user, your app must send the user to the [authorization URL](/api/authentication#authorization-code-grant). + + +### Example authorization URL + +```text +https://${account.namespace}/authorize? + response_type=code& + client_id=${account.clientId}& + redirect_uri=${account.callback}& + scope=SCOPE& + audience=API_AUDIENCE& + state=STATE +``` + +#### Parameters + +Note that for authorizing a user when calling a custom API, you: + +- must include an audience parameter +- can include additional scopes supported by the target API + + +| Parameter Name | Description | +|-----------------|-------------| +| `response_type` | Denotes the kind of credential that Auth0 will return (`code` or `token`). For this flow, the value must be `code`. | +| `client_id` | Your application's Client ID. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | +| `redirect_uri` | The URL to which Auth0 will redirect the browser after authorization has been granted by the user. The Authorization Code will be available in the `code` URL parameter. You must specify this URL as a valid callback URL in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings).

      **Warning:** Per the [OAuth 2.0 Specification](https://tools.ietf.org/html/rfc6749#section-3.1.2), Auth0 removes everything after the hash and does *not* honor any fragments. | +| `scope` | Specifies the [scopes](/scopes) for which you want to request authorization, which dictate which claims (or user attributes) you want returned. These must be separated by a space. You can request any of the [standard OpenID Connect (OIDC) scopes](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) about users, such as `profile` or `email`, [custom claims](/tokens/concepts/jwt-claims#custom-claims) conforming to a [namespaced format](/tokens/guides/create-namespaced-custom-claims), or any scopes supported by the target API (e.g., `read:contacts`). Include `offline_access` to get a Refresh Token (make sure that the __Allow Offline Access__ field is enabled in the [Application Settings](${manage_url}/#/applications)). | +| `audience` | The unique identifier of the API your web app wants to access. Use the **Identifier** value on the [Settings](${manage_url}/#/apis) tab for the API you created as part of the prerequisites for this tutorial. | +| `state` | (recommended) An opaque arbitrary alphanumeric string your app adds to the initial request that Auth0 includes when redirecting back to your application. To see how to use this value to prevent cross-site request forgery (CSRF) attacks, see [Mitigate CSRF Attacks With State Parameters](/protocols/oauth2/mitigate-csrf-attacks). | + +As an example, your HTML snippet for your authorization URL when calling an API might look like: + +```html + + Sign In + +``` + +### Response + +If all goes well, you'll receive an `HTTP 302` response. The authorization code is included at the end of the URL: + +```text +HTTP/1.1 302 Found +Location: ${account.callback}?code=AUTHORIZATION_CODE&state=xyzABC123 +``` diff --git a/articles/flows/guides/auth-code/includes/call-api.md b/articles/flows/guides/auth-code/includes/call-api.md new file mode 100644 index 0000000000..c621fb6d86 --- /dev/null +++ b/articles/flows/guides/auth-code/includes/call-api.md @@ -0,0 +1,15 @@ +## Call your API + +To call your API from a regular web application, the application must pass the retrieved Access Token as a Bearer token in the Authorization header of your HTTP request. + + + ```har +{ + "method": "GET", + "url": "https://myapi.com/api", + "headers": [ + { "name": "Content-Type", "value": "application/json" }, + { "name": "Authorization", "value": "Bearer ACCESS_TOKEN" } + ] +} +``` diff --git a/articles/flows/guides/auth-code/includes/refresh-tokens.md b/articles/flows/guides/auth-code/includes/refresh-tokens.md new file mode 100644 index 0000000000..4ebc667073 --- /dev/null +++ b/articles/flows/guides/auth-code/includes/refresh-tokens.md @@ -0,0 +1,66 @@ +## Refresh Tokens + +You have already received a Refresh Token if you've been following this tutorial and completed the following: + +* configured your API to allow offline access +* included the `offline_access` scope when you initiated the authentication request through the [authorize](/api/authentication/reference#authorize-application) endpoint + +You can use the Refresh Token to get a new Access Token. Usually, a user will need a new Access Token only after the previous one expires or when gaining access to a new resource for the first time. It's bad practice to call the endpoint to get a new Access Token every time you call an API, and Auth0 maintains rate limits that will throttle the amount of requests to the endpoint that can be executed using the same token from the same IP. + +To refresh your token, make a `POST` request to the `/oauth/token` endpoint in the Authentication API, using `grant_type=refresh_token`. + +### Example POST to token URL + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData" : { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "refresh_token" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "refresh_token", + "value": "YOUR_REFRESH_TOKEN" + } + ] + } +} +``` + +#### Parameters + +| Parameter Name | Description | +|-----------------|-------------| +| `grant_type` | Set this to "refresh_token". | +| `client_id` | Your application's Client ID. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | +| `refresh_token` | The Refresh Token to use. | +| `scope` | (optional) A space-delimited list of requested scope permissions. If not sent, the original scopes will be used; otherwise you can request a reduced set of scopes. Note that this must be URL encoded. | + +### Response + +If all goes well, you'll receive an `HTTP 200` response with a payload containing a new `access_token`, its lifetime in seconds (`expires_in`), granted `scope` values, and `token_type`. If the scope of the initial token included `openid`, then the response will also include a new `id_token`: + +```json +{ + "access_token": "eyJ...MoQ", + "expires_in": 86400, + "scope": "openid offline_access", + "id_token": "eyJ...0NE", + "token_type": "Bearer" +} +``` + +::: warning +You should validate your tokens before saving them. To learn how, see [Validate ID Tokens](/tokens/guides/validate-id-tokens) and [Validate Access Tokens](/tokens/guides/validate-access-tokens). +::: diff --git a/articles/flows/guides/auth-code/includes/request-tokens.md b/articles/flows/guides/auth-code/includes/request-tokens.md new file mode 100644 index 0000000000..6a468fe06c --- /dev/null +++ b/articles/flows/guides/auth-code/includes/request-tokens.md @@ -0,0 +1,78 @@ +## Request Tokens + +Now that you have an Authorization Code, you must exchange it for tokens. Using the extracted Authorization Code (`code`) from the previous step, you will need to `POST` to the [token URL](/api/authentication#authorization-code). + +### Example POST to token URL + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData" : { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "authorization_code" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "client_secret", + "value": "YOUR_CLIENT_SECRET" + }, + { + "name": "code", + "value": "YOUR_AUTHORIZATION_CODE" + }, + { + "name": "redirect_uri", + "value": "${account.callback}" + } + ] + } +} +``` + +#### Parameters + +| Parameter Name | Description | +|-----------------|-------------| +| `grant_type` | Set this to "authorization_code". | +| `code` | The `authorization_code` retrieved in the previous step of this tutorial. | +| `client_id` | Your application's Client ID. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | +| `client_secret` | Your application's Client Secret. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | +| `redirect_uri` | The valid callback URL set in your Application settings. This must exactly match the `redirect_uri` passed to the authorization URL in the previous step of this tutorial. Note that this must be URL encoded. | + + +### Response + +If all goes well, you'll receive an HTTP 200 response with a payload containing `access_token`, `refresh_token`, `id_token`, and `token_type` values: + +```js +{ + "access_token": "eyJz93a...k4laUWw", + "refresh_token": "GEbRxBN...edjnXbL", + "id_token": "eyJ0XAi...4faeEoQ", + "token_type": "Bearer" +} +``` + +::: warning +You should validate your tokens before saving them. To learn how, see [Validate ID Token](/tokens/guides/validate-id-tokens) and [Validate Access Tokens](/tokens/guides/validate-access-tokens). +::: + +[ID Tokens](/tokens/concepts/id-tokens) contain user information that must be [decoded and extracted](/tokens/id-tokens#id-token-payload). + +[Access Tokens](/tokens/concepts/access-tokens) are used to call the [Auth0 Authentication API's `/userinfo` endpoint](/api/authentication#get-user-info) or another API. If you are calling your own API, the first thing your API will need to do is [verify the Access Token](/tokens/guides/validate-access-tokens). + +[Refresh Tokens](/tokens/concepts/refresh-tokens) are used to obtain a new Access Token or ID Token after the previous one has expired. The `refresh_token` will only be present in the response if you included the `offline_access` scope and enabled __Allow Offline Access__ for your API in the Dashboard. + +::: warning +Refresh Tokens must be stored securely since they allow a user to remain authenticated essentially forever. +::: diff --git a/articles/flows/guides/auth-code/includes/sample-use-cases-add-login.md b/articles/flows/guides/auth-code/includes/sample-use-cases-add-login.md new file mode 100644 index 0000000000..f0a6478f24 --- /dev/null +++ b/articles/flows/guides/auth-code/includes/sample-use-cases-add-login.md @@ -0,0 +1,87 @@ +## Sample Use Cases + +### Basic Authentication Request + +This example shows the most basic request you can make when authorizing the user in step 1. It displays the Auth0 login screen and allows the user to sign in with any of your configured connections: + +```text +https://${account.namespace}/authorize? + response_type=code& + client_id=${account.clientId}& + redirect_uri=${account.callback}& + scope=openid +``` + +Now, when you [request tokens](/flows/guides/auth-code/add-login-auth-code#request-tokens), your ID Token will contain the most basic claims. When you [decode the ID Token](/tokens/id-tokens#id-token-payload), it will look similar to: + +```json +{ + "iss": "https://auth0pnp.auth0.com/", + "sub": "auth0|581...", + "aud": "xvt9...", + "exp": 1478112929, + "iat": 1478076929 +} +``` + +### Request the User's Name and Profile Picture + +In addition to the usual user authentication, this example shows how to request additional user details, such as name and picture. + +To request the user's name and picture, you need to add the appropriate scopes when authorizing the user in step 1: + +```text +https://${account.namespace}/authorize? + response_type=code& + client_id=${account.clientId}& + redirect_uri=${account.callback}& + scope=openid%20name%20picture& + state=STATE +``` + +Now, when you [request tokens](/flows/guides/auth-code/add-login-auth-code#request-tokens), your ID Token will contain the requested name and picture claims. When you [decode the ID Token](/tokens/id-tokens#id-token-payload), it will look similar to: + +```json +{ + "name": "jerrie@...", + "picture": "https://s.gravatar.com/avatar/6222081fd7dcea7dfb193788d138c457?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fje.png", + "iss": "https://auth0pnp.auth0.com/", + "sub": "auth0|581...", + "aud": "xvt...", + "exp": 1478113129, + "iat": 1478077129 +} +``` + +### Request a User Log In with GitHub + +In addition to the usual user authentication, this example shows how to send users directly to a social identity provider, such as GitHub. For this example to work, you will first need to [configure the appropriate connection in the Auth0 Dashboard](${manage_url}/#/connections/social) and get the connection name from the **Settings** tab. + +To send users directly to the GitHub login screen, you need to pass the `connection` parameter and set its value to the connection name (in this case, `github`) when authorizing the user in step 1: + +```text +https://${account.namespace}/authorize? + response_type=code& + client_id=${account.clientId}& + redirect_uri=${account.callback}& + scope=openid%20name%20picture& + state=STATE& + connection=github +``` + +Now, when you [request tokens](/flows/guides/auth-code/add-login-auth-code#request-tokens), your ID Token will contain a `sub` claim with the user's unique ID returned from GitHub. When you [decode the ID Token](/tokens/id-tokens#id-token-payload), it will look similar to: + +```json +{ + "name": "Jerrie Pelser", + "nickname": "jerriep", + "picture": "https://avatars.githubusercontent.com/u/1006420?v=3", + "iss": "https://auth0pnp.auth0.com/", + "sub": "github|100...", + "aud": "xvt...", + "exp": 1478114742, + "iat": 1478078742 +} +``` + +For a list of possible connections, see [Identity Providers Supported by Auth0](/identityproviders). diff --git a/articles/flows/guides/auth-code/includes/sample-use-cases-call-api.md b/articles/flows/guides/auth-code/includes/sample-use-cases-call-api.md new file mode 100644 index 0000000000..3987b1496b --- /dev/null +++ b/articles/flows/guides/auth-code/includes/sample-use-cases-call-api.md @@ -0,0 +1,25 @@ +## Sample Use Cases + +### Customize Tokens + +You can use [Rules](/rules) to change the returned scopes of Access Tokens and/or add claims to Access and ID Tokens. To do so, add the following rule, which will run after the user authenticates: + +```javascript +function(user, context, callback) { + + // add custom claims to Access Token and ID Token + context.accessToken['http://foo/bar'] = 'value'; + context.idToken['http://fiz/baz'] = 'some other value'; + + // change scope + context.accessToken.scope = ['array', 'of', 'strings']; + + callback(null, user, context); +} +``` + +Scopes will be available in the token after all rules have run. + +::: panel-warning Namespacing Custom Claims +Auth0 returns profile information in a [structured claim format as defined by the OpenID Connect (OIDC) specification](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims). This means that custom claims added to ID Tokens or Access Tokens must [conform to a namespaced format](/tokens/guides/create-namespaced-custom-claims) to avoid possible collisions with standard OIDC claims. +::: diff --git a/articles/flows/guides/client-credentials/call-api-client-credentials.md b/articles/flows/guides/client-credentials/call-api-client-credentials.md new file mode 100644 index 0000000000..320ac08210 --- /dev/null +++ b/articles/flows/guides/client-credentials/call-api-client-credentials.md @@ -0,0 +1,56 @@ +--- +title: Call API Using the Client Credentials Flow +description: Learn how to call your API from a machine-to-machine (M2M) application using the Client Credentials Flow. +toc: true +topics: + - api-authentication + - oidc + - client-credentials + - M2M + - machine-to-machine apps +contentType: tutorial +useCase: + - secure-api + - call-api +--- +# Call Your API Using the Client Credentials Flow + +::: note +This tutorial will help you call your API from a machine-to-machine (M2M) application using the Client Credentials Flow. If you want to learn how the flow works and why you should use it, see [Client Credentials Flow](/flows/concepts/client-credentials). +::: + +Auth0 makes it easy for your app to implement the Client Credentials Flow. Following successful authentication, the calling application will have access to an [Access Token](/tokens/concepts/access-tokens), which can be used to call your protected APIs. + +## Prerequisites + +**Before beginning this tutorial:** + +* [Register your API with Auth0](/architecture-scenarios/server-api/part-2#configure-the-api) + +* [Register the M2M Application with Auth0](/dashboard/guides/applications/register-app-m2m). + * Select an **Application Type** of **Machine to Machine Applications**. + * Choose your previously-registered API. + * Authorize the M2M Application to call your API. + +## Steps + +1. [Request a token](#request-token): +From the authorized application, request an Access Token for your API. +2. [Call your API](#call-your-api): +Use the retrieved Access Token to call your API. + +Optional: [Explore Sample Use Cases](#sample-use-cases) + +<%= include('./includes/request-token') %> + +<%= include('./includes/call-api') %> + +<%= include('./includes/sample-use-cases') %> + +Once your API receives a request with an Access Token, it will need to validate the token. For details, see [Validate Access Tokens](/tokens/guides/validate-access-tokens). + +## Keep reading + +- [How to change scopes and add custom claims to tokens using Hooks](/api-auth/tutorials/client-credentials/customize-with-hooks) +- [OpenID Connect (OIDC) protocol](/protocols/oidc) +- [Tokens](/tokens) diff --git a/articles/flows/guides/client-credentials/includes/call-api.md b/articles/flows/guides/client-credentials/includes/call-api.md new file mode 100644 index 0000000000..20650469e4 --- /dev/null +++ b/articles/flows/guides/client-credentials/includes/call-api.md @@ -0,0 +1,15 @@ +## Call your API + +To call your API from the M2M application, the application must pass the retrieved Access Token as a Bearer token in the Authorization header of your HTTP request. + + + ```har +{ + "method": "GET", + "url": "https://myapi.com/api", + "headers": [ + { "name": "Content-Type", "value": "application/json" }, + { "name": "Authorization", "value": "Bearer ACCESS_TOKEN" } + ] +} +``` diff --git a/articles/flows/guides/client-credentials/includes/request-token.md b/articles/flows/guides/client-credentials/includes/request-token.md new file mode 100644 index 0000000000..2e62b59a20 --- /dev/null +++ b/articles/flows/guides/client-credentials/includes/request-token.md @@ -0,0 +1,64 @@ +## Request Token + + To access your API, you must request an Access Token for it. To do so, you will need to `POST` to the [token URL](https://auth0.com/docs/api/authentication#client-credentials). + +### Example POST to token URL + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData" : { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "client_credentials" + }, + { + "name": "client_id", + "value": "YOUR_CLIENT_ID" + }, + { + "name": "client_secret", + "value": "YOUR_CLIENT_SECRET" + }, + { + "name": "audience", + "value": "YOUR_API_IDENTIFIER" + } + ] + } +} +``` + +#### Parameters + +| Parameter Name | Description | +|-----------------|-------------| +| `grant_type` | Set this to "client_credentials". | +| `client_id` | Your application's Client ID. You can find this value on the [application's settings tab](${manage_url}/#/applications). | +| `client_secret` | Your application's Client Secret. You can find this value on the [application's settings tab](${manage_url}/#/applications). | +| `audience` | The audience for the token, which is your API. You can find this in the **Identifier** field on your [API's settings tab](${manage_url}/#/apis). | + + +### Response + + If all goes well, you'll receive an HTTP 200 response with a payload containing `access_token`, `token_type`, and `expires_in` values: + + ```json +{ + "access_token":"eyJz93a...k4laUWw", + "token_type":"Bearer", + "expires_in":86400 +} +``` + + +::: warning +You should validate your token before saving it. To learn how, see [Validate Access Tokens](/tokens/guides/validate-access-tokens). +::: + diff --git a/articles/flows/guides/client-credentials/includes/sample-use-cases.md b/articles/flows/guides/client-credentials/includes/sample-use-cases.md new file mode 100644 index 0000000000..a7a969f962 --- /dev/null +++ b/articles/flows/guides/client-credentials/includes/sample-use-cases.md @@ -0,0 +1,12 @@ +## Sample Use Cases + +### Customize Tokens + +You can use [Hooks](/hooks) to change the returned scopes of Access Tokens and/or add claims to them. Auth0 invokes Hooks attached to the client credentials grant at runtime to execute your custom logic. + +For more information, see our tutorial on [Using Hooks with the Client Credentials Grant](/api-auth/tutorials/client-credentials/customize-with-hooks). + + +### View Sample Application: Server Client + API + +For a sample implementation, see the [Server Client + API](/architecture-scenarios/application/server-api) architecture scenario. This series of tutorials is accompanied by a code sample that you can access in [GitHub](https://github.com/auth0-samples/auth0-pnp-exampleco-timesheets). diff --git a/articles/flows/guides/device-auth/call-api-device-auth.md b/articles/flows/guides/device-auth/call-api-device-auth.md new file mode 100644 index 0000000000..b0f3fd4c6b --- /dev/null +++ b/articles/flows/guides/device-auth/call-api-device-auth.md @@ -0,0 +1,20 @@ +--- +title: Call API Using Device Authorization Flow +description: Learn how to call your API from an input-constrained device using the Device Authorization flow. +toc: true +topics: + - api-authentication + - oidc + - device-flow + - native-apps + - desktop-apps + - mobile-apps + - devices +contentType: tutorial +useCase: + - secure-api + - call-api +--- +# Call Your API Using the Device Authorization Flow + +<%= include('./includes/index.md') %> diff --git a/articles/flows/guides/device-auth/includes/call-api.md b/articles/flows/guides/device-auth/includes/call-api.md new file mode 100644 index 0000000000..20be11679e --- /dev/null +++ b/articles/flows/guides/device-auth/includes/call-api.md @@ -0,0 +1,15 @@ +## Call your API + +To call your API, the application must pass the retrieved Access Token as a Bearer token in the Authorization header of your HTTP request. + + + ```har +{ + "method": "GET", + "url": "https://myapi.com/api", + "headers": [ + { "name": "Content-Type", "value": "application/json" }, + { "name": "Authorization", "value": "Bearer ACCESS_TOKEN" } + ] +} +``` diff --git a/articles/flows/guides/device-auth/includes/index.md b/articles/flows/guides/device-auth/includes/index.md new file mode 100644 index 0000000000..a7fdf8b8f3 --- /dev/null +++ b/articles/flows/guides/device-auth/includes/index.md @@ -0,0 +1,66 @@ +::: note +This tutorial will help you call your own API from an input-constrained device using the Device Authorization Flow. If you want to learn how the flow works and why you should use it, see Device Authorization Flow. +::: + +Auth0 makes it easy for your app to implement the Device Authorization flow using: + +* Authentication API: Keep reading to learn how to call our API directly. For an interactive experience, see our Device Flow Playground. + +## Prerequisites + +**Before beginning this tutorial:** + +* Check [limitations](#limitations) to be sure the Device Authorization flow is suitable for your implementation. + +* Register the Application with Auth0. + * Select an **Application Type** of **Native**. + * If necessary, set **Allowed Web Origins**. You can use this to allow localhost as an origin for local development, or to set an allowed origin for specific TV software with architecture subject to CORS (eg: HTML5 + JS). Most applications will not use this setting. + * Ensure that the **OIDC Conformant** toggle is enabled. This setting is in the Dashboard under **Application Settings > Advanced > OAuth**. + * Make sure the Application's **Grant Types** include **Device Code**. This is also in the Dashboard, under **Application Settings > Advanced > Grant Types**. + * If you want your Application to be able to use Refresh Tokens, make sure the Application's **Grant Types** include **Refresh Token**. + +* Set up and enable at least one connection for the Application: Database connections, Social connections + +* Register your API with Auth0 + * If you want your API to receive Refresh Tokens to allow it to obtain new tokens when the previous ones expire, enable **Allow Offline Access**. + +* Configure Device User Code Settings to define the character set, format, and length of your randomly-generated user code. + +## Steps + +1. [Request device code](#request-device-code) (Device Flow): Request a device code that the user can use to authorize the device. +2. [Request device activation](#request-device-activation) (Device Flow): Request that the user authorize the device using their laptop or smartphone. +3. [Request Tokens](#request-tokens) (Device Flow): Poll the token endpoint to request a token. +4. [User authorization](#user-authorization) (Browser Flow): The user authorizes the device, so the device can receive tokens. +5. [Receive Tokens](#receive-tokens) (Device Flow): After the user successfully authorizes the device, receive tokens. +6. [Call your API](#call-your-api) (Device Flow): Use the retrieved Access Token to call your API. +7. [Refresh Tokens](#refresh-tokens) (Device Flow): Use a Refresh Token to request new tokens when the existing ones expire. + +Optional: [Explore Sample Use Cases](#sample-use-cases) + +Optional: [Troubleshooting](#troubleshooting) + +<%= include('./request-device-code') %> + +<%= include('./request-device-activation') %> + +<%= include('./request-tokens') %> + +<%= include('./user-authorization') %> + +<%= include('./receive-tokens') %> + +<%= include('./call-api') %> + +<%= include('./refresh-tokens') %> + +<%= include('./sample-use-cases-call-api') %> + +<%= include('./troubleshooting') %> + +## Keep reading + +- The OAuth 2.0 protocol +- The OpenID Connect protocol +- Tokens +- Tenant Logs for Devices diff --git a/articles/flows/guides/device-auth/includes/receive-tokens.md b/articles/flows/guides/device-auth/includes/receive-tokens.md new file mode 100644 index 0000000000..a2350b94ad --- /dev/null +++ b/articles/flows/guides/device-auth/includes/receive-tokens.md @@ -0,0 +1,29 @@ + +## Receive Tokens + +While the user has been authenticating and authorizing the device, the device app has continued to poll the token URL to request an Access Token. + +Once the user has successfully authorized the device, you'll receive an `HTTP 200` response with a payload containing `access_token`, `refresh_token` (optionally), `id_token` (optionally), `token_type`, and `expires_in` values: + +```json +{ + "access_token":"eyJz93a...k4laUWw", + "refresh_token":"GEbRxBN...edjnXbL", + "id_token": "eyJ0XAi...4faeEoQ", + "token_type":"Bearer", + "expires_in":86400 +} +``` +::: warning +You should validate your tokens before saving them. To learn how, see [Validate Access Tokens](/tokens/guides/validate-access-tokens) and [Validate ID Tokens](/tokens/guides/validate-id-tokens). +::: + +[Access Tokens](/tokens/concepts/access-token) are used to call the [Auth0 Authentication API's `/userinfo` endpoint](/api/authentication#get-user-info) or another API. You will be able to use the Access Token to call `/userinfo` only if you included the `openid` scope. If you are calling your own API, the first thing your API will need to do is [verify the Access Token](/tokens/guides/validate-access-tokens). + +[ID Tokens](/tokens/concepts/id-tokens) contain user information that must be [decoded and extracted](/tokens/id-tokens#id-token-payload). The `id_token` will only be present in the response if you included the `openid` scope. + +[Refresh Tokens](/tokens/concepts/refresh-tokens) are used to obtain a new Access Token or ID Token after the previous one has expired. The `refresh_token` will only be present in the response if you included the `offline_access` scope and enabled __Allow Offline Access__ for your API in the Dashboard. + +::: warning +Refresh Tokens must be stored securely since they allow a user to remain authenticated essentially forever. +::: diff --git a/articles/flows/guides/device-auth/includes/refresh-tokens.md b/articles/flows/guides/device-auth/includes/refresh-tokens.md new file mode 100644 index 0000000000..9bea311641 --- /dev/null +++ b/articles/flows/guides/device-auth/includes/refresh-tokens.md @@ -0,0 +1,71 @@ +## Refresh Tokens + +You have already received a [Refresh Token](/tokens/concepts/refresh-tokens) if you've been following this tutorial and completed the following: + +* configured your API to allow offline access +* included the `offline_access` scope when you initiated the authentication request through the [authorize](/api/authentication/reference#authorize-application) endpoint + +You can use the Refresh Token to get a new Access Token. Usually, a user will need a new Access Token only after the previous one expires or when gaining access to a new resource for the first time. It's bad practice to call the endpoint to get a new Access Token every time you call an API, and Auth0 maintains rate limits that will throttle the amount of requests to the endpoint that can be executed using the same token from the same IP. + +To refresh your token, make a `POST` request to the `/oauth/token` endpoint in the Authentication API, using `grant_type=refresh_token`. + +### Example refresh token POST to token URL + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData" : { + "mimeType": "application/x-www-form-urlencoded", + "params" : [ + { + "name": "grant_type", + "value": "refresh_token" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "client_secret", + "value": "${account.clientSecret}" + }, + { + "name": "refresh_token", + "value": "YOUR_REFRESH_TOKEN" + } + ] + } +} +``` + +#### Refresh Token Request Parameters + +| Parameter Name | Description | +|-----------------|-------------| +| `grant_type` | Set this to "refresh_token". | +| `client_id` | Your application's Client ID. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | +| `client_secret` | Your application's Client Secret. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientSecret}/settings). | +| `refresh_token` | The Refresh Token to use. | +| `scope` | (Optional) A space-delimited list of requested scope permissions. If not sent, the original scopes will be used; otherwise you can request a reduced set of scopes. Note that this must be URL encoded. | + +### Refresh Token Response + +If all goes well, you'll receive an `HTTP 200` response with a payload containing a new `access_token`, `id_token` (optionally), token lifetime in seconds (`expires_in`), granted `scope` values, and `token_type`: + +```json +{ + "access_token": "eyJ...MoQ", + "expires_in": 86400, + "scope": "openid offline_access", + "id_token": "eyJ...0NE", + "token_type": "Bearer" +} +``` + +::: warning +You should validate your tokens before saving them. To learn how, see [Validate Access Tokens](/tokens/guides/validate-access-tokens) and [Validate ID Tokens](/tokens/guides/validate-id-tokens). +::: diff --git a/articles/flows/guides/device-auth/includes/request-device-activation.md b/articles/flows/guides/device-auth/includes/request-device-activation.md new file mode 100644 index 0000000000..b6429b9025 --- /dev/null +++ b/articles/flows/guides/device-auth/includes/request-device-activation.md @@ -0,0 +1,11 @@ +## Request Device Activation + +Once you have received a `device_code` and `user_code`, you must ask the user to go to the `verification_uri` on their laptop or smartphone and enter the `user_code`: + +![Request Device Activation](/media/articles/flows/guides/device-auth/request-device-activation.png) + +The `device_code` is not intended for the user directly and should not be displayed during the interaction to avoid confusing the user. + +::: note +When building a CLI, you could skip this step and immediately open the browser with `verification_uri_complete`. +::: diff --git a/articles/flows/guides/device-auth/includes/request-device-code.md b/articles/flows/guides/device-auth/includes/request-device-code.md new file mode 100644 index 0000000000..4aca46bb7a --- /dev/null +++ b/articles/flows/guides/device-auth/includes/request-device-code.md @@ -0,0 +1,89 @@ +## Request Device Code + +Once the user has started their device app and wants to authorize the device, you'll need to get a device code. When the user begins their session in their browser-based device, this code will be bound to that session. + +To get the device code, your app must request a code from the [device code URL](/api/authentication#get-device-code), including the Client ID. + +### Example POST to device code URL + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/device/code", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData" : { + "mimeType": "application/x-www-form-urlencoded", + "params" : [ + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "scope", + "value": "SCOPE" + }, + { + "name": "audience", + "value": "AUDIENCE" + } + ] + } +} +``` + +#### Device Code Parameters + +Note that when requesting a device code to call a custom API, you: + +- must include an audience parameter +- can include additional scopes supported by the target API + +::: note + If your app wants an Access Token only to retrieve info about the authenticated user, then no audience parameter is required. +::: + +| Parameter Name | Description | +|-----------------|-------------| +| `client_id` |Your application's Client ID. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | +| `scope` | The [scopes](/scopes) for which you want to request authorization. These must be separated by a space. You can request any of the [standard OIDC scopes](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) about users, such as `profile` and `email`, [custom claims](/tokens/concepts/jwt-claims#custom-claims) conforming to a [namespaced format](/tokens/guides/create-namespaced-custom-claims), or any [scopes supported by the target API](/scopes/current/api-scopes) (e.g., `read:contacts`). Include `openid` to get an ID Token or to be able to use the [/userinfo endpoint](/api/authentication#user-profile) to retrieve profile information for the user. Include `offline_access` to get a Refresh Token (make sure that the __Allow Offline Access__ field is enabled in the [API Settings](${manage_url}/#/apis)). Note that this must be URL encoded. | +|`audience` | The unique identifier of the API your app wants to access. Use the **Identifier** value on the [Settings](${manage_url}/#/apis) tab for the API you created as part of the prerequisites for this tutorial. Note that this must be URL encoded. | + +### Device Code Response + +If all goes well, you'll receive an HTTP 200 response with a payload containing `device_code`, `user_code`, `verification_uri`, and `expires_in`, `interval`, and `verification_uri_complete` values: + +```json +{ + "device_code": "Ag_EE...ko1p", + "user_code": "QTZL-MCBW", + "verification_uri": "https://accounts.acmetest.org/activate", + "verification_uri_complete": "https://accounts.acmetest.org/activate?user_code=QTZL-MCBW", + "expires_in": 900, + "interval": 5 +} +``` + +* `device_code` is the unique code for the device. When the user goes to the `verification_uri` in their browser-based device, this code will be bound to their session. +* `user_code` contains the code that should be input at the `verification_uri` to authorize the device. +* `verification_uri` contains the URL the user should visit to authorize the device. +* `verification_uri_complete` contains the complete URL the user should visit to authorize the device. This allows your app to embed the `user_code` in the URL, if you so choose. +* `expires_in` indicates the lifetime (in seconds) of the `device_code` and `user_code`. +* `interval` indicates the interval (in seconds) at which the app should poll the token URL to request a token. + +::: note +You can [configure the character set, format, and length of your randomly-generated user code](/dashboard/guides/tenants/configure-device-user-code-settings) in your tenant settings. + +To prevent brute force attacks, we enforce the following limits on `user_code`: + +**Minimum length**: +* BASE20 Letters: 8 characters +* Numbers: 9 characters + +**Maximum length**: +* 20 characters (including hyphens and spaces, which may be added as separators for readability) + +**Expiration time**: +* 15 minutes +::: diff --git a/articles/flows/guides/device-auth/includes/request-tokens.md b/articles/flows/guides/device-auth/includes/request-tokens.md new file mode 100644 index 0000000000..d2b1de6a53 --- /dev/null +++ b/articles/flows/guides/device-auth/includes/request-tokens.md @@ -0,0 +1,107 @@ +## Request Tokens + +While you are waiting for the user to activate the device, begin polling the token URL to request an Access Token. Using the extracted polling interval (`interval`) from the previous step, you will need to `POST` to the [token URL](/api/authentication#device-auth) sending along the `device_code`. + +To avoid errors due to network latency, you should start counting each interval after receipt of the last polling request's response. + +### Example request token POST to token URL + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData" : { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "urn:ietf:params:oauth:grant-type:device_code" + }, + { + "name": "device_code", + "value": "YOUR_DEVICE_CODE" + }, + { + "name": "client_id", + "value": "${account.clientId}" + } + ] + } +} +``` + +#### Token Request Parameters + +| Parameter Name | Description | +|-----------------|-------------| +| `grant_type` | Set this to "urn:ietf:params:oauth:grant-type:device_code". This is an extension grant type (as defined by Section 4.5 of [RFC6749](https://tools.ietf.org/html/rfc6749#section-4.5)). Note that this must be URL encoded. | +| `device_code` | The `device_code` retrieved in the previous step of this tutorial. | +| `client_id` | Your application's Client ID. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | + +### Token Responses + +While you wait for the user to authorize the device, you may receive a few different `HTTP 4xx` responses: + +#### Authorization pending + +You will see this error while waiting for the user to take action. Continue polling using the suggested interval retrieved in the previous step of this tutorial. + +```json +`HTTP 403` + +{ + "error": "authorization_pending", + "error_description": "..." +} +``` + +#### Slow down + +You are polling too fast. Slow down and use the suggested interval retrieved in the previous step of this tutorial. To avoid receiving this error due to network latency, you should start counting each interval after receipt of the last polling request's response. + +```json +`HTTP 429` + +{ + "error": "slow_down", + "error_description": "..." +} +``` + +#### Expired Token + +The user has not authorized the device quickly enough, so the `device_code` has expired. Your application should notify the user that the flow has expired and prompt them to reinitiate the flow. + +::: note +Then `expired_token` error will be returned exactly once; after that, the dreaded `invalid_grant` will be returned. Your device *must* stop polling. +::: + +```json +`HTTP 403` + +{ + "error": "expired_token", + "error_description": "..." +} +``` + +#### Access Denied + +Finally, if access is denied, you will receive: + +```json +`HTTP 403` + +{ + "error": "access_denied", + "error_description": "..." +} +``` +This can occur for a variety of reasons, including: + +* the user refused to authorize the device +* the authorization server denied the transaction +* a configured [Rule](/rules) denied access diff --git a/articles/flows/guides/device-auth/includes/sample-use-cases-call-api.md b/articles/flows/guides/device-auth/includes/sample-use-cases-call-api.md new file mode 100644 index 0000000000..8b5955b216 --- /dev/null +++ b/articles/flows/guides/device-auth/includes/sample-use-cases-call-api.md @@ -0,0 +1,21 @@ +## Sample Use Cases + +### Detect Device Authorization Flow Use + +You can use [Rules](/rules) to detect whether the current transaction is using the Device Authorization Flow. To do so, check the `context` object's `protocol` property: + +```javascript +function (user, context, callback) { + if (context.protocol === 'oauth2-device-code') { + ... + } + + callback(null, user, context); +} +``` + +### Sample Implementations + +* [Device Authorization Playground](https://auth0.github.io/device-flow-playground/) +* [AppleTV (Swift)](https://github.com/pushpabrol/auth0-device-flow-appletv): Simple application that shows how Auth0 can be used with the Device Authorization Flow from an AppleTV. +* [CLI (Node.js)](https://gist.github.com/panva/652c61e7d847e0ed99926c324fa91b36): Sample implementation of a CLI that uses the Device Authorization Flow instead of the Authorization Code Flow. The major difference is that your CLI does not need to host a webserver and listen on a port. \ No newline at end of file diff --git a/articles/flows/guides/device-auth/includes/troubleshooting.md b/articles/flows/guides/device-auth/includes/troubleshooting.md new file mode 100644 index 0000000000..7815d9016d --- /dev/null +++ b/articles/flows/guides/device-auth/includes/troubleshooting.md @@ -0,0 +1,29 @@ +# Troubleshooting + +[Tenant logs](/logs) are created for any interaction that takes place and can be used to troubleshoot issues. + +## Error codes + +| Code | Name | Description | +|------------|------|-------------| +| `fdeaz` | Failed device authorization request | | +| `fdeac` | Failed device activation | | +| `fdecc` | User canceled the device confirmation | | +| `fede` | Failed Exchange | Device Code for Access Token | +| `sede` | Success Exchange | Device Code for Access Token | + +## Limitations + +To use the Device Authorization Flow, devices must: + +* Support Server Name Indication (SNI) +* Have an [Auth0 application type](/applications) of **Native** +* Have the [**Token Endpoint Authentication Method**](/dashboard/reference/settings-application) set to **None** +* Be [OIDC-conformant](/dashboard/reference/settings-application#oauth) +* Not be created through [Dynamic Client Registration](/api-auth/dynamic-client-registration) + +In addition, the Device Authorization Flow does not allow: +* [Social Connections](/connections) using [Auth0 developer keys](/connections/social/devkeys) unless you are using new [New Universal Login Experience](/universal-login/new). +* Query string parameters to be accessed from hosted login page or rules + +We support the full [Draft 15](https://tools.ietf.org/html/draft-ietf-oauth-device-flow-15), except for confidential Clients. diff --git a/articles/flows/guides/device-auth/includes/user-authorization.md b/articles/flows/guides/device-auth/includes/user-authorization.md new file mode 100644 index 0000000000..360a4bb7cf --- /dev/null +++ b/articles/flows/guides/device-auth/includes/user-authorization.md @@ -0,0 +1,24 @@ +## User Authorization + +The user will either scan the QR code, or else will open the activation page and enter the user code: + +![Enter User Code](/media/articles/flows/guides/device-auth/enter-user-code.png) + +A confirmation page will be shown to have the user confirm that this is the right device: + +![Confirm Device](/media/articles/flows/guides/device-auth/confirm-device.png) + +The user will complete the transaction by signing in. This step may include one or more of the following processes: + +* Authenticating the user; +* Redirecting the user to an Identity Provider to handle authentication; +* Checking for active SSO sessions; +* Obtaining user consent for the device, unless consent has been previously given. + +![Authenticate User](/media/articles/flows/guides/device-auth/user-auth.png) + +Upon successful authentication and consent, the confirmation prompt will be shown: + +![User Confirmation](/media/articles/flows/guides/device-auth/user-confirmation.png) + +At this point, the user has authenticated, and the device has been authorized. \ No newline at end of file diff --git a/articles/flows/guides/implicit/add-login-implicit.md b/articles/flows/guides/implicit/add-login-implicit.md new file mode 100644 index 0000000000..36373a31b2 --- /dev/null +++ b/articles/flows/guides/implicit/add-login-implicit.md @@ -0,0 +1,54 @@ +--- +title: Add Login Using the Implicit Flow with Form Post +description: Learn how to add login to your single-page application (SPA) using the Implicit Flow with Form Post. +toc: true +topics: + - api-authentication + - oidc + - hybrid-flow + - implicit-flow + - SPA + - single-page apps +contentType: tutorial +useCase: + - add-login +--- +# Add Login Using the Implicit Flow with Form Post + +::: note +This tutorial will help you add login to your single-page application (SPA) using the Implicit Flow with Form Post. If you want to learn how the flow works and why you should use it, see [Implicit Flow with Form Post](/flows/concepts/implicit). + +You can use the Implicit Flow with Form Post for login-only use cases; if you need to request Access Tokens while logging the user in so you can call your API, use the [Authorization Code Flow with PKCE](/flows/concepts/auth-code-pkce). +::: + +Auth0 makes it easy to implement the Implicit Flow with Form Post by using: + +* [Express OpenID Connect SDK](https://www.npmjs.com/package/express-openid-connect): The easiest way to implement the flow, which will do most of the heavy-lifting for you. If you use our [Javascript SDK](/libraries/auth0js), please ensure you are implementing mitigations that are appropriate for your architecture. +* Authentication API: If you prefer to roll your own solution, keep reading to learn how to call our API directly. + +Following successful login, your application will have access to the user's [ID Token](/tokens/id-tokens). The ID Token will contain basic user profile information. + +## Prerequisites + +**Before beginning this tutorial:** + +* [Register your Application with Auth0](applications/spa) + * Select an **Application Type** of **Single-Page App**. + * Add an **Allowed Callback URL** of **`${account.callback}`**. + * Make sure your Application's **[Grant Types](/dashboard/guides/applications/update-grant-types)** include **Implicit**. + +## Steps + +1. [Authorize the user](#authorize-the-user): Request the user's authorization and redirect back to your app. + +Optional: [Explore Sample Use Cases](#sample-use-cases) + +<%= include('./includes/authorize-user-add-login') %> + +<%= include('./includes/sample-use-cases-add-login') %> + +## Keep reading + +- [The OAuth 2.0 protocol](/protocols/oauth2) +- [OpenID Connect (OIDC) protocol](/protocols/oidc) +- [Tokens](/tokens) diff --git a/articles/flows/guides/implicit/call-api-implicit.md b/articles/flows/guides/implicit/call-api-implicit.md new file mode 100644 index 0000000000..c524badcde --- /dev/null +++ b/articles/flows/guides/implicit/call-api-implicit.md @@ -0,0 +1,57 @@ +--- +title: Call API Using the Implicit Flow +description: Learn how to call your API from single-page apps (SPA) using the Implicit Flow. +toc: true +topics: + - api-authentication + - oidc + - implicit-flow + - single-page apps + - SPA +contentType: tutorial +useCase: + - secure-api + - call-api +--- +# Call Your API Using the Implicit Flow + +::: note +This tutorial will help you call your own API from a single-page application (SPA) using the Implicit Flow. If you want to learn how the flow works and why you should use it, see [Implicit Flow](/flows/concepts/implicit). If you want to learn to add login to your single-page application (SPA), see [Add Login Using the Implicit Flow](/flows/guides/implicit/add-login-implicit). +::: + +Auth0 makes it easy for your app to implement the Implicit Flow using: + +* [Auth0.js](/libraries/auth0js): The easiest way to implement the flow, which will do most of the heavy-lifting for you. Our [Single-Page App Quickstarts](/quickstart/spa) will walk you through the process. +* Authentication API: If you prefer to roll your own, keep reading to learn how to call our API directly. + +## Prerequisites + +**Before beginning this tutorial:** + +* [Register your Application with Auth0](/dashboard/guides/applications/register-app-spa). + * Select an **Application Type** of **Single-Page App**. + * Add an **Allowed Callback URL** of **`${account.callback}`**. + * Make sure your Application's **[Grant Types](/dashboard/guides/applications/update-grant-types)** include **Implicit**. + +* [Register your API with Auth0](/architecture-scenarios/spa-api/part-2#create-the-api) + +## Steps + +1. [Authorize the user](#authorize-the-user): +Request the user's authorization and redirect back to your app with the requested credentials. +2. [Call Your API](#call-your-api): +Use the retrieved Access Token to call your API. + +Optional: [Explore Sample Use Cases](#sample-use-cases) + +<%= include('./includes/authorize-user-call-api') %> + +<%= include('./includes/call-api') %> + +<%= include('./includes/sample-use-cases-call-api') %> + +## Keep reading + +- [OAuth 2.0 framework](/protocols/oauth2) +- [OpenID Connect (OIDC) protocol](/protocols/oidc) +- [Tokens](/tokens) diff --git a/articles/flows/guides/implicit/includes/authorize-user-add-login.md b/articles/flows/guides/implicit/includes/authorize-user-add-login.md new file mode 100644 index 0000000000..8f057fee2e --- /dev/null +++ b/articles/flows/guides/implicit/includes/authorize-user-add-login.md @@ -0,0 +1,80 @@ +## Authorize the user + +To begin the flow, you'll need to get the user's authorization. This step may include one or more of the following processes: + +* Authenticating the user; +* Redirecting the user to an Identity Provider to handle authentication; +* Checking for active Single Sign-on (SSO) sessions; +* Obtaining user consent for the requested permission level, unless consent has been previously given. + +To authorize the user, your app must send the user to the authorization URL. + +### Example authorization URL + +```text +https://${account.namespace}/authorize? + response_type=YOUR_RESPONSE_TYPE& + response_mode=form_post& + client_id=${account.clientId}& + redirect_uri=${account.callback}& + state=STATE& + nonce=NONCE +``` + +#### Parameters + +| Parameter Name | Description | +| -------------- | ----------- | +| `response_type` | Denotes the kind of credential that Auth0 will return (code or token). For the Implicit Flow, the value can be `id_token`, `token`, or `id_token token`. Specifically, `id_token` returns an ID Token, and `token` returns an Access Token. | +| `response_mode` | Specifies the method with which response parameters should be returned. For security purposes, the value should be `form_post`. In this mode, response parameters will be encoded as HTML form values that are transmitted via the HTTP POST method and encoded in the body using the `application/x-www-form-urlencoded` format. | +| `client_id` | Your application's Client ID. You can find this value at your [Application's Settings](${manage_url}/#/applications/${account.clientId}/settings). | +| `redirect_uri` | The URL to which Auth0 will redirect the browser after authorization has been granted by the user. You must specify this URL as a valid callback URL in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings).

      **Warning:** Per the [OAuth 2.0 Specification](https://tools.ietf.org/html/rfc6749#section-3.1.2), Auth0 removes everything after the hash and does *not* honor any fragments. | +| `scope` | Specifies the [scopes](/scopes) for which you want to request authorization, which dictate which claims (or user attributes) you want returned. These must be separated by a space. You can request any of the [standard OpenID Connect (OIDC) scopes](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) about users, such as `profile` and `email`, [custom claims](/tokens/concepts/jwt-claims#custom-claims) conforming to a [namespaced format](/tokens/guides/create-namespaced-custom-claims), or any scopes supported by the target API (for example, `read:contacts`). | +| `state` | (recommended) An opaque arbitrary alphanumeric string that your app adds to the initial request and Auth0 includes when redirecting back to your application. To see how to use this value to prevent cross-site request forgery (CSRF) attacks, see [Mitigate CSRF Attacks With State Parameters](/protocols/oauth2/mitigate-csrf-attacks). | +| `nonce` | (required for `response_type` containing `id_token token`, otherwise recommended) A cryptographically random string that your app adds to the initial request and Auth0 includes inside the ID Token, [used to prevent token replay attacks](/api-auth/tutorials/nonce). | +| `connection` | (optional) Forces the user to sign in with a specific connection. For example, you can pass a value of `github` to send the user directly to GitHub to log in with their GitHub account. When not specified, the user sees the Auth0 Lock screen with all configured connections. You can see a list of your configured connections on the **Connections** tab of your application. | + +As an example, your HTML snippet for your authorization URL when adding login to your app might look like: + +```html + + Sign In + +``` + +### Response + +If all goes well, you'll receive an `HTTP 302` response. The requested credentials are encoded in the body: + +```text +HTTP/1.1 302 Found +Content-Type: application/x-www-form-urlencoded + +id_token=eyJ...acA& +state=xyzABC123 +``` + +Note that the returned values depend on what you requested as a `response_type`. + +| Response Type | Components | +| ------------------- | ---------- | +| id_token | ID Token | +| token | Access Token (plus `expires_in` and `token_type` values) | +| id_token token | ID Token, Access Token (plus `expires_in` and `token_type` values) | + +Auth0 will also return any state value you included in your call to the authorization URL. + +::: warning +You should validate your tokens before saving them. To learn how, see [Validate ID Tokens](/tokens/guides/validate-id-tokens) and [Validate Access Tokens](/tokens/guides/validate-access-tokens). +::: + +[ID Tokens](/tokens/concepts/id-tokens) contain user information that must be [decoded and extracted](/tokens/concepts/id-tokens#id-token-payload). + +[Access Tokens](/tokens/concepts/access-tokens) are used to call the [Auth0 Authentication API's `/userinfo` endpoint](/api/authentication#get-user-info) or another API. If you are calling your own API, the first thing your API will need to do is [verify the Access Token](/tokens/guides/validate-access-tokens). \ No newline at end of file diff --git a/articles/flows/guides/implicit/includes/authorize-user-call-api.md b/articles/flows/guides/implicit/includes/authorize-user-call-api.md new file mode 100644 index 0000000000..08d668c77e --- /dev/null +++ b/articles/flows/guides/implicit/includes/authorize-user-call-api.md @@ -0,0 +1,78 @@ +## Authorize the user + +To begin the flow, you'll need to get the user's authorization. This step may include one or more of the following processes: + +* Authenticating the user; +* Redirecting the user to an Identity Provider to handle authentication; +* Checking for active Single Sign-on (SSO) sessions; +* Obtaining user consent for the requested permission level, unless consent has been previously given. + +To authorize the user, your app must send the user to the authorization URL. + +### Example authorization URL + +```text +https://${account.namespace}/authorize? + response_type=YOUR_RESPONSE_TYPE& + client_id=${account.clientId}& + redirect_uri=${account.callback}& + scope=YOUR_SCOPE& + audience=YOUR_API_AUDIENCE& + state=STATE& + nonce=NONCE +``` + +#### Parameters + +| Parameter Name | Description | +| -------------- | ----------- | +| `response_type` | Denotes the kind of credential that Auth0 will return (code or token). For the Implicit Flow, the value can be `id_token`, `token`, or `id_token token`. Specifically, `id_token` returns an ID Token, and `token` returns an Access Token. | +| `client_id` | Your application's Client ID. You can find this value at your [Application's Settings](${manage_url}/#/applications/${account.clientId}/settings). | +| `redirect_uri` | The URL to which Auth0 will redirect the browser after authorization has been granted by the user. You must specify this URL as a valid callback URL in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings).

      **Warning:** Per the [OAuth 2.0 Specification](https://tools.ietf.org/html/rfc6749#section-3.1.2), Auth0 removes everything after the hash and does *not* honor any fragments. | +| `scope` | Specifies the [scopes](/scopes) for which you want to request authorization, which dictate which claims (or user attributes) you want returned. These must be separated by a space. You can request any of the [standard OpenID Connect (OIDC) scopes](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) about users, such as `profile` and `email`, [custom claims](/tokens/concepts/jwt-claims#custom-claims) conforming to a [namespaced format](/tokens/guides/create-namespaced-custom-claims), or any scopes supported by the target API (for example, `read:contacts`). | +| `audience` | The unique identifier of the API the web app wants to access. Use the **Identifier** value on the [Settings](${manage_url}/#/apis) tab for the API you created as part of the prerequisites for this tutorial. | +| `state` | (recommended) An opaque arbitrary alphanumeric string that your app adds to the initial request and Auth0 includes when redirecting back to your application. To see how to use this value to prevent cross-site request forgery (CSRF) attacks, see [Mitigate CSRF Attacks With State Parameters](/protocols/oauth2/mitigate-csrf-attacks). | +| `nonce` | (required for `response_type` containing `id_token token`, otherwise recommended) A cryptographically random string that your app adds to the initial request and Auth0 includes inside the ID Token, [used to prevent token replay attacks](/api-auth/tutorials/nonce). | + +As an example, your HTML snippet for your authorization URL when adding login to your app might look like: + +```html + + Sign In + +``` + + +### Response + +If all goes well, you'll receive an `HTTP 302` response. The requested credentials are included in a hash fragment at the end of the URL: + +```text +HTTP/1.1 302 Found +Location: ${account.callback}#access_token=ey...MhPw&expires_in=7200&token_type=Bearer&id_token=ey...Fyqk&state=xyzABC123 +``` + +Note that the returned values depend on what you requested as a `response_type`. + +| Response Type | Components | +| ------------------- | ---------- | +| id_token | ID Token | +| token | Access Token (plus `expires_in` and `token_type` values) | +| id_token token | ID Token, Access Token (plus `expires_in` and `token_type` values) | + +Auth0 will also return any state value you included in your call to the authorization URL. + +::: warning +You should validate your tokens before saving them. To learn how, see [Validate ID Tokens](/tokens/guides/validate-id-tokens) and [Validate Access Tokens](/tokens/guides/validate-access-tokens). +::: + +[ID Tokens](/tokens/concepts/id-tokens) contain user information that must be [decoded and extracted](/tokens/concepts/id-tokens#id-token-payload). + +[Access Tokens](/tokens/concepts/access-tokens) are used to call the [Auth0 Authentication API's `/userinfo` endpoint](/api/authentication#get-user-info) or another API. If you are calling your own API, the first thing your API will need to do is [verify the Access Token](/tokens/guides/validate-access-tokens). diff --git a/articles/flows/guides/implicit/includes/call-api.md b/articles/flows/guides/implicit/includes/call-api.md new file mode 100644 index 0000000000..61d453a2c1 --- /dev/null +++ b/articles/flows/guides/implicit/includes/call-api.md @@ -0,0 +1,15 @@ +## Call your API + +To call your API from a SPA, the application must pass the retrieved Access Token as a Bearer token in the Authorization header of your HTTP request. + + + ```har +{ + "method": "GET", + "url": "https://myapi.com/api", + "headers": [ + { "name": "Content-Type", "value": "application/json" }, + { "name": "Authorization", "value": "Bearer ACCESS_TOKEN" } + ] +} +``` diff --git a/articles/flows/guides/implicit/includes/refresh-tokens.md b/articles/flows/guides/implicit/includes/refresh-tokens.md new file mode 100644 index 0000000000..4ebc667073 --- /dev/null +++ b/articles/flows/guides/implicit/includes/refresh-tokens.md @@ -0,0 +1,66 @@ +## Refresh Tokens + +You have already received a Refresh Token if you've been following this tutorial and completed the following: + +* configured your API to allow offline access +* included the `offline_access` scope when you initiated the authentication request through the [authorize](/api/authentication/reference#authorize-application) endpoint + +You can use the Refresh Token to get a new Access Token. Usually, a user will need a new Access Token only after the previous one expires or when gaining access to a new resource for the first time. It's bad practice to call the endpoint to get a new Access Token every time you call an API, and Auth0 maintains rate limits that will throttle the amount of requests to the endpoint that can be executed using the same token from the same IP. + +To refresh your token, make a `POST` request to the `/oauth/token` endpoint in the Authentication API, using `grant_type=refresh_token`. + +### Example POST to token URL + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData" : { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "refresh_token" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "refresh_token", + "value": "YOUR_REFRESH_TOKEN" + } + ] + } +} +``` + +#### Parameters + +| Parameter Name | Description | +|-----------------|-------------| +| `grant_type` | Set this to "refresh_token". | +| `client_id` | Your application's Client ID. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | +| `refresh_token` | The Refresh Token to use. | +| `scope` | (optional) A space-delimited list of requested scope permissions. If not sent, the original scopes will be used; otherwise you can request a reduced set of scopes. Note that this must be URL encoded. | + +### Response + +If all goes well, you'll receive an `HTTP 200` response with a payload containing a new `access_token`, its lifetime in seconds (`expires_in`), granted `scope` values, and `token_type`. If the scope of the initial token included `openid`, then the response will also include a new `id_token`: + +```json +{ + "access_token": "eyJ...MoQ", + "expires_in": 86400, + "scope": "openid offline_access", + "id_token": "eyJ...0NE", + "token_type": "Bearer" +} +``` + +::: warning +You should validate your tokens before saving them. To learn how, see [Validate ID Tokens](/tokens/guides/validate-id-tokens) and [Validate Access Tokens](/tokens/guides/validate-access-tokens). +::: diff --git a/articles/flows/guides/implicit/includes/request-tokens.md b/articles/flows/guides/implicit/includes/request-tokens.md new file mode 100644 index 0000000000..406e1564ad --- /dev/null +++ b/articles/flows/guides/implicit/includes/request-tokens.md @@ -0,0 +1,78 @@ +## Request Tokens + +Now that you have an authorization code, you can exchange it for tokens. The Access Token you receive will allow you to call the API specified when you authorized the user. Using the extracted Authorization Code (`code`) from the first step, you will need to `POST` to the [Token URL](/api/authentication?http#authorization-code). + +### Example POST to token URL + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData" : { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "authorization_code" + }, + { + "name": "code", + "value": "YOUR_AUTHORIZATION_CODE" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "client_secret", + "value": "YOUR_CLIENT_SECRET" + }, + { + "name": "redirect_uri", + "value": "${account.callback}" + } + ] + } +} +``` + +#### Parameters + +| Parameter | Description | +| --------- | ----------- | +| `grant_type` | Set this to "authorization_code". | +| `code` | The `authorization_code` retrieved in the previous step of this tutorial. | +| `client_id` | Your application's Client ID. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | +| `client_secret` | Your application's Client Secret. You can find this value in your [Application Settings](${manage_url}/#/Applications/${account.clientId}/settings). | +| `redirect_uri` | The valid callback URL set in your Application settings. This must exactly match the `redirect_uri` passed to the authorization URL in the previous step of this tutorial. Note that this must be URL encoded. | + + +### Response + +If all goes well, you'll receive an HTTP 200 response with a payload containing `access_token`, `refresh_token`, `id_token`, and `token_type` values: + +```js +{ + "access_token": "eyJz93a...k4laUWw", + "refresh_token": "GEbRxBN...edjnXbL", + "id_token": "eyJ0XAi...4faeEoQ", + "token_type": "Bearer" +} +``` + +::: warning +You should validate your tokens before saving them. To learn how, see [Validate ID Tokens](/tokens/guides/validate-id-tokens) and [Validate Access Tokens](/tokens/guides/validate-access-tokens). +::: + +[ID Tokens](/tokens/concepts/id-tokens) contain user information that must be [decoded and extracted](/tokens/concepts/id-tokens#id-token-payload). + +[Access Tokens](/tokens/concepts/access-token) are used to call the [Auth0 Authentication API's `/userinfo` endpoint](/api/authentication#get-user-info) or another API. If you are calling your own API, the first thing your API will need to do is [verify the Access Token](/tokens/guides/validate-access-tokens). + +[Refresh Tokens](/tokens/concepts/refresh-tokens) are used to obtain a new Access Token or ID Token after the previous one has expired. The `refresh_token` will only be present in the response if you included the `offline_access` scope and enabled __Allow Offline Access__ for your API in the Dashboard. + +::: warning +Refresh Tokens must be stored securely since they allow a user to remain authenticated essentially forever. +::: diff --git a/articles/flows/guides/implicit/includes/sample-use-cases-add-login.md b/articles/flows/guides/implicit/includes/sample-use-cases-add-login.md new file mode 100644 index 0000000000..410a8637a1 --- /dev/null +++ b/articles/flows/guides/implicit/includes/sample-use-cases-add-login.md @@ -0,0 +1,83 @@ +## Sample Use Cases + +### Basic Authentication Request + +This example shows the most basic request you can make when authorizing the user in step 1. It displays the Auth0 login screen and allows the user to sign in with any of your configured connections: + +```text +https://${account.namespace}/authorize? + response_type=id_token& + response_mode=form_post& + client_id=${account.clientId}& + redirect_uri=${account.callback}& + nonce=NONCE +``` + +This will return an ID Token, which you can parse from your redirect URL. + + +### Request the User's Name and Profile Picture + +In addition to the usual user authentication, this example shows how to request additional user details, such as name and picture. + +To request the user's name and picture, you need to add the appropriate scopes when authorizing the user in step 1: + +```text +https://${account.namespace}/authorize? + response_type=id_token token& + response_mode=form_post& + client_id=${account.clientId}& + redirect_uri=${account.callback}& + scope=openid%20name%20picture& + state=STATE& + nonce=NONCE +``` + +Now, your ID Token will contain the requested name and picture claims. When you [decode the ID Token](/tokens/id-tokens#id-token-payload), it will look similar to: + +```json +{ + "name": "jerrie@...", + "picture": "https://s.gravatar.com/avatar/6222081fd7dcea7dfb193788d138c457?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fje.png", + "iss": "https://auth0pnp.auth0.com/", + "sub": "auth0|581...", + "aud": "xvt...", + "exp": 1478113129, + "iat": 1478077129 +} +``` + +### Request a User Log In with GitHub + +In addition to the usual user authentication, this example shows how to send users directly to a social identity provider, such as GitHub. For this example to work, you will first need to [configure the appropriate connection in the Auth0 Dashboard](${manage_url}/#/connections/social) and get the connection name from the **Settings** tab. + +To send users directly to the GitHub login screen, you need to pass the `connection` parameter and set its value to the connection name (in this case, `github`) when authorizing the user in step 1: + +```text +https://${account.namespace}/authorize? + response_type=id_token token& + response_mode=form_post& + client_id=${account.clientId}& + redirect_uri=${account.callback}& + scope=openid%20name%20picture& + state=STATE& + nonce=NONCE& + connection=github +``` + +Now, your ID Token will contain a `sub` claim with the user's unique ID returned from GitHub. When you [decode the ID Token](/tokens/id-tokens#id-token-payload), it will look similar to: + +```json +{ + "name": "Jerrie Pelser", + "nickname": "jerriep", + "picture": "https://avatars.githubusercontent.com/u/1006420?v=3", + "iss": "https://auth0pnp.auth0.com/", + "sub": "github|100...", + "aud": "xvt...", + "exp": 1478114742, + "iat": 1478078742 +} +``` + +For a list of possible connections, see [Identity Providers Supported by Auth0](/identityproviders). diff --git a/articles/flows/guides/implicit/includes/sample-use-cases-call-api.md b/articles/flows/guides/implicit/includes/sample-use-cases-call-api.md new file mode 100644 index 0000000000..3987b1496b --- /dev/null +++ b/articles/flows/guides/implicit/includes/sample-use-cases-call-api.md @@ -0,0 +1,25 @@ +## Sample Use Cases + +### Customize Tokens + +You can use [Rules](/rules) to change the returned scopes of Access Tokens and/or add claims to Access and ID Tokens. To do so, add the following rule, which will run after the user authenticates: + +```javascript +function(user, context, callback) { + + // add custom claims to Access Token and ID Token + context.accessToken['http://foo/bar'] = 'value'; + context.idToken['http://fiz/baz'] = 'some other value'; + + // change scope + context.accessToken.scope = ['array', 'of', 'strings']; + + callback(null, user, context); +} +``` + +Scopes will be available in the token after all rules have run. + +::: panel-warning Namespacing Custom Claims +Auth0 returns profile information in a [structured claim format as defined by the OpenID Connect (OIDC) specification](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims). This means that custom claims added to ID Tokens or Access Tokens must [conform to a namespaced format](/tokens/guides/create-namespaced-custom-claims) to avoid possible collisions with standard OIDC claims. +::: diff --git a/articles/flows/index.md b/articles/flows/index.md new file mode 100644 index 0000000000..424e69d796 --- /dev/null +++ b/articles/flows/index.md @@ -0,0 +1,90 @@ +--- +url: /flows +section: articles +classes: topic-page +title: Authentication and Authorization Flows +description: Introduction to the various flows used for authentication and authorization of applications and APIs. +topics: + - api-authentication + - api-authorization + - oidc +contentType: index +useCase: + - secure-api + - call-api + - add-login +--- + +
      +
      +

      Authentication and Authorization Flows

      +

      Introduction to the various flows used for authentication and authorization of applications and APIs.

      +
      + +Auth0 uses [OpenID Connect (OIDC)](/protocols/oidc) and [OAuth 2.0](/protocols/oauth2) to authenticate users and get their authorization to access protected resources. With Auth0, you can easily support different flows in your own applications and APIs without worrying about the OAuth 2.0/OIDC specification or the other technical aspects of authentication and authorization. + +We support scenarios for server-side, mobile, desktop, client-side, machine-to-machine, and device applications. + + diff --git a/articles/getting-started/_list-processes.md b/articles/getting-started/_list-processes.md index 7b9dc2fa64..b8d018dc5a 100644 --- a/articles/getting-started/_list-processes.md +++ b/articles/getting-started/_list-processes.md @@ -1,31 +1,33 @@ <% if (screen === "dashboard") { %> This is the dashboard home page. Here you can view statistics about your apps: the login activity for the past year, the logins and new signups for the past week, a list of the latest signups, and more. [More docs on the dashboard](/dashboard). -<% } else if (screen === "clients") { %> +<% } else if (screen === "applications") { %> Use this page to manage your applications. For every app of yours that you want to use Auth0, you should register an application here. You can create new applications, view your existing ones, review settings, enable connections, and more. - [More info on applications](/clients). + [More info on applications](/applications). <% } else if (screen === "apis") { %> Use this page to manage your APIs. Here you can register a new API of yours, that you want to secure with Auth0, and manage your existing ones. - [More info on APIs](/apis). + [More info on APIs](/api-auth). <% } else if (screen === "sso") { %> - Single Sign On (SSO) Integrations enable the use of external services for single sign-on. In this page you can see a list of the available external services that you can use, such as Office 365, Salesforce, and others. Here you can create a new SSO integration, find tutorials on how to configure it, and review and update the settings of a particular integration. - [More info on SSO Integrations](/sso/integrations). + Single Sign-on (SSO) Integrations enable the use of external services for SSO. In this page you can see a list of the available external services that you can use, such as Office 365, Salesforce, and others. Here you can create a new SSO integration, find tutorials on how to configure it, and review and update the settings of a particular integration. + [More info on SSO Integrations](/integrations/sso). <% } else if (screen === "connections") { %> Use this page to manage the identity providers that you use to login to your apps. There are four types: - - [Database](${manage_url}/#/connections/database): securely store and manage username / password credentials either in an Auth0 Database or in your own. To connect to an existing database you can use JavaScript scripts (we provide the templates) that run on Auth0's server on every authentication. Furthermore, you can migrate an existing legacy credentials database to Auth0 gradually as users authenticate (no password reset required). [More info on Database Connections](/connections/database). - - [Social](${manage_url}/#/connections/social): configure social connections like Facebook, Twitter, Github and others, so that you can let your users login with them. [More info on individual social providers](/identityproviders#social). - - [Enterprise](${manage_url}/#/connections/enterprise): configure Enterprise Connections like Active Directory, SAML, Office 365 and others so that you can let your users login with them. This way your users can use their enterprise credentials to login to your app. [More info on individual enterprise providers](/identityproviders#enterprise). - - [Passwordless](${manage_url}/#/connections/passwordless): let your users signup and login using one-time codes (delivered by email or SMS) or one-click links, instead of passwords. [More info on Passwordless](/connections/passwordless). -<% } else if (screen === "users") { %> - This is where you manage your user's identities. In this page you can view your user's profiles, create new ones, perform password resets, block and delete users, and many more. You can also use this page to log in as any of your users in order to reproduce any issues that they report and debug your application. [More info on User Management](/users). + - [Database](${manage_url}/#/connections/database): Securely store and manage username / password credentials either in an Auth0 Database or in your own. To connect to an existing database you can use JavaScript scripts (we provide the templates) that run on Auth0's server on every authentication. Furthermore, you can migrate an existing legacy credentials database to Auth0 gradually as users authenticate (no password reset required). [More info on Database Connections](/connections/database). + - [Social](${manage_url}/#/connections/social): Configure social connections like Facebook, Twitter, Github and others, so that you can let your users login with them. [More info on individual social providers](/connections/identity-providers-social). + - [Enterprise](${manage_url}/#/connections/enterprise): Configure Enterprise Connections like Active Directory, SAML, Office 365 and others so that you can let your users login with them. This way your users can use their enterprise credentials to login to your app. [More info on individual enterprise providers](/connections/identity-providers-enterprise). + - [Passwordless](${manage_url}/#/connections/passwordless): Let your users signup and login using one-time codes (delivered by email or SMS) or one-click links, instead of passwords. [More info on Passwordless](/connections/passwordless). + <% } else if (screen === "universal-login") { %> + This is where you can create a beautiful universal login page where you can redirect to authenticate your users, customize the look and feel of your login page with CSS and HTML, and implement SSO in your applications with the flip of a switch. [More info on Universal Login](/universal-login). +<% } else if (screen === "users-roles") { %> + This is where you manage your user's identities and permissions. + - [Users](${manage_url}/#/users): View your user's profiles, create new ones, perform password resets, block and delete users, and many more. [More info on Users](/users). + - [Roles](${manage_url}/#/roles): Create and manage roles for your applications. Roles contain collection of permissions and can be assigned to users. [More info on Roles](/authorization/guides/manage-roles). <% } else if (screen === "rules") { %> Here you can configure custom JavaScript snippets that are executed in Auth0 as part of the transaction every time a user authenticates to your application. You can call external APIs, filter which users can login to your application, use a whitelist, geolocated access or anything. [More information on Rules](/rules). <% } else if (screen === "hooks") { %> Here you can configure Node.js code that is executed against extensibility points (which are comparable to webhooks that come with a server). This way you can customize the behavior of Auth0 when you use Database Connections. [More info on Hooks](/hooks). <% } else if (screen === "mfa") { %> - Use this page to configure Multifactor Authentication (MFA) for your apps. This way you can add an additional factor to conventional logins to prevent unauthorized access. You can use Push Notifications, SMS or both. [More info on MFA](/multifactor-authentication). -<% } else if (screen === "hlp") { %> - Here you can create a login page where you can redirect to authenticate your users. The page can be customized with HTML and CSS and will be hosted by Auth0. By using centralized authentication, your app will be more secure and you will be able to implement SSO very easily. Except for the login, you can also add pages for the Password Reset process, MFA, and error pages. [More info on Hosted Pages](/hosted-pages). + Use this page to configure multi-factor authentication (MFA) for your apps. This way you can add an additional factor to conventional logins to prevent unauthorized access. You can use Push Notifications, SMS, Voice, etc. [More info on MFA](/mfa). <% } else if (screen === "emails") { %> Here you can configure the email templates for verification emails, welcome emails, change password emails, and more. You can also configure a custom SMTP email provider which is a requirement for production purposes. Auth0 does offer a built-in email infrastructure but it should be used for testing purposes only. [More info on emails](/email). <% } else if (screen === "logs") { %> @@ -35,5 +37,5 @@ <% } else if (screen === "extensions") { %> In this page you can see a list of pre-built addons that we have created for you. You can use them to extend the functionality of the Auth0 base product. You can enable extensions in order to import or export users, export logs to external services, expose the Users dashboard to a group of users (without allowing them access to the rest of the dashboard), manage user authorization, and more. [More info on extensions](/extensions). <% } else { %> - The last screeen navigates you to our [Support Center](${env.DOMAIN_URL_SUPPORT}). The alternative to users that do not have access to support services is the [Auth0 Community](https://community.auth0.com/). [More info on support options](/support). -<% } %> \ No newline at end of file + The last screen navigates you to our [Support Center](${env.DOMAIN_URL_SUPPORT}). The alternative to users that do not have access to support services is the [Auth0 Community](https://community.auth0.com/). [More info on support options](/support). +<% } %> diff --git a/articles/getting-started/create-tenant.md b/articles/getting-started/create-tenant.md new file mode 100644 index 0000000000..ecc9e1c324 --- /dev/null +++ b/articles/getting-started/create-tenant.md @@ -0,0 +1,36 @@ +--- +title: Create a Tenant +description: Learn how to create a tenant in the Auth0 Dashboard. +topics: + - tenants +contentType: how-to +useCase: + - create-tenant + - get-started +--- +# Create a Tenant + +Once you create your account, you will be asked to create a **tenant**. No tenant can access the data of another tenant, even though multiple tenants might be running on the same machine. + +Tenant characteristics include: + +- The tenant name has to be unique. It will be used to create your personal domain. +- The tenant name can contain only lowercase alphanumeric characters and hyphens ("-"). It cannot begin or end with a hyphen. +- The tenant name must be a minimum of 3 characters and maximum of 64 characters. +- The tenant name cannot be changed after creation. +- You can create more than one tenant; in fact you are encouraged to do so for each environment you may have, such as development, staging, or production. For details, see [Set Up Multiple Environments](/dev-lifecycle/setting-up-env). + +When you name your tenant, that name becomes your Auth0 domain. (Or you can create a custom domain.) This domain is the base URL that you will use to access our API and the URL where your users are redirected to authenticate. + +Auth0 supports three regional subdomains: +- `us.auth0.com` for US +- `eu.auth0.com` for Europe +- `au.auth0.com` for Australia + +When you you are asked for the region you want to use, your choice affects which regional subdomain will be assigned to you and where your data will be hosted. If you pick US, then the name format will be `YOUR-TENANT-NAME.us.auth0.com`; for Europe, it will be `YOUR-TENANT-NAME.eu.auth0.com`; and so forth. + +In our example, Example-Co chose the name `example-co` and **Americas** as their region. So their domain is `example-co.us.auth0.com`. + +## Keep reading + +* [Set Up Multiple Environments](/dev-lifecycle/setting-up-env) diff --git a/articles/getting-started/dashboard-overview.md b/articles/getting-started/dashboard-overview.md index d951a1d079..3528b0a344 100644 --- a/articles/getting-started/dashboard-overview.md +++ b/articles/getting-started/dashboard-overview.md @@ -2,6 +2,14 @@ title: Dashboard Overview description: Learn the basics of the Auth0 Dashboard toc: true +topics: + - auth0-101 + - dashboard +contentType: + - how-to +useCase: + - manage-accounts + - get-started --- # Dashboard Overview @@ -13,7 +21,7 @@ It consists of several sections which you can navigate using the sidebar menu on ## Configure your implementation -The matrix that follows offers a brief overview of the different dashboard screens and what you can do on each. +The following table contains a brief overview of the different dashboard pages and what you can do on each. @@ -29,7 +37,7 @@ The matrix that follows offers a brief overview of the different dashboard scree - + @@ -44,8 +52,12 @@ The matrix that follows offers a brief overview of the different dashboard scree - - + + + + + + @@ -56,13 +68,9 @@ The matrix that follows offers a brief overview of the different dashboard scree - + - - - - @@ -90,10 +98,10 @@ The matrix that follows offers a brief overview of the different dashboard scree On the top right you can see your tenant's name and icon, and a little arrow. This arrow displays a drop-down menu that you can use to configure different aspects of your account: +- **Settings**: Here you can configure several aspects of your tenant. For more info see [Tenant Settings in the Auth0 Dashboard](/dashboard/reference/settings-tenant). +- **Invite an admin**: Use this option to add another person as admin to your tenant configuration. For more info see [Manage Admins in the Dashboard](/dashboard/manage-dashboard-admins). +- **Create tenant**: Use this to [create a new tenant](/getting-started/create-tenant). - **Switch tenant**: If you have multiple [tenants](/getting-started/the-basics#account-and-tenants) you can use this option to switch between them. All configuration described in the previous section is per tenant. If you create an application for `tenant-A`, you will not see it listed for `tenant-B`. If you have more than one tenant, you will find this switching option handy. -- **Settings**: Here you can configure several aspects of your tenant. For more info see [Tenant Settings in the Auth0 Dashboard](/dashboard/dashboard-tenant-settings). -- **Invite users to this tenant**: Use this option to add another person as admin to your tenant configuration. For more info see [Manage Admins in the Dashboard](/dashboard/manage-dashboard-admins). -- **Create tenant**: Use this to [create a new tenant](/getting-started/the-basics#account-and-tenants). - **View profile**: Use this to view information about your [account profile](${manage_url}/#/profile). -- **Subscription overview**: This option navigates you to our [Account Center](${env.DOMAIN_URL_SUPPORT}/tenants/public) where you can see information about your subscription and your tenants. -- **Log out**: Log out from your account. \ No newline at end of file +- **Account usage**: This option navigates you to our [Account Center](${env.DOMAIN_URL_SUPPORT}/tenants/public) where you can see information about your subscription and your tenants. +- **Logout**: Log out from your account. \ No newline at end of file diff --git a/articles/getting-started/deployment-models.md b/articles/getting-started/deployment-models.md index a6bef722b4..3f9a81a6cf 100644 --- a/articles/getting-started/deployment-models.md +++ b/articles/getting-started/deployment-models.md @@ -2,19 +2,43 @@ title: Auth0 Deployment Models description: Read about the four different deployment models that Auth0 offers and the differences between them toc: true +topics: + - auth0-101 + - deployment-models +contentType: + - concept +useCase: + - development + - get-started --- # Auth0 Deployment Models -Auth0 is offered in four deployment models: +Auth0 is offered in the following deployment models: -- As a **multi-tenant cloud service** running on Auth0's cloud -- As a **dedicated cloud service** running on Auth0's cloud -- As a **dedicated cloud service** running on Customer's cloud infrastructure -- As an **on-premises virtual Private SaaS (PSaaS) Appliance** running on Customer's data centers +
       Applications<%= include('./_list-processes', {"screen": "clients"}) %><%= include('./_list-processes', {"screen": "applications"}) %>
       APIs<%= include('./_list-processes', {"screen": "connections"}) %>
       Users<%= include('./_list-processes', {"screen": "users"}) %> Universal Login<%= include('./_list-processes', {"screen": "universal-login"}) %>
       Users & Roles<%= include('./_list-processes', {"screen": "users-roles"}) %>
       Rules<%= include('./_list-processes', {"screen": "hooks"}) %>
       Multifactor Auth Multi-factor Auth <%= include('./_list-processes', {"screen": "mfa"}) %>
       Hosted Pages<%= include('./_list-processes', {"screen": "hlp"}) %>
       Emails <%= include('./_list-processes', {"screen": "emails"}) %>
      + + + + + + + + + + + + + + + + +
      DeploymentDescription
      Public CloudA multi-tenant cloud service running on Auth0's cloud
      Standard Private CloudA dedicated cloud service running on Auth0's cloud
      Managed Private CloudA dedicated cloud service running on either Auth0's cloud or the customer's AWS cloud infrastructure
      -::: note -PSaaS Appliance is a managed service that you can use if your organization's requirements prevent you from using a multi-tenant cloud service. To learn more refer to [Private SaaS (PSaaS) Appliance](/appliance). -::: +The [Standard and the Managed Private Cloud](/private-cloud) options are managed services that you can use if: + +* Your organization's requirements prevent you from using the multi-tenant public cloud service +* You require an SLA guaranteeing higher uptimes +* You require a guaranteed level of requests per second The following tables describe operational and feature differences between these models. @@ -24,15 +48,15 @@ The following tables describe operational and feature differences between these Where It Runs - Auth0's Infrastructure - Customer's Infrastructure + Auth0's Infrastructure + Auth0's Infrastructure + Auth0's Infrastructure or Customer's AWS Cloud How It Runs - Multi-Tenant - Dedicated - Cloud - On-Premises + Public Cloud (Multi-Tenant) + Standard Private Cloud + Managed Private Cloud @@ -40,172 +64,138 @@ The following tables describe operational and feature differences between these Public Facing Yes Yes - Configurable - Configurable + Auth0's Cloud: Yes
      Customer's AWS Cloud: Configurable* Updates - Unscheduled.
      Multiple times per day.

      Staged in two zones. - Cumulative. Deployed post multi-tenant update after coordination with Customer. - Scheduled with Customer.

      Minimum 1/month, except critical updates (such as vulnerabilities, security updates) - Scheduled with Customer.

      Minimum 1/month, except critical updates (such as vulnerabilities, security updates) + Automatic Updates + Automatic Monthly Updates + Monthly, bi-monthly, or quarterly as coordinated with Auth0. Excludes critical updates (e.g., security patches), which will be applied as soon as possible Deployment Configurations N/A - High Availability (HA);
      Geo HA;
      High Capacity;
      Geo HA and High Capacity - High Availability (HA);
      Geo HA;
      High Capacity;
      Geo HA and High Capacity + High Availability (HA);
      High Capacity High Availability (HA);
      Geo HA;
      High Capacity;
      Geo HA and High Capacity + + Isolated Non-Production Environment + No + Yes + Yes + Service & Uptime Reporting - http://status.auth0.com
      http://uptime.auth0.com + https://status.auth0.com
      http://uptime.auth0.com Monitored by Auth0 - Monitored by Auth0 and Customer's tools - Monitored by Auth0 and Customer's tools + Auth0's Cloud: Auth0
      Customer's AWS Cloud: Customer + + + Infrastructure and Backup Responsibility + Auth0 + Auth0 + Auth0's Cloud: Auth0
      Customer's AWS Cloud: Customer Uptime SLA Provided - Yes - Yes - No + 99.90%
      No upgrade option available + 99.95% SLA with optional upgrade to 99.99%** + 99.95% SLA with optional upgrade to 99.99%** + + + Requests per Second + See Rate Limit Policy for Auth0 APIs + 500 requests per second with optional upgrade to 1500 requests per second + 500 requests per second with optional upgrade to 1500 requests per second + + + Data Residency + Not applicable + Region of Choice*** **** + Region of Choice*** + + + PCI Compliance No + Add-on available + Add-on available for Auth0-Hosted Private Cloud Support Channels & Levels - Same across all models + Same across all models + Same across all models + Same across all models +*Access to the Managed Private Cloud can be restricted to customer's private subnets. + +**See the **PSaaS Appliance** section the Auth0 [Service Level Description](https://auth0.com/legal) (located under **Support Program and Service Levels**). + +***Deployments to China are currently unavailable. + +****If you need to meet data sovereignty requirements, Auth0 supports Private Cloud deployments in the following regions USA, Europe, Australia, Canada, and Japan. Otherwise, the Private Cloud can be supported in other regions (excepting China). + ## Feature Differences - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + - - - + + - - - - - - - - - - - - - - - - - + + - - + - - - - + + - - - - - - - - - - - - - - - - - - + +
      Where It RunsAuth0's InfrastructureCustomer's Infrastructure
      How It RunsMulti-TenantDedicatedCloudOn-PremisesPublic Cloud (Multi-Tenant)Standard Private CloudManaged Private Cloud
      SSO LifetimeDefault SettingsConfigurableConfigurableConfigurable
      User SearchLucene queriesSimple attribute search or Lucene queriesSimple attribute search or Lucene queriesSimple attribute search or Lucene queries
      Tenant Log SearchLucene queriesSimple attribute searchSimple attribute searchSimple attribute search
      Log RetentionUp to 30 days (depends on subscription plan)Limited to 30 daysLimited to 30 daysLimited to 30 daysv3v3
      Code SandboxWebtask (Javascript and C#)Webtask or in-processWebtask or in-processWebtask or in-processWebtask (Node.js version 8 and C#)Webtask (Node.js version 8)Webtask (Node.js version 8)
      Webtask Multi-TenantDedicated (Fixed NPM modules)Dedicated (Fixed NPM modules)On-Premises (Fixed NPM modules)DedicatedDedicated
      Anomaly Detection Brute Force and Breached PasswordsBrute ForceBrute ForceBrute Force
      ExtensionsYesYes *Yes *Yes *
      GeolocationYesYesYesYesBrute Force and Breached PasswordsBrute Force and Breached Passwords
      Connecting IP Address Filtering Restrictions No NoYesYesAuth0's Cloud: No
      Customer's AWS Cloud: Yes
      Custom Domains YesYes**Yes**Yes**
      Yes*Yes*
      Shared Resources Among Multiple Customers Yes No NoNo
      MFA YesAvailable using SMS, Google Authenticator, Duo over TOTP/HOTP, and Push Notification with Guardian SDK.Available using SMS, Google Authenticator, Duo over TOTP/HOTP, and Push Notification with Guardian SDK.Available using SMS, Google Authenticator, Duo over TOTP/HOTP, and Push Notification with Guardian SDK.
      LockYesYesYesYes ***
      Internet RestrictedNoNoNoOptional ***Available using SMS, Voice, Google Authenticator or similar apps, Duo over TOTP/HOTP, Email, and Push Notification with Guardian Available using SMS, Voice, Google Authenticator or similar apps, Duo over TOTP/HOTP, Email, and Push Notification with Guardian
      -*See the [PSaaS Appliance: Extensions page](/appliance/extensions) to learn more about configuring extensions with the PSaaS Appliance. - -**See [PSaaS Appliance Custom Domains](/appliance/custom-domains) for details. If your PSaaS Appliance is hosted in the Auth0 Private Cloud, see [Private Cloud Requirements](/appliance/private-cloud-requirements). - -***You may choose to [operate the PSaaS Appliance in an Internet-restricted environment](/appliance/infrastructure/internet-restricted-deployment) (except during [update periods](/appliance/infrastructure/ip-domain-port-list#external-connectivity)). \ No newline at end of file +*See [Custom Domains](/appliance/custom-domains) and [Private Cloud Requirements](/appliance/private-cloud-requirements) for details. diff --git a/articles/getting-started/faq.md b/articles/getting-started/faq.md index b0cd2722cb..82bc9567db 100644 --- a/articles/getting-started/faq.md +++ b/articles/getting-started/faq.md @@ -2,5 +2,11 @@ description: FAQ for Auth0 beginners toc: true public: false +topics: + - auth0-101 +contentType: concept +useCase: + - strategize + - get-started --- # Frequently Asked Questions - UNDER CONSTRUCTION diff --git a/articles/getting-started/hello-world.md b/articles/getting-started/hello-world.md index 47162e0187..28e11867a5 100644 --- a/articles/getting-started/hello-world.md +++ b/articles/getting-started/hello-world.md @@ -2,5 +2,11 @@ description: How to add authentication to a simple Hello World app using Auth0 toc: true public: false +topics: + - auth0-101 +contentType: tutorial +useCase: + - strategize + - get-started --- # Hello World - UNDER CONSTRUCTION diff --git a/articles/getting-started/index.md b/articles/getting-started/index.md index 46ab091b2d..a033710ec9 100644 --- a/articles/getting-started/index.md +++ b/articles/getting-started/index.md @@ -1,29 +1,25 @@ --- description: If you are new to Auth0 start here for a list of resources that can get you started -title: Getting Started +title: Get Started classes: topic-page +topics: + - auth0-101 +contentType: + - concept + - index +useCase: + - strategize + - get-started ---
      -

      Getting Started

      +

      Get Started

      Learn the basics of Auth0.

      -Welcome! If you are new to Auth0, you are in the right place. - -This is an introduction to Auth0, and covers things like: - -* What is it we do -* How we can help you -* The basic terminology we use -* The process of implementing Auth0 -* The Auth0 ecosystem -* ... and many more - -Let's get started! - +Welcome! If you are new to Auth0, you are in the right place. Here we will cover how to get started using Auth0. diff --git a/articles/getting-started/overview.md b/articles/getting-started/overview.md index 72eb99f382..738d3bbd98 100644 --- a/articles/getting-started/overview.md +++ b/articles/getting-started/overview.md @@ -1,56 +1,59 @@ --- title: Auth0 Overview -description: Learn what Auth0 is and how you can use it +description: Learn what Auth0 is and how you can use it. toc: true +topics: + - auth0-101 + - auth0-overview +contentType: concept +useCase: + - strategize + - get-started --- # Auth0 Overview -Auth0 provides authentication and authorization as a service. - -We are here to give developers and companies the building blocks they need in order to secure their applications, without having to become security experts. +Auth0 is a flexible, drop-in solution to add authentication and authorization services to your applications. Your team and organization can avoid the cost, time, and risk that comes with building your own solution to authenticate and authorize users. You can connect any application (written in any language or on any stack) to Auth0 and define the identity providers you want to use (how you want your users to log in). -Based on your app's technology, choose one of our SDKs (or call our API) and hook it up to your app. Now each time a user tries to authenticate, Auth0 will verify their identity and send the required information back to your app. - -![Auth0 Overview](/media/articles/getting-started/overview.png) +Based on your app's technology, choose one of our SDKs (or call our API), and hook it up to your app. Now each time a user tries to authenticate, Auth0 will verify their identity and send the required information back to your app. ## Why use Auth0? -Take a look at just a few of the use cases for which you can use Auth0: +Take a look at just a few of Auth0's use cases: -- You built an awesome app and you want to add user authentication and authorization. Your users should be able to log in either with username/password or with their social accounts (Facebook, Twitter, and so on). You want to retrieve the user's profile after the login so you can customize the UI and apply your authorization policies. +- You built an awesome app and you want to add user authentication and authorization. Your users should be able to log in either with username/password or with their social accounts (such as Facebook or Twitter). You want to retrieve the user's profile after the login so you can customize the UI and apply your authorization policies. - You built an API and you want to secure it with [OAuth 2.0](/protocols/oauth2). -- You have more than one app and you want to implement [Single Sign On](/sso). -- You built a JavaScript front-end app and a mobile app and you want them both to securely access your API. -- You have a web app which needs to authenticate users using SAML. +- You have more than one app, and you want to implement Single Sign-on (SSO). +- You built a JavaScript front-end app and a mobile app, and you want them both to securely access your API. +- You have a web app which needs to authenticate users using Security Assertion Markup Language (SAML). - You believe passwords are broken and you want your users to log in with one-time codes delivered by email or SMS. -- If one of your user's email addresses is compromised in some site's public data breach, you want to be notified, and also notify the users and/or block them from logging in to your app until they reset their password. -- You want to act proactively and block suspicious IP addresses if they make consecutive failed login attempts, in order to avoid DDoS attacks. +- If one of your user's email addresses is compromised in some site's public data breach, you want to be notified, and you want to notify the users and/or block them from logging in to your app until they reset their password. +- You want to act proactively to block suspicious IP addresses if they make consecutive failed login attempts, in order to avoid DDoS attacks. - You are part of a large organization who wants to federate their existing enterprise directory service to allow employees to log in to the various internal and third-party applications using their existing enterprise credentials. - You don't want (or you don't know how) to implement your own user management solution. Password resets, creating, provisioning, blocking, and deleting users, and the UI to manage all these. You just want to focus on your app. -- You want to enforce [multifactor authentication](/multifactor-authentication) when your users want to access sensitive data. -- You are looking for an identity solution that will help you stay on top of the constantly growing compliance requirements of SOC2, GDPR, OpenID Connect and others. -- You want to use analytics to track users on your site or application. You plan on using this data to create funnels, measure user retention, and improve your sign up flow. +- You want to enforce multi-factor authentication (MFA) when your users want to access sensitive data. +- You are looking for an identity solution that will help you stay on top of the constantly growing compliance requirements of SOC2, GDPR, PCI DSS, HIPAA, and others. +- You want to use analytics to track users on your site or application. You plan on using this data to create funnels, measure user retention, and improve your sign-up flow. ## Which industry standards does Auth0 use? -Once upon a time, when computers were standalone systems, all the authentication and user data lived in a single machine. Times have changed, and now you can use the same login information across multiple apps and sites. This was achieved due to the identity industry standards that were widely adopted across the web. +Once upon a time, when computers were standalone systems, all the authentication and user data lived in a single machine. Times have changed, and now you can use the same login information across multiple apps and sites. This has been achieved through widespread adoption of identity industry standards across the web. These are a set of open specifications and protocols that specify how to design an authentication and authorization system. They specify how you should manage identity, move personal data securely, and decide who can access applications and data. The identity industry standards that we use here in Auth0 are: -- **OAuth 1**: the original standard for access delegation. Used as a way for a user to grant websites access to their information on other websites or apps, but without giving them the credentials. -- **OAuth 2**: an authorization standard that allows a user to grant limited access to their resources on one site, to another site, without having to expose their credentials. You use this standard every time you log in to a site using your Google account and you are asked if you agree with sharing your email address and your contacts list with that site. -- **Open ID Connect**: an identity layer that sits on top of OAuth 2 and allows for easy verification of the user's identity, as well the ability to get basic profile information from the identity provider. -- **JSON Web Tokens**: an open standard that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. +- **Open Authorization (OAuth) 1**: the original standard for access delegation. Used as a way for a user to grant websites access to their information on other websites or apps, but without giving them the credentials. +- **Open Authorization (OAuth) 2**: an authorization standard that allows a user to grant limited access to their resources on one site, to another site, without having to expose their credentials. You use this standard every time you log in to a site using your Google account and you are asked if you agree with sharing your email address and your contacts list with that site. +- **OpenID Connect (OIDC)**: an identity layer that sits on top of OAuth 2 and allows for easy verification of the user's identity, as well the ability to get basic profile information from the identity provider. +- **JSON Web Tokens (JWT)**: an open standard that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. - **Security Assertion Markup Language (SAML)**: an open-standard, XML-based data format that allows businesses to communicate user authentication and authorization information to partner companies and enterprise applications their employees may use. -- **WS-Federation**: a standard developed by Microsoft, and used extensively in their applications. It defines the way security tokens can be transported between different entities to exchange identity and authorization information. +- **WS-Federation (WS-Fed)**: a standard developed by Microsoft, and used extensively in their applications. It defines the way security tokens can be transported between different entities to exchange identity and authorization information. ## Keep reading ::: next-steps -- [Learn the basics and familiarize yourself with the identity terminology](/getting-started/the-basics) -- [Read about the four different deployment models that Auth0 offers](/getting-started/deployment-models) +- [Learn the basics and familiarize yourself with identity terminology](/getting-started/the-basics) +- [Read about different deployment models offered by Auth0](/getting-started/deployment-models) ::: diff --git a/articles/getting-started/set-up-api.md b/articles/getting-started/set-up-api.md new file mode 100644 index 0000000000..cb5c67c61f --- /dev/null +++ b/articles/getting-started/set-up-api.md @@ -0,0 +1,101 @@ +--- +title: Set Up an API +description: Learn how to set up an API in Auth0 Dashboard. +topics: + - apis +contentType: how-to +useCase: + - set-up-api + - get-started +--- +# Set Up an API + +1. In the Dashboard, click on the [APIs menu option](${manage_url}/#/apis) on the left. + + ::: note + The API tab will already have one API created automatically, the **Auth0 Management API**. For more details on the features of the Management API and its available endpoints, refer to: [Management API](/api/management/v2). + ::: + +2. Click the **+ Create API** button. + + ![Create a new API](/media/articles/api/overview/create-api.png) + + You need to provide the following information for your API: + + - **Name**: a friendly name for the API. Does not affect any functionality. + + - **Identifier**: a unique identifier for the API. Auth0 recommends using a URL. Auth0 does differentiate between URLs that include the last forward slash. For example, https://example.com and https://example.com/ are two different identifiers. The URL does not have to be a publicly available URL. Auth0 will not call your API. This value **cannot** be modified afterwards. + + - **Signing Algorithm**: the algorithm to sign the tokens with. The available values are `HS256` and `RS256`. When selecting `RS256` the token will be signed with the tenant's private key. To learn more about signing algorithms, see [Signing Algorithms](/tokens/concepts/signing-algorithms). + +3. Fill in the required information and click the **Create** button. + + Once you do so you will be navigated to the *Quick Start* of your API. Here you can find details on the implementation changes you have to do to your API, which basically consists of choosing a JWT library from a predefined list and configuring this library to validate the Access Tokens in your API. + + ![API Quick Starts](/media/articles/api/overview/quickstarts-view.png) + + The other available views for your API are: + + - **Settings**: lists the settings for your API. Some are editable. Here you can change the token expiration time and enable offline access (this way Auth0 will allow your applications to ask for Refresh Tokens for this API). For details refer to the [API Settings paragraph](#api-settings). + + - **Scopes**: here you can define the scopes for this API, by setting a name and a description. + + - **Machine to Machine Applications**: lists all applications for which the **Client Credentials** grant is **enabled**. By default, this grant is **enabled* for [Regular Web Applications and Machine to Machine Applications](/applications). You can authorize any of these applications to request Access Tokens for your API. Optionally, you can select a subset of the defined scopes to limit your authorized application's access. + + - **Test**: from this view, you can execute a sample Client Credentials flow with any of your authorized applications to check that everything is working as expected. + +## API settings + +Click on the **Settings** tab of your [API](${manage_url}/#/apis) to review the available settings: + +- **Id**: A unique alphanumeric string generated by Auth0. The information is read only and you will only need it if you will be working directly with [Auth0's Management API Resource Servers endpoints](/api/management/v2#!/Resource_Servers/get_resource_servers_by_id). + +- **Name**: A friendly name for the API. Does not affect any functionality. The following characters are not allowed: `< >`. + +- **Identifier**: A unique identifier for your API. This value is set upon API creation and cannot be modified afterwards. We recommend using a URL but note that this doesn't have to be a publicly available URL, Auth0 will not call your API at all. + +- **Token Expiration (Seconds)**: The amount of time (in seconds) before the Auth0 Access Token expires. The default value is 86400 seconds (24 hours). The maximum value you can set is 2592000 seconds (30 days). + +- **Allow Skipping User Consent**: When a first party application requests authorized access against an API with the *Allow Skipping User Consent* flag set, the User Consent dialog will not be shown to the final user. Note that if the hostname of your application's **callback URL** is `localhost` or `127.0.0.1` the consent dialog will always be displayed. + +- **Allow Offline Access**: If this setting is enabled, Auth0 will allow applications to ask for Refresh Tokens for this API. + +- **Signing Algorithm**: The algorithm to sign the tokens with. The available values are `HS256` and `RS256`. When selecting `RS256` (recommended) the token will be signed with the tenant's private key. This value is set upon API creation and cannot be modified afterwards. For more details on the signing algorithms see the [Signing Algorithms paragraph](#signing-algorithms) below. + +## Signing algorithms + +When you create an API you have to select the algorithm your tokens will be signed with. The signature is used to verify that the sender of the JWT is who it says it is and to ensure that the message wasn't changed along the way. + +::: note +The signature is part of a JWT. If you are not familiar with the JWT structure, please see [JSON Web Tokens (JWTs) in Auth0](/jwt#what-is-the-json-web-token-structure-). +::: + +To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that. That algorithm, which is part of the JWT header, is the one you select for your API: `HS256` or `RS256`. + +- **RS256** is an [asymmetric algorithm](https://en.wikipedia.org/wiki/Public-key_cryptography) which means that there are two keys: one public and one private (secret). Auth0 has the secret key, which is used to generate the signature, and the consumer of the JWT has the public key, which is used to validate the signature. + +- **HS256** is a [symmetric algorithm](https://en.wikipedia.org/wiki/Symmetric-key_algorithm) which means that there is only one secret key, shared between the two parties. The same key is used both to generate the signature and to validate it. Special care should be taken in order for the key to remain confidential. + +The most secure practice, and our recommendation, is to use **RS256**. Some of the reasons are: + +- With RS256 you are sure that only the holder of the private key (Auth0) can sign tokens, while anyone can check if the token is valid using the public key. + +- Under HS256, if the secret key is compromised (e.g. by the application) you would have to re-deploy the API with the new secret. + +- With RS256 you can request a token that is valid for multiple audiences. + +- With RS256 you can implement key rotation without having to re-deploy the API with the new secret. + +::: panel Verify an RS256 signed token +Go to [Dashboard > Applications](${manage_url}/#/applications). Open the **Settings** of your applications, scroll down and open **Advanced Settings**. Open the **Certificates** tab and you will find the Public Key in the **Signing Certificate** field. + +If you want to use the Public Key to verify a JWT signature on [JWT.io](https://jwt.io/), you can copy the Public Key and paste it in the **Public Key or Certificate** field under the **Verify Signature** section on the [JWT.io](https://jwt.io/) website. + +If you want to verify the signature of a token from one of your applications, we recommend that you get the Public Key from your tenant's [JSON Web Key Set (JWKS)](/tokens/concepts/jwks). Your tenant's JWKS is `https://${account.namespace}/.well-known/jwks.json`. +::: + +# Keep reading + +- [API Authorization Overview](/api-auth) +- [Which OAuth Flow to Use](/api-auth/which-oauth-flow-to-use) +- [Tokens](/tokens) diff --git a/articles/getting-started/set-up-app/index.md b/articles/getting-started/set-up-app/index.md new file mode 100644 index 0000000000..c289ac8edc --- /dev/null +++ b/articles/getting-started/set-up-app/index.md @@ -0,0 +1,21 @@ +--- +title: Set Up an App +description: Learn how to set up an app in Auth0 Dashboard. +classes: topic-page +topics: + - apps +contentType: how-to +useCase: + - set-up-app + - get-started +--- +# Set Up an App + +Learn how to set up an app in the Auth0 Dashboard. You can set up the following app types: + +<%= include('../../_includes/_topic-links', { links: [ + 'dashboard/guides/applications/register-app-regular-web', + 'dashboard/guides/applications/register-app-native', + 'dashboard/guides/applications/register-app-spa', + 'dashboard/guides/applications/register-app-m2m', +] }) %> diff --git a/articles/getting-started/the-authentication-flow.md b/articles/getting-started/the-authentication-flow.md index 26238ad8b6..b91140b4c8 100644 --- a/articles/getting-started/the-authentication-flow.md +++ b/articles/getting-started/the-authentication-flow.md @@ -2,5 +2,12 @@ description: Learn how the Auth0 authentication flow works toc: true public: false +topics: + - auth0-101 + - authentication +contentType: concept +useCase: + - development + - get-started --- # The Authentication Flow - UNDER CONSTRUCTION diff --git a/articles/getting-started/the-basics.md b/articles/getting-started/the-basics.md index fb1d91c58e..ed84b63202 100644 --- a/articles/getting-started/the-basics.md +++ b/articles/getting-started/the-basics.md @@ -1,46 +1,70 @@ --- title: Learn the Basics -description: Learn the basics of Auth0 and familiarize yourself with the terminology +description: Learn the basics of Auth0 and familiarize yourself with the terminology. toc: true +topics: + - auth0-101 + - auth0-basics +contentType: concept +useCase: + - development + - strategize + - get-started --- # Learn the Basics -Often, the biggest barrier to learning new things, especially in the tech industry, is terminology. The words that are used to describe things can cause problems when you try to understand new concepts. This document explains some of the basic terminology we use here at Auth0, and maps these terms to concepts you are already familiar with. +Often, the biggest barrier to learning new things, especially in the tech industry, is terminology. The words that are used to describe things can cause problems when you try to understand new concepts. This document explains some of the basic terminology we use here at Auth0, and maps these terms to concepts you are already familiar with. We also have a handy [glossary](/glossary). ::: panel TL;DR -This article uses an example to introduce some core concepts of Auth0: **accounts**, **tenants**, **domains**, **applications**, and **connections**. If you already know what these are (in the context of Auth0) you can safely skip reading it. +This article uses an example to introduce some core concepts of Auth0: **accounts**, **tenants**, **domains**, **applications**, and **connections**. If you already know what these are in the context of Auth0, you can safely skip reading it. -We will use a very simple example: A company named `Example-Co` wants to use Auth0 for authentication. They have a web app and a mobile app, and they want their users to be able to login with username/password, Google, or GitHub. +We will use a very simple example: A company named `Example-Co` wants to use Auth0 for authentication. They have a web app and a mobile app, and they want their users to be able to log in with username/password, Google, or GitHub. ::: ## Account and tenants -If you haven't already signed up for an Auth0 **account**, do so (it's free). You can either use username/password or log in with a social provider (GitHub, Google, or Microsoft). +If you haven't already [signed up](https://auth0.com/signup) for an Auth0 **account**, do so (it's free). You can either use username and password or log in with a social provider (such as Facebook, Google, or Apple). -Once you create your account you will be asked to create a **Tenant**. This is a **logical isolation unit**. +Once you create your account you will be asked to create a tenant. *Tenant* is a term borrowed from [software multitenancy](https://en.wikipedia.org/wiki/Multitenancy). It refers to an architecture where a single software instance serves multiple tenants. In Auth0, a tenant is logically isolated. No tenant can access the data of another tenant, even though multiple tenants might be running on the same machine. -The term is borrowed from "software multitenancy". This refers to an architecture where a single instance of the software serves multiple tenants. No tenant can access the instance of another tenant, even though the software might be running on the same machine (hence the logical isolation). +Tenant characteristics: -Some characteristics: - -- The tenant name has to be unique (we will see in the next paragraph that it is used to create your own personal domain). +- The tenant name has to be unique. It will be used to create your personal domain. +- The tenant name can contain only lowercase alphanumeric characters and hyphens ("-"). It cannot begin or end with a hyphen. +- The tenant name must be a minimum of three characters and maximum of 64 characters. - The tenant name cannot be changed after creation. - You can create more than one tenant; in fact, you are encouraged to do so for each environment you have (such as Development, Staging, or Production). -- If you chose to host your data in Europe or Australia, then your tenant will have a suffix (`eu` or `au`). In our example, if `Example-Co` picked the name `example-co`, then depending on where the data is stored, the tenant name would be `example-co-eu` or `example-co-au`. -## Domain +You can create additional tenants at any time. To do so, go to the upper-right corner of the Dashboard and click on your tenant name to display the pulldown menu. Click **Create Tenant**. -As discussed in the previous section, when you create a new account with Auth0, you are asked to pick a name for your **Tenant**. This name, appended with `auth0.com`, will be your Auth0 **Domain**. It's the base URL you will be using when you want to access our API (for example, to authenticate a user). The name format is `TENANT-NAME.auth0.com` (you get to pick the `TENANT-NAME` part). +## Domains -In our example, `Example-Co` picked the name `example-co`; hence their domain is `example-co.auth0.com`. +As discussed in the previous section, when you create a new account with Auth0, you are asked to pick a name for your tenant. This name, appended with `auth0.com`, will be your Auth0 *domain*. (You can also use [custom domains](#custom-domains).) It's the base URL you will use to access our API and the URL where your users are redirected in order to authenticate. -::: panel Custom Domains -You can use a custom domain, such as `example-co.com`. This comes with an additional cost. This feature is in beta for **public-cloud tenants** (see the [Custom Domains](/custom-domains) documentation for details). If you have a **single-tenant** implementation, you can deploy your custom domain in one of three locations: -- The cloud managed by Auth0 -- A cloud managed by you -- An [on-premise installation](/appliance) +Auth0 supports three regional subdomains: +- `us.auth0.com` for US +- `eu.auth0.com` for Europe +- `au.auth0.com` for Australia + +When you create your tenant, you are asked for the region you want to use. This choice affects which regional subdomain will be assigned to you and where your data will be hosted. So if you pick US then the name format will be `YOUR-TENANT-NAME.auth0.com`, for Europe it will be `YOUR-TENANT-NAME.eu.auth0.com`, and so forth. + +In our example, `Example-Co` picked the name `example-co` and Americas as their region. Therefore their domain is `example-co.auth0.com`. + +::: note +Tenants created on or after 10 June 2020 in the US region will be appended with `us.auth0.com` (instead of `auth0.com`) to create the domain URL that you use to access Auth0 services. ::: +### Custom domains + +We recommend the use of custom domains, such as `example-co.com`, in your production environments to provide your users with the most secure and seamless experience. This comes with an additional cost. + +If you have a [**single-tenant** implementation](/private-cloud), you can deploy your custom domain in: + +- The cloud managed by Auth0 +- An AWS cloud managed by you + +For more information, see [Custom Domains](/custom-domains). + ## Application Now that you have an account, we need to know about your app(s) that will be using our services. To that end, you must register each application. We use the term **application** to refer to an application (like [OAuth 2.0 does](https://tools.ietf.org/html/rfc6749#page-6)). @@ -70,9 +94,9 @@ This relationship between Auth0 and the identity provider is referred to as a ** Connections are sources of users and they can be of the following types: - [Database connections](/connections/database): Users log in with username and passwords, stored either in the Auth0 cloud or your own database -- [Social logins](/identityproviders#social): Google, Facebook, Twitter, and more -- [Enterprise directories](/identityproviders#enterprise): LDAP, Google Apps, Office 365, ADFS, AD, SAML-P, WS-Federation, and more -- [Passwordless systems](/connections/passwordless): Users log in with one-time codes, sent via SMS or email +- [Social logins](/connections/identity-providers-social): Google, Facebook, Twitter, and more +- [Enterprise directories](/connections/identity-providers-enterprise): LDAP, G Suite, Office 365, ADFS, AD, SAML-P, WS-Federation, and more +- [Passwordless systems](/connections/passwordless): Users log in with one-time codes, sent via SMS or email Each connection can be shared among multiple applications. You can configure any number of connections, and then choose which of them to enable for each application. @@ -84,7 +108,7 @@ In our example, `ExampleCo` wants their users to be able to login with username/ 1. Enable all three connections for the mobile app ::: note -For more information on the supported identity providers, refer to [Identity Providers Supported by Auth0](/identityproviders). For details on how to enable a connection for an application, refer to [Application Connections](/applications/connections). +For more information on the supported identity providers, refer to [Identity Providers Supported by Auth0](/identityproviders). For details on how to enable a connection for an application, refer to [Connections](/connections). ::: ## Where to go from here @@ -95,13 +119,11 @@ If you wish to learn more about the next steps in setting up Auth0, you can read - **Hook Auth0 up to your app**: Assuming that your app has a login and a logout button, you need to add some code in order to invoke Auth0 APIs each time one of these buttons is clicked. For details you can refer to one of our [quickstarts](/quickstarts). Alternatively, you can directly call our API to [log in](/api/authentication#login) or [log out](/api/authentication#logout) a user, or implement one of Auth0's [libraries and SDKs](/libraries). -- **Migrate your users to Auth0**: If you already have a user store, you need to migrate these users to Auth0 before you go live. For more information refer to [User Migration](/users/migrations). Alternatively, you can [connect your app to your own user database](/connections/database/custom-db) and access it via Auth0. +- **Migrate your users to Auth0**: If you already have a user store, you need to migrate these users to Auth0 before you go live. For more information refer to [User Migration](/users/concepts/overview-user-migration). Alternatively, you can [connect your app to your own user database](/connections/database/custom-db) and access it via Auth0. ## Keep reading -::: next-steps -- [Learn how you can configure, secure, and access your own API with Auth0](/apis) -- [Learn more about Auth0 APIs](/api/info) -- [Learn about our libraries](/libraries) -- [Learn about working with users and user profiles in Auth0](/users) -::: \ No newline at end of file +- [Auth0 APIs](/api/info) - Learn about Auth0 APIs. +- [Set Up an API](/getting-started/set-up-api) - Learn how to configure your own API with Auth0. +- [Auth0 Libraries & SDKs](/libraries) - Learn about our libraries and SDKs. +- [Manage Users](/users) - Learn about working with users and user profiles in Auth0. diff --git a/articles/getting-started/the-implementation-process.md b/articles/getting-started/the-implementation-process.md index 2470d48cbb..832eefbc0f 100644 --- a/articles/getting-started/the-implementation-process.md +++ b/articles/getting-started/the-implementation-process.md @@ -2,21 +2,27 @@ description: Roadmap of what you need to do to add authentication to your app and secure your APIs with Auth0 toc: true public: false +topics: + - auth0-101 + - auth0-basics +contentType: concept +useCase: + - strategize + - development + - get-started --- # The Implementation Process - UNDER CONSTRUCTION ## Integrate Auth0 with your Application -The default [protocol](/protocols) between your application and Auth0 is [OpenID Connect](/protocols/oidc), a modern, lightweight, simple to use, and simple to integrate protocol. - -<%= include('../_includes/_pipeline2') %> +The default [protocol](/protocols) between your application and Auth0 is [OpenID Connect (OIDC)](/protocols/oidc), a modern, lightweight, simple to use, and simple to integrate protocol. Auth0 ships [SDKs for all major platforms](/support/matrix#sdks) (.NET, Java, PHP, Python, node, iOS, and many more), but the use of Auth0 SDKs is not required. Virtually anything able to send HTTP requests can integrate with Auth0. -Auth0 also supports other common identity protocols, such as [WS-Federation](/protocols/ws-fed) and [SAML](/protocols/saml). Applications that are already "claims enabled" can easily connect to Auth0. +Auth0 also supports other common identity protocols, such as [WS-Federation](/protocols/ws-fed) and [SAML](/protocols/saml). Applications that are already "claims enabled" can easily connect to Auth0. -The **best** solution for integrating Auth0 with your application is to use Auth0's [universal login](/hosted-pages/login). Using universal login is a much less complicated process, and circumvents the dangers of cross-origin authentication. Universal login uses the [Lock](/libraries/lock) widget to allow your users to authenticate by default, but has other starting templates as well. You can customize the login page in the [Dashboard](${manage_url}/#/login_page). +The **best** solution for integrating Auth0 with your application is to use Auth0's Universal Login. Using Universal Login is a much less complicated process, and circumvents the dangers of cross-origin authentication. Universal Login uses the [Lock](/libraries/lock) widget to allow your users to authenticate by default, but has other starting templates as well. You can customize the login page in the [Dashboard](${manage_url}/#/login_page). ## Access your APIs -Auth0's [API authorization](/api-auth) features allow you to manage the authorization requirements for server-to-server and client-to-server applications, using the [OAuth 2.0 protocol](/protocols/oauth2). Using Auth0, you can easily support [different flows](/api-auth/which-oauth-flow-to-use) in your own APIs without worrying about the OAuth 2.0/OpenID Connect specification, or the many other technical aspects of API authorization. \ No newline at end of file +Auth0's [API authorization](/api-auth) features allow you to manage the authorization requirements for server-to-server and client-to-server applications, using the [OAuth 2.0 protocol](/protocols/oauth2). Using Auth0, you can easily support [different flows](/api-auth/which-oauth-flow-to-use) in your own APIs without worrying about the OAuth 2.0/OpenID Connect specification, or the many other technical aspects of API authorization. diff --git a/articles/getting-started/whats-next.md b/articles/getting-started/whats-next.md index 699e378d16..a2ed17b47d 100644 --- a/articles/getting-started/whats-next.md +++ b/articles/getting-started/whats-next.md @@ -2,6 +2,14 @@ description: Learn about Auth0 advanced features toc: true public: false +topics: + - auth0-101 + - auth0-basics +contentType: concept +useCase: + - strategize + - development + - get-started --- # What's Next? - UNDER CONSTRUCTION @@ -9,8 +17,8 @@ public: false Auth0 offers several ways to extend the platform's functionality: -- **Rules**: [Rules](/rules) are functions written in JavaScript or C#, that are executed in Auth0 just after successful authentication and before control returns to your app. Rules can be chained together for modular coding and can be turned on and off individually. They can be used for Access Control, Webhooks, Profile Enrichment, Multi-factor Authentication, and many other things. +- **Rules**: [Rules](/rules) are functions written in JavaScript or C#, that are executed in Auth0 just after successful authentication and before control returns to your app. Rules can be chained together for modular coding and can be turned on and off individually. They can be used for Access Control, Webhooks, Profile Enrichment, Multi-factor Authentication (MFA), and many other things. -- **Hooks**: [Hooks](/hooks) allow you to customize the behavior of Auth0 using Node.js code that is executed against extensibility points (which are comparable to webhooks that come with a server). They are [Webtasks](https://webtask.io) associated with specific [extensibility points](/hooks/extensibility-points) of the Auth0 platform. Auth0 invokes the Hooks at runtime to execute your custom logic. Hooks will eventually replace Rules, the current Auth0 extensibility method. Currently, you can use both Hooks and Rules, but Auth0 will implement new functionality in Hooks. +- **Hooks**: [Hooks](/hooks) allow you to customize the behavior of Auth0 using Node.js code that is executed against extensibility points (which are comparable to webhooks that come with a server). They are secure, self-contained functions associated with specific [extensibility points](/hooks/extensibility-points) of the Auth0 platform. Auth0 invokes the Hooks at runtime to execute your custom logic. Hooks will eventually replace Rules, the current Auth0 extensibility method. Currently, you can use both Hooks and Rules, but Auth0 will implement new functionality in Hooks. -- **Extensions**: [Auth0 Extensions](/extensions) enable you to install applications or run commands/scripts that extend the functionality of the Auth0 base product. You can either use one of the [pre-defined extensions](/extensions#using-an-auth0-provided-extension), provided by Auth0, or [create your own](/extensions#creating-your-own-extension). Some of the actions you can do with extensions are manage the authorizations for users (using groups, roles and permissions), import/export users, export logs to other services, deploy scripts from external repositories, and more. \ No newline at end of file +- **Extensions**: [Auth0 Extensions](/extensions) enable you to install applications or run commands/scripts that extend the functionality of the Auth0 base product. You can either use one of the [pre-defined extensions](/extensions#using-an-auth0-provided-extension), provided by Auth0, or [create your own](/extensions#creating-your-own-extension). Some of the actions you can do with extensions are manage the authorizations for users (using groups, roles, and permissions), import/export users, export logs to other services, deploy scripts from external repositories, and more. \ No newline at end of file diff --git a/articles/guides/ip-whitelist.md b/articles/guides/ip-whitelist.md new file mode 100644 index 0000000000..093624e73e --- /dev/null +++ b/articles/guides/ip-whitelist.md @@ -0,0 +1,55 @@ +--- +title: Whitelist IP Addresses +description: Identify Auth0 IP addresses to whitelist if you are behind a firewall. +topics: + - connections + - custom-database + - scripts +contentType: + - reference + - how-to +useCase: + - customize-connections +--- + +# Whitelist IP Addresses + +If you are behind a firewall, the following features may require whitelisting of the appropriate Auth0 IP addresses to ensure proper functionality: + +* [Custom Database Connections](/connections/database/custom-db) +* [Hooks](/hooks) +* [Rules](/rules) + +## Outbound Calls + +::: warning +Please note that IP addresses are subject to change. In the event of a change, Auth0 will send notifications several months before any IP address changes take place. The lists provided are up-to-date at the time of writing, but check the [Dashboard](${manage_url}) for the latest list. +::: + +When Auth0 makes outbound calls, the IP addresses are static. Auth0 translates internal IP addresses to one of the displayed options when reaching out using NAT. + +Please be sure to **allow** inbound connections from the region-specific set of IP addresses listed in the [Dashboard](${manage_url}). The specific set of IP addresses you should use is provided when you create your new [Custom Database Connection](${manage_url}/#/connections/database), [Hook](${manage_url}/#/hooks), or [Rule](${manage_url}/#/rules/create). + +The IP addresses are region-specific. + +### United States + +```text +35.167.74.121, 35.166.202.113, 35.160.3.103, 54.183.64.135, 54.67.77.38, 54.67.15.170, 54.183.204.205, 35.171.156.124, 18.233.90.226, 3.211.189.167, 18.232.225.224, 34.233.19.82, 52.204.128.250, 3.132.201.78, 3.19.44.88, 3.20.244.231 +``` + +### Europe + +```text +52.28.56.226, 52.28.45.240, 52.16.224.164, 52.16.193.66, 34.253.4.94, 52.50.106.250, 52.211.56.181, 52.213.38.246, 52.213.74.69, 52.213.216.142, 35.156.51.163, 35.157.221.52, 52.28.184.187, 52.28.212.16, 52.29.176.99, 52.57.230.214, 54.76.184.103, 52.210.122.50, 52.208.95.174 +``` + +### Australia + +```text +52.64.84.177, 52.64.111.197, 54.153.131.0, 13.210.52.131, 13.55.232.24, 13.54.254.182, 52.62.91.160, 52.63.36.78, 52.64.120.184, 54.66.205.24, 54.79.46.4 +``` + +## Inbound Calls + +IP addresses related to inbound calls to Auth0 may be variable due to the lack of fixed IP addresses on the load balancers. In this case firewall rules should operate on the name of the service (e.g. `.auth0.com`). diff --git a/articles/guides/login/_includes/_centralized_webapp.md b/articles/guides/login/_includes/_centralized_webapp.md index 3c1d2056fd..beb5e5dd35 100644 --- a/articles/guides/login/_includes/_centralized_webapp.md +++ b/articles/guides/login/_includes/_centralized_webapp.md @@ -9,7 +9,7 @@ router.get('/callback', ``` ## Convert your Code to use Universal Login -In web applications, you don't need any client-side code to integrate universal login. Your application should perform these steps: +In web applications, you don't need any client-side code to integrate Universal Login. Your application should perform these steps: 1. When the application needs to authenticate, navigate to a `/login` route in your website. If you were using plain HTML to code the web views, it would be: @@ -35,6 +35,6 @@ After authentication is done, it will redirect to the `/callback` url as in the 3. Review if you are using any [legacy authentication flow in your application](guides/migration-legacy-flows), and adjust your code accordingly. -You can find complete examples of implementing universal login in web applications for different technologies in our [Quickstarts](/quickstart/webapp). +You can find complete examples of implementing Universal Login in web applications for different technologies in our [Quickstarts](/quickstart/webapp). <%= include('_customizing-login-page') %> diff --git a/articles/guides/login/_includes/_customizing-login-page.md b/articles/guides/login/_includes/_customizing-login-page.md index 9980122d8f..92d0bd121b 100644 --- a/articles/guides/login/_includes/_customizing-login-page.md +++ b/articles/guides/login/_includes/_customizing-login-page.md @@ -1,16 +1,16 @@ ## Customizing the Login Page -When you integrate universal login in your application, you redirect the user to the `/authorize` endpoint of your Auth0 tenant. If Auth0 needs to authenticate the user, it will show the default login page. +When you integrate Universal Login in your application, you redirect the user to the `/authorize` endpoint of your Auth0 tenant. If Auth0 needs to authenticate the user, it will show the default login page. -You can customize the login page in your [Dashboard](${manage_url}/#/login_page) under Hosted Pages, by enabling the **Customize Login Page** toggle. +You can customize the login page in your [Dashboard](${manage_url}/#/login_settings) under Universal Login, by enabling the **Customize Login Page** toggle. ![Login Page](/media/articles/hosted-pages/login.png) ## Customize Lock in the Login Page -The default login page for universal login with your tenant is a template that will use [Lock](/libraries/lock) to provide your users with an attractive interface and smooth authentication process. You can look over that template and use it as a starting point if you choose to customize it in any way. +The default login page for Universal Login with your tenant is a template that will use [Lock](/libraries/lock) to provide your users with an attractive interface and smooth authentication process. You can look over that template and use it as a starting point if you choose to customize it in any way. -If you want to change any of Lock's [configurable options](/libraries/lock/configuration), you can do so using the editor [Dashboard](${manage_url}/#/login_page) under Hosted Pages. These options can alter the behavior of Lock itself, or the look and feel of the widget using the theming options. See the [configuration documentation](/libraries/lock/configuration) for details on how to customize Lock. +If you want to change any of Lock's [configurable options](/libraries/lock/configuration), you can do so using the editor [Dashboard](${manage_url}/#/login_settings) under Universal Login. These options can alter the behavior of Lock itself, or the look and feel of the widget using the theming options. See the [configuration documentation](/libraries/lock/configuration) for details on how to customize Lock. When you're done making changes to the code, click **Save** to persist the changes. diff --git a/articles/guides/login/migrating-lock-v10-spa.md b/articles/guides/login/migrating-lock-v10-spa.md index 8d66b3dbef..f24d3acc12 100644 --- a/articles/guides/login/migrating-lock-v10-spa.md +++ b/articles/guides/login/migrating-lock-v10-spa.md @@ -1,12 +1,20 @@ --- title: Moving SPAs using Lock to Universal Login -description: Learn how to migrate from Single Page Applications using Lock to Universal Login +description: Learn how to migrate from Single-Page Applications using Lock to Universal Login toc: true +topics: + - lock + - migrations + - spa + - universal-login +contentType: + - how-to +useCase: migrate --- # Migrate SPAs using Lock 10+ to Universal Login -This document explains how to migrate Single Page Applications using [Lock](/libraries/lock) to universal login. For other migration scenarios see [Migrating from Embedded to Universal Login](/guides/login/migration-embedded-universal). +This document explains how to migrate Single-Page Applications using [Lock](/libraries/lock) to Universal Login. For other migration scenarios see [Migrating from Embedded to Universal Login](/guides/login/migration-embedded-universal). When you use Lock, your code does basically this: @@ -54,7 +62,7 @@ function login() { } ``` -To use **universal login**, you need to use [auth0.js](/libraries/auth0js) to perform the same tasks: +To use **Universal Login**, you need to use [auth0.js](/libraries/auth0js) to perform the same tasks: 1. Initialize auth0.js, using the same parameters as when initializing Lock: @@ -99,6 +107,6 @@ function login() { 5. Review if you are using any [legacy authentication flow in your application](guides/migration-legacy-flows), and adjust your code accordingly. -You can find complete examples of implementing universal login in Single Page Applications for different technologies in our [Quickstarts](/quickstart/spa). +You can find complete examples of implementing Universal Login in Single-Page Applications for different technologies in our [Quickstarts](/quickstart/spa). <%= include('_includes/_customizing-login-page') %> diff --git a/articles/guides/login/migrating-lock-v10-webapp.md b/articles/guides/login/migrating-lock-v10-webapp.md index 0861c719ee..b2378e8a08 100644 --- a/articles/guides/login/migrating-lock-v10-webapp.md +++ b/articles/guides/login/migrating-lock-v10-webapp.md @@ -2,10 +2,18 @@ title: Moving Web Applications using Lock to Universal Login description: Learn how to migrate from Web Applications using Lock to Universal Login toc: true +topics: + - lock + - migrations + - web-apps + - universal-login +contentType: + - how-to +useCase: migrate --- # Migrate Web Applications using Lock 10+ to Universal Login -This document explains how to migrate Web Applications using [Lock 10+](/libraries/lock) to universal login. For other migration scenarios see [Migrating from Embedded to Universal Login](/guides/login/migration-embedded-universal). +This document explains how to migrate Web Applications using [Lock 10+](/libraries/lock) to Universal Login. For other migration scenarios see [Migrating from Embedded to Universal Login](/guides/login/migration-embedded-universal). When you use Lock in a Web Application, your code does basically this: diff --git a/articles/guides/login/migrating-lock-v8.md b/articles/guides/login/migrating-lock-v8.md index dfefdf1e11..62c9674b41 100644 --- a/articles/guides/login/migrating-lock-v8.md +++ b/articles/guides/login/migrating-lock-v8.md @@ -2,10 +2,16 @@ title: Moving Applications using Lock 8 to Universal Login description: Learn how to migrate from Applications using Lock 8 to Universal Login toc: true +topics: + - lock + - migrations + - universal-login +contentType: index +useCase: migrate --- # Migrating Applications using Lock 8 to Universal Login -Lock v8 is very similar to Lock v9 from an API standpoints, so the guides for v9 give you all the information you need to migrate to universal login: +Lock v8 is very similar to Lock v9 from an API standpoints, so the guides for v9 give you all the information you need to migrate to Universal Login: - [Migrating Web Applications using Lock 9](/guides/login/migrating-lock-v9-webapp) diff --git a/articles/guides/login/migrating-lock-v9-spa-popup.md b/articles/guides/login/migrating-lock-v9-spa-popup.md index cabfc6a8d4..0e4fdeac6d 100644 --- a/articles/guides/login/migrating-lock-v9-spa-popup.md +++ b/articles/guides/login/migrating-lock-v9-spa-popup.md @@ -2,12 +2,20 @@ title: Migrate SPAs Using Lock 9 Popup Mode to Universal Login description: Learn how to Migrate SPAs Using Lock 9 Popup Mode to Universal Login toc: true +topics: + - lock + - migrations + - spa + - universal-login +contentType: + - how-to +useCase: migrate --- # Migrate SPAs Using Lock 9 Popup Mode to Universal Login -This document explains how to migrate Web Applications using [Lock](/libraries/lock) to universal login. For other migration scenarios see [Migrating from Embedded to Universal Login](/guides/login/migration-embedded-universal). +This document explains how to migrate Web Applications using [Lock](/libraries/lock) to Universal Login. For other migration scenarios see [Migrating from Embedded to Universal Login](/guides/login/migration-embedded-universal). -When you use 'popup mode' in Lock 9 applications, the entire authentication flow happens in a web page, without any kind of redirection. That will change when you use universal login. +When you use 'popup mode' in Lock 9 applications, the entire authentication flow happens in a web page, without any kind of redirection. That will change when you use Universal Login. 1. Initialize Lock: @@ -40,7 +48,7 @@ function login() } ``` -To use **universal login**, you need to use [auth0.js](/libraries/auth0js) to manage the authentication flow: +To use **Universal Login**, you need to use [auth0.js](/libraries/auth0js) to manage the authentication flow: 1. Initialize auth0.js, using the same parameters as when initializing Lock and also including the ones you use when you call lock.show(). @@ -76,6 +84,6 @@ webAuth.parseHash(function(err, authResult) { 4. Review if you are using any [legacy authentication flow in your application](guides/migration-legacy-flows), and adjust your code accordingly. -You can find complete examples of implementing universal login in Single Page Applications for different technologies in our [Quickstarts](/quickstart/spa). +You can find complete examples of implementing Universal Login in Single-Page Applications for different technologies in our [Quickstarts](/quickstart/spa). <%= include('_includes/_customizing-login-page') %> diff --git a/articles/guides/login/migrating-lock-v9-spa.md b/articles/guides/login/migrating-lock-v9-spa.md index fa0c8a26a5..ced825aa61 100644 --- a/articles/guides/login/migrating-lock-v9-spa.md +++ b/articles/guides/login/migrating-lock-v9-spa.md @@ -2,10 +2,18 @@ title: Moving Web Applications using Lock to Universal Login description: Learn how to migrate from Web Applications using Lock to Universal Login toc: true +topics: + - lock + - migrations + - spa + - universal-login +contentType: + - how-to +useCase: migrate --- -# Migrate Single Page Applications using Lock 9 to Universal Login +# Migrate Single-Page Applications using Lock 9 to Universal Login -This document explains how to migrate Web Applications using [Lock](/libraries/lock) to universal login. For other migration scenarios see [Migrating from Embedded to Universal Login](/guides/login/migration-embedded-universal). +This document explains how to migrate Web Applications using [Lock](/libraries/lock) to Universal Login. For other migration scenarios see [Migrating from Embedded to Universal Login](/guides/login/migration-embedded-universal). When you use Lock v9 in a Web Application, your code does basically this: @@ -47,7 +55,7 @@ function login() { } ``` -To use **universal login**, you need to use [auth0.js](/libraries/auth0js) to manage the authentication flow: +To use **Universal Login**, you need to use [auth0.js](/libraries/auth0js) to manage the authentication flow: 1. Initialize auth0.js, using the same parameters as when initializing Lock and also including the ones you use when you call lock.show(): @@ -83,6 +91,6 @@ function login() { 4. Review if you are using any [legacy authentication flow in your application](guides/migration-legacy-flows), and adjust your code accordingly. -You can find complete examples of implementing universal login in Single Page Applications for different technologies in our [Quickstarts](/quickstart/spa). +You can find complete examples of implementing Universal Login in Single-Page Applications for different technologies in our [Quickstarts](/quickstart/spa). <%= include('_includes/_customizing-login-page') %> diff --git a/articles/guides/login/migrating-lock-v9-webapp.md b/articles/guides/login/migrating-lock-v9-webapp.md index 7b97086a39..1df0f0a1e4 100644 --- a/articles/guides/login/migrating-lock-v9-webapp.md +++ b/articles/guides/login/migrating-lock-v9-webapp.md @@ -2,10 +2,18 @@ title: Moving Web Applications using Lock to Universal Login description: Learn how to migrate from Web Applications using Lock to Universal Login toc: true +topics: + - lock + - migrations + - web-apps + - universal-login +contentType: + - how-to +useCase: migrate --- # Migrate Web Applications using Lock 9 to Universal Login -This document explains how to migrate Web Applications using Lock to universal login. For other migration scenarios see [Migrating from Embedded to Universal Login](/guides/login/migration-embedded-universal). +This document explains how to migrate Web Applications using Lock to Universal Login. For other migration scenarios see [Migrating from Embedded to Universal Login](/guides/login/migration-embedded-universal). When you use Lock v9 in a Web Application, your code does basically this: diff --git a/articles/guides/login/migration-embedded-universal.md b/articles/guides/login/migration-embedded-universal.md index fb5bd75a5e..6bd0804496 100644 --- a/articles/guides/login/migration-embedded-universal.md +++ b/articles/guides/login/migration-embedded-universal.md @@ -1,20 +1,28 @@ --- title: Migrating from Embedded to Universal Login description: Learn how to migrate from Embedded Login using Lock to Universal Login +topics: + - lock + - migrations + - universal-login + - embedded-login +contentType: + - index +useCase: migrate --- # Migrating to Universal Login -When you integrate Auth0 in our applications, you have to decide whether you will use embedded or universal login. +When you integrate Auth0 in our applications, you have to decide whether you will use embedded or Universal Login. - With embedded login the login dialog is hosted in your application. You can use [Lock](/libraries/lock) or create your own UI and use [auth0.js](/libraries/auth0js). -- With universal login, you redirect to an Auth0-hosted [login page](/hosted-pages/login) where the authentication flow is performed. +- With Universal Login, you redirect to an Auth0-hosted [login page](/universal-login) where the authentication flow is performed. -Universal login has several advantages over embedded login. For a detailed analysis refer to [Centralized vs Embedded Login](/guides/login/universal-vs-embedded). +Universal Login has several advantages over embedded login. For a detailed analysis refer to [Centralized vs Embedded Login](/guides/login/universal-vs-embedded). -We put together a set of articles to help you migrate to universal login in different scenarios. +We put together a set of articles to help you migrate to Universal Login in different scenarios. -You can also find how to implement universal login in multiple technology stacks using [our Quickstarts](/quickstart). +You can also find how to implement Universal Login in multiple technology stacks using [our Quickstarts](/quickstart). ## Migration Guides per Application Type diff --git a/articles/guides/login/migration-sso.md b/articles/guides/login/migration-sso.md index d9b23551a1..b309d94aa7 100644 --- a/articles/guides/login/migration-sso.md +++ b/articles/guides/login/migration-sso.md @@ -1,19 +1,28 @@ --- -title: Migration in Embedded Login Scenarios with SSO -description: Learn how to migrate from old versions of Lock/Auth0.js when your application uses embedded login and requires SSO. +title: Migration in Embedded Login Scenarios with Single Sign-On +description: Learn how to migrate from old versions of Lock/Auth0.js when your application uses embedded login and requires Single Sign-on (SSO). +topics: + - lock + - migrations + - sso + - embedded-login +contentType: + - concept + - index +useCase: migrate --- -# Migration in Embedded Login Scenarios with SSO +# Migration in Embedded Login Scenarios with Single Sign-On -Migration from legacy versions of Lock and Auth0.js is required. For Single Sign On (SSO) scenarios, it will imply moving to [Universal Login](/hosted-pages/login) in most cases. +Migration from legacy versions of Lock and Auth0.js is required. For Single Sign-on (SSO) scenarios, it will imply moving to [Universal Login](/universal-login) in most cases. -## Single Page Apps +## Single-Page Apps -Single Page Applications (SPAs) with embedded login can only achieve SSO if they are on the same top-level domain. If SPAs with embedded login which are on different domains require SSO, the websites will need to [migrate to Universal Login](/guides/login/migration-embedded-universal). +Single-Page Applications (SPAs) with embedded login can only achieve SSO if they are on the same top-level domain. If SPAs with embedded login which are on different domains require SSO, the websites will need to [migrate to Universal Login](/guides/login/migration-embedded-universal). SSO works by having Auth0 set a cookie that identifies the session in the Auth0 server for a specific domain. -In order to make embedded login work properly, you need to set up a [custom domain](/custom-domains) that matches your website's top level domain, so as to avoid [cross-origin authentication issues](/cross-origin-authentication#limitations-of-cross-origin-authentication). +In order to make embedded login work properly, you need to set up a [custom domain](/custom-domains) that matches your website's top level domain, so as to avoid [cross-origin authentication issues](/cross-origin-authentication#limitations). If two applications using embedded login are sitting on different top-level domains, they would need to point to two different custom domains in order implement embedded login properly. If they are on different domains, those domains cannot share the same SSO cookie, so you can’t implement SSO across those sites. @@ -23,4 +32,4 @@ Web Applications using embedded login that require SSO need to [migrate to Unive The proper way of implementing embedded login for web applications is by creating a custom form that POSTs credentials to the web application. The web application then validates them with Auth0 using the [/oauth/token endpoint](/api-auth/tutorials/password-grant). -This approach does not allow for the creation of an SSO session, as the Auth0 server cannot set a cookie in the end-user’s browser. It also prevents Auth0 from performing [Anomaly Detection](/anomaly-detection#restrictions-regarding-brute-force-protection). +This approach does not allow for the creation of an SSO session, as the Auth0 server cannot set a cookie in the end-user’s browser. It also prevents Auth0 from performing [Anomaly Detection](/anomaly-detection). diff --git a/articles/guides/login/universal-vs-embedded.md b/articles/guides/login/universal-vs-embedded.md index c37a39ec4f..73fe301b7c 100644 --- a/articles/guides/login/universal-vs-embedded.md +++ b/articles/guides/login/universal-vs-embedded.md @@ -2,12 +2,21 @@ title: Universal vs Embedded Login description: Read about the differences between Universal and Embedded login toc: true +topics: + - universal-login + - embedded-login + - migrations +contentType: + - concept +useCase: + - strategize + - development --- # Universal vs Embedded Login When you design the authentication experience for your application, you have to choose whether the login flow will use **universal** or **embedded** login. -With universal login, when the users try to log in they are redirected to a central domain, through which authentication is performed, and then they are redirected back to the app. An example is Google Apps. No matter which service you are trying to access (gmail, google calendar, google docs, etc) if you are not logged in you are redirected to `https://accounts.google.com` and once you successfully log in you are redirected back to the calling app. +With Universal Login, when the users try to log in they are redirected to a central domain, through which authentication is performed, and then they are redirected back to the app. An example is G Suite. No matter which service you are trying to access (gmail, google calendar, google docs, etc) if you are not logged in you are redirected to `https://accounts.google.com` and once you successfully log in you are redirected back to the calling app. ![Google Universal Login](/media/articles/guides/login/google-login.jpg) @@ -19,23 +28,23 @@ In this article, we will evaluate the pros and cons of these two options and see ## Pros and cons -- **Single Sign-On (SSO)**: If you are working with mobile apps you cannot have SSO unless you use universal login. With web apps you can, although the most secure way is to use a central service so the cookies are from the same origin. With embedded login, you'd have to collect the user credentials in an application served from one origin and then send them to another origin, which can present certain security vulnerabilities, including the possibility of a phishing attack (see [Embedded Login with Auth0 > Security risks](#security-risks) for more info). There are workarounds you could use, like third-party cookies, but the most secure option for SSO, and logins in general, is using a central service. +- **Single Sign-on (SSO)**: If you are working with mobile apps you cannot have SSO unless you use Universal Login. With web apps you can, although the most secure way is to use a central service so the cookies are from the same origin. With embedded login, you'd have to collect the user credentials in an application served from one origin and then send them to another origin, which can present certain security vulnerabilities, including the possibility of a phishing attack (see [Embedded Login with Auth0 > Security risks](#security-risks) for more info). There are workarounds you could use, like third-party cookies, but the most secure option for SSO, and logins in general, is using a central service. -- **Consistency and Maintenance**: With embedded login, if you have more than one app, you will have to implement more than one login page. You will also have to maintain and manage these pages. Besides the extra effort it can also introduce inconsistencies which results in bad UX. Furthermore, with embedded login you would have to manage the dangers of cross-origin attack vectors. On the other hand, if you are using universal login, then your Authorization Server (the domain that logs the users in) owns all the login pages which makes the management easier and the pages more consistent and secure. You could also use a single login page among your apps, a process that creates an impression that users are logging into a centralized system, rather than an individual app. In the following diagram you can see an example of how the universal and embedded logins look. The reason why the universal login offers a more consistent and thus superior use experience is evident. +- **Consistency and Maintenance**: With embedded login, if you have more than one app, you will have to implement more than one login page. You will also have to maintain and manage these pages. Besides the extra effort it can also introduce inconsistencies which results in bad UX. Furthermore, with embedded login you would have to manage the dangers of cross-origin attack vectors. On the other hand, if you are using Universal Login, then your Authorization Server (the domain that logs the users in) owns all the login pages which makes the management easier and the pages more consistent and secure. You could also use a single login page among your apps, a process that creates an impression that users are logging into a centralized system, rather than an individual app. In the following diagram you can see an example of how the universal and embedded logins look. The reason why the Universal Login offers a more consistent and thus superior use experience is evident. ![Universal vs Embedded login UX](/media/articles/guides/login/centralized-embedded-ux.jpg) -- **Central Features Management**: When you use universal login with Auth0, you can turn on and off features across all your apps, using the Dashboard. An example is [Multifactor Authentication](/multifactor-authentication) which you can enable using the toggles located at the [Dashboard > Multifactor Auth](${manage_url}/#/guardian) page. These changes will be automatically available to all your registered apps. +- **Central Features Management**: When you use Universal Login with Auth0, you can turn on and off features across all your apps, using the Dashboard. An example is [Multi-factor Authentication](/mfa) which you can enable using the toggles located at the [Dashboard > Multi-factor Auth](${manage_url}/#/mfa) page. These changes will be automatically available to all your registered apps. - **User Experience**: In the past, an argument could be made that the user experience with embedded login was better because it did not require redirecting users to another subdomain. However, users are getting increasingly familiar with the process of being redirected to another subdomain to log in. As a result, they don't find the process disruptive to their experience. Think about this, when you try to access your Gmail, if you are not logged in, you get redirected to the Google Accounts subdomain in order to log in. Do you get frustrated with that? You probably don't even notice it. -- **Mobile Apps & Security**: According to the [Best Current Practice for OAuth 2.0 for Native Apps Request For Comments](https://www.rfc-editor.org/rfc/rfc8252.txt), only external user agents (such as the browser) should be used by native applications for authentication flows. Using the browser to make native app authorization requests results in better security and it gives users the confidence that they are entering credentials in the right domain. It also enables use of the user's current authentication state, making single sign-on possible. Embedded user agents are deemed unsafe for third parties and should not be implemented (see [Embedded Login with Auth0 > Security risks](#security-risks) for more info). With native login a malicious app could try and phish users for username/password or tokens. Also, if your mobile apps use native login, then your users have to enter their credentials for each of your apps, hence SSO is not possible. +- **Mobile Apps & Security**: According to the [Best Current Practice for OAuth 2.0 for Native Apps Request For Comments](https://www.rfc-editor.org/rfc/rfc8252.txt), only external user agents (such as the browser) should be used by native applications for authentication flows. Using the browser to make native app authorization requests results in better security and it gives users the confidence that they are entering credentials in the right domain. It also enables use of the user's current authentication state, making Single Sign-on (SSO) possible. Embedded user agents are deemed unsafe for third parties and should not be implemented (see [Embedded Login with Auth0 > Security risks](#security-risks) for more info). With native login a malicious app could try and phish users for username/password or tokens. Also, if your mobile apps use native login, then your users have to enter their credentials for each of your apps, hence SSO is not possible. -## Universal login with Auth0 +## Universal Login with Auth0 -For most situations, we recommend using a a universal login strategy, where Auth0 will show a [login page](/hosted-pages/login) if authentication is required. You can customize your login page using the [Dashboard](${manage_url}/#/login_page). +For most situations, we recommend using a Universal Login strategy, where Auth0 will show a [login page](/universal-login) if authentication is required. You can customize your login page using the [Dashboard](${manage_url}/#/login_page). -You can use **Auth0's Custom Domains** in order to persist the same domain across the login page and the app. This way the redirect to the login page will be transparent to your users since the domain will not change. For more details refer to [Custom Domains Overview](/custom-domains). +You can use **Auth0's Custom Domains** in order to persist the same domain across the login page and the app. This way the redirect to the login page will be transparent to your users since the domain will not change. For more details, see [Custom Domains](/custom-domains). Whenever your app triggers an authentication request, the user will be redirected to the login page in order to authenticate. This will create a cookie. In future authentication requests, Auth0 will check for this cookie, and if it is present the user will not be redirected to the login page. They will see the page only when they need to actually log in. This is the easiest way to implement SSO. @@ -45,36 +54,35 @@ Note that if the incoming authentication request uses an external identity provi You can deploy your custom login page from an external repository, like [GitHub](/extensions/github-deploy#deploy-hosted-pages), [Bitbucket](/extensions/bitbucket-deploy#deploy-hosted-pages), [GitLab](/extensions/gitlab-deploy#deploy-hosted-pages), or [Visual Studio Team Services](/extensions/visual-studio-team-services-deploy#deployment). ::: -Our recommendation is to use universal login when you use Auth0. The first and foremost reason is security. Using Auth0 hosted pages instead of hosting them externally provides seamless CSRF protection. This helps prevent third-party impersonation or the hijacking of sessions. +Our recommendation is to use Universal Login when you use Auth0. The first and foremost reason is security. Using Auth0 Universal Login instead of embedding login in your application provides seamless CSRF protection. This helps prevent third-party impersonation or the hijacking of sessions. ## Embedded login with Auth0 Embedded logins in web apps with Auth0 use [Cross-Origin Authentication](/cross-origin-authentication). This uses [third-party cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#Third-party_cookies) to allow for secure authentication transactions across different origins. This does not apply to native applications since they use the standard OAuth 2.0 token endpoint. ::: note -Cross-origin authentication is only necessary when authenticating against a directory using a username and password. Social identity providers and enterprise federation use a different mechanism, redirecting via standard protocols like OpenID Connect and SAML. +Cross-origin authentication is not recommended and is only necessary when authenticating against a directory using a username and password. Social IdPs and enterprise federation use a different mechanism, redirecting via standard protocols like OpenID Connect (OIDC) and SAML. Additionally, cross-origin authentication is only applicable to embedded login on the web (using Lock or auth0.js). Native applications using embedded login make use of the standard OAuth 2.0 token endpoint. ::: -In addition, if you have not enabled [Custom Domain Names](/custom-domains) the end user must have a browser that supports third-party cookies, otherwise, in some browsers, cross-origin authentication will fail. For more information refer to [Limitations of Cross-Origin Authentication](/cross-origin-authentication). +In addition, if you have not enabled [custom domains](/custom-domains), the end user must have a browser that supports third-party cookies. Otherwise, in some browsers, cross-origin authentication will fail. For more information, see [Cross-Origin Authentication](/cross-origin-authentication#limitations). This limitation applies to both traditional username/password database connections as well as to passwordless database connections. + ### Security risks -Universal login is more secure than embedded login. Authentication takes place over the same domain, eliminating cross-origin requests. Cross-origin authentication is inherently more dangerous. Collecting user credentials in an application served from one origin and then sending them to another origin can present certain security vulnerabilities. [Phishing attacks](https://auth0.com/blog/all-you-need-to-know-about-the-google-docs-phishing-attack/) are more likely, as are [man-in-the-middle attacks](/security/common-threats#man-in-the-middle-mitm-attacks). Universal login does not send information between origins, thereby negating cross-origin concerns. +Universal Login is more secure than embedded login. Authentication takes place over the same domain, eliminating cross-origin requests. Cross-origin authentication is inherently more dangerous. Collecting user credentials in an application served from one origin and then sending them to another origin can present certain security vulnerabilities. Phishing attacks are more likely, as are [man-in-the-middle attacks](/security/common-threats#man-in-the-middle-mitm-attacks). Universal Login does not send information between origins, thereby negating cross-origin concerns. Embedded user agents are unsafe for third parties, including the authorization server itself. If an embedded login is used, the app has access to both the authorization grant and the user's authentication credentials. As a consequence, this data is left vulnerable to recording or malicious use. Even if the app is trusted, allowing it to access the authorization grant as well as the user's **full credentials** is unnecessary. This violates the [principle of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege) and increases the potential for attack. :::note -As a matter of fact, Google no longer supports an embedded approach when implementing OAuth. For more information on this, refer to [Google Blocks OAuth Requests Made via embedded browsers](https://auth0.com/blog/google-blocks-oauth-requests-from-embedded-browsers/). +Google no longer supports an embedded approach when implementing OAuth. ::: -Furthermore, according to the [Internet Engineering Task Force (IETF)](https://www.ietf.org/), authorization requests from native apps should only be made through external user agents, primarily the user's browser. Using the browser to make native app authorization requests results in better security. When embedded agents are used, the app has access to the OAuth authorization grant as well as the user's credentials, leaving this data vulnerable to recording or malicious use. For more info refer to [OAuth 2.0 Best Practices for Native Apps](https://auth0.com/blog/oauth-2-best-practices-for-native-apps/). +Furthermore, according to the [Internet Engineering Task Force (IETF)](https://www.ietf.org/), authorization requests from native apps should only be made through external user agents, primarily the user's browser. Using the browser to make native app authorization requests results in better security. When embedded agents are used, the app has access to the OAuth authorization grant as well as the user's credentials, leaving this data vulnerable to recording or malicious use. ## Keep reading :::next-steps - [Migrating from Embedded to Universal Login](/guides/login/migration-embedded-universal) - [Browser-Based vs. Native Login Flows on Mobile Devices](/design/browser-based-vs-native-experience-on-mobile) -- [Authentication Provider Best Practices: Universal Login](https://auth0.com/blog/authentication-provider-best-practices-centralized-login/) -- [OAuth 2.0 Best Practices for Native Apps](https://auth0.com/blog/oauth-2-best-practices-for-native-apps/) - [Modernizing OAuth interactions in Native Apps for Better Usability and Security](https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html) ::: diff --git a/articles/guides/migration-legacy-flows.md b/articles/guides/migration-legacy-flows.md index c95b872489..ba6f220bab 100644 --- a/articles/guides/migration-legacy-flows.md +++ b/articles/guides/migration-legacy-flows.md @@ -3,6 +3,16 @@ section: libraries title: Migrating from Legacy Authentication Flows description: How to migrate from Legacy Authentication Flows toc: true +topics: + - migrations + - lock + - auth0js + - tokens + - user-profiles +contentType: + - how-to + - concept +useCase: migrate --- # Migrating from Legacy Authentication Flows @@ -10,11 +20,11 @@ When using Lock versions below 11 and Auth0.js version below 9, you could use le ## Renewing Tokens -Legacy applications used [Refresh Tokens](/tokens/refresh-token) and the `refreshToken()` function as a way to get new tokens upon expiration (an example of this is below). +Legacy applications used Refresh Tokens and the `refreshToken()` function as a way to get new tokens upon expiration (an example of this is below). ```js function renewToken() { - // Assumes the refresh_token is stored in localStorage + // Assumes the Refresh Token is stored in localStorage refresh_token = localStorage.getItem('refresh_token'); auth0.refreshToken(refresh_token, function (err, delegationResult) { if (!err) @@ -22,9 +32,9 @@ function renewToken() { var expires_at = JSON.stringify( delegationResult.expires_in* 1000 + new Date().getTime()) ; - // Assumes you want to keep the time the token will expire - // and the id_token in localStorage - localStorage.setItem('expires_at', expires_at); + // Assumes you want to keep the time the token will expire + // and the ID Token in localStorage + localStorage.setItem('expires_at', expires_at); localStorage.setItem('id_token', delegationResult.id_token); } ); @@ -52,14 +62,14 @@ Check the [Silent Authentication documentation](/api-auth/tutorials/silent-authe ## Calling APIs -Legacy applications used an [ID Token](/tokens/id-token) to invoke APIs. This [is a bad practice](/api-auth/why-use-access-tokens-to-secure-apis) and we recommend you to start using [Access Tokens](/tokens/access-token). +Legacy applications used an [ID Token](/tokens/concepts/id-tokens) to invoke APIs. This is a bad practice, and we recommend that you only use [Access Tokens](/tokens/concepts/access-tokens). To call an API, you will need to specify the API identifier as the `audience` parameter when initializing auth0.js or Lock. ```js var lock = new Auth0Lock('${account.clientId}', '${account.namespace}', { auth: { - audience: 'https::/mydomain.com/api', + audience: 'https://mydomain.com/api', } }); ``` @@ -68,7 +78,9 @@ If you specify an audience, then the OIDC flow will be triggered and the user pr You can check the **Calling an API** section of our [SPA Quickstarts](/quickstart/backend) for more information on how to call APIs from SPAs. You will also need to migrate your backend API implementation to use Access Tokens. You can look at our [API Quickstarts](/quickstart/backend) for instructions on how to do this. -## User Profiles +## User Profiles + +The legacy authentication flows that allow ID Tokens and the `/userinfo` endpoint to include the complete user profile are being deprecated. Make sure the `Legacy User Profile` toggle is turned off after completing the migration to the new OIDC-conformant APIs. When using the legacy authentication flows, the entire user profile is returned in ID Tokens and from `/userinfo`, as demonstrated below. @@ -114,21 +126,21 @@ The new user profile conforms to the OIDC specification, which allows for certai } ``` -The contents will vary depending on which [scopes](/scopes) are requested. You will need to adjust the scopes you request when configuring Auth0.js or Lock so all the claims you need are available in your application. Note that you can add custom claims to return whatever data you want (for example, user metadata), as described in [this example](/scopes/current#example-add-custom-claims). +The contents will vary depending on which [scopes](/scopes) are requested. You will need to adjust the scopes you request when configuring Auth0.js or Lock so all the claims you need are available in your application. Note that you can add custom claims to return whatever data you want (for example, user metadata), as described in [this example](/scopes/current/sample-use-cases#add-custom-claims-to-a-token). Another approach to get the full user profile is to use the [Management API](/api/management/v2) (instead of getting the profile through the authentication flow) as described in the next section. ## User Profile with Management API -In the legacy flows, the [Management API](/api/management/v2) supported authentication with an `id_token`. This approach has been deprecated, and now you need to call it with an `access_token`. +In the legacy flows, the [Management API](/api/management/v2) supported authentication with an ID Token. This approach has been deprecated, and now you need to call it with an Access Token. -To get an `access_token`, you need to ask Auth0 for one using the `https://${account.namespace}/api/v2/` audience. Auth0 does not currently support specifying two audiences when authenticating, so you will need to still use your application's API audience when initializing Lock or auth0.js. Once the user is authenticated, you can use `checkSession` to retrieve a Management API `access_token`, and then call the [getUser() endpoint](/api/management/v2#!/Users/get_users_by_id). +To get an Access Token, you need to ask Auth0 for one using the `https://${account.namespace}/api/v2/` audience. Auth0 does not currently support specifying two audiences when authenticating, so you will need to still use your application's API audience when initializing Lock or auth0.js. Once the user is authenticated, you can use `checkSession` to retrieve a Management API `access_token`, and then call the [getUser() endpoint](/api/management/v2#!/Users/get_users_by_id). ```js function getUserUsingManagementApi() { webAuth.checkSession( { - audience: `https://${account.namespace}/api/v2/˜`, + audience: `https://${account.namespace}/api/v2/`, scope: 'read:current_user' }, function(err, result) { diff --git a/articles/hooks/_includes/_access_hook_secrets.md b/articles/hooks/_includes/_access_hook_secrets.md new file mode 100644 index 0000000000..f97a1aa5fb --- /dev/null +++ b/articles/hooks/_includes/_access_hook_secrets.md @@ -0,0 +1,3 @@ +::: note +To access a configured Hook Secret from within a Hook, use `context.webtask.secrets.SECRET_NAME`. +::: \ No newline at end of file diff --git a/articles/hooks/_includes/_default_hook_enable_behavior.md b/articles/hooks/_includes/_default_hook_enable_behavior.md new file mode 100644 index 0000000000..fd1cac9b99 --- /dev/null +++ b/articles/hooks/_includes/_default_hook_enable_behavior.md @@ -0,0 +1,3 @@ +::: warning +When creating new Hooks, Auth0 automatically enables the first Hook you create for an extensibility point. Any subsequent Hooks you create for that extensibility point are automatically disabled, so you must explicitly enable them. +::: \ No newline at end of file diff --git a/articles/hooks/_includes/_handle_rate_limits.md b/articles/hooks/_includes/_handle_rate_limits.md new file mode 100644 index 0000000000..ec53a8e291 --- /dev/null +++ b/articles/hooks/_includes/_handle_rate_limits.md @@ -0,0 +1,5 @@ +::: panel Handle Rate Limits when calling Auth0 APIs from within Hooks +If you call Auth0 APIs from within a Hook's script, you will need to handle rate limits. To do so, check the `X-RateLimit-Remaining` header and act appropriately when the number returned nears 0. + +Additionally, add logic to handle cases in which you exceed the provided rate limits and receive the `429` HTTP Status Code (`Too Many Requests`). In this case, if a re-try is needed, it is best to allow for a back-off to avoid going into an infinite re-try loop. To learn more about rate limits, see [Rate Limit Policy For Auth0 APIs](/policies/rate-limits). +::: \ No newline at end of file diff --git a/articles/hooks/_includes/_hook_enabled_limit.md b/articles/hooks/_includes/_hook_enabled_limit.md new file mode 100644 index 0000000000..f88e9902b3 --- /dev/null +++ b/articles/hooks/_includes/_hook_enabled_limit.md @@ -0,0 +1,3 @@ +::: warning +Although you may create multiple Hooks for any given extensibility point, each extensibility point may have only **one** **enabled** Hook at a time. +::: \ No newline at end of file diff --git a/articles/hooks/_includes/_hook_secrets_limit.md b/articles/hooks/_includes/_hook_secrets_limit.md new file mode 100644 index 0000000000..67d2753477 --- /dev/null +++ b/articles/hooks/_includes/_hook_secrets_limit.md @@ -0,0 +1,3 @@ +::: note +You may create up to 20 secrets for any given Hook. +::: \ No newline at end of file diff --git a/articles/hooks/_includes/_test_runner_save_warning.md b/articles/hooks/_includes/_test_runner_save_warning.md new file mode 100644 index 0000000000..101c626f77 --- /dev/null +++ b/articles/hooks/_includes/_test_runner_save_warning.md @@ -0,0 +1,3 @@ +::: warning +Executing the code using the Runner requires a save, which means that the original code will be overwritten. +::: \ No newline at end of file diff --git a/articles/hooks/cli/create-delete.md b/articles/hooks/cli/create-delete.md deleted file mode 100644 index 31d2111d15..0000000000 --- a/articles/hooks/cli/create-delete.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -description: How to create/delete Hooks using the Auth0 Command-Line Interfance -beta: true ---- - -# Create/Delete Hooks Using the Auth0 Command-Line Interface - -::: note -The Auth0 CLI examples use `auth0-profile` as the name of the profile. This is the same profile name used when installing `wt-cli`, and you can obtain it from *Step 2* of the instructions set located on [Auth0 Management Dashboard's Webtask page](${manage_url}/#/account/webtasks). -::: - -Using the Auth0 CLI, you can create new Hooks, as well as manage or delete existing Hooks. You can also gather real-time data about your Hooks. - -## Create a New Hook - -Rather than beginning from scratch, you can scaffold the sample code for an Auth0 hook. - -`auth0 scaffold -t pre-user-registration > file.js` - -Create the hook: - -`auth0 create -t pre-user-registration --name my-extension-1 -p auth0-default file.js` - -### Provision Secrets to New Hooks - -Optionally, you can add provision secrets (such as Twilio Keys or database connection strings) to your new Hook by adding `--secret KEY=VALUE` to your *Create* command. The information you attach will be encrypted, and it can only be decrypted by the Webtask server. - -At this point, you have created a new, disabled Hook using the `pre-user-registration` [extensibility point](/hooks/extensibility-points). You can repeat this process and create Hooks for any of the other extensibility points. - -## Delete an Existing Hook - -If you need to delete an existing Hook, you can do so using the following command: - -`auth0 rm my-extension-1 -p auth0-default` \ No newline at end of file diff --git a/articles/hooks/cli/edit.md b/articles/hooks/cli/edit.md deleted file mode 100644 index 5ed62216c7..0000000000 --- a/articles/hooks/cli/edit.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -description: How to edit Hooks using the Auth0 Command-Line Interfance -beta: true ---- - -# Edit Existing Hooks Using the Auth0 Command-Line Interface - -::: note -All of the examples on this page use `auth0-profile` as the name of the profile. This is the same profile name used when installing `wt-cli` and can be obtained from *Step 2* of the instructions set located on [Auth0 Management Dashboard's Webtask page](${manage_url}/#/account/webtasks). -::: - -You can edit the code of your Hook using the [Webtask Editor](https://webtask.io/docs/editor). The following command will open up the code for your Hook in the Webtask Editor window: - - `auth0 edit my-extension-1` - - ![Webtask Editor](/media/articles/hooks/webtask-editor.png) - -If the CLI cannot open the Editor window automatically, you can copy and paste the provided link into your web browser. - -::: note -Please see the [Webtask docs](https://webtask.io/docs/editor) for detailed information on using the Webtask Editor. -::: - -## Test Your Hook - -The Webtask Editor allows you to test your Hook using the Runner. By default, the Runner is hidden until you choose to display it by clicking its icon in the top left of the Editor. - -![](/media/articles/hooks/webtask-runner.png) - -The Runner allows you to simulate an Auth0 call to your Hook and provides the basic parameters needed to complete the call. You can edit the provided schema as necessary. - -![](/media/articles/hooks/webtask-runner2.png) - -When you're ready, click **Run** to proceed. You will be presented with the results of the call. - -![](/media/articles/hooks/webtask-runner3.png) - -If you run multiple tests, the Runner keeps track of the calls you've made in its *History* section. For each result, you can see specific details about the call by clicking **>** to the right of the call result. - -![](/media/articles/hooks/webtask-runner4.png) - -:::panel Test Runner Schema -If you created your Hook early on during the beta testing period, your Webtask Editor/Test Runner window might not populate with the schema required to successfully use the Test Runner. If that is the case, you'll need to save the Hook's code, delete the Hook, and create a new Hook using your existing code. -::: - -## Manipulate Secrets - -If you [provisioned a secret to your Hook](/hooks/cli/create-delete#provision-secrets-to-new-hooks) during creation, you can manipulate it by clicking on the **wrench** at the top left of the Webtask Editor window and selecting **Secrets** from the dropdown menu. - - ![Webtask Editor Secrets pane](/media/articles/hooks/webtask-editor-secrets.png) \ No newline at end of file diff --git a/articles/hooks/cli/enable-disable.md b/articles/hooks/cli/enable-disable.md deleted file mode 100644 index 2229fb58a6..0000000000 --- a/articles/hooks/cli/enable-disable.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -description: How to enable/disable Hooks using the Auth0 Command-Line Interfance -beta: true ---- - -# Enable or Disable Existing Hooks Using the Auth0 Command-Line Interface - -::: note -All of the examples on this page use `auth0-profile` as the name of the profile. This is the same profile name used when installing `wt-cli` and can be obtained from *Step 2* of the instructions set located on [Auth0 Management Dashboard's Webtask page](${manage_url}/#/account/webtasks). -::: - -For each extensibility point, you may have either no associated Hooks enabled or **one** associated Hook enabled. - -By default, the Auth0 CLI creates new Hooks in a disabled state. - -## Enable Your Hook - -The following command enables your Hook: - - `auth0 enable my-extension-1 -p auth0-default` - -By enabling a given Hook, the Auth0 CLI disables all other Hooks associated with the same extensibility point. - -## Disable Your Hook - -The following command disables your Hook: - - `auth0 disable my-extension-1 -p auth0-default` \ No newline at end of file diff --git a/articles/hooks/cli/index.md b/articles/hooks/cli/index.md deleted file mode 100644 index 65968957b6..0000000000 --- a/articles/hooks/cli/index.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -description: How to use the Command-Line Interface with Hooks -url: /hooks/cli -beta: true ---- - -# Auth0 Command-Line Interface - -The Auth0 Command-Line Interface (CLI) allows you to create, edit, enable/disable, and delete Hooks associated with specific extensibility points within the Auth0 platform. You can also use the CLI to identify Hooks and gather real-time logging information. - -## Set Up the CLI - -You can find instructions for installing and configuring the Webtask CLI in the [Dashboard > Webtask page](${manage_url}/#/account/webtasks). - -The `wt-cli` package also includes the `auth0` binary, allowing you to use the Auth0 CLI. - -![Install Webtasks Instructions](/media/articles/hooks/mgmt-dashboard-webtasks.png) - -## Work with Hooks - -Once you have installed and set up the CLI, you can use it to create new Hooks and manage/delete existing Hooks. You can also use it to gather real-time log data on your Hooks. - -::: note -The Auth0 CLI examples use `auth0-profile` as the name of the profile. This is the same profile name used when installing `wt-cli`, and you can obtain it from *Step 2* of the instructions set located on [Dashboard > Webtask](${manage_url}/#/account/webtasks). -::: - -* [Create/Delete Hooks](/hooks/cli/create-delete) -* [Edit Existing Hooks](/hooks/cli/edit) -* [Enable/Disable Existing Hooks](/hooks/cli/enable-disable) -* [Identify and Get Log Data from Your Hooks](/hooks/cli/logs) \ No newline at end of file diff --git a/articles/hooks/cli/logs.md b/articles/hooks/cli/logs.md deleted file mode 100644 index 82b6a88c5e..0000000000 --- a/articles/hooks/cli/logs.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -description: How to get Hooks logs using the Auth0 Command-Line Interface -beta: true ---- - -# Get Log Information About Hooks Using the Auth0 Command-Line Interface - -::: note -All of the examples on this page use `auth0-profile` as the name of the profile. This is the same profile name used when installing `wt-cli` and can be obtained from *Step 2* of the instructions set located on [Auth0 Management Dashboard's Webtask page](${manage_url}/#/account/webtasks). -::: - -You can use the Auth0 CLI to gather information about your Hooks: - -* To get a list of Hooks for a specific extensibility point: - `auth0 ls -t pre-user-registration -p auth0-default` -* To get a list of Hooks associated with your Auth0 account: - `auth0 ls -p auth0-default` -* To access logs containing real-time data on your Hooks: - `auth0 logs -p auth0-default` \ No newline at end of file diff --git a/articles/hooks/create.md b/articles/hooks/create.md new file mode 100644 index 0000000000..40d1be3940 --- /dev/null +++ b/articles/hooks/create.md @@ -0,0 +1,90 @@ +--- +title: Create Hooks +description: Learn how to create Hooks using the Dashboard and Management API. Hooks may also be imported and exported using the Auth0 Deploy Command-Line Interface (CLI) tool. +topics: + - hooks + - dashboard + - mgmt-api +contentType: how-to +useCase: extensibility-hooks +v2: true +--- + +# Create Hooks + +You can create multiple Hooks for any given [extensibility point](/hooks/extensibility-points) using the Dashboard or Management API. + +Hooks may also be imported and exported using the [Deploy Command-Line Interface (CLI) Extension](/extensions/deploy-cli). + +<%= include('./_includes/_hook_enabled_limit') %> + +
      + +
      +
      + +## Create Hooks using the Dashboard + +<%= include('./_includes/_default_hook_enable_behavior') %> + +1. Navigate to the [Hooks](${manage_url}/#/hooks) page in the [Auth0 Dashboard](${manage_url}/), and click **Create a Hook**. +2. Enter a descriptive name for your Hook, select the extensibility point for which the Hook should execute, and click **Create**. +3. Locate the section for the extensibility point you selected, and click the pencil icon next to the hook you created. +4. Update the Hook using the Hook Editor, and click the disk icon to save. + +
      +
      + +## Create Hooks using the Management API + +<%= include('./_includes/_default_hook_enable_behavior') %> + +1. Make a `POST` call to the [Create a Hook endpoint](/api/management/v2/#!/Hooks/post_hooks). Be sure to replace `MGMT_API_ACCESS_TOKEN`, `HOOK_NAME`, `HOOK_SCRIPT`, and `EXTENSIBILITY_POINT_NAME` placeholder values with your Management API Access Token, Hook name, Hook script, and extensibility point name, respectively. + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/api/v2/hooks", + "headers": [ + { "name": "Content-Type", "value": "application/json" }, + { "name": "Authorization", "value": "Bearer MGMT_API_ACCESS_TOKEN" }, + { "name": "Cache-Control", "value": "no-cache" } + ], + "postData": { + "mimeType": "application/json", + "text" : "{ \"name\": \"HOOK_NAME\", \"script\": \"HOOK_SCRIPT\", \"triggerId\": \"EXTENSIBILITY_POINT_NAME\" }" + } +} +``` + +| **Value** | **Description** | +| - | - | +| `MGMT_API_ACCESS_TOKEN` | [Access Token for the Management API](/api/management/v2/tokens) with the scope `create:hooks`. | +| `HOOK_NAME` | Name of the hook you would like to create. | +| `HOOK_SCRIPT` | Script that contains the code for the hook. Should match what you would enter if you were creating a new hook using the Dashboard. | +| `EXTENSIBILITY_POINT_NAME` | Name of the extensibility point for which the hook should execute. Options include: `credentials-exchange`, `pre-user-registration`, `post-user-registration`, `post-change-password`. To learn more about extensibility points, see [Extensibiity Points](/hooks/extensibility-points). | + +
      +
      +
      + +<%= include('./_includes/_handle_rate_limits') %> + +::: note +Optionally, you can add secrets (such as Twilio Keys or database connection strings) to Hooks. To learn more, see [Hook Secrets](/hooks/secrets). +::: + +### Explore starter code and sample Hook scripts + +To explore starter code and sample Hook scripts, see the documentation for your chosen [extensibility point](/hooks/extensibility-points): + +* [Client Credentials Exchange](/hooks/extensibility-points/client-credentials-exchange) +* [Post Change Password](/hooks/extensibility-points/post-change-password) +* [Post User Registration](/hooks/extensibility-points/post-user-registration) +* [Pre User Registration](/hooks/extensibility-points/pre-user-registration) +* [Send Phone Message](/hooks/extensibility-points/send-phone-message) diff --git a/articles/hooks/dashboard/create-delete.md b/articles/hooks/dashboard/create-delete.md deleted file mode 100644 index b3106a1c70..0000000000 --- a/articles/hooks/dashboard/create-delete.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -description: How to create new Hooks using the Management Dashboard -beta: true ---- - -# Create a New Hook Using the Dashboard - -You can create new Hooks using the Auth0 Management Dashboard. - -![Management Dashboard Hooks Page](/media/articles/hooks/hooks-dashboard.png) - -## Create a New Hook - -1. Navigate to [the Hooks page of the Dashboard](${manage_url}/#/hooks). You can create new Hooks in one of two ways: - - * Clicking on the **+ Create New Hook** button at the top right of the Hooks page. - * Finding the extensibility hook you want to work with and then clicking the **Create New Hook** link below. - -2. On the *New Hook* pop-up window, provide the requested information: - - ![Create Hook Dialog](/media/articles/hooks/create-new-hook.png) - - * **Name**: The name for your new Hook - * **Hook**: The extensibility point associated with your Hook - - Click **Create** to create your Hook. - - At this point, you will see your newly-created Hook listed under its associated extensibility point. - -:::panel New Hooks -For any given extensibility point, you may create multiple Hooks. However, you may only have **one** Hook enabled per extensibility point at any given time. - -Auth0 automatically enables the first Hook you create for an extensibility point, and any subsequent Hooks for that point are created in a disabled state. As such, you must explicitly activate subsequent Hooks. -::: - -![List of Hooks](/media/articles/hooks/hooks-list.png) - -## Delete an Existing Hook - -1. In the Hooks page of the Management Dashboard, find the Hook you want to edit. -2. Click the **Gear** icon next to your Hook. -3. Click **Delete**. -4. Confirm that you want to delete your Hook by clicking **YES, DELETE HOOK**. - -![Delete Hook Confirmation](/media/articles/hooks/delete-hook.png) \ No newline at end of file diff --git a/articles/hooks/dashboard/edit.md b/articles/hooks/dashboard/edit.md deleted file mode 100644 index b965191d05..0000000000 --- a/articles/hooks/dashboard/edit.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -description: How to edit Hooks using the Management Dashboard -beta: true ---- - -# Edit Existing Hooks Using the Dashboard - -You can edit the code for your existing Hook using the [Webtask Editor](https://webtask.io/docs/editor). To open up the Webtask Editor: - -1. Navigate to [the Hooks page of the Dashboard](${manage_url}/#/hooks) and find the Hook you want to edit. -2. Click the **Pencil and Paper** icon to the right of the Hook to open the Webtask Editor. - - ![List of Hooks](/media/articles/hooks/hooks-list.png) - -3. Edit your Hook using the Webtask Editor. - - ![Webtask Editor](/media/articles/hooks/webtask-editor.png) - - ::: note - Please see the [Webtask docs](https://webtask.io/docs/editor) for detailed information on using the Webtask Editor. - ::: - -## Test Your Hook - -The Webtask Editor allows you to test your Hook using the Runner. By default, the Runner is hidden until you choose to display it by clicking its icon in the top left of the Editor. - -![](/media/articles/hooks/webtask-runner.png) - -The Runner allows you to simulate an Auth0 call to your Hook and provides the basic parameters needed to complete the call. You can edit the provided schema as necessary. - -![](/media/articles/hooks/webtask-runner2.png) - -When you're ready, click **Run** to proceed. You will be presented with the results of the call. - -![](/media/articles/hooks/webtask-runner3.png) - -If you run multiple tests, the Runner keeps track of the calls you've made in its *History* section. For each result, you can see specific details about the call by clicking **>** to the right of the call result. - -![](/media/articles/hooks/webtask-runner4.png) - -:::panel Test Runner Schema -If you created your Hook early on during the beta testing period, your Webtask Editor/Test Runner window might not populate with the schema required to successfully use the Test Runner. If that is the case, you'll need to save the Hook's code, delete the Hook, and create a new Hook using your existing code. -::: - -## Rename Your Hook - -You can rename your Hook using the Management Dashboard. - -1. In [the Hooks page of the Dashboard](${manage_url}/#/hooks), find the Hook you want to edit. -2. Click the **Gear** icon next to your Hook. -3. Click **Rename**. You will see a dialog pop up, asking you for the **Current Name** of the Hook, as well as the **New Name** you want to use. Click **Rename** when you have populated both values. - -![Rename Hooks prompt](/media/articles/hooks/rename-hook.png) \ No newline at end of file diff --git a/articles/hooks/dashboard/enable-disable.md b/articles/hooks/dashboard/enable-disable.md deleted file mode 100644 index 45bcb33496..0000000000 --- a/articles/hooks/dashboard/enable-disable.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -description: How to enable or disable Hooks using the Management Dashboard -beta: true ---- - -# Enable or Disable Existing Hooks Using the Dashboard - -You can use the Management Dashboard to enable/disable Hooks. Each extensibility point may be associated with **zero** or **one** active Hook. - -::: note -When creating new Hooks, Auth0 enables your Hook for that extensibility point if there are no other Hooks associated with that point. In any other circumstance, Auth0 does *not* enable your new Hook. -::: - -## Enable a Hook - -1. Navigate to [the Hooks page of the Dashboard](${manage_url}/#/hooks) and find the extensibility point for which you want an enabled Hook. -2. Immediately under the name and description of the extensibility point, click on the dropdown box that lists all of the point's associated Hooks. - - ![List of Hooks for a Point](/media/articles/hooks/select-hook-to-enable.png) - -3. Select the Hook you want to enable. -4. Confirm your selection by clicking **YES, ENABLE HOOK**. - - ![Confirm Hook to Enable](/media/articles/hooks/confirm-enable-hook.png) - -You will now see a green dot next to the name of the Hook, indicating that it's enabled. - -## Disable a Hook - -1. Navigate to [the Hooks page of the Dashboard](${manage_url}/#/hooks) and find the extensibility point for which you want an enabled Hook. -2. Immediately under the name and description of the extensibility point, click on the dropdown box that lists all of the point's associated Hooks. - - ![List of Hooks for a Point](/media/articles/hooks/select-hook-to-enable.png) - -3. Select **None**. -4. Confirm your selection by clicking **YES, DISABLE HOOK**. - - ![Confirm Hook to Disable](/media/articles/hooks/disable-hook.png) \ No newline at end of file diff --git a/articles/hooks/dashboard/index.md b/articles/hooks/dashboard/index.md deleted file mode 100644 index 18fed1500a..0000000000 --- a/articles/hooks/dashboard/index.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -description: How to create new Hooks using the Management Dashboard -url: /hooks/dashboard -beta: true ---- - -# Work with Hooks in the Dashboard - -![Management Dashboard Hooks Page](/media/articles/hooks/hooks-dashboard.png) - -The Auth0 Management Dashboard provides a visual interface for working with Hooks. With the Dashboard, you can: - -* [Create/Delete New Hooks](/hooks/dashboard/create-delete) -* [Enable/Disable Existing Hooks](/hooks/dashboard/enable-disable) -* [Edit Existing Hooks](/hooks/dashboard/edit) \ No newline at end of file diff --git a/articles/hooks/delete.md b/articles/hooks/delete.md new file mode 100644 index 0000000000..cdc18884aa --- /dev/null +++ b/articles/hooks/delete.md @@ -0,0 +1,56 @@ +--- +title: Delete Hooks +description: Learn how to delete Hooks using the Dashboard and Management API. Hooks may also be imported and exported using the Auth0 Deploy Command-Line Interface (CLI) tool. +topics: + - hooks + - mgmt-api + - dashboard +contentType: how-to +useCase: extensibility-hooks +v2: true +--- +# Delete Hooks + +When you no longer need Hooks, you can delete them using either the Dashboard or Management API. + +Hooks may also be imported and exported using the [Deploy Command-Line Interface (CLI) Extension](/extensions/deploy-cli). + +
      + +
      +
      + +## Delete Hooks using the Dashboard + +1. Navigate to the [Hooks](${manage_url}/#/hooks) page in the [Auth0 Dashboard](${manage_url}/), and click the gear icon next to the Hook you want to delete. +2. Select **Delete**, and confirm. +
      +
      + +## Delete Hooks using the Management API + +1. Make a `DELETE` call to the [Delete a Hook endpoint](/api/management/v2/#!/Hooks/delete_hooks_by_id). Be sure to replace `HOOK_ID` and `MGMT_API_ACCESS_TOKEN` placeholder values with your hook ID and Management API Access Token, respectively. + +```har +{ + "method": "DELETE", + "url": "https://${account.namespace}/api/v2/hooks/HOOK_ID", + "headers": [ + { "name": "Authorization", "value": "Bearer MGMT_API_ACCESS_TOKEN" } + ] +} +``` + +| Value | Description | +| - | - | +| `HOOK_ID` | ID of the Hook you would like to delete. | +| `MGMT_API_ACCESS_TOKEN` | [Access Token for the Management API](/api/management/v2/tokens) with the scope `delete:hooks`. | + +
      +
      +
      diff --git a/articles/hooks/enable-disable.md b/articles/hooks/enable-disable.md new file mode 100644 index 0000000000..29db93e2a5 --- /dev/null +++ b/articles/hooks/enable-disable.md @@ -0,0 +1,76 @@ +--- +title: Enable/Disable Hooks +description: Learn how to enable and disable Hooks using the Dashboard and Management API. +topics: + - hooks + - dashboard + - mgmt-api +contentType: how-to +useCase: extensibility-hooks +v2: true +--- + +# Enable/Disable Hooks + +You can enable or disable Hooks that have been configured for any given [extensibility point](/hooks/extensibility-points) using the Dashboard or Management API. + +<%= include('./_includes/_hook_enabled_limit') %> + +<%= include('./_includes/_default_hook_enable_behavior') %> + +
      + +
      +
      + +## Enable/Disable Hooks using the Dashboard + +1. Navigate to the [Hooks](${manage_url}/#/hooks) page in the [Auth0 Dashboard](${manage_url}/), and locate the extensibility point for which you want to enable or disable a Hook. + +2. Click on the dropdown box located immediately under the extensibility point's name and description. + + ![View Avalilable Hooks for an Extensibility Point](/media/articles/hooks/select-hook-to-enable.png) + +3. Select the Hook you want to enable, and confirm. If you want to disable all Hooks, select `None`. + +A green dot will appear next to the name of any enabled Hooks. +
      +
      + +## Enable/Disable Hooks using the Management API + +1. Make a `PATCH` call to the [Update a Hook endpoint](/api/management/v2/#!/Hooks/patch_hooks_by_id). Be sure to replace `HOOK_ID` and `MGMT_API_ACCESS_TOKEN` placeholder values with your hook ID and Management API Access Token, respectively. + +```har +{ + "method": "PATCH", + "url": "https://${account.namespace}/api/v2/hooks/HOOK_ID", + "headers": [ + { "name": "Content-Type", "value": "application/json" }, + { "name": "Authorization", "value": "Bearer MGMT_API_ACCESS_TOKEN" }, + { "name": "Cache-Control", "value": "no-cache" } + ], + "postData": { + "mimeType": "application/json", + "text" : "{ \"enabled\": \"true\" }" + } +} +``` + +| Value | Description | +| - | - | +| `HOOK_ID` | ID of the hook to be updated. | +| `MGMT_API_ACCESS_TOKEN` | [Access Tokens for the Management API](/api/management/v2/tokens) with the scope `update:hooks`. | + +::: note +The `enabled` property represents whether the rule is enabled (`true`) or disabled (`false`). | +::: + +
      +
      +
      diff --git a/articles/hooks/extensibility-points/client-credentials-exchange.md b/articles/hooks/extensibility-points/client-credentials-exchange.md new file mode 100644 index 0000000000..1d447b40f7 --- /dev/null +++ b/articles/hooks/extensibility-points/client-credentials-exchange.md @@ -0,0 +1,263 @@ +--- +title: Client Credentials Exchange +description: Learn how hooks can be used with the Client Credentials Exchange extensibility point, which is available for database connections and passwordless connections. +toc: true +topics: + - hooks + - extensibility-points + - client-credentials-exchange + - credentials-exchange +contentType: + - how-to +useCase: extensibility-hooks +v2: true +--- + +# Client Credentials Exchange + +At the Client Credentials Exchange extensibility point, Hooks allow custom actions to be executed when an Access Token is issued through the Authentication API [`POST /oauth/token` endpoint](/api/authentication#client-credentials-flow) using the [Client Credentials Flow](/flows/concepts/client-credentials). For example, you may deny the token from being issued, add custom claims to the Access Token, or modify its scopes. + +Hooks at this extensibility point are blocking (synchronous), which means they execute as part of the trigger's process and will prevent the rest of the Auth0 pipeline from running until the Hook is complete. + +::: note +The `triggerId` for the Client Credentials Exchange extensibility point is `credentials-exchange`. To learn how to create Hooks for this extensibility point, see [Create New Hooks](/hooks/create). +::: + +To learn about other extensibility points, see [Extensibility Points](/hooks/extensibility-points). + +## Starter code and parameters + +When creating a Hook executed at the Client Credentials Exchange extensibility point, you may find the following starter code helpful. Parameters that can be passed into and used by the Hook function are listed at the top of the code sample. + +```js +/** +@param {object} client - client information +@param {string} client.name - client name +@param {string} client.id - client ID +@param {string} client.tenant - Auth0 tenant name +@param {object} client.metadata - client metadata +@param {array|undefined} scope - either an array of strings representing the token's scope claim, or undefined +@param {string} audience - token's audience claim +@param {object} context - Auth0 context info +@param {object} context.webtask - Hook (webtask) context +@param {function} cb - function (error, accessTokenClaims) +*/ + +module.exports = function(client, scope, audience, context, cb) { + var access_token = {}; + access_token.scope = scope; // do not remove this line + + // Modify scopes or add extra claims + // access_token['https://example.com/claim'] = 'bar'; + // access_token.scope.push('extra'); + + // Deny the token and respond with an OAuth2 error response + // if (denyExchange) { + // // To return an HTTP 400 with { "error": "invalid_scope", "error_description": "Not authorized for this scope." } + // return cb(new InvalidScopeError('Not authorized for this scope.')); + // + // // To return an HTTP 400 with { "error": "invalid_request", "error_description": "Not a valid request." } + // return cb(new InvalidRequestError('Not a valid request.')); + // + // // To return an HTTP 500 with { "error": "server_error", "error_description": "A server error occurred." } + // return cb(new ServerError('A server error occurred.')); + // } + + cb(null, access_token); +}; +``` + +Please note: + +* The callback function (`cb`) at the end of the sample code signals completion and *must* be included. +- The line `access_token.scope = scope` ensures that all granted scopes will be present in the Access Token. Removing it will reset all scopes, and the token will include only any scopes you might add with the script. + +### Default response + +When you run a Hook executed at the Client Credentials Exchange extensibility point, the default response object is: + +```json +{ + "scope": "array of strings" +} +``` + +### Starter code response + +Once you've customized the starter code with your scopes and additional claims, you can test the Hook using the Runner embedded in the Hook Editor. The Runner simulates a call to the Hook with the same body and response that you would get with a Client Credentials Exchange. + +<%= include('../_includes/_test_runner_save_warning') %> + +When you run a Hook based on the starter code, the response object is: + +```json +{ + "audience": "https://my-tenant.auth0.com/api/v2/", + "client": { + "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "name": "client-name", + "tenant": "my-tenant", + "metadata": { + "plan": "full" + } + }, + "scope": [ + "read:connections" + ] +} +``` + +## Sample script: Add an additional scope to the Access Token + +In this example, we use a Hook to add an additional [scope](/scopes) to those already existing for the Access Token. + +```js +module.exports = function(client, scope, audience, context, cb) { + // Scopes to be added + var access_token = {}; + + // Get the scope that's currently on the Access Token + // and add it to the object we're working with + // Do not remove this line! + access_token.scope = scope; + + // Append the `read:resource` scope + access_token.scope.push('read:resource'); + + // Callback to indicate completion and to return new + // array of scopes + cb(null, access_token); +}; +``` + +### Response + +When we run this Hook, the response object is: + +```json +{ + "scope": [ + "read:connections", + "read:resource" + ] +} +``` + +## Sample script: Add a claim to the Access Token + +In this example, we add a [namespaced](/tokens/guides/create-namespaced-custom-claims) custom claim and its value to the Access Token. + +You can add the following as claims to the issued token: + +* The `scope` property of the response object +* Any properties with [namespaced](/tokens/concepts/claims-namespacing) property names + +The extensibility point will ignore all other response object properties. + +<%= include('../_includes/_access_hook_secrets') %> + +```js +module.exports = function(client, scope, audience, context, cb) { + // Claims to be added + var access_token = {}; + + // New claim to add to the token + access_token['https://example.com/foo'] = 'bar'; + + // Callback to indicate completion and to return new claim + cb(null, access_token); + }; +``` + +### Response + +When we run this Hook, the response object is: + +```json +{ + "https://example.com/foo": "bar" +} +``` + +## Sample script: Raise an Error or Deny an Access Token + +In this example, we use custom Error objects to generate OAuth2 Error Responses. ([See OAuth2 RFC - Section 5.2](https://tools.ietf.org/html/rfc6749#section-5.2)) + +If a plain JavaScript error is returned in the callback, such as: + +```js +module.exports = function(client, scope, audience, context, cb) { + // Callback to indicate completion and to return new claim + cb(new Error("Unknown error occurred."); + }; +``` + +Then when you request a `client_credentials` grant from the `/oauth/token` endpoint, Auth0 will respond with: + +``` +HTTP 500 +{ "error": "server_error", "error_description": "Unknown error occurred." } +``` + +However, if you like additional control over the OAuth2 Error Response, three custom Error objects are available to use instead. They are: + +### InvalidScopeError + +```js +module.exports = function(client, scope, audience, context, cb) { + const invalidScope = ...; // determine if scope is valid + + if(invalidScope) { + cb(new InvalidScopeError("Scope is not permitted.")); + } + }; +``` + +Then when you request a `client_credentials` grant is from the `/oauth/token` endpoint, Auth0 will respond with: + +``` +HTTP 400 +{ "error": "invalid_scope", "error_description": "Scope is not permitted." } +``` + +### InvalidRequestError + +```js +module.exports = function(client, scope, audience, context, cb) { + const invalidRequest = ...; // determine if request is valid + + if(invalidRequest) { + cb(new InvalidRequestError("Bad request.")); + } + }; +``` + +Then when you request a `client_credentials` grant from the `/oauth/token` endpoint, Auth0 will respond with: + +``` +HTTP 400 +{ "error": "invalid_request", "error_description": "Bad request." } +``` + +### ServerError + +```js +module.exports = function(client, scope, audience, context, cb) { + callOtherService(function(err, response) { + if(err) { + return cb(new ServerError("Error calling remote system: " + err.message)); + } + }); + }; +``` + +Then when you request a `client_credentials` grant from the `/oauth/token` endpoint, Auth0 will respond with: + +``` +HTTP 400 +{ "error": "server_error", "error_description": "Error calling remote system: ..." } +``` + +::: note +Currently, the behavior of the built-in JavaScript `Error` class and `ServerError` is identical, but the `ServerError` class allows you to be explicit about the OAuth2 error that will be returned. +::: diff --git a/articles/hooks/extensibility-points/credentials-exchange.md b/articles/hooks/extensibility-points/credentials-exchange.md deleted file mode 100644 index 4117d61609..0000000000 --- a/articles/hooks/extensibility-points/credentials-exchange.md +++ /dev/null @@ -1,162 +0,0 @@ ---- -title: Using the Credentials Exchange Extensibility Point -description: The credentials-exchange extensibility point for use with Hooks -toc: true -beta: true ---- - -# Extensibility Point: Credentials Exchange - -The `credentials-exchange` extensibility point allows you to change the scopes and add custom claims to the [Access Tokens](/tokens/access-token) issued by the [Auth0 API's `POST /oauth/token` endpoint](/api/authentication#authorization-code) during runtime. - -::: note -Please see [Calling APIs from a Service](/api-auth/grant/client-credentials) for more information on the Client Credentials Grant. -::: - -## Types of Claims Available - -You can add the following as claims to the issued token: - -* The `scope` property of the response object; -* Any properties with namespaced property names: - - * URLs with HTTP or HTTPS schemes - * URLs with hostnames that *aren't* auth0.com, webtask.io, webtask.run, or the associated subdomain names - -The extensibility point will ignore all other response object properties. - -::: note -If you need to configure client secrets and access them within your Hook, you can do so using `context.webtask.secrets.SECRET_NAME`. -::: - -## How to Implement This - -You can implement a [Hook](/hooks#work-with-hooks) using this extensibility point with either the [Dashboard](/hooks/dashboard) or the [Command Line Interface](/hooks/cli). - -For detailed steps on implementing the grant, please refer to [Using Hooks with Client Credentials Grant](/api-auth/tutorials/client-credentials/customize-with-hooks). - -### Starter Code and Parameters - -After you've created a new Hook that uses the Credentials Exchange extensibility point, you can open up the Hook and edit it using the Webtask Editor embedded in the Dashboard. - -The parameters listed in the comment at the top of the code indicate the Auth0 objects (and the parameters within the objects) that can be passed into and used by the Hook's function. For example, the `client` object comes with the following parameters: client name, client ID, the Auth0 tenant name with which the client is associated, and client metadata. - -```js -/** -@param {object} client - information about the client -@param {string} client.name - name of client -@param {string} client.id - client id -@param {string} client.tenant - Auth0 tenant name -@param {object} client.metadata - client metadata -@param {array|undefined} scope - array of strings representing the scope claim or undefined -@param {string} audience - token's audience claim -@param {object} context - additional authorization context -@param {object} context.webtask - webtask context -@param {function} cb - function (error, accessTokenClaims) -*/ -module.exports = function(client, scope, audience, context, cb) { - var access_token = {}; - access_token.scope = scope; - - // Modify scopes or add extra claims - // access_token['https://example.com/claim'] = 'bar'; - // access_token.scope.push('extra'); - - cb(null, access_token); -}; -``` - -The callback function `cb` at the end of the sample code is used to signal completion and must not be omitted. - -#### Response - -The default response object every time you run this Hook is as follows: - -```json -{ - "scope": "array of strings" -} -``` - -### Testing Your Hook - -::: note -Executing the code using the Runner requires a save, which means that your original code will be overwritten. -::: - -Once you've modified the sample code with the specific scopes of additional claims you'd like added to your Access Tokens, you can test your Hook using the Runner. The runner simulates a call to the Hook with the same body/payload that you would get with a Credentials Exchange. The following is the sample body that populates the Runner by default (these are the same objects/parameters detailed in the comment at the top of the sample Hook code): - -```json -{ - "audience": "https://my-tenant.auth0.com/api/v2/", - "client": { - "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "name": "client-name", - "tenant": "my-tenant", - "metadata": { - "plan": "full" - } - }, - "scope": [ - "read:connections" - ] -} -``` - -## Example: Add Scope to the Access Token - -This example shows you how to use the Hook to add an additional scope to the scopes already existing on the Access Token. - -```js -module.exports = function(client, scope, audience, context, cb) { - // Scopes to be added - var access_token = {}; - - // Get the scope that's currently on the Access Token - // and add it to the object we're working with - access_token.scope = scope; - - // Append the `read:resource` scope - access_token.scope.push('read:resource'); - - // Callback to indicate completion and to return new - // array of scopes - cb(null, access_token); -}; -``` - -Using the [test runner](https://webtask.io/docs/editor/runner), we see that the response is as follows: - -```json -{ - "scope": [ - "read:connections", - "read:resource" - ] -} -``` - -## Example: Add a Claim to the Access Token - -This example show you have to add a namespaced claim and its value to the Access Token. - -```js -module.exports = function(client, scope, audience, context, cb) { - // Claims to be added - var access_token = {}; - - // New claim to add to the token - access_token['https://example.com/foo'] = 'bar'; - - // Callback to indicate completion and to return new claim - cb(null, access_token); - }; -``` - -Using the [test runner](https://webtask.io/docs/editor/runner), we see that the response is as follows: - -```json -{ - "https://example.com/foo": "bar" -} -``` \ No newline at end of file diff --git a/articles/hooks/extensibility-points/index.md b/articles/hooks/extensibility-points/index.md index 85b2a78920..c39ebc9aa5 100644 --- a/articles/hooks/extensibility-points/index.md +++ b/articles/hooks/extensibility-points/index.md @@ -1,13 +1,27 @@ --- -description: The extensibility points for use with Hooks -url: /hooks/extensibility-points -beta: true +description: Learn about extensibility points of the Auth0 platform that are available to use with Hooks. +topics: + - hooks + - extensibility-points +contentType: + - reference +useCase: extensibility-hooks --- # Extensibility Points -Hooks allow you to customize the behavior of Auth0 with Node.js code. They are essentially [Webtask](https://webtask.io), but [Hooks](/hooks#work-with-hooks) are executed only against selected extensibility points, which are the serverless option that's analagous to the webhooks that come with a server. The following is a list of currently available extensibility points: +Extensibility points are places in the Auth0 platform where [Hooks](/hooks) can be executed. -- [Credentials Exchange](/hooks/extensibility-points/credentials-exchange): change the scopes and add custom claims to the tokens issued by the Auth0 API's `POST /oauth/token` endpoint -- [Pre-User Registration](/hooks/extensibility-points/pre-user-registration): prevent user registration and add custom metadata to a newly-created user -- [Post-User Registration](/hooks/extensibility-points/post-user-registration): implement custom actions that execute asynchronously from the Auth0 authentication process after a new user registers and is added to the database \ No newline at end of file +Whether Hooks can be used with connections varies according to extensibility point. Hooks that can be used with connections only work with [Database Connections](/connections/database) and [Passwordless Connections](/connections/passwordless). + +Extensibility points may also block processes from executing. Synchronous extensibility points are blocking, which means they execute the Hook as part of the trigger's process and will prevent that process from executing until the Hook is complete. Aynchronous extensibility points will not wait for the Hook to finish its execution before proceeding. + +The following extensibility points are available: + +| Extensibility Point | Trigger ID | Connection Type(s) | Blocking? | Description | +|---------------------|-----------|-----------------|-------------|-------------------| +| [Client Credentials Exchange](/hooks/extensibility-points/client-credentials-exchange) | `credentials-exchange` | N/A | Yes | Extend machine-to-machine token exchanges. Prevent a token exchange or change the scopes and add custom claims to access tokens issued by the Auth0 API's `POST /oauth/token` endpoint. | +| [Pre-User Registration](/hooks/extensibility-points/pre-user-registration) | `pre-user-registration` | Database, Passwordless | Yes | Prevent user creation or registration, or add custom metadata to a newly-created user. | +| [Post-User Registration](/hooks/extensibility-points/post-user-registration) | `post-user-registration` | Database, Passwordless | No | Implement custom actions from the Auth0 authentication process after a new user is created or registers and is added to the database. | +| [Post-Change Password](/hooks/extensibility-points/post-change-password) | `post-change-password` | Database | No | Implement custom actions to be executed after a successful user password change. | +| [Send Phone Message](/hooks/extensibility-points/send-phone-message) | `send-phone-message` | N/A | Yes | Implement a custom phone messaging provider to deliver MFA one-time-use codes. | diff --git a/articles/hooks/extensibility-points/post-change-password.md b/articles/hooks/extensibility-points/post-change-password.md new file mode 100644 index 0000000000..4a26db63aa --- /dev/null +++ b/articles/hooks/extensibility-points/post-change-password.md @@ -0,0 +1,128 @@ +--- +title: Post-Change Password +description: Learn how hooks can be used with the Post Change Password extensibility point, which is available for database connections. +toc: true +topics: + - hooks + - extensibility-points + - post-change-password +contentType: + - how-to +useCase: extensibility-hooks +v2: true +--- + +# Post-Change Password + +At the Post-Change Password extensibility point, Hooks allow custom actions to be executed after a successful user password change, whether initiated by a user for their own password or by a tenant administrator for another user's password. For example, you may send an email to a user to notify them that their password has been changed. + +Hooks at this extensibility point are non-blocking (asynchronous), which means the Auth0 pipeline will continue to run without waiting for a Hook to finish its execution. Thus, the Hook's outcome does not affect the Auth0 transaction. + +The Post-Change Password extensibility point is available for [Database Connections](/connections/database). + +::: note +The `triggerId` for the Post-Change Password extensibility point is `post-change-password`. To learn how to create Hooks for this extensibility point, see [Create New Hooks](/hooks/create). +::: + +To learn about other extensibility points, see [Extensibility Points](/hooks/extensibility-points). + +## Starter code and parameters + +When creating a Hook executed at the Post-Change Password extensibility point, you may find the following starter code helpful. Parameters that can be passed into and used by the Hook function are listed at the top of the code sample. + +```js +/** +@param {object} user - affected user +@param {string} user.id - user's ID +@param {string} user.username - user's username +@param {string} user.email - user's email +@param {string} user.last_password_reset - date/time the user's password was last changed +@param {object} context - Auth0 context info, such as connection +@param {object} context.connection - connection info +@param {object} context.connection.id - connection ID +@param {object} context.connection.name - connection name +@param {object} context.connection.tenant - connection tenant +@param {object} context.webtask - Hook (webtask) context +@param {function} cb - function (error) +**/ + +module.exports = function (user, context, cb) { + // Perform any asynchronous actions, e.g. send notification to Slack. + cb(); +}; +``` + +Please note: + +* The callback function (`cb`) at the end of the sample code signals completion and *must* be included. + +### Default response + +Hooks executed at the Post-Change Password extensibility point ignore any response object. If an error is returned, a tenant log entry is created, but this does not affect the Auth0 transaction. + +### Starter code response + +Once you've customized the starter code, you can test the Hook using the Runner embedded in the Hook Editor. The Runner simulates a call to the Hook with the appropriate body and response. + +<%= include('../_includes/_test_runner_save_warning') %> + +When you run a Hook based on the starter code, the response object is: + +```json +{ + "user": { + "id": "abc123", + "username": "user1", + "email": "user1@foo.com", + "last_password_reset": "2019-02-27T14:14:29.206Z" + }, + "context": { + "connection": { + "id": "con_xxxxxxxxxxxxxxxx", + "name": "Username-Password-Authentication", + "tenant": "my-tenant" + } + } +} +``` + +## Sample script: Send a notification email upon password change + +In this example, we use a Hook to have SendGrid send a notification email to the user upon password change. The example requires a valid SendGrid API key to be stored in [Hook Secrets](/hooks/secrets) as `SENDGRID_API_KEY`. + +```js +module.exports = function (user, context, cb) { + + const request = require('request'); + const sendgridApiKey = context.webtask.secrets.SENDGRID_API_KEY; + + // https://sendgrid.api-docs.io/v3.0/mail-send + request.post({ + url: 'https://api.sendgrid.com/v3/mail/send', + headers: { + 'Authorization': 'Bearer ' + sendgridApiKey + }, + json: { + personalizations: [{ + to: [{ + email: user.email + }] + }], + from: { + email: 'admin@example.com' + }, + subject: 'Your password was changed', + content: [{ + type: 'text/plain', + value: 'The password for your ' + context.connection.name + ' account ' + user.email + ' was recently changed.' + }] + } + }, function (err, resp, body) { + if (err || resp.statusCode !== 202) { + return cb(err || new Error(body.errors[0].message)); + } + + cb(); + }); +}; +``` diff --git a/articles/hooks/extensibility-points/post-user-registration.md b/articles/hooks/extensibility-points/post-user-registration.md index 1e785ee835..694ee52253 100644 --- a/articles/hooks/extensibility-points/post-user-registration.md +++ b/articles/hooks/extensibility-points/post-user-registration.md @@ -1,69 +1,78 @@ --- -title: Using the Post-User Registration Extensibility Point -description: The post-user-registration extensibility point for use with Hooks -beta: true +title: Post-User Registration +description: Learn how hooks can be used with the Post-User Registration extensibility point, which is available for database connections and passwordless connections. toc: true +topics: + - hooks + - extensibility-points + - post-user-registration +contentType: + - how-to +useCase: extensibility-hooks +v2: true --- -# Extensibility Point: Post-User Registration +# Post-User Registration -For [Database Connections](/connections/database), the `post-user-registration` extensibility point allows you to implement custom actions that execute after a new user registers and is added to the database. [Hooks](/hooks#work-with-hooks) associated with the `post-user-registration` extensibility point execute asynchronously from the actions that are a part of the Auth0 authentication process. +At the Post-User Registration extensibility point, Hooks allow custom actions to be executed after a new user registers an account and is added to the database. For example, you may send a message to Slack or create a record in your customer relationship management (CRM) system. -This allows you to implement scenarios including (but not limited to): +Hooks at this extensibility point are non-blocking (asynchronous), which means the Auth0 pipeline will continue to run without waiting for a Hook to finish its execution. Thus, the Hook's outcome does not affect the Auth0 transaction. -* Sending notifications to Slack or via e-mail about the user's new account; -* Creating a new user record in a CRM system. +The Post-User Registration extensibility point is available for [Database Connections](/connections/database) and [Passwordless Connections](/connections/passwordless). -## How to Implement This - -You can implement a [Hook](/hooks#work-with-hooks) using this extensibility point with either the [Dashboard](/hooks/dashboard) or the [Command Line Interface](/hooks/cli). +::: note +The `triggerId` for the Post-User Registration extensibility point is `post-user-registration`. To learn how to create Hooks for this extensibility point, see [Create New Hooks](/hooks/create). +::: -### Starter Code and Parameters +To learn about other extensibility points, see [Extensibility Points](/hooks/extensibility-points). -After you've created a new Hook that uses the Post-User Registration extensibility point, you can open up the Hook and edit it using the Webtask Editor embedded in the Dashboard. +## Starter code and parameters -The parameters listed in the comment at the top of the code indicate the Auth0 objects (and the parameters within the objects) that can be passed into and used by the Hook's function. For example, the `client` object comes with the following parameters: application name, client ID, the Auth0 tenant name with which the application is associated, and application metadata. +When creating a Hook executed at the Post-User Registration extensibility point, you may find the following starter code helpful. Parameters that can be passed into and used by the Hook function are listed at the top of the code sample. ```js /** -@param {object} user - The user being created -@param {string} user.id - user id +@param {object} user - user being created +@param {string} user.id - user's ID (user GUID without "auth0|" database prefix) @param {string} user.tenant - Auth0 tenant name -@param {string} user.username - user name -@param {string} user.email - email -@param {boolean} user.emailVerified - is e-mail verified? -@param {string} user.phoneNumber - phone number -@param {boolean} user.phoneNumberVerified - is phone number verified? -@param {object} user.user_metadata - user metadata -@param {object} user.app_metadata - application metadata -@param {object} context - Auth0 connection and other context info +@param {string} user.username - user's username +@param {string} user.email - user's email +@param {boolean} user.emailVerified - indicates whether email is verified +@param {string} user.phoneNumber - user's phone number +@param {boolean} user.phoneNumberVerified - indicates whether phone number is verified +@param {object} user.user_metadata - user's user metadata +@param {object} user.app_metadata - user's application metadata +@param {object} context - Auth0 context info, such as connection @param {string} context.requestLanguage - language of the application agent -@param {object} context.connection - information about the Auth0 connection -@param {object} context.connection.id - connection id +@param {object} context.connection - connection info +@param {object} context.connection.id - connection ID @param {object} context.connection.name - connection name @param {object} context.connection.tenant - connection tenant -@param {object} context.webtask - webtask context +@param {object} context.webtask - Hook (webtask) context @param {function} cb - function (error, response) */ + module.exports = function (user, context, cb) { // Perform any asynchronous actions, such as send notification to Slack. cb(); }; ``` -The callback function `cb` at the end of the sample code is used to signal completion and must not be omitted (even though the extensibility point ignores response objects). +Please note: -#### Response +* The callback function (`cb`) at the end of the sample code signals completion and *must* be included. -The Post-User Registration extensibility point ignores any response object. +### Default response -### Testing Your Hook +Hooks executed at the Post-User Registration extensibility point ignore any response object. -::: note -Executing the code using the Runner requires a save, which means that your original code will be overwritten. -::: +### Starter code response + +Once you've customized the starter code, you can test the Hook using the Runner embedded in the Hook Editor. The Runner simulates a call to the Hook with the appropriate body and response. + +<%= include('../_includes/_test_runner_save_warning') %> -Once you've modified the sample code with the specific scopes of additional claims you'd like added to your Access Tokens, you can test your Hook using the Runner. The runner simulates a call to the Hook with the appropriate user information body/payload. The following is the sample body that populates the Runner by default (these are the same objects/parameters detailed in the comment at the top of the sample Hook code): +When you run a Hook based on the starter code, the response object is: ```json { @@ -92,7 +101,9 @@ Once you've modified the sample code with the specific scopes of additional clai } ``` -## Example: Integrate with Slack +## Sample script: Integrate with Slack + +In this example, we use a Hook to have Slack post a new user's username and email address to a specified channel upon user registration. ```js module.exports = function (user, context, cb) { @@ -102,7 +113,7 @@ module.exports = function (user, context, cb) { // Post the new user's name and email address to the selected channel var slack = require('slack-notify')(SLACK_HOOK); - var message = 'New User: ' + (user.name || user.email) + ' (' + user.email + ')'; + var message = 'New User: ' + (user.username || user.email) + ' (' + user.email + ')'; var channel = '#some_channel'; slack.success({ @@ -113,4 +124,4 @@ module.exports = function (user, context, cb) { // Return immediately; the request to the Slack API will continue on the sandbox cb(); }; -``` \ No newline at end of file +``` diff --git a/articles/hooks/extensibility-points/pre-user-registration.md b/articles/hooks/extensibility-points/pre-user-registration.md index 572f317734..6291fd715e 100644 --- a/articles/hooks/extensibility-points/pre-user-registration.md +++ b/articles/hooks/extensibility-points/pre-user-registration.md @@ -1,49 +1,61 @@ --- -title: Using the Pre-User Registration Extensibility Point -description: The pre-user-registration extensibility point for use with Hooks +title: Pre-User Registration +description: Learn how hooks can be used with the Pre-User Registration extensibility point, which is available for database connections and passwordless connections. toc: true -beta: true +topics: + - hooks + - extensibility-points + - pre-user-registration +contentType: + - how-to +useCase: extensibility-hooks +v2: true --- -# Extensibility Point: Pre-User Registration +# Pre-User Registration -For [Database Connections](/connections/database), the `pre-user-registration` extensibility point allows you to add custom `app_metadata` or `user_metadata` to a newly-created user. +At the Pre-User Registration extensibility point, Hooks allow custom actions to be executed when a new user is created. For example, you may add custom `app_metadata` or `user_metadata` to the newly-created user, or even prevent the creation of the user in the database. -This allows you to implement scenarios such as setting conditional [metadata](/metadata) on users that do not exist yet. +Hooks at this extensibility point are blocking (synchronous), which means they execute as part of the trigger's process and will prevent the rest of the Auth0 pipeline from running until the Hook is complete. -## How to Implement This +The Pre-User Registration extensibility point is available for [Database Connections](/connections/database) and [Passwordless Connections](/connections/passwordless). -You can implement a [Hook](/hooks#work-with-hooks) using this extensibility point with either the [Dashboard](/hooks/dashboard) or the [Command Line Interface](/hooks/cli). +::: note +The `triggerId` for the Pre-User Registration extensibility point is `pre-user-registration`. To learn how to create Hooks for this extensibility point, see [Create New Hooks](/hooks/create). +::: -## Starter Code and Parameters +To learn about other extensibility points, see [Extensibility Points](/hooks/extensibility-points). -After you've created a new Hook that uses the Pre-User Registration extensibility point, you can open up the Hook and edit it using the Webtask Editor embedded in the Dashboard. +## Starter code and parameters -The parameters listed in the comment at the top of the code indicate the Auth0 objects (and the parameters within the objects) that can be passed into and used by the Hook's function. For example, the `client` object comes with the following parameters: application name, client ID, the Auth0 tenant name with which the application is associated, and application metadata. +When creating a Hook executed at the Pre-User Registration extensibility point, you may find the following starter code helpful. Parameters that can be passed into and used by the Hook function are listed at the top of the code sample. ```js /** -@param {object} user - The user being created +@param {object} user - user being created @param {string} user.tenant - Auth0 tenant name -@param {string} user.username - user name +@param {string} user.username - user's username @param {string} user.password - user's password -@param {string} user.email - email -@param {boolean} user.emailVerified - is e-mail verified? -@param {string} user.phoneNumber - phone number -@param {boolean} user.phoneNumberVerified - is phone number verified? -@param {object} context - Auth0 connection and other context info -@param {string} context.requestLanguage - language of the application agent -@param {object} context.connection - information about the Auth0 connection -@param {object} context.connection.id - connection id +@param {string} user.email - user's email +@param {boolean} user.emailVerified - indicates whether email is verified +@param {string} user.phoneNumber - user's phone number +@param {boolean} user.phoneNumberVerified - indicates whether phone number is verified +@param {object} context - Auth0 context info, such as connection +@param {string} context.renderLanguage - language of the signup flow +@param {string} context.request.ip - ip address +@param {string} context.request.language - language of the application agent +@param {object} context.connection - connection info +@param {object} context.connection.id - connection ID @param {object} context.connection.name - connection name @param {object} context.connection.tenant - connection tenant -@param {object} context.webtask - webtask context -@param {function} cb - function (error, response) +@param {object} context.webtask - Hook (webtask) context +@param {function} cb - Function (error, response) */ + module.exports = function (user, context, cb) { var response = {}; - // Add user or app metadata to the newly created user + // Add user or app metadata to the newly-created user // response.user = { // user_metadata: { foo: 'bar' }, // app_metadata: { vip: true, score: 7 } @@ -55,11 +67,13 @@ module.exports = function (user, context, cb) { }; ``` -The callback function `cb` at the end of the sample code is used to signal completion and must not be omitted. +Please note: -### Response +* The callback function (`cb`) at the end of the sample code signals completion and *must* be included. + +### Default response -The default response object every time the Hook runs is similar to the following: +When you run a Hook executed at the Pre-User Registration extensibility point, the default response object is: ```json { @@ -87,13 +101,17 @@ If you specify `app_metadata` and `user_metadata` in the response object, Auth0 Metadata property names must not start with the `$` character or contain the `.` character. ::: -## Testing Your Hook - ::: note -Executing the code using the Runner requires a save, which means that your original code will be overwritten. +Hooks executed at the Pre-User Registration extensibility point do not pass error messages to any Auth0 APIs. ::: -Once you've modified the sample code with the specific scopes of additional claims you'd like added to your Access Tokens, you can test your Hook using the Runner. The runner simulates a call to the Hook with the appropriate user information body/payload. The following is the sample body that populates the Runner by default (these are the same objects/parameters detailed in the comment at the top of the sample Hook code): +### Starter code response + +Once you've customized the starter code, you can test the Hook using the Runner embedded in the Hook Editor. The Runner simulates a call to the Hook with the appropriate body and response. + +<%= include('../_includes/_test_runner_save_warning') %> + +When you run a Hook based on the starter code, the response object is: ```json { @@ -113,7 +131,10 @@ Once you've modified the sample code with the specific scopes of additional clai } }, "context": { - "requestLanguage": "en-us", + "request": { + "language": "en-us", + "ip": "123.123.123.123" + }, "connection": { "id": "con_xxxxxxxxxxxxxxxx", "name": "Username-Password-Authentication", @@ -123,7 +144,9 @@ Once you've modified the sample code with the specific scopes of additional clai } ``` -## Example: Add Metadata to New Users +## Sample script: Add metadata to new users + +In this example, we use a Hook to add metadata to new users upon creation. ```js module.exports = function (user, context, cb) { @@ -138,7 +161,9 @@ module.exports = function (user, context, cb) { }; ``` -Using the [test runner](https://webtask.io/docs/editor/runner), we see that the response, reflecting the updated metadata, is as follows: +### Response + +When we run this Hook, the response object is: ```json { @@ -154,6 +179,27 @@ Using the [test runner](https://webtask.io/docs/editor/runner), we see that the } ``` -::: note -The Pre-Registration Hook does not currently pass error messages to any Auth0 APIs. -::: \ No newline at end of file +## Sample script: Customize the error message and language for user messages + +In this example, we use a Hook to prevent a user from registering, then return a custom error message in our tenant logs and show a custom, translated error message to the user when they are denied. To return the user message and use the translation functionality, your tenant must be configured to use the [Universal Login - New Experience](/universal-login/new). + +```js +module.exports = function (user, context, cb) { + const isUserDenied = ...; // determine if a user should be allowed to register + + if (isUserDenied) { + const LOCALIZED_MESSAGES = { + en: 'You are not allowed to register.', + es: 'No tienes permitido registrarte.' + }; + + const localizedMessage = LOCALIZED_MESSAGES[context.renderLanguage] || LOCALIZED_MESSAGES['en']; + return cb(new PreUserRegistrationError('Denied user registration in Pre-User Registration Hook', localizedMessage)); + } +}; +``` + +Please note: +* The custom `PreUserRegistrationError` class allows you to control the message seen by the user who is attempting to register. +* The first parameter passed to `PreUserRegistrationError` controls the error message that appears in your tenant logs. +* The second parameter controls the error message seen by the user who is attempting to register. In this example, the `context.renderLanguage` parameter generates a user-facing message in the appropriate language for the user. You can use these parameters only if your tenant is configured to use the [Universal Login - New Experience](/universal-login/new). diff --git a/articles/hooks/extensibility-points/send-phone-message.md b/articles/hooks/extensibility-points/send-phone-message.md new file mode 100644 index 0000000000..89ec90acf3 --- /dev/null +++ b/articles/hooks/extensibility-points/send-phone-message.md @@ -0,0 +1,138 @@ +--- +title: Send Phone Message +description: Learn how to provide your own code to send phone messages for MFA +toc: true +topics: + - hooks + - extensibility-points + - send-phone-message + - custom-messaging-gateway + - sms + - voice +contentType: + - how-to +useCase: extensibility-hooks +v2: true +--- +# Send Phone Message + +If you decide to use SMS or Voice as a factor for Multi-factor Authentication (MFA), you can configure how you want Auth0 to send the messages in the [MFA Phone configuration dialog](/mfa/guides/configure-phone#administrative-setup). + +If you select the 'Custom' delivery method, you must create a **Send Phone Message Hook** that will let you write your own code to send the message. This allows you to use whatever messaging provider you want. + +Hooks at this extensibility point are blocking (synchronous), which means they execute as part of the trigger's process and will prevent the rest of the Auth0 pipeline from running until the Hook is complete. + +::: note +The `triggerId` for the Send Phone Message extensibility point is `send-phone-message`. To learn how to create Hooks for this extensibility point, see [Create New Hooks](/hooks/create). +::: + +To learn about other extensibility points, see [Extensibility Points](/hooks/extensibility-points). + +## Starter code and parameters + +When creating a Hook executed at the Send Phone Message extensibility point, you may find the following starter code helpful. Parameters that can be passed into and used by the Hook function are listed at the top of the code sample. + +```js +/** +@param {string} recipient - phone number +@param {string} text - message body +@param {object} context - additional authorization context +@param {string} context.message_type - 'sms' or 'voice' +@param {string} context.action - 'enrollment' or 'second-factor-authentication' +@param {string} context.language - language used by login flow +@param {string} context.code - one-time password +@param {string} context.ip - ip address +@param {string} context.user_agent - user agent making the authentication request +@param {object} context.client - object with details about the Auth0 application +@param {string} context.client.client_id - Auth0 application ID +@param {string} context.client.name - Auth0 application name +@param {object} context.client.client_metadata - metadata from client +@param {object} context.user - object representing the user +@param {string} context.user.user_id - Auth0 user's ID +@param {string} context.user.name - user's name +@param {string} context.user.email - user 'semail +@param {object} context.user.app_metadata - metadata specific to user and application +@param {object} context.user.user_metadata - metadata specific to user +@param {function} cb - function (error, response) +*/ +module.exports = function(recipient, text, context, cb) { + // TODO: Add your code here + cb(null, {}); +}; +``` + +::: note +The callback function (`cb`) at the end of the sample code signals completion and **must** be included. +::: + +## Example parameters + +This is an example of the parameters: + +```js +{ + "recipient": "1-808-555-5555", + "text": "Here is your one time password: 999111", + "context": { + "message_type": "sms", + "action": "enrollment", + "language": "en", + "code": "123456", + "ip": "127.0.0.1", + "user_agent": "Mozilla/5.0", + "client": { + "client_id": "1235", + "name": "Test Application", + "client_metadata": { } + }, + "user": { + "user_id": "auth0|test12345", + "name": "Billie Magnusson", + "email": "billie@email.com", + "app_metadata": { }, + "user_metadata": { } + } + } +} +``` + +## Starter code response + +Once you have customized the Hook code, you can test it using the Runner embedded in the Editor. The Runner simulates a call to the Hook with the appropriate body and response. + +<%= include('../_includes/_test_runner_save_warning') %> + +When you run a Hook based on the starter code, the response object is: + +``` +{ + "MessageID": "998a9ad1-c9b9-4b85-97b1-ac0305aa5532" +} +``` + +## Localization + +The `context.language` parameter will always have one of the [languages configured in the Tenant Settings](/universal-login/i18n). Depending on how you trigger the MFA flow, we will calculate which language to use in the following different ways: + +- If you use the [MFA API](/mfa/concepts/mfa-api), we will use the Accept-Language header from the request and map it to a tenant language. If the language is not available, we will set the parameter to the tenant default language. + +- If you use the New Universal Login Experience, we will use a combination of the Accept-Language header and the `ui_locales` parameter, as described in [Universal Login Internationalization](/universal-login/i18n#language-selection). + +- If you use the Classic Universal Login Experience, we will set the language to 'N/A'. This is a limitation that will be fixed in upcoming releases. + +## Examples + +Learn how to integrate different messaging providers with the examples below: + +* [Amazon SNS](/mfa/send-phone-message-hook-amazon-sns) +* [Twilio](/mfa/send-phone-message-hook-twilio) +* [Infobip](/mfa/send-phone-message-hook-infobip) +* [TeleSign](/mfa/send-phone-message-hook-telesign) +* [Vonage](/mfa/send-phone-message-hook-vonage) +* [Esendex](/mfa/send-phone-message-hook-esendex) +* [Mitto](/mfa/send-phone-message-hook-mitto) + +## Keep Reading + +- [Configure SMS or Voice Notifications for MFA](/mfa/guides/configure-phone) +- [Extensibility Points](/hooks/extensibility-points) diff --git a/articles/hooks/index.md b/articles/hooks/index.md index 2c14134ba2..ee230d7323 100644 --- a/articles/hooks/index.md +++ b/articles/hooks/index.md @@ -1,51 +1,46 @@ --- -url: /hooks -classes: topic-page title: Hooks -description: Working with Hooks -beta: true +description: Learn about Auth0 Hooks for Database Connections and Passwordless Connections. +topics: + - hooks + - extensibility-points +contentType: + - index + - concept +useCase: extensibility-hooks --- +# Hooks -
      -
      -

      Hooks

      -

      - Hooks allow you to extend the Auth0 platform with custom code. -

      -
      - -## What are Hooks? - -When using [Database Connections](/connections/database), Hooks allow you to customize the behavior of Auth0 using Node.js code that is executed against extensibility points (which are comparable to webhooks that come with a server). Hooks allow you modularity when configuring your Auth0 implementation, and extend the functionality of base Auth0 features. - -## Work with Hooks - - - -## Use the Webtask Editor - -You can edit Hooks directly using the Webtask Editor. Please see the [Webtask documentation](https://webtask.io/docs/editor) for detailed information. +<%= include('../_includes/_ip_whitelist') %> + +Hooks are secure, self-contained functions that allow you to customize the behavior of Auth0 when executed for selected [extensibility points](/hooks/extensibility-points) of the Auth0 platform. Auth0 invokes Hooks during runtime to execute your custom Node.js code. + +Whether Hooks can be used with connections varies according to extensibility point. Hooks that can be used with connections only work with [Database Connections](/connections/database) and [Passwordless Connections](/connections/passwordless). + +## Manage Hooks + +You can create, update, delete, enable/disable, and view Hooks from the Dashboard or Management API. To learn more, see: + +- [Create Hooks](/hooks/create) +- [Update Hooks](/hooks/update) +- [Delete Hooks](/hooks/delete) +- [Enable/Disable Hooks](/hooks/enable-disable) +- [View Hooks](/hooks/view) + +Hooks may also be imported and exported using the [Deploy Command-Line Interface (CLI) Extension](/extensions/deploy-cli). + +<%= include('./_includes/_handle_rate_limits') %> + +## Manage Hook Secrets + +Hooks feature integrated secret management to securely store secrets while making them conveniently available in code. To learn more, see [Hook Secrets](/hooks/secrets). + +## Test Hooks + +The Hooks editor in the Dashboard has an integrated Runner, which allows you to test your code without leaving the editor. + +<%= include('./_includes/_test_runner_save_warning') %> + +## View Logs + +You can view real-time logging information for specific configured Hooks using the Dashboard. To learn more, see [View Logs for Hooks](/hooks/view-logs). diff --git a/articles/hooks/overview.md b/articles/hooks/overview.md deleted file mode 100644 index bc135c0bc6..0000000000 --- a/articles/hooks/overview.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -description: >- - Hooks are JavaScript functions executed as part of the user - authentication flow. They allow you to customize and extend Auth0's - capabilities, and you can chain them together for modular coding. -beta: true ---- - -# Hooks: Overview - -Hooks, which will eventually replace [Rules](/rules), allow you to extend the Auth0 platform with custom code. - -Hooks are Webtasks associated with specific extensibility points of the Auth0 platform. When using [Database Connections](/connections/database), Auth0 invokes the Hooks at runtime to execute your custom logic. - -You can manage your Hooks using: - -* [The Auth0 Management Dashboard](/hooks/dashboard) -* [The Auth0 Command-Line Interface (CLI)](/hooks/cli). - -## Supported Extensibility Points - -You can create Hooks for the following [extensibility points](/hooks/extensibility-points): - -- [Credentials Exchange](/hooks/extensibility-points/credentials-exchange) -- [Pre-User Registration](/hooks/extensibility-points/pre-user-registration) -- [Post-User Registration](/hooks/extensibility-points/post-user-registration) \ No newline at end of file diff --git a/articles/hooks/secrets/create.md b/articles/hooks/secrets/create.md new file mode 100644 index 0000000000..071f5318d8 --- /dev/null +++ b/articles/hooks/secrets/create.md @@ -0,0 +1,71 @@ +--- +title: Create Hook Secrets +description: Learn how to create Hook Secrets using the Dashboard and Management API. Hook Secrets may also be imported and exported using the Auth0 Deploy Command-Line Interface (CLI) tool. +topics: + - hooks + - secrets + - dashboard + - mgmt-api +contentType: how-to +useCase: extensibility-hooks +v2: true +--- + +# Create Hook Secrets + +You can create multiple Hook Secrets for any [Hook](/hooks) using the Dashboard or Management API. + +Hook Secrets may also be imported and exported using the [Deploy Command-Line Interface (CLI) Extension](/extensions/deploy-cli). + +<%= include('../_includes/_hook_secrets_limit') %> + +
      + +
      +
      + +## Create Hook Secrets using the Dashboard + +1. Navigate to the [Hooks](${manage_url}/#/hooks) page in the [Auth0 Dashboard](${manage_url}/), and click the pencil icon next to the Hook you want to edit. +2. In the Hook editor, click the wrench icon, and click **Secrets**. +3. Click **Add Secret**. +4. Enter a descriptive name and value for your secret, and click **Save**. + +
      +
      + +## Create Hook Secrets using the Management API + +1. Make a `POST` call to the [Add Hook Secrets endpoint](/api/management/v2/#!/Hooks/post_secrets). Be sure to replace `MGMT_API_ACCESS_TOKEN`, `HOOK_ID`, `HOOK_SECRET_KEY`, and `HOOK_SECRET_VALUE` placeholder values with your Management API Access Token, Hook ID, and Hook key-value pair(s), respectively. + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/api/v2/hooks/HOOK_ID/secrets", + "headers": [ + { "name": "Content-Type", "value": "application/json" }, + { "name": "Authorization", "value": "Bearer MGMT_API_ACCESS_TOKEN" }, + { "name": "Cache-Control", "value": "no-cache" } + ], + "postData": { + "mimeType": "application/json", + "text": "{ [ \"HOOK_SECRET_KEY\", \"HOOK_SECRET_VALUE\" ], [ \"HOOK_SECRET_KEY\", \"HOOK_SECRET_VALUE\" ] }" + } +} +``` + +| **Value** | **Description** | +| - | - | +| `MGMT_API_ACCESS_TOKEN` | [Access Token for the Management API](/api/management/v2/tokens) with the scope `create:hooks`. | +| `HOOK_ID` | ID of the hook for which you would like to add secrets. | +| `HOOK_SECRET_KEY` | Name of the secret that you would like to add to the specified hook. This endpoint accepts an object of key-value pairs. | +| `HOOK_SECRET_VALUE` | Value of the secret that you would like to add to the specified hook. This endpoint accepts an object of key-value pairs. | + +
      +
      +
      diff --git a/articles/hooks/secrets/delete.md b/articles/hooks/secrets/delete.md new file mode 100644 index 0000000000..128a697d81 --- /dev/null +++ b/articles/hooks/secrets/delete.md @@ -0,0 +1,64 @@ +--- +title: Delete Hook Secrets +description: Learn how to delete Hook Secrets using the Dashboard and Management API. Hook Secrets may also be imported and exported using the Auth0 Deploy Command-Line Interface (CLI) tool. +topics: + - hooks + - secrets + - mgmt-api + - dashboard +contentType: how-to +useCase: extensibility-hooks +v2: true +--- +# Delete Hook Secrets + +When you no longer need Hook Secrets for a given [Hook](/hooks), you can delete them using either the Dashboard or Management API. + +Hook Secrets may also be imported and exported using the [Deploy Command-Line Interface (CLI) Extension](/extensions/deploy-cli). + +
      + +
      +
      + +## Delete Hook Secrets using the Dashboard + +1. Navigate to the [Hooks](${manage_url}/#/hooks) page in the [Auth0 Dashboard](${manage_url}/), and click the pencil icon next to the Hook you want to edit. +2. In the Hook editor, click the wrench icon, and click **Secrets**. +3. Locate the Hook Secret you want to delete, click the trash can icon, and confirm. + +
      +
      + +## Delete Hook Secrets using the Management API + +1. Make a `DELETE` call to the [Delete Hook Secrets endpoint](/api/management/v2/#!/Hooks/delete_secrets). Be sure to replace `HOOK_ID`, `HOOK_SECRET_NAME`, and `MGMT_API_ACCESS_TOKEN` placeholder values with your hook ID, your hook secret name(s), and Management API Access Token, respectively. + +```har +{ + "method": "DELETE", + "url": "https://${account.namespace}/api/v2/hooks/HOOK_ID/secrets", + "headers": [ + { "name": "Authorization", "value": "Bearer MGMT_API_ACCESS_TOKEN" } + ], + "postData": { + "mimeType": "application/json", + "text": "{ [ \"HOOK_SECRET_NAME\", \"HOOK_SECRET_NAME\" ] }" + } +} +``` + +| Value | Description | +| - | - | +| `HOOK_ID` | ID of the Hook for which you want to delete secrets. | +| `MGMT_API_ACCESS_TOKEN` | [Access Tokens for the Management API](/api/management/v2/tokens) with the scope `delete:hooks`. | +| `HOOK_SECRET_NAME` | Name(s) of the secret(s) you would like to delete from the specified Hook. This endpoint accepts an array of secret names to delete. | + +
      +
      +
      diff --git a/articles/hooks/secrets/index.md b/articles/hooks/secrets/index.md new file mode 100644 index 0000000000..aab126f146 --- /dev/null +++ b/articles/hooks/secrets/index.md @@ -0,0 +1,26 @@ +--- +title: Hook Secrets +description: Learn about integrated secret management used with Auth0 Hooks. +topics: + - hooks + - secrets +contentType: + - concept +useCase: extensibility-hooks +--- +# Hook Secrets + +[Hooks](/hooks) feature integrated secret management to securely store secrets while making them conveniently available in code. + +<%= include('../_includes/_access_hook_secrets') %> + +## Manage Hook Secrets + +You can create, update, delete, and view Hook Secrets from the Dashboard or Management API. To learn more, see: + +- [Create Hook Secrets](/hooks/secrets/create) +- [Update Hook Secrets](/hooks/secrets/update) +- [Delete Hook Secrets](/hooks/secrets/delete) +- [View Hook Secrets](/hooks/secrets/view) + + Hook Secrets may also be imported or exported using the [Deploy Command-Line Interface (CLI) Extension](/extensions/deploy-cli). diff --git a/articles/hooks/secrets/update.md b/articles/hooks/secrets/update.md new file mode 100644 index 0000000000..4ee4c59e79 --- /dev/null +++ b/articles/hooks/secrets/update.md @@ -0,0 +1,73 @@ +--- +title: Update Hook Secrets +description: Learn how to update Hook Secrets using the Dashboard or Management API. Hook Secrets may also be imported and exported using the Auth0 Deploy Command-Line Interface (CLI) tool. +topics: + - hooks + - secrets + - dashboard + - mgmt-api +contentType: how-to +useCase: extensibility-hooks +v2: true +--- + +# Update Hook Secrets + +You can update Hook Secrets added to any given [Hook](/hooks) using the Dashboard or Management API. + +Hook Secrets may also be imported and exported using the [Deploy Command-Line Interface (CLI) Extension](/extensions/deploy-cli). + +
      + +
      +
      + +## Update Hook Secrets using the Dashboard + +1. Navigate to the [Hooks](${manage_url}/#/hooks) page in the [Auth0 Dashboard](${manage_url}/), and click the pencil icon next to the Hook you want to edit. +2. In the Hook editor, click the wrench icon, and click **Secrets**. +3. Click the pencil and paper icon next to the value of the secret you want to edit. +4. Make your changes to the name and/or value of the selected secret, and click **Save**. + +
      +
      + +## Update Hook Secrets using the Management API + +1. Make a `PATCH` call to the [Update Hook Secrets endpoint](/api/management/v2/#!/Hooks/patch_secrets). Be sure to replace `HOOK_ID` and `MGMT_API_ACCESS_TOKEN` placeholder values with your hook ID and Management API Access Token, respectively. + +```har +{ + "method": "PATCH", + "url": "https://${account.namespace}/api/v2/hooks/HOOK_ID/secrets", + "headers": [ + { "name": "Content-Type", "value": "application/json" }, + { "name": "Authorization", "value": "Bearer MGMT_API_ACCESS_TOKEN" }, + { "name": "Cache-Control", "value": "no-cache" } + ], + "postData": { + "mimeType": "application/json", + "text": "{ [ \"HOOK_SECRET_KEY\", \"HOOK_SECRET_VALUE\" ], [ \"HOOK_SECRET_KEY\", \"HOOK_SECRET_VALUE\" ] }" + } +} +``` + +| **Value** | **Description** | +| - | - | +| `MGMT_API_ACCESS_TOKEN` | [Access Token for the Management API](/api/management/v2/tokens) with the scope `create:hooks`. | +| `HOOK_ID` | ID of the hook for which you would like to update secrets. | +| `HOOK_SECRET_KEY` | Name of the secret that you would like to update for the specified hook. This endpoint accepts an object of key-value pairs. | +| `HOOK_SECRET_VALUE` | Value of the secret that you would like to update for the specified hook. This endpoint accepts an object of key-value pairs. | + +::: warning +When retrieving secrets configured for a specified hook, values will contain the placeholder text: `_VALUE_NOT_SHOWN`. Be careful not to return this placeholder text during an update, or the secret's actual value will be overwritten. +::: + +
      +
      +
      diff --git a/articles/hooks/secrets/view.md b/articles/hooks/secrets/view.md new file mode 100644 index 0000000000..0760ba1468 --- /dev/null +++ b/articles/hooks/secrets/view.md @@ -0,0 +1,63 @@ +--- +title: View Hook Secrets +description: Learn how to view Hook Secrets using the Dashboard and Management API. +topics: + - hooks + - secrets + - mgmt-api + - dashboard +contentType: how-to +useCase: extensibility-hooks +v2: true +--- +# View Hook Secrets + +To see configured secrets for a [Hook](/hooks), you can view them using the Dashboard or retrieve a list of them using the Management API. + +
      + +
      +
      + +## View Hook Secrets using the Dashboard + +1. Navigate to the [Hooks](${manage_url}/#/hooks) page in the [Auth0 Dashboard](${manage_url}/), and click the pencil icon next to the Hook for which you want to view secrets. + +2. In the Hook editor, click the wrench icon, and click **Secrets**. + +All configured secrets for the selected Hook will be listed. + +
      +
      + +## Get Hook Secrets using the Management API + +1. Make a `GET` call to the [Get Hook Secrets endpoint](/api/management/v2/#!/Hooks/get_secrets). Be sure to replace `HOOK_ID` and `MGMT_API_ACCESS_TOKEN` placeholder values with your Hook's ID and the Management API Access Token, respectively. + +```har +{ + "method": "GET", + "url": "https://${account.namespace}/api/v2/hooks/HOOK_ID/secrets", + "headers": [ + { "name": "Authorization", "value": "Bearer MGMT_API_ACCESS_TOKEN" } + ] +} +``` + +| **Value** | **Description** | +| - | - | +| `HOOK_ID` | ID of the Hook for which you want to retrieve secrets. | +| `MGMT_API_ACCESS_TOKEN` | [Access Token for the Management API](/api/management/v2/tokens) with the scope `read:hooks`. | + +::: warning +Secrets are write-only. When retrieving secrets configured for a specified hook, values will contain the placeholder text: `_VALUE_NOT_SHOWN`. +::: + +
      +
      +
      diff --git a/articles/hooks/update.md b/articles/hooks/update.md new file mode 100644 index 0000000000..06a288e13a --- /dev/null +++ b/articles/hooks/update.md @@ -0,0 +1,92 @@ +--- +title: Update Hooks +description: Learn how to update Hooks using the Dashboard or Management API. Hooks may also be imported and exported using the Auth0 Deploy Command-Line Interface (CLI) tool. +topics: + - hooks + - dashboard + - mgmt-api +contentType: how-to +useCase: extensibility-hooks +v2: true +--- + +# Update Hooks + +You can update Hooks configured for any given [extensibility point](/hooks/extensibility-points) using the Dashboard or Management API. + +Hooks may also be imported and exported using the [Deploy Command-Line Interface (CLI) Extension](/extensions/deploy-cli). + +::: note +If you added a [Hook Secret](/hooks/secrets) and want to update it, see [Update Hook Secrets](/hooks/secrets/update). +::: + +
      + +
      +
      + +## Rename Hooks using the Dashboard + +1. Navigate to the [Hooks](${manage_url}/#/hooks) page in the [Auth0 Dashboard](${manage_url}/), and click the gear icon next to the Hook you want to rename. +2. Select **Rename**. +3. Enter the current name and new name of the hook, then click **Rename**. + +![Rename Hooks prompt](/media/articles/hooks/rename-hook.png) + +## Update Hook scripts using the Dashboard + +1. Navigate to the [Hooks](${manage_url}/#/hooks) page in the [Auth0 Dashboard](${manage_url}/), and click the pencil icon next to the Hook you want to update. + + ![List of Hooks](/media/articles/hooks/hooks-list.png) + +2. Update the Hook using the Hook Editor, and click the disk icon to save. + + ![Update a Hook in the Hook Editor](/media/articles/hooks/webtask-editor.png) +
      +
      + +## Update Hooks using the Management API + +1. Make a `PATCH` call to the [Update a Hook endpoint](/api/management/v2/#!/Hooks/patch_hooks_by_id). Be sure to replace `HOOK_ID` and `MGMT_API_ACCESS_TOKEN` placeholder values with your hook ID and Management API Access Token, respectively. + +```har +{ + "method": "PATCH", + "url": "https://${account.namespace}/api/v2/hooks/HOOK_ID", + "headers": [ + { "name": "Content-Type", "value": "application/json" }, + { "name": "Authorization", "value": "Bearer MGMT_API_ACCESS_TOKEN" }, + { "name": "Cache-Control", "value": "no-cache" } + ], + "postData": { + "mimeType": "application/json", + "text" : "{ \"name\": \"HOOK_NAME\", \"script\": \"HOOK_SCRIPT\", \"enabled\": \"true\" }" + } +} +``` + +| Value | Description | +| - | - | +| `HOOK_ID` | ID of the hook to be updated. | +| `MGMT_API_ACCESS_TOKEN` | [Access Tokens for the Management API](/api/management/v2/tokens) with the scope `update:hooks`. | +| `HOOK_NAME` | Name of the hook you would like to create. | +| `HOOK_SCRIPT` | Script that contains the code for the hook. Should match what you would enter if you were creating a new hook using the Dashboard. | + +::: note +The `enabled` property represents whether the rule is enabled (`true`) or disabled (`false`). | +::: + +
      +
      +
      + +<%= include('./_includes/_handle_rate_limits') %> + +::: note +Optionally, you can add secrets (such as Twilio Keys or database connection strings) to Hooks. To learn how to update secrets, see [Update Hook Secrets](/hooks/secrets/update). +::: diff --git a/articles/hooks/view-logs.md b/articles/hooks/view-logs.md new file mode 100644 index 0000000000..af51d1f9b5 --- /dev/null +++ b/articles/hooks/view-logs.md @@ -0,0 +1,21 @@ +--- +title: View Logs for Hooks +description: Learn how to view logs for Hooks using the Auth0 Dashboard. +topics: + - hooks + - logs + - dashboard +contentType: how-to +useCase: extensibility-hooks +v2: true +--- + +# View Logs for Hooks + +You can view real-time logging information for specific configured Hooks using the Dashboard. + +1. Navigate to the [Hooks](${manage_url}/#/hooks) page in the [Auth0 Dashboard](${manage_url}/), and click the pencil icon next to the Hook you want to update. + + ![List of Hooks](/media/articles/hooks/hooks-list.png) + +2. In the Hooks Editor, click the logs icon. diff --git a/articles/hooks/view.md b/articles/hooks/view.md new file mode 100644 index 0000000000..498e623194 --- /dev/null +++ b/articles/hooks/view.md @@ -0,0 +1,55 @@ +--- +title: View Hooks +description: Learn how to view Hooks using the Dashboard and Management API. Hooks may also be imported and exported using the Auth0 Deploy Command-Line Interface (CLI) tool. +topics: + - hooks + - mgmt-api + - dashboard +contentType: how-to +useCase: extensibility-hooks +v2: true +--- +# View Hooks + +To see configured Hooks, you can view them using the Dashboard or retrieve a list of them using the Management API. + +
      + +
      +
      + +## View Hooks using the Dashboard + +1. Navigate to the [Hooks](${manage_url}/#/hooks) page in the [Auth0 Dashboard](${manage_url}/). + +All configured Hooks will be listed by the extensibility point at which they are executed. A green dot next to a Hook indicates that it is enabled. + +
      +
      + +## Get Hooks using the Management API + +1. Make a `GET` call to the [Get Hooks endpoint](/api/management/v2/#!/Hooks/get_hooks). Be sure to replace `MGMT_API_ACCESS_TOKEN` placeholder value with your Management API Access Token. + +```har +{ + "method": "GET", + "url": "https://${account.namespace}/api/v2/hooks", + "headers": [ + { "name": "Authorization", "value": "Bearer MGMT_API_ACCESS_TOKEN" } + ] +} +``` + +| **Value** | **Description** | +| - | - | +| `MGMT_API_ACCESS_TOKEN` | [Access Token for the Management API](/api/management/v2/tokens) with the scope `read:hooks`. | + +
      +
      +
      diff --git a/articles/hosted-pages/custom-error-pages.md b/articles/hosted-pages/custom-error-pages.md deleted file mode 100644 index 7ce87d71ad..0000000000 --- a/articles/hosted-pages/custom-error-pages.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: Custom Error Pages -description: How to setup a custom error page for authorization error events. -toc: true -crews: crew-2 ---- -# Custom Error Pages - -In the event of an authorization error, you may choose to display to your users either [the default Auth0 error page](/hosted-pages/error-pages) or a customized error page. - -This article will show you how to use a customized error page. For details on the default Auth0 error page see [Error Pages](/hosted-pages/error-pages). - -## How to customize the error page - -If you choose to display a custom error page, you have two options: - -- [Redirect the user to a custom error page](#redirect-users-to-a-custom-error-page) -- [Configure Auth0 to render a custom error page on your behalf](#render-a-custom-error-page). This feature is only available via the Management API. - -### Redirect users to a custom error page - -You can configure Auth0 to redirect users to a custom error page, using the Dashboard or the Management API. - -If you use the Dashboard, follow these steps: - -1. Log in to the [Dashboard](${manage_url}). -1. Click on your tenant name in the top right corner to bring up the associated dropdown box. -1. Select **Settings** to open the [Tenant Settings](${manage_url}/#/tenant/) page. -1. Scroll down to the Error Pages section. -1. Select the option **Redirect users to your own error page**. -1. Provide the URL of the error page you would like your users to see. - -![Error Page Redirect Option](/media/articles/error-pages/redirect-error-page.png) - -If you use the API instead, use the `PATCH /api/v2/tenants/settings` endpoint. Update the `url` field of your JSON body to point to the location of the error page. - -```har -{ - "method": "PATCH", - "url": "https://${account.namespace}/api/v2/tenants/settings", - "httpVersion": "HTTP/1.1", - "cookies": [], - "headers": [ - { "name": "Authorization", "value": "Bearer YOUR_TOKEN"}, - { "name": "Content-Type", "value": "application/json" } - ], - "queryString" : [], - "postData": { - "mimeType": "application/json", - "text": "{\"error_page\": {\"html\": \"\", \"show_log_link\":false, \"url\": \"http://www.example.com\"}}" - }, - "headersSize" : -1, - "bodySize" : -1, - "comment" : "" -} -``` - -### Render a custom error page - -To provide the appropriate HTML, pass in a string containing the appropriate Liquid syntax to the `html` element: - -```har -{ - "method": "PATCH", - "url": "https://login.auth0.com/api/v2/tenants/settings", - "httpVersion": "HTTP/1.1", - "cookies": [], - "headers": [ - { "name": "Authorization", "value": "Bearer YOUR_TOKEN"}, - { "name": "Content-Type", "value": "application/json" } - ], - "queryString" : [], - "postData": { - "mimeType": "application/json", - "text": "{\"error_page\": {\"html\": \"

      Hello {{name}}. This error was generated {{'now' | date: '%Y %h'}}.<\\h1>\", \"show_log_link\": false, \"url\": \"\"}}" - }, - "headersSize" : -1, - "bodySize" : -1, - "comment" : "" -} -``` diff --git a/articles/hosted-pages/error-pages.md b/articles/hosted-pages/error-pages.md deleted file mode 100644 index df02ed9daa..0000000000 --- a/articles/hosted-pages/error-pages.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -description: Guide on how to use the hosted error pages for authorization error events -crews: crew-2 ---- - -# Error Pages - -## Generic Error Page - -Throughout the authentication process, your users may encounter errors. Auth0 provides you the option of using [custom error pages](/hosted-pages/custom-error-pages), but you may also choose to use the generic error page that Auth0 provides. - -![Hosted Error Page](/media/articles/hosted-pages/error-pages.png) - -By going into the [Tenant Settings](${manage_url}/#/tenant/) page of the Management Dashboard, you may customize your Auth0 error page with the following fields: - -* **Friendly Name**: the name of your company; -* **Logo URL**: the URL to your company logo; -* **Support Email**: the email address of your company's support team; -* **Support URL**: the URL to your company's support page. - -In addition to these fields, the error page returns the follow information to assist you in troubleshooting the error: - -* **Client ID**: the identifier for the client; -* **Connection**: the Connection used at the time of error; -* **Language**: the language set to be used at the time of error; -* **Error**: the code corresponding to the error that occurred; -* **Error Description**: a description of the error that occurred; -* **Show Log URL**: the link to the error logs, if available; -* **Title**: the friendly name of the tenant; -* **Tenant**: the tenant information (the friendly name, logo URL, support email, and support URL fields that you may customize). - -## Custom Error Pages - -In the event of an authorization error, you may choose to display to your users either the default Auth0 error page or a customized error page. - -The [custom error pages](/hosted-pages/custom-error-pages) page details how you can configure your own custom error page for use with Auth0. diff --git a/articles/hosted-pages/guardian.md b/articles/hosted-pages/guardian.md deleted file mode 100644 index 67e6d096f8..0000000000 --- a/articles/hosted-pages/guardian.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -description: Guide on how to use the hosted Guardian MFA page ---- -# Guardian Multifactor Login Page - -In the [Auth0 Dashboard](${manage_url}/#/guardian_mfa_page), you can enable 2nd factor authentication, using Guardian Multifactor. You can customize the page that Auth0 displays to your users, allowing you to require MFA on logins which meet certain criteria, or just across the board. For more information on Guardian, refer to [Guardian MFA](/multifactor-authentication/guardian). - -![Hosted Guardian MFA Page](/media/articles/hosted-pages/guardian.png) - -## Guardian Login Page HTML Editor - -To enable the Guardian Login page, go to [Dashboard > Hosted Pages > Guardian Multifactor](${manage_url}/#/guardian_mfa_page) and enable the __Customize Guardian Page__ switch. - -Once you do that, you'll be able to use the text editor built into the Auth0 Dashboard to change your HTML, style your page using CSS, and alter the JavaScript used to retrieve custom variables. Once you've made your changes, and make sure to click __Save__. - -If you'd like to revert to an earlier design, you have two options: - -* Reverting to the last saved template by clicking **Reset to Last**; -* Reverting to the default template provided by Auth0 by clicking **Reset to Default**. diff --git a/articles/hosted-pages/index.md b/articles/hosted-pages/index.md deleted file mode 100644 index 95513db8e1..0000000000 --- a/articles/hosted-pages/index.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -description: Overview of hosted pages with Auth0, and how to use them ---- - -# Auth0 Hosted Pages - -Auth0 offers you the ability to display customized pages containing Auth0-related functionality and to which Auth0 redirects your users during the authorization process. You can create the following types of hosted pages: - -* [Login](/hosted-pages/login) -* [Password Reset](/hosted-pages/password-reset) -* [Guardian Multifactor](/hosted-pages/guardian) -* [Error pages](/hosted-pages/error-pages) - -While Auth0 hosts your custom pages, you can still [manage your pages using the version control system of your choice](/hosted-pages/version-control). - -## Why Use Hosted Pages - -Hosted pages are easy to implement and secure. For example, using Auth0 hosted pages instead of hosting them externally provides seamless CSRF protection. This helps prevent third party impersonation or the hijacking of sessions. - -## How to Enable and Customize Hosted Pages - -To enable a particular type of hosted page, navigate to the [Hosted Pages section of the Auth0 Dashboard](${manage_url}/#/login_page) (note that Error Page settings are located under [Tenant Settings](${manage_url}/#/tenant)). Click on the slider to enable the page. - -## Customize Your Hosted Page - -In the Auth0 Dashboard, you'll see an HTML editor, as well as a **Preview** tab, for each of the hosted page types. You can either use the editor to create your HTML or paste in the HTML you've created elsewhere. - -For detailed instructions on how to customize each type of hosted page, please see the following docs: - -* [Login Page](/hosted-pages/login) -* [Password Reset Page](/hosted-pages/password-reset) -* [Guardian Multifactor Authentication Page](/hosted-pages/guardian) -* [Error Pages](/error-pages) diff --git a/articles/hosted-pages/login/auth0js.md b/articles/hosted-pages/login/auth0js.md deleted file mode 100644 index 0dd64f2da4..0000000000 --- a/articles/hosted-pages/login/auth0js.md +++ /dev/null @@ -1,181 +0,0 @@ ---- -description: How to Use the Auth0.js with the Hosted Login Page ---- -# Using Auth0.js in the Hosted Login Page - -Within the login page, you can use the the [Auth0.js SDK](/libraries/auth0js), instead of [Lock](/libraries/lock), to perform authentication using a custom UI. - -## Auth0.js Template for the Login Page - -You can start out with a basic template that will provide you with a working, ready-to-use example of a custom UI using Auth0.js v8 in your universal login page. - -In the [dashboard](${manage_url}), go to **Hosted Pages**, and then to the **Login** page section. - -At the top of the code editor for the page contents, you'll see a dropdown, titled **Default Templates**. Here you can choose from `Lock`, `Lock Passwordless`, or `Custom UI`. - -Choose `Custom UI` to get started. - -![Login Page](/media/articles/hosted-pages/hlp-customui.png) - -The template showcases using Auth0.js to allow users to sign up, log in with a database connection, or login with a social provider (Google, in this example). - -Additionally, you can take a look at the following example scenario using Auth0.js as well. - -### Passwordless example - -With [passwordless authentication](/connections/passwordless), the user is prompted to enter an email or an SMS number, at which they will receive a one-time code to enter, or a "magic link" to click, which will authenticate them. In this example, the user will enter an email, and receive a one-time code. - -For this example, replace the code in the login page editor with the following template: - -```html - - - - - - Sign In with Auth0 - - - - - - - - - - - - - - - - - -``` - -This should allow you to prompt your users to enter their email address, receive a code, and enter it to verify. Once the transaction is complete and they're redirected to your application, you'll want to [parse the URL hash](/libraries/auth0js#extract-the-authresult-and-get-user-info) to acquire their token and finish your authentication process. - -## Next Steps - -Are you looking for more information about the SDK used here, or about Passwordless authentication? Or are you ready to get started implementing universal login? - -::: next-steps -* [Read more About the Auth0.js SDK](/libraries/auth0js) -* [Get Started with Universal Login](${manage_url}/#/login_page) -::: diff --git a/articles/hosted-pages/login/index.md b/articles/hosted-pages/login/index.md index 8da2c2a94e..91c88f8d46 100644 --- a/articles/hosted-pages/login/index.md +++ b/articles/hosted-pages/login/index.md @@ -8,15 +8,17 @@ crews: crew-2 ## About Universal Login -Auth0's universal login is the most secure way to easily authenticate users for your applications. The login page appearance and behavior is easily customizable right from the [Dashboard](${manage_url}). By default, the login page uses Auth0's [Lock Widget](/libraries/lock) to authenticate your users, but the code of the login page can be customized to replace Lock with the Lock Passwordless widget, or an entirely custom UI can be built in its place, using the [Auth0.js SDK](/libraries/auth0js) for authentication. +Auth0's universal login is the most secure way to easily authenticate users for your applications. The login page appearance and behavior is easily customizable right from the [Dashboard](${manage_url}). By default, the login page uses Auth0's [Lock Widget](/libraries/lock) to authenticate your users, but the code of the login page can be customized to replace Lock with the Lock Passwordless widget, or an entirely custom UI can be built in its place, using the [Auth0.js SDK](/libraries/auth0js) for authentication. If you cannot use universal login, you can embed the Lock widget or a custom login form in your application using [cross-origin authentication](/cross-origin-authentication), but be sure to read about its limitations before choosing to do so. ![Login Page](/media/articles/hosted-pages/hlp-lock.png) +To find the default page name for the login page, see [How to Use Version Control to Manage Your Universal Login Pages](/universal-login/version-control). + ### How Does Universal Login Work -Auth0 shows the login page whenever something (or someone) triggers an authentication request, such as calling the `/authorize` endpoint (OIDC/OAuth) or sending a SAML login request. +Auth0 shows the login page whenever something (or someone) triggers an authentication request, such as calling the `/authorize` endpoint (OIDC/OAuth) or sending a SAML login request. Users will see the login page, typically with either the Lock widget or with your custom UI. Once they login, they will be redirected back to your application. @@ -24,16 +26,16 @@ Users will see the login page, typically with either the Lock widget or with you If the incoming authentication request includes a `connection` parameter that uses an external identity provider (such as a social provider), the login page will not display. Instead, Auth0 will direct the user to the [identity provider's](/identityproviders) login page. ::: -#### Single Sign-On (SSO) +#### Single Sign-on (SSO) -If you want to use single sign on, you should use universal login rather than an embedded login solution. When a user logs in via the login page, a cookie will be created and stored. On future calls to the `authorize` endpoint, the cookie will be checked, and if SSO is achieved, the user will not ever be redirected to the login page. They will see the page only when they need to actually login. +If you want to use Single Sign-on (SSO), you should use universal login rather than an embedded login solution. When a user logs in via the login page, a cookie will be created and stored. On future calls to the `authorize` endpoint, the cookie will be checked, and if SSO is achieved, the user will not ever be redirected to the login page. They will see the page only when they need to actually login. This behavior occurs without the need for any modification to the login page itself. This is a simple two step process: -1. Enable SSO for the application in the [Dashboard](${manage_url}) (Go to the Application's Settings, then scroll down to the **Use Auth0 instead of the IdP to do Single Sign On** setting and toggle it on. +1. Enable SSO for the application in the [Dashboard](${manage_url}) (Go to the Application's Settings, then scroll down to the **Use Auth0 instead of the IdP to do Single Sign-on** setting (legacy tenants only) and toggle it on. 1. Use the [authorize endpoint](/api/authentication#authorization-code-grant) with `?prompt=none` for [silent SSO](/api-auth/tutorials/silent-authentication). -::: note +::: note For more details about how SSO works, see the [SSO documentation](/sso). ::: @@ -57,7 +59,7 @@ Currently, universal login is the **only** way to use [Passwordless](/connection ### 1. Enable Customization on the Login Page -In the [Dashboard](${manage_url}), you can enable a custom login page by navigating to [Hosted Pages](${manage_url}/#/login_page) and enabling the **Customize Login Page** toggle. +In the [Dashboard](${manage_url}), you can enable a custom login page by navigating to [Universal Login](${manage_url}/#/login_settings) and enabling the **Customize Login Page** toggle. ![Login Page](/media/articles/hosted-pages/login.png) @@ -67,7 +69,7 @@ In order to get started customizing the login page, you'll first want to choose - [Lock](/hosted-pages/login/lock) - Lock is a pre-built, customizable login widget that will allow your users to quickly and easily login to your application. - [Lock (Passwordless Mode)](/hosted-pages/login/lock-passwordless) - Lock in Passwordless Mode uses the same Lock interface, but rather than offering identity providers as login options, will simply ask the user to enter an email or SMS number to begin a passwordless authentication transaction. -- [Auth0.js](/hosted-pages/login/auth0js) - Auth0.js is the SDK used for interacting with the Auth0 [authentication API](/api/authentication). Primarily, you would use the SDK if you need to build your own custom login UI, or implement more complex functionality than simply allowing your users to login. +- [Auth0.js](/hosted-pages/login/auth0js) - Auth0.js is the SDK used for interacting with the Auth0 [authentication API](/api/authentication). Primarily, you would use the SDK if you need to build your own custom login UI, or implement more complex functionality than simply allowing your users to login. ### 3. Customization @@ -77,7 +79,7 @@ All changes to the page's appearance and/or behavior will apply to **all** users #### Parameters for the Authorize Endpoint -If you initiate universal login via the `authorize` endpoint, whether by an SDK like auth0.js or by calling the endpoint directly, you may also pass some customization parameters to the login page. However, parameters passed to the `authorize` endpoint must be [OIDC specification](http://openid.net/specs/openid-connect-core-1_0.html#AuthRequest) compliant parameters. +If you initiate universal login via the `authorize` endpoint, whether by an SDK like auth0.js or by calling the endpoint directly, you may also pass some customization parameters to the login page. However, parameters passed to the `authorize` endpoint must be [OpenID Connect (OIDC) specification](http://openid.net/specs/openid-connect-core-1_0.html#AuthRequest) compliant parameters. The `config` object contains the set of configuration values that adjusts the behavior of the login page at runtime. Set the `config` object up in the login page editor so that you can access the config parameters to use in your page: @@ -85,7 +87,7 @@ The `config` object contains the set of configuration values that adjusts the be var config = JSON.parse(decodeURIComponent(escape(window.atob('@@config@@')))); ``` -The below examples assume that you are using [Auth0.js](/libraries/auth0js) within your application to call the `authorize` endpoint and show the login page. +The below examples assume that you are using [Auth0.js](/libraries/auth0js) within your application to call the `authorize` endpoint and show the login page. ##### Callback URL @@ -103,19 +105,19 @@ webAuth.authorize({ ## Configure Multiple Pages by Using Separate Tenants -In some cases, you might have multiple apps and want to configure separate login pages for each. Since the hosted pages are configured in the [Dashboard](${manage_url}) at the tenant level (every app you have set up on a single tenant would use the same login page), you would have to create a new tenant for each application that requires a different hosted page. +In some cases, you might have multiple apps and want to configure separate login pages for each. Since the Universal Login pages are configured in the [Dashboard](${manage_url}) at the tenant level (every app you have set up on a single tenant would use the same login page), you would have to create a new tenant for each application that requires a different login page. In most cases, it would be preferable to use a single login page, which unifies your brand and the authentication experience for your users across the various areas in which they might encounter it. Additionally, using the same pages, and the same tenant, will allow you to share the resources that would otherwise need to be separated across multiple tenants. -Creating a separate tenant is only really a viable option for an organization that needs two or more separate sets of custom pages, such as for branding reasons. If an example corporation has multiple branded subsidiaries or products, and separate APIs for all of them, it might make sense for them to create several separate Auth0 tenants, each with their own hosted pages set up for that brand or product's specific needs. +Creating a separate tenant is only really a viable option for an organization that needs two or more separate sets of custom pages, such as for branding reasons. If an example corporation has multiple branded subsidiaries or products, and separate APIs for all of them, it might make sense for them to create several separate Auth0 tenants, each with their own Universal Login pages set up for that brand or product's specific needs. -Bear in mind that separating tenants with the goal of having separate hosted pages will also mean that those separate tenants will have two distinct sets of applications, users, settings, and so on as these things are not shared between tenants. +Bear in mind that separating tenants with the goal of having separate Universal Login pages will also mean that those separate tenants will have two distinct sets of applications, users, settings, and so on as these things are not shared between tenants. ### Creating New Tenants If your use case requires separate sets of custom pages, let's see how you would go about creating them. -If you have five different applications, with three of them (`app1`, `app2`, `app3`) using the same set of hosted pages and the other two (`app4`, `app5`) using different ones, you would do the following: +If you have five different applications, with three of them (`app1`, `app2`, `app3`) using the same set of Universal Login pages and the other two (`app4`, `app5`) using different ones, you would do the following: - If you already have an account, you have a tenant configured. Configure three applications under this tenant, one to represent each app (`app1`, `app2`, `app3`), and one login page which these applications will all share. - Create a second tenant, configure a new application for `app4`, and configure the login page for this application. diff --git a/articles/hosted-pages/login/lock-passwordless.md b/articles/hosted-pages/login/lock-passwordless.md deleted file mode 100644 index d964ab0147..0000000000 --- a/articles/hosted-pages/login/lock-passwordless.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -description: How to use Lock Passwordless with Universal Login ---- -# Universal Login with Lock Passwordless - -Using Lock Passwordless in a universal login page is the easiest and most secure implementation of [passwordless authentication](/connections/passwordless) that can be achieved. Additionally, universal login is the **only** way to perform passwordless authentication with native applications at this time. - -## Lock Passwordless Template - -You can start out with a basic template that will provide you with a working, ready-to-use example of Lock with Passwordless Mode in the login page. - -In the [dashboard](${manage_url}), go to **Hosted Pages**, and then to the **Login** page section. - -At the top of the code editor for the page contents, you'll see a dropdown, titled **Default Templates**. Here you can choose from `Lock`, `Lock Passwordless`, or `Custom UI`. - -Choose `Lock Passwordless` to get started. - -![Login Page](/media/articles/hosted-pages/hlp-lock-passwordless.png) - -## Next Steps - -Are you looking for more information about Lock? Or are you ready to get started with your own login page? - -::: next-steps -* [Read more about Lock](/libraries/lock) -* [Get started on your own login page](${manage_url}/#/login_page) -::: diff --git a/articles/hosted-pages/login/lock.md b/articles/hosted-pages/login/lock.md deleted file mode 100644 index c5ef0b0a41..0000000000 --- a/articles/hosted-pages/login/lock.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -description: How to use Lock with Universal Login ---- -# How to Use Lock with Universal Login - -[Lock](/libraries/lock) is a signup and authentication widget that provides quick and easy authentication for your application's users without requiring you to design the UI or interact manually with an Auth0 API. - -## Customize Lock in the Login Page - -The default login page for your tenant is a template that will use Lock to provide your users with an attractive interface and smooth authentication process, as discussed above. You can look over that template and use it as a starting point if you choose to customize it in any way. - -If you want to change any of Lock's [configurable options](/libraries/lock/configuration), you can do so using the [Hosted Pages](${manage_url}/#/login_page) editor interface. These options can alter the behavior of Lock itself, or the look and feel of the widget using the theming options. See the [configuration documentation](/libraries/lock/v11/configuration) for details on how to customize Lock. - -When you're done making changes to the code, click **Save** to persist the changes. - -![Login Page](/media/articles/hosted-pages/hlp-lock.png) - -## Next Steps - -::: next-steps -* [Read more about Lock](/libraries/lock) -* [Get started on your own login page](${manage_url}/#/login_page) -::: diff --git a/articles/hosted-pages/password-reset.md b/articles/hosted-pages/password-reset.md deleted file mode 100644 index 8e28f7ea9f..0000000000 --- a/articles/hosted-pages/password-reset.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -description: Guide on how to use the hosted password reset page -crews: crew-2 ---- - -# Password Reset Page - -The Password Reset Page allows users to change their passwords in the event that they're unable to log in. Using this page, you can maintain consistency in the appearance of your pages (login, password reset, and so on), and your users can easily change their passwords as needed. - -## Enable the Custom Password Reset Page - -Using the [Auth0 Dashboard](${manage_url}/#/password_reset), you can enable your Hosted Password Reset Page by flipping the toggle switch. - -![Hosted Password Reset Page](/media/articles/hosted-pages/password-reset.png) - -## Edit the Custom Password Reset Page - -Once you've enabled the Password Reset Page for your tenant, you'll be able to use the text editor built into the Auth0 Dashboard to change your HTML, style your page using CSS, and alter the JavaScript used to retrieve custom variables. After you've made your changes, and make sure to click _Save_. - -### Custom Variables - -You can use JavaScript to retrieve the following custom variables: - -| Variable | Description | -| - | - | -| `email` | The email address of the user requesting the password change | -| `ticket` | The ticket representing the given password reset request | -| `csrf_token` | Token used to prevent CSRF activity | -| `tenant.name` | The name associated with your Auth0 tenant | -| `tenant.friendly_name` | The name displayed for your Auth0 tenant | -| `tenant.picture_url` | The URL leading to the logo representing you in Auth0 | -| `tenant.support_email` | The support email address for your company displayed to your Auth0 users | -| `tenant.support_url` | The support URL for your company displayed to your Auth0 users | -| `lang` | The user's language | -| `password_policy` | The active connection's security policy You can see what this is using `${manage_url}/#/connections/database/con_YOUR-CONNECTION-ID/security`. Be sure to provide your connection ID in the URL.) | - -::: note -You can set/check the values for your `tenant` variables in the **Settings** area in [Tenant Settings](${manage_url}/#/tenant) -::: - -Within the Password Reset Page Editor, you'll see the following JavaScript embedded: - -```js - -``` - -Notice that the sample template uses the `tenant.picture_url` variable to return the value entered in the **Logo URL** field of the **Settings** area in [Tenant Settings](${manage_url}/#/tenant). Auth0 will retrieve the logo at that URL and display it on the password reset widget. If Auth0 cannot resolve the URL, it'll display a default image (note that the sample snippet below has all unrelated content removed, including mandatory fields): - -```js - -``` - -## Revert Your Changes - -If you'd like to revert to an earlier design, you have two options: - -* Reverting to the last saved template by clicking **Reset to Last**; -* Reverting to the default template provided by Auth0 by clicking **Reset to Default**. diff --git a/articles/hosted-pages/version-control.md b/articles/hosted-pages/version-control.md deleted file mode 100644 index ac3f4e2bd7..0000000000 --- a/articles/hosted-pages/version-control.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -description: How to back up your hosted pages using the Auth0 version control extensions ---- -# How to Use Version Control to Manage Your Hosted Pages - -You can use version control software to manage the source code of your hosted pages. -To do so, you can use the Auth0-provided extension that works with the version control system you're using: - -* [GitLab Extension](/extensions/gitlab-deploy#deploy-hosted-pages) -* [GitHub Extension](/extensions/github-deploy#deploy-hosted-pages) -* [BitBucket Extension](/extensions/bitbucket-deploy#deploy-hosted-pages) -* [Visual Studio Team Services Extension](/extensions/visual-studio-team-services-deploy#deploy-hosted-pages) - -While the specific documentation pages contain detailed information for the extensions, the general deploying process requires just the following steps: - -1. Create a folder in your version control repository with the appropriate name (`pages`). -2. Create an HTML page (`login.html`, `password_reset.html`, `guardian_multifactor.html`, or `error_page.html`) within your folder. -3. Create a JSON file with the same name as your HTML page for each hosted page that you wish to source control. To enable the page, the JSON file needs to contain the following: - -```json -{ - "enabled": true -} -``` - - -### File Naming Example - - -```text -your-repo/pages/error_page.html -your-repo/pages/error_page.json -``` diff --git a/articles/i18n/i18n-guide-android.md b/articles/i18n/i18n-guide-android.md index dba9f51f23..c415958ffe 100644 --- a/articles/i18n/i18n-guide-android.md +++ b/articles/i18n/i18n-guide-android.md @@ -1,6 +1,11 @@ --- title: Android guide to i18n description: Links to the Android guide on how to localize resource files. +topics: + - i18n + - android +contentType: how-to +useCase: localize --- # Android guide to i18n diff --git a/articles/i18n/i18n-guide-ios.md b/articles/i18n/i18n-guide-ios.md index e50ec405b3..d691be0649 100644 --- a/articles/i18n/i18n-guide-ios.md +++ b/articles/i18n/i18n-guide-ios.md @@ -1,5 +1,10 @@ --- description: This page is themguide to internationalizing an iOS application. +topics: + - i18n + - ios +contentType: how-to +useCase: localize --- # iOS guide to i18n diff --git a/articles/i18n/index.md b/articles/i18n/index.md index 4b0190b4d0..924045f31e 100644 --- a/articles/i18n/index.md +++ b/articles/i18n/index.md @@ -1,12 +1,17 @@ --- url: /i18n description: Links to documentation on internationalizing an application. +topics: + - i18n +contentType: index +useCase: localize --- # Internationalization and Multilingual settings Below you can find useful links in our documentation to handle different languages within Auth0. - [Customizing Your Emails](/email/templates) +- [Universal Login Internationalization](/universal-login/i18n) - [Lock: Internationalization](/libraries/lock/i18n) - [Password Options Translation](/i18n/password-options) - [iOS guide to i18n](/i18n/i18n-guide-ios) diff --git a/articles/i18n/password-options.md b/articles/i18n/password-options.md index a31e0d9872..f1bbff1601 100644 --- a/articles/i18n/password-options.md +++ b/articles/i18n/password-options.md @@ -1,5 +1,11 @@ --- description: How to customize the translation of Lock password features. +topics: + - i18n + - lock + - password +contentType: how-to +useCase: localize --- # Password Options Translation @@ -50,7 +56,7 @@ dict: { passwordConfirmationPlaceholder: "confirm your new password", passwordConfirmationMatchError: "Please ensure the password and the confirmation are the same.", successMessage: "Your password has been reset successfully.", - configurationError: "An error ocurred. There appears to be a misconfiguration in the form.", + configurationError: "An error occurred. There appears to be a misconfiguration in the form.", networkError: "The server cannot be reached, there is a problem with the network.", timeoutError: "The server cannot be reached, please try again.", serverError: "There was an error processing the password reset.", diff --git a/articles/identity-labs/01-web-sign-in/exercise-01.md b/articles/identity-labs/01-web-sign-in/exercise-01.md new file mode 100644 index 0000000000..1b27b80792 --- /dev/null +++ b/articles/identity-labs/01-web-sign-in/exercise-01.md @@ -0,0 +1,203 @@ +--- +section: exercises +description: Auth0 Digital Identity Lab 1, Exercise 1: Adding Web Sign-In +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - index + - concept +--- +# Lab 1, Exercise 1: Adding Web Sign-In + +::: warning +If you came to this page directly, go to the [first page of this lab](/identity-labs/01-web-sign-in) and read through the instructions before getting started. +::: + +In this exercise, you will learn how to add sign-in to an app using: + +- Node.js + Express +- An Express middleware to handle checking authentication and redirecting to login +- Auth0 as an Authorization Server + +
      + +
      +
      +
      +
      +
      +
      + +A simple Node.js Express application has been created to get you started. This is a web application with two pages. The first page, served under the root path `/`, shows “Hello World” and a link (“Expenses”) to the second page. The second page, served at `/expenses`, shows a table with expenses. At this point, these expenses are hard-coded; you will learn how to consume them from an API secured with Auth0 in the next lab. + +1. Open your Terminal app, clone the [identity exercise repo](https://github.com/auth0/identity-102-exercises/), then go to the `/lab-01/begin` folder: + +```bash +❯ git clone https://github.com/auth0/identity-102-exercises.git +Cloning into 'identity-102-exercises'... + +❯ cd identity-102-exercises/lab-01/begin +``` + +2. Open a code editor like VS Code or Atom in the same directory (File > Open) and review the `server.js` code. This is a generic Node.js web application that uses `ejs` for views and `morgan` to log HTTP requests. + +3. The `.env-sample` file will be used for the environment variables you need for this lab. It’s populated with a `PORT` (the port number where the app will run) and an `APP_SESSION_SECRET` (value used to encrypt the cookie data). You will set the other values later on in the lab. For now, create a copy of this file in the same folder and name it `.env`. Run the following commands in your terminal (or copy, paste, and rename the sample file in your editor): + +```bash +# Make sure we're in the right directory +❯ pwd +/Users/username/identity-102-exercises/lab-01/begin + +# Copy the .env-sample file to a new .env file that the app will use +❯ cp .env-sample .env +``` + +4. In your terminal, use `npm` to install all the dependencies and start the application: + +```bash +❯ npm install +# Ignore any warnings + +added XX packages in X.XXs +❯ npm start + +listening on http://localhost:3000 +``` + +::: note +If you see a message like "Error: listen EADDRINUSE :::3000" in your terminal after starting the application, this means that port 3000 is in use somewhere. Change the `PORT` value in your `.env` file to "4000" and try again. +::: + +5. Open a Web browser and go to [localhost:3000](http://localhost:3000) (or `http://localhost:PORT` where PORT is the value of the environment variable, in case you changed its value). You should see a page with a “Hello World” message. Click the Expenses link to view the expenses page. + +![First page of the starter app](/media/articles/identity-labs/lab-01-starter-app-rendered.png) + +6. Now, we're ready to start adding authentication! Switch to your terminal window and press `[CTRL]` + `[c]` to stop the server, then use `npm` to install the package you'll use to secure the app. The `express-openid-connect` package is a simple Express middleware that provides OpenID Connect and JWT implementation. + +```bash +# Continuing from previous terminal session ... +listening on http://localhost:3000 +^C # Command to stop the server +❯ npm install express-openid-connect@1.0.2 --save +# Ignore any warnings + ++ express-openid-connect@1.0.2 +added XX packages in X.XXs +``` + +7. Next, update your application code to require `express-openid-client` in the `server.js` file: + +```js +// lab-01/begin/server.js + +require('dotenv').config(); +// ... other required packages + +// Add the line below 👇 +const { auth } = require('express-openid-connect'); + +// ... +``` + +8. Now add the authentication middleware that will be used for all application routes: + +```js +// lab-01/begin/server.js +// ... + +const app = express(); +app.set('view engine', 'ejs'); +app.use(morgan('combined')); + +// Add the code below 👇 +app.use(auth({ + auth0Logout: true, + baseURL: appUrl +})); + +// ... other app routes +``` + +The middleware you installed automatically defines three routes in your application: + +- `/login` - builds the OpenID Connect request and redirects to the authorization server (in this case, Auth0). For this to work properly, the middleware needs to include specific parameters with the request. You will configure these values using environment variables in the next step. +- `/callback` - handles the response from the authorization server, performs required validations like nonce, state, and token verification using the `openid-client` package, and sets the user in the session from the ID token claims. +- `/logout` - terminates the session in the application and redirects to Auth0 to end the session there as well. + +The middleware will also augment Express’s request object with additional properties whenever the request is authenticated. For example, `req.openid.user` is a property that will contain user information. + +::: note +The `auth0Logout: true` configuration key passed to `auth()` tells the middleware that, when the user logs out of the application, they should be redirected to a specific Auth0 URL to end their session there as well. +::: + +The middleware needs to be initialized with some information to build a proper OpenID request and send it to the authorization server. This information includes: + +- **The URL of the authorization server.** This URL will be used to download the OpenID Connect configuration from the discovery document, available at the URL `https://{your-auth0-domain}/.well-known/openid-configuration` ([here is the configuration](https://auth0.auth0.com/.well-known/openid-configuration) for the main Auth0 tenant). The discovery document is a standard OpenID Connect mechanism used to publish relevant discovery metadata of the OpenID Connect provider, including a link to what keys should be used for validating the tokens it issues. +- **The unique identifier for your application.** This is created on the authorization server and is a unique string that identifies your application. This identifier must be provided in each request, so the authorization server knows what application the authentication request is for. + +You will use the Auth0 Dashboard to register your application with Auth0. Afterward, you’ll be able to retrieve the two values above and configure them as environment variables for your app. The middleware will read these environment variables and use them to build the request when a user tries to authenticate. + +9. Log into the Auth0 Dashboard, go to the [Applications page](${manage_url}/#/applications), and click the **Create Application** button. + +10. Set a descriptive name (e.g., "Identity Lab 1 - Web Sign In"), choose **Regular Web Applications** for the type, and click **Create**. + +11. You should now see the Quickstart section that describes how to integrate Auth0 with a production application. Click the **Settings** tab at the top to see the Application settings. + +12. Add your application’s callback URL - `http://localhost:3000/callback` (adjust the port number if needed) - to the **Allowed Callback URLs** field. Auth0 will allow redirects **only** to the URLs in this field after authentication. If the one provided in the authorization URL does not match any in this field, an error page will be displayed. + +![Application callback URL field](/media/articles/identity-labs/lab-01-callback-url-config.png) + +13. Next, add `http://localhost:3000` (adjust the port number if needed) to the **Allowed Logout URLs field**. Auth0 will allow redirects **only** to the URLs in this field after logging out of the authorization server. + +![Application logout URL field](/media/articles/identity-labs/lab-01-logout-url-config.png) + +14. Scroll down and click **Show Advanced Settings**, then **OAuth**. Make sure **JsonWebToken Signature Algorithm** is set to `RS256`. + +15. Scroll down and click **Save Changes** + +16. Open your `.env` file. Add `https://` to the **Domain** from Auth0 as the value for the `ISSUER_BASE_URL` key. Add the **Client ID** from Auth0 as the value for the `CLIENT_ID` key. Add a long, random string and the value for the `APP_SESSION_SECRET` key. You `.env` file should look similar to the sample below: + +``` +ISSUER_BASE_URL=https://your-tenant-name.auth0.com +CLIENT_ID=0VMFtHgN9mUa1YFoDx3CD2Qnp2Z11mvx +APP_SESSION_SECRET=a36877de800e31ba46df86ec947dab2fc8a2f7e1d23688ce2010cd076539bd28 +PORT=3000 +``` + +::: note +Mac users can enter the following in Terminal to get a random string suitable for the secret value: `openssl rand -hex 32`. This value is used by the session handler in the SDK to generate opaque session cookies. +::: + +17. Save the changes to `.env` and restart the server as before, but do not open it in a browser yet. + +Your app is now ready to authenticate with Auth0 using OpenID Connect! Before testing it, continue to the next exercise, where you will review the interactions that happen under the hood between your app and Auth0 while you sign up and log in. + +```bash +# Continuing from previous terminal session ... +listening on http://localhost:3000 +^C # Command to stop the server +❯ npm start + +listening on http://localhost:3000 +``` +
      +
      +
      + +Next → diff --git a/articles/identity-labs/01-web-sign-in/exercise-02.md b/articles/identity-labs/01-web-sign-in/exercise-02.md new file mode 100644 index 0000000000..1d5d2759a4 --- /dev/null +++ b/articles/identity-labs/01-web-sign-in/exercise-02.md @@ -0,0 +1,133 @@ +--- +section: exercises +description: Auth0 digital identity Lab 1, Exercise 2: Using Network Traces +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - index + - concept +--- +# Lab 1, Exercise 2: Using Network Traces + +::: warning +If you came to this page directly, go to the [first page of this lab](/identity-labs/01-web-sign-in) and read through the instructions before getting started. +::: + +In this exercise, you will sign up for your application (which will also log you in) while exploring some of the relevant network traces of the authentication process. + +
      + +
      +
      +
      +
      +
      + +1. Using Chrome, open **Developer Tools**. Switch to the **Network** tab then open your local application. You should immediately be redirected to Auth0 to login. + +2. The first request you should see is a GET request to your application homepage: + +![Network request for application homepage](/media/articles/identity-labs/lab-01-network-trace-01.png) + +3. After that, you should see a GET request to `https://your-tenant-name.auth0.com/authorize`. This is the middleware added in exercise 1 taking over. The middleware checks if the user is logged in and, because they are not, it builds the OpenID Connect request to the authorization server URL and forwards the user to it. In this case, the complete GET request URL will look something like this (line breaks added for clarity): + +```text +https://YOUR_DOMAIN/authorize +?client_id=YOUR_CLIENT_ID +&scope=openid%20profile%20email +&response_type=id_token +&nonce=71890cc63567e17b +&state=85d5152581b310e3389b +&redirect_uri=http%3A%2F%2Flocalhost%3A3000 +&response_mode=form_post +``` + +--- + +The middleware sends several parameters. The important ones for this lab are: + +- `client_id`: the unique identifier of your app at the authorization server +- `response_type`: the requested artifacts; in this case, you are requesting an ID token +- `scope`: why the artifacts are required, i.e. what content and capabilities are needed +- `redirect_uri`: where the results are to be sent after the login operation, i.e. the callback URL. +- `response_mode`: how the response from the server is to be sent to the app; in this case, the response we want is a POST request. + +![Network request for authorization server](/media/articles/identity-labs/lab-01-network-trace-02.png) + +::: note +If you scroll down while on the **Headers** tab in Chrome Developer Tools to the **Query String Parameters** section, you can see the different URL parameters in a more-readable table format. +::: + +4. If you already have a user created, enter your credentials and continue below. If not, click the **Sign Up** link at the bottom (if you're using the classic page, this will be a tab at the top) and enter an email and password. + +5. A consent dialog will be shown requesting access to your profile and email. Click the green button to accept and continue. + +6. The authorization server will log you in and POST the response - an error if something went wrong or the ID token if not - back to the callback URL for your application. Once you’ve successfully logged in, you should see your user name on the page. This means authentication has been configured properly! + +![Network request for application callback](/media/articles/identity-labs/lab-01-network-trace-03.png) + +The complete trace of the callback request is: + +```text +Request URL: `http://localhost:3000/callback` +Request Method: POST +Status Code: 302 Found +Remote Address: [::1]:3000 +Referrer Policy: no-referrer-when-downgrade +Connection: keep-alive +Content-Length: 46 +Content-Type: text/html; charset=utf-8 +Date: Mon, 12 Nov 2018 23:00:08 GMT +Location: / +Set-Cookie: identity102-lab=eyJyZX[..]; path=/; httponly +Set-Cookie: identity102-lab.sig=wld5z7[..]; path=/; httponly +Vary: Accept +X-Powered-By: Express +id_token: eyJ0eX[..].eyJuaW[..].IEpcS5[..] +state: 85d5152581b310e3389b +``` + +::: note +If you see an error in your console about an ID token used too early, this is likely a clock skew issue in your local environment. Try restarting your machine and walking through the login steps again from the beginning. +::: + +7. Click on the callback request, then search for the Form Data section of the Headers tab of the Developer Console. Copy the complete `id_token` value. + +![Network request for ID token form post](/media/articles/identity-labs/lab-01-network-trace-04.png) + +8. Go to [jwt.io](https://jwt.io) and paste the ID token copied from the last step into the text area on the left. Notice that as soon as you paste it, the contents of the text area on the right are updated. This is because the site decodes your ID token and displays its contents (claims) in that panel. + +![Decoded ID token](/media/articles/identity-labs/lab-01-id-token-in-jwt-io.png) + +Note the following: + +- The token structure: it consists of the header (information about the token), the payload (the token’s claims and user profile information), and the signature. +- The claim `iss` is for the issuer of the token. It denotes who created and signed it. The value should match your Auth0 Domain value with an `https://` prefixed. +- The claim `sub` is the subject of the token. It denotes to whom the token refers. In our case, the value matches the ID of the Auth0 user. +- The claim `aud` is the audience of the token. It denotes for which app the token is intended. In our case, this matches the Client ID of the application that made the authentication request. +- The claim `iat` shows when the token was issued (seconds since Unix epoch) and can be used to determine the token’s age. +- The claim `exp` shows when the token expires (seconds since Unix epoch). + +🎉 **You have completed Lab 1 by building a web application with sign-on using OpenID Connect!** 🎉 + +
      +
      +
      + +← All Identity Labs diff --git a/articles/identity-labs/01-web-sign-in/index.md b/articles/identity-labs/01-web-sign-in/index.md new file mode 100644 index 0000000000..54291adf62 --- /dev/null +++ b/articles/identity-labs/01-web-sign-in/index.md @@ -0,0 +1,39 @@ +--- +section: exercises +classes: topic-page +description: Auth0 digital identity Lab 1: Web Sign-In +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - index + - concept +--- +# Lab 1: Web Sign-In + +This lab covers the process for adding sign-in to a basic Node.js application. This lab is the same exercise we provide for new employees in a technical role here at Auth0. + +::: warning +The Node OIDC npm package that this lab uses has not been tested, licensed, or officially released and should not be used in production. +::: + +## Prerequisites + +- Read the introduction on the [main Identity Labs page](/identity-labs) +- Watch the [Introduction to Identity video](/videos/learn-identity/01-introduction-to-identity) +- Watch the [OIDC and OAuth video](/videos/learn-identity/02-oidc-and-oauth) +- Watch the [Web Sign-In video](/videos/learn-identity/03-web-sign-in) +- Read [Using Express Middleware](https://expressjs.com/en/guide/using-middleware.html) (optional) +- Read [Beginner's Guide to Using npm](https://nodesource.com/blog/an-absolute-beginners-guide-to-using-npm/) (optional) + +## What You'll Need + +<%= include('../_includes/_what-you-need') %> + +--- + +**For Windows users** - We recommend that you use the Windows PowerShell terminal (instead of the Windows command line) so that the terminal commands provided in the lab instructions work as they are. This is because the syntax of the commands used in the labs is the same for the Mac and PowerShell terminals. + +Start → diff --git a/articles/identity-labs/02-calling-an-api/exercise-01.md b/articles/identity-labs/02-calling-an-api/exercise-01.md new file mode 100644 index 0000000000..b057e2d5b6 --- /dev/null +++ b/articles/identity-labs/02-calling-an-api/exercise-01.md @@ -0,0 +1,216 @@ +--- +section: exercises +description: Auth0 digital identity Lab 2, Exercise 1: Consuming APIs +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - index + - concept +--- +# Lab 2, Exercise 1: Consuming APIs + +::: warning +If you came to this page directly, go to the [first page of this lab](/identity-labs/02-calling-an-api) and read through the instructions before getting started. +::: + +After learning how to secure your web application with Auth0 in [lab 1](/identity-labs/01-web-sign-in), you will now learn how to make this application consume APIs on behalf of your users. You will start by running an unsecured API and a web application to see both working together, and then you will secure your API with Auth0. + +
      + +
      +
      +
      +
      +
      +
      +
      +
      + +1. Open a new terminal and browse to `/lab-02/begin/api` in your locally-cloned copy of the [identity exercise repo](https://github.com/auth0/identity-102-exercises/). This is where the code for your API resides. The API is an Express backend that contains a single endpoint. This endpoint (served under the root path) returns expenses, which are data that belong to each user (though they are static and the same for all). + +<%= include('../_includes/_git-clone-note') %> + +2. Install the dependencies using npm: + +```bash +# Make sure we're in the right directory +❯ pwd +/Users/username/identity-102-exercises/lab-02/begin/api + +❯ npm install +# Ignore any warnings + +added XX packages in X.XXs +``` + +3. Next, copy `.env-sample` to `.env` and start the API: + +```bash +❯ cp .env-sample .env +❯ npm start + +listening on http://localhost:3001 +``` + +::: note +If you see a message like *Error: listen EADDRINUSE :::3001* in your terminal after starting the application, this means that port 3001 is in use somewhere. Change the `PORT` value in your `.env` file to "3002" and try again. +::: + +4. In a new terminal window or tab, navigate to the `/lab-02/begin/webapp` directory and install the dependencies using npm: + +```bash +# Navigating from the previous directory +❯ cd ../webapp + +# Make sure we're in the right directory +❯ pwd +/Users/username/identity-102-exercises/lab-02/begin/webapp + +❯ npm install +# Ignore any warnings + +added XX packages in X.XXs +``` + +5. Once again, copy the `.env-sample` to `.env` for the web application: + +```bash +❯ cp .env-sample .env +``` + +6. Update the web application `.env` file you just created with the same values as you used in lab 1. If you did not do lab 1 first, follow steps 9 through 15 [on this page](/identity-labs/01-web-sign-in/exercise-01) to create and configure an application with Auth0 and update the `.env` file. + +```text +ISSUER_BASE_URL=https://YOUR_DOMAIN +CLIENT_ID=YOUR_CLIENT_ID +API_URL=http://localhost:3001 +PORT=3000 +APP_SESSION_SECRET=LONG_RANDOM_STRING +``` + +::: note +If you changed the port for the API above, make sure to update the `API_URL` with this new value. +::: + +7. Start the web application using npm: + +```bash +❯ npm start + +listening on http://localhost:3000 +``` + +8. Open [localhost:3000](http://localhost:3000) in your browser. There, you will see the homepage of the web application and, if you log in, you will be able to access the expenses report. The page might look similar to the Lab 1 solution, however, the difference is that an external API provides the Expenses information instead of being hard-coded in the Web app. + +![First page of the starter application](/media/articles/identity-labs/lab-02-starter-app-rendered.png) + +Right now, even though the application requires authentication, the API does not. That is, you are calling the API from the Web app, without any authentication information. If you browse to the API's URL at [localhost:3001](http://localhost:3001) without logging in, you will see the expenses. In the following steps, you will update your application to call the API with a token. + +9. Open `webapp/server.js` in your code editor and make the following change: + +```js +// webapp/server.js + +app.use(auth({ + required: false, + auth0Logout: true, + baseURL: appUrl, + + // Add the additional configuration keys below 👇 + appSessionSecret: false, + authorizationParams: { + response_type: 'code id_token', + response_mode: 'form_post', + audience: process.env.API_AUDIENCE, + scope: 'openid profile email read:reports' + }, + handleCallback: async function (req, res, next) { + req.session.openidTokens = req.openidTokens; + req.session.userIdentity = req.openidTokens.claims(); + next(); + }, + getUser: async function (req) { + return req.session.userIdentity; + } + // 👆 + +})); +``` + +This change updates the configuration object passed to `auth()` and defines how you want the `express-openid-connect` library to behave. In this case, you configured the library with a new property called `authorizationParams` and passed in an object with three properties: + +- `response_type` - setting this field to `code id_token` indicates that you no longer want the middleware to fetch just an ID token (which is the default behavior for this package). Instead, you are specifying that you want an ID token *and* an authorization code. When you configure the `express-openid-connect` library to fetch an authorization code, the middleware automatically exchanges this code for an access token (this process is known as the Authorization Code Grant flow). Later, you will use the access token to call the API. +- `response_mode` - This is the same mode used in lab 1, a POST request from the authorization server to the application. +- `audience` - this tells the middleware that you want access tokens valid for a specific resource server (your API, in this case). As you will see soon, you will configure an `API_AUDIENCE` environment variable to point to the identifier of an API that you will register with Auth0. +- `scope` - securing your API uses a delegated authorization mechanism where an application (your web app) requests access to resources controlled by the user (the resource owner) and hosted by an API (the resource server). Scopes, in this case, are the permissions that the access token grants to the application on behalf of the user. In your case, you are defining four scopes: the first three (`openid`, `profile`, and `email`) are scopes related to the user profile (part of OpenID Connect specification). The last one, `read:reports`, is a custom scope that will be used to determine whether the caller is authorized to retrieve the expenses report from the API on behalf of a user. + +The `appSessionSecret`, `handleCallback`, and `getUser` additions change how the user session is handled and stores the incoming access and refresh tokens somewhere we can access later. + +10. Back in the `webapp/server.js` file, find the `/expenses` endpoint definition. In this code, you are making a request to the API, without any authorization information, to get a JSON resource. Note the use of the `requiresAuth()` middleware. This will enforce authentication for all requests to this endpoint. + +11. Update the endpoint definition to include authorization information in the request: + +```js +// webapp/server.js + +app.get('/expenses', requiresAuth(), async (req, res, next) => { + try { + + // Replace this code ❌ + /* + const expenses = await request(process.env.API_URL, { + json: true + }); + */ + + // ... with the code below 👇 + let tokenSet = req.openid.makeTokenSet(req.session.openidTokens); + const expenses = await request(process.env.API_URL, { + headers: { authorization: "Bearer " + tokenSet.access_token }, + json: true + }); + + // ... keep the rest + } + // ... +}); +``` + +In the new version of this endpoint, you are sending the access token in an `Authorization` header when sending requests to the API. By doing so, the web application consumes the API on behalf of the logged in user. + +12. Add the following two environment variables to the `webapp/.env` file: + +```text +API_AUDIENCE=https://expenses-api +CLIENT_SECRET=YOUR_APPLICATION_CLIENT_SECRET +``` + +The `API_AUDIENCE` value is the identifier for the API that will be created in the following exercise. To get your Client Secret, go to your Application settings page in the Auth0 Dashboard: + +![Application client secret field](/media/articles/identity-labs/lab-02-client-secret-config.png) + +**And that's it!** You have just configured your web application to consume the API on behalf of the logged in user. + +If you restart the application in your terminal, logout, and try to log back in, you will see an error because no resource server with the identifier `https://expenses-api` has been registered yet. In the next exercise, you will learn how to create and secure APIs with Auth0, and this request will begin to work. + +
      +
      +
      + +Next → diff --git a/articles/identity-labs/02-calling-an-api/exercise-02.md b/articles/identity-labs/02-calling-an-api/exercise-02.md new file mode 100644 index 0000000000..d4ecb91d29 --- /dev/null +++ b/articles/identity-labs/02-calling-an-api/exercise-02.md @@ -0,0 +1,144 @@ +--- +section: exercises +description: Auth0 digital identity Lab 2, Exercise 2: Securing APIs with Auth0 +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - index + - concept +--- +# Lab 2, Exercise 2: Securing APIs with Auth0 + +::: warning +If you came to this page directly, go to the [first page of this lab](/identity-labs/02-calling-an-api) and read through the instructions before getting started. +::: + +In this exercise, you will register the API with Auth0 so that tokens can be issued for it. You will also learn how to secure your API with Auth0. You will refactor the API that your web application is consuming by installing and configuring some libraries needed to secure it with Auth0. + +
      + +
      +
      +
      +
      +
      +
      +
      +
      + +1. To register the API with Auth0, open the Auth0 Dashboard and go to the [APIs screen](${manage_url}/#/apis). + +2. Click the **Create API** button. Add a descriptive Name, paste `https://expenses-api` into the **Identifier** field, and click **Create**. + +3. Click the **Permissions** tab and add a new permission called `read:reports` with a suitable description. This custom permission is the one you will use to determine whether the client is authorized to retrieve expenses. + +4. In your terminal, restart your web application with `[CTRL]` + `[c]`, then `npm start`. + +5. Log out of the web application by clicking [logout](http://localhost:3000/logout), then log in again. When logging in, you will see a consent screen where Auth0 mentions that the web application is requesting access to the read:reports scope: + +![API consent screen on the authorization server](/media/articles/identity-labs/lab-02-api-consent-initial.png) + +6. Agree to this delegation by clicking the **Accept** button, and Auth0 will redirect you back to the application. Now, you should still be able to see your expenses on the expenses page, [localhost:3000/expenses](http://localhost:3000/expenses): + +![Application expenses page](/media/articles/identity-labs/lab-02-starter-app-rendered.png) + +::: note +If at any point, you want to see the consent screen again when logging in, you can go to the Users screen in the Auth0 Dashboard, click on the user you'd like to modify, click the **Authorized Applications** tab, find the application you're using, and click **Revoke**. The next time you log in, the consent screen will appear again. +::: + +As mentioned earlier, the expenses API is still not secure. You can see this by navigating directly to [localhost:3001](http://localhost:3001/). The expense data is available publicly, without an access token. The next steps will change the API to require a properly-scoped access token to view. + +4. In your terminal, stop your API with `[CTRL]` + `[c]`. + +5. Install the `express-oauth2-bearer` npm package. This is an Express authentication middleware used to protect OAuth2 resources, which validates access tokens: + +```bash +# Make sure we're in the right directory +❯ pwd +/Users/username/identity-102-exercises/lab-02/begin/api + +❯ npm install express-oauth2-bearer@0.4.0 --save +# Ignore any warnings + ++ express-oauth2-bearer@0.4.0 +added XX packages in X.XXs +``` + +6. Open the `api/api-server.js` file and add a statement to import the library. Make sure this is added after the dotenv require statement: + +```js +// api/api-server.js + +require('dotenv').config(); +// ... other require statements + +// Add the line below 👇 +const { auth, requiredScopes } = require('express-oauth2-bearer'); +``` + +7. Configure the Express app to use the authentication middleware for all requests: + +```js +// api/api-server.js + +// ... other require statements +const app = express(); + +// Add the line below 👇 +app.use(auth()); +``` + +8. Find the `/` endpoint code and update it to require the `read:reports` scope in access tokens. This is done by adding a `requiredScopes` middleware, as shown below: + +```js +// lab-02/begin/api/api-server.js + +// Change only the line below 👇 +app.get('/', requiredScopes('read:reports'), (req, res) => { + + // ... leave the endpoint contents unchanged. + +}); +``` + +The next time you run your API, all requests that do not include a valid access token (expired token, incorrect scopes, etc.) will return an error instead of the desired data. + +9. Open the `api/.env` file you created before and change the `ISSUER_BASE_URL` value to your own Auth0 base URL (same as the one in your application). The `.env` file should look like this: + +```text +PORT=3001 +ISSUER_BASE_URL=https://your-tenant-name.auth0.com +ALLOWED_AUDIENCES=https://expenses-api +``` + +10. Once again, start the API server with npm: + +```bash +❯ npm start + +listening on http://localhost:3001 +``` + +To test your secured API, refresh the expenses page in your application - [localhost:3000/expenses](http://localhost:3000/expenses). If everything works as expected, you will still be able to access this view (which means that the web app is consuming the API on your behalf). If you browse directly to the API at [localhost:3001](http://localhost:3001), however, you will get an error saying the token is missing. + +
      +
      +
      + +Next → diff --git a/articles/identity-labs/02-calling-an-api/exercise-03.md b/articles/identity-labs/02-calling-an-api/exercise-03.md new file mode 100644 index 0000000000..7d0c5c465e --- /dev/null +++ b/articles/identity-labs/02-calling-an-api/exercise-03.md @@ -0,0 +1,140 @@ +--- +section: exercises +description: Auth0 digital identity Lab 2, Exercise 3: Working with Refresh Tokens +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - index + - concept +--- +# Lab 2, Exercise 3: Working with Refresh Tokens + +::: warning +If you came to this page directly, go to the [first page of this lab](/identity-labs/02-calling-an-api) and read through the instructions before getting started. +::: + +
      + +
      +
      +
      +
      +
      +
      + +Right now, if your users stay logged in for too long and try to refresh the `/expenses` page, they will face a problem. Access tokens were conceived to be exchanged by different services through the network (which makes them more prone to leakage), so they should expire quickly. When an access token is expired, your API won't accept it anymore, and your web application won't be able to fetch the data needed. A token expired error will be returned instead. + +To change this behavior, you can make your web app take advantage of yet another token: the refresh token. A refresh token is used to obtain new access tokens and/or ID tokens from the authorization server. In this exercise, we're going to modify the application to obtain a refresh token and use it to get a new access token when it expires. + +1. Navigate to the [APIs screen](${manage_url}/#/apis) in your Auth0 Dashboard and open the API created in the last exercise. Scroll down, turn on the **Allow Offline Access** option, and click **Save**: + +![Allow API to grant offline access](/media/articles/identity-labs/lab-02-api-allow-offline.png) + +2. Now, Open the `webapp/server.js` file and add `offline_access` to the `authorizationParams.scope` field passed to the `auth()` middleware: + +```js +// webapp/server.js + +app.use(auth({ + required: false, + auth0Logout: true, + appSessionSecret: false, + authorizationParams: { + response_type: 'code id_token', + response_mode: 'form_post', + audience: process.env.API_AUDIENCE, + + // Change only the line below 👇 + scope: 'openid profile email read:reports offline_access' + + }, + + // ... keep the rest + +})); +``` + +3. Now, find the following line in the `/expenses` endpoint code and replace it with the following: + +```js +// webapp/server.js + +app.get('/expenses', requiresAuth(), async (req, res, next) => { + try { + + let tokenSet = req.openid.makeTokenSet(req.session.openidTokens); + + // Add the code block below 👇 + if (tokenSet.expired()) { + tokenSet = await req.openid.client.refresh(tokenSet); + tokenSet.refresh_token = req.session.openidTokens.refresh_token; + req.session.openidTokens = tokenSet; + } + + // ... keep the rest + } + // ... +}); +``` + +This change will update your endpoint to check if the `tokenSet` is expired. If it is, the `Issuer` class will create a client that is capable of refreshing the `tokenSet`. To see the refreshing process in action, you will have to make a small change to your Auth0 API configuration. + +4. Navigate to the [APIs screen](${manage_url}/#/apis) in your Auth0 Dashboard and open the API created in the last exercise. Set both the **Token Expiration (Seconds)** and **Token Expiration For Browser Flows (Seconds)** values to 10 seconds or less and click **Save**: + +![Access token expiration time](/media/articles/identity-labs/lab-02-api-token-expiration.png) + +5. Back in your editor, add a log statement to `api/api-server.js` to show when the new access token was issued: + +```js +// api/api-server.js + +app.get('/', requiredScopes('read:reports'), (req, res) => { + + // Add the line below 👇 + console.log(new Date(req.auth.claims.iat * 1000)); + + // ... +}); +``` + +6. Restart both the application and API (`[CTRL]` + `[c]`, then `npm start`). + +7. Log out and log in again. This will get you a complete set of tokens (ID token, access token, and refresh token). Note, at this point, you will see a new consent screen for the offline_access scope, which you need to accept. + +Open [localhost:3000/expenses](http://localhost:3000/expenses) in your browser and refresh the page. You will see that your API logs a timestamp in the terminal. The same timestamp will be logged every time you refresh the page as long as your token remains valid. Then, if you wait a few seconds (more than ten) and refresh the view again, you will see that your API starts logging a different timestamp, which corresponds to the new token retrieved. This shows that you are getting a different access token every ten seconds and that your web application uses the refresh token automatically to get them. + +::: note +If you see an error in your console about an ID token used too early, this is likely a clock skew issue in your local environment. Try restarting your machine and walking through the login steps again from the beginning. You can also try going to "Date & Time" settings, unlock them if needed by clicking on the lock icon at the bottom, and disable and re-enable the "Set date and time automatically" option. +::: + +::: note +If you don't see changes in the "Issued At" claim in the console, make sure you have logged out and logged in again after applying the changes above. +::: + +::: note +If you are using PowerShell in Windows and you see blank lines instead of the timestamp logging in the terminal, it could be the font color of the logs is the same as the background. As an alternative, you can run the API server from the Windows command line, or change the background color in PowerShell. +::: + +🎉 **You have completed Lab 2 by building a web application that calls an API with refresh capability!** 🎉 + +
      +
      +
      + +← All Identity Labs diff --git a/articles/identity-labs/02-calling-an-api/index.md b/articles/identity-labs/02-calling-an-api/index.md new file mode 100644 index 0000000000..9b636eda3f --- /dev/null +++ b/articles/identity-labs/02-calling-an-api/index.md @@ -0,0 +1,36 @@ +--- +section: exercises +description: Auth0 digital identity Lab 2: Calling an API +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - index + - concept +--- +# Lab 2: Calling an API + +This lab covers the process for adding sign-in to a basic Node.js application and calling an API. This lab is the same exercise we provide for new employees in a technical role here at Auth0. + +::: warning +The Node OIDC and bearer token npm packages that this lab uses has not been tested, licensed, or officially released and should not be used in production. +::: + +## Prerequisites + +- Read the introduction on the [main Identity Labs page](/labs/) +- Watch the [Calling an API video](/videos/learn-identity/04-calling-an-api) +- Read [Using Express Middleware](https://expressjs.com/en/guide/using-middleware.html) (optional) +- Read [Beginner's Guide to Using npm](https://nodesource.com/blog/an-absolute-beginners-guide-to-using-npm/) (optional) + +## What You'll Need + +<%= include('../_includes/_what-you-need') %> + +--- + +**For Windows users** - We recommend that you use the Windows PowerShell terminal (instead of the Windows command line) so that the terminal commands provided in the lab instructions work as they are. This is because the syntax of the commands used in the labs is the same for the Mac and PowerShell terminals. + +Start → diff --git a/articles/identity-labs/03-mobile-native-app/exercise-01.md b/articles/identity-labs/03-mobile-native-app/exercise-01.md new file mode 100644 index 0000000000..eddea08b18 --- /dev/null +++ b/articles/identity-labs/03-mobile-native-app/exercise-01.md @@ -0,0 +1,274 @@ +--- +section: exercises +description: Auth0 digital identity Lab 3, Exercise 1: Adding Authentication +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - index + - concept +--- +# Lab 3, Exercise 1: Adding Authentication + +::: warning +If you came to this page directly, go to the [first page of this lab](/identity-labs/03-mobile-native-app) and read through the instructions before getting started. +::: + +In this exercise, you will add authentication to an existing iOS application. A simple iOS application has been provided to get you started. This is a single-view application with a button to launch the Auth0 authentication process. + +
      + +
      +
      +
      +
      +
      +
      +
      +
      + +1. Launch Xcode, go to **File > Open**, and open `/lab-03/exercise-01/begin/exercise-01.xcworkspace` in your locally-cloned copy of the [identity exercise repo](https://github.com/auth0/identity-102-exercises/). + +<%= include('../_includes/_git-clone-note') %> + +::: note +If the project complains about a missing dependency, you might have opened `exercise-01.xcodeproj` instead of `exercise-01.xcworkspace` (note the extension). +::: + +This project is a bare-bones application that imports the [Auth0.swift](https://github.com/auth0/auth0.swift) dependency to provide the OpenID Connect implementation. There is also a stub method called `actionLogin` for processing the touch of the login button. + +2. In the bar at the top of the project window, click the device selector and pick a late-model iPhone, then click the Play button (or **Product > Run** from the Xcode menu) to run the app. + +![Device simulator selection](/media/articles/identity-labs/lab-03-choose-device-and-run.png) + +The simulator may take a few moments to load the first time, and then you should see the following: + +![First time running iOS application](/media/articles/identity-labs/lab-03-first-run.png) + +3. Touch the **Log In** button. This will output a "Log In" message to the Debug area in Xcode. If you don’t see the Debug view, you can enable it with **View > Debug Area > Show Debug Area**. + +![iOS application debug console in Xcode](/media/articles/identity-labs/lab-03-first-debug-area.png) + +4. Before any calls are made to the Auth0 authorization server, you need to set up a new Auth0 Application for handling Native Applications. Log into the Auth0 Dashboard, go to the [Applications page](${manage_url}/#/applications), and click the **Create Application** button. + +5. Enter a descriptive name, select **Native** as the application type, and click **Create**. + +6. Click on the **Settings** tab and scroll down to the **Allowed Callback URLs** field. Enter the value below (modified with your tenant domain): + +```text +com.auth0.identity102://${account.namespace}/ios/com.auth0.identity102/callback +``` + +7. Scroll down and click **Show Advanced Settings**, then **OAuth**. Make sure **JsonWebToken Signature Algorithm** is set to `RS256`. + +8. Click **Save Changes** + +You might be wondering why the callback URL is in this format. There are two parts to this: + +- The first element is the scheme of the application, which for the purposes of this exercise, is defined as `com.auth0.identity102`. Whenever Safari needs to handle a request with this scheme, it will route it to our application (you will set up this custom URL scheme URL later in the lab). +- The rest of the URL is in a format that the Auth0.swift SDK specifies for callbacks. + +9. Now the sample iOS application needs to be configured with the **Client ID** and **Domain** values from the Auth0 Application. Return to Xcode and open the `exercise-01/Auth0.plist` file. You should see value placeholders for **ClientId** and **Domain**. Replace these with the values from the Auth0 Application created above. + +![iOS application plist values](/media/articles/identity-labs/lab-03-plist.png) + +::: note +The domain must not have any prefix like in the previous labs. Enter it exactly as it is provided in the Auth0 dashboard. +::: + +To be able to use the callback that was configured in the Auth0 dashboard, a URL scheme handler needs to be registered in our iOS application so that it can respond to requests made to the callback URL. + +10. In the file navigator on the left, click on `exercise-01` to open the project settings, then click on the **Info** tab. + +![Project settings for iOS application](/media/articles/identity-labs/lab-03-project-settings-info-tab.png) + +11. Scroll down to **URL Types**, expand the section, click the **+** button, and enter or select the following details: + +- **Identifier**: `auth0` +- **URL Schemes**: `$(PRODUCT_BUNDLE_IDENTIFIER)` +- **Role**: `None` + +Just as `http` is a URL Scheme that will launch a browser, the bundle identifier of the app has a URL Scheme (which will resolve to `com.auth0.identity102`) will tell iOS that any time this scheme is used in a URL, it must be routed to our application. That will be the case of the callback used by Auth0 after you log in. + +12. Now, the application needs to have the Auth0.swift SDK handle the callback in order to proceed with the authentication flow. In the Project Navigator on the left, open `exercise-01/AppDelegate.swift` and add the following import statement just below the other one: + +```swift +// exercise-01/AppDelegate.swift + +import UIKit + +// Add the line below 👇 +import Auth0 +``` + +13. In the same file, add the following method inside the `AppDelegate` class: + +```swift +// exercise-01/AppDelegate.swift +// ... +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + // Add the code below 👇 + func application(_ + app: UIApplication, + open url: URL, + options: [UIApplication.OpenURLOptionsKey : Any] + ) -> Bool { + return Auth0.resumeAuth(url, options: options) + } + + // ... other existing methods +} +``` + +When another app requests a URL containing the custom scheme, the system will launch your app if necessary, bring it to the foreground, and call the method above. The iOS Framework provides the delegate method above for you to implement so that you can parse the contents of the URL and take appropriate action. In this case, you need this information to continue the authentication flow process. You will see later in this exercise why this step is needed. + +Now that the iOS application is configured with your Auth0 application credentials and is able to receive and process callbacks, complete the following steps to see how to construct the OpenID Connect request to the authorization server. + +14. Open `exercise-01/ViewController.swift` and add the following code inside the `actionLogin` method, after the line that prints the "Log In" message to the console: + +```swift +// exercise-01/ViewController.swift +// ... + @IBAction func actionLogin(_ sender: Any) { + print("Log In") + + // Add the code below 👇 + Auth0 + .webAuth() + .scope("openid profile email") + .logging(enabled: true) + .start { response in + switch(response) { + case .success(let result): + print("Authentication Success") + print("Access Token: \(result.accessToken ?? "No Access Token Found")") + print("ID Token: \(result.idToken ?? "No ID Token Found")") + case .failure(let error): + print("Authentication Failed: \(error)") + } + } + } +// ... +``` + +15. Run the app again by clicking the Play button (or **Product > Run** from the Xcode menu). Once the app has launched, touch the **Log In** button. You should see a permission prompt from iOS. Touch **Continue** to proceed to the Auth0 login page, which is rendered within a browser. + +![Universal login page loaded](/media/articles/identity-labs/lab-03-login-confirmation.png) + +16. Log in using your database user, and you will be taken back to the app. Nothing will have changed visually, but if you take a look at the Debug Area in Xcode you will see something like this: + +```text +Authentication Success +Access Token: vxPp0Xtg3wkZJudFZWzqMQByYF98Qyer +ID Token: eyJ0eX[..].eyJodH[..].kLtZDg[..] +``` + +To view the contents of your ID Token, you can copy and paste it into [jwt.io](https://jwt.io/) to view the claims. + +Now that you have an ID token, it's important to validate it to ensure that it can be trusted. A helper method `isTokenValid` is already included in the project; you can review its code in `Extras/Utils.swift` to learn how the validation is performed. It should be called after obtaining the token, to illustrate how it is used. + +17. Back in the `actionLogin` method in `ViewController.swift`, add the line below: + +```swift +// exercise-01/ViewController.swift +// ... + + @IBAction func actionLogin(_ sender: Any) { + print("Log In") + + Auth0 + // ... + case .success(let result): + // ... other print statements + + // Add the line below 👇 + print("ID Token Valid: \(isTokenValid(result.idToken!))") + + // ... failure case + } + } +// ... +``` + +18. Run the app again, log in, and take a look at the logs in Xcode. You should see an entry "ID Token Valid:" with the status of the validation (true or false). + +Congratulations! You have successfully added Auth0 authentication to your native iOS app using an authorization code grant! + +The authorization code grant by itself has some security issues when implemented on native applications. For instance, a malicious attacker can intercept the authorization code returned by Auth0 and exchange it for an access token. The Proof Key for Code Exchange (PKCE) is a technique used to mitigate this authorization code interception attack. + +With PKCE, for every authorization request, the application creates a cryptographically random key called the **code verifier**, hashes that value into a **code challenge**, and sends the **code challenge** to the authorization server to get the authorization code. When the application receives the code after a successful login, it will send the code and the code verifier to the token endpoint to exchange them for the requested tokens. + +Since you previously enabled logging in our `WebAuth` call with the `logging()` method, it is easy to see the process flow in the Debug Area. + +19. Run the iOS Application, touch the **Log In** button, and then take a look at the Debug Area. The iOS application initiates the flow and redirects the user to the `/authorize` endpoint, sending the `code_challenge` and `code_challenge_method` parameters. It also sends a `response_type` of `code` (line breaks added below for readability): + +```text +SafariAuthenticationSession: +https://${account.namespace}/authorize +?code_challenge=VsPaQ0gJjnluA2vwV0piY-D-DTCltGI9GbYkBNHvPHQ +&response_type=code +&redirect_uri=com.auth0.identity102://${account.namespace}/ios/com.auth0.identity102/callback +&state=RFnNyPj4NOZMUW8IpDBr-j3UgO4gCbhBZtLpWB_vmDo +&client_id=${account.clientId} +&scope=openid%20profile +&code_challenge_method=S256 +&auth0Client=eyJzd2lmdC12ZXJzaW9uIjoiMy4wIiwibmFtZSI6IkF1dGgwLnN3aWZ0IiwidmVyc2lvbiI6IjEuMTMuMCJ9 +``` + +20. Once again, enter your credentials and log in. Auth0 redirects the user back to the iOS application by calling the callback with the authorization code in the query string: + +```text +iOS Safari: +com.auth0.identity102://${account.namespace}/ios/com.auth0.identity102/callback +?code=6SiMHrJHbG2aAPrj +&state=RFnNyPj4NOZMUW8IpDBr-j3UgO4gCbhBZtLpWB_vmDo +``` + +21. The Auth0.swift SDK will process the query string and send the authorization `code` and `code_verifier` together with the `redirect_uri` and the `client_id` to the token endpoint of the authorization server: + +```text +POST /oauth/token + +{"grant_type":"authorization_code", +"redirect_uri":"com.auth0.identity102:\/\/${account.namespace}\/ios\/com.auth0.identity102\/callback", +"code":"6SiMHrJHbG2aAPrj", +"code_verifier":"qiV8gYUrPco3qBlejLeZzgC9DMtXZY1GddzZpmVxyxw", +"client_id":"${account.clientId}"} +``` + +22. The authorization server validates this information and returns the requested access and ID tokens. If successful, you will see the following response containing your tokens: + +```text +Content-Type: application/json + +{"access_token":"ekhGPSE7xdhOTJuTo2dV-TYyJV-OTYrO", +"id_token":"eyJ0eX[..].eyJodH[..].1kZccn[..]", +"expires_in":86400, +"token_type":"Bearer"} +``` + +In the next exercise, you will use a token to validate and authorize the user and authorize against a protected API. + +
      +
      +
      + +Next → diff --git a/articles/identity-labs/03-mobile-native-app/exercise-02.md b/articles/identity-labs/03-mobile-native-app/exercise-02.md new file mode 100644 index 0000000000..c0a673e7d9 --- /dev/null +++ b/articles/identity-labs/03-mobile-native-app/exercise-02.md @@ -0,0 +1,340 @@ +--- +section: exercises +description: Auth0 digital identity Lab 3, Exercise 2: Calling a Secured API +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - concept +--- +# Lab 3, Exercise 2: Calling a Secured API + +::: warning +If you came to this page directly, go to the [first page of this lab](/identity-labs/03-mobile-native-app) and read through the instructions before getting started. +::: + +In this exercise, you are going to enable the native application to authorize against the protected API backend that was built in [Lab 2, Exercise 2](/identity-labs/02-calling-an-api/exercise-02). In that lab, you set up an Auth0 API server for your Expenses API with an audience value of `https://expenses-api`. + +
      + +
      +
      +
      +
      +
      +
      + + +If you have already completed lab 2, you can use the same Auth0 configuration and local files to run the API needed for this lab. Just go to `/lab-02/begin/api` in your locally-cloned copy of the [identity exercise repo](https://github.com/auth0/identity-102-exercises/) and run `npm start` in your terminal before beginning this exercise. Make sure your token expiration times in Auth0 are back to normal (at least an hour for both). + +::: panel If you did not complete Lab 2 +If you are doing this lab by itself, you can use the completed exercise sample code: + +1. Go to `/lab-02/end/api` and run `npm install` in your terminal. + +2. Follow steps 1-3 on [this page](/identity-labs/02-calling-an-api/exercise-02) to create an API in Auth0. + +3. Create a copy of the `.env` file in the same directory as above, change the `ISSUER_BASE_URL` value to include your tenant name, and save the file. + +4. Back in the terminal, run `npm start`. + +```bash +# Starting from the Lab 3 begin folder... +❯ cd ../../../lab-02/end/api + +❯ pwd +/Users/username/identity-102-exercises/lab-02/end/api + +❯ cp .env-sample .env + +❯ vim .env +# Change the ISSUER_BASE_URL value ... + +❯ npm install + +added XX packages in X.XXs + +❯ npm start + +listening on http://localhost:3001 +``` + +::: + +Regardless of which API codebase you're using, you should now be able to load [localhost:3001](http://localhost:3001/) in your browser and see an error saying `UnauthorizedError: bearer token is missing`. + +5. For this exercise, we're going to open a different project in Xcode than the one we used in exercise 1. Go to **File > Open** in Xcode and select `lab-03/exercise-02/begin/exercise-02.xcworkspace` (make sure you pick the right file extension), then open `exercise-02/ViewController.swift`. This code picks up where the previous exercise left off and adds a new button to call the API. + +6. Open the `exercise-02/Auth0.plist` file and replace the placeholder values for **ClientId** and **Domain** with the ones from the Auth0 Application created before. + +7. Click the Play button (or **Product > Run** from the Xcode menu) to run the app. + +![iOS application Call API button](/media/articles/identity-labs/lab-03-call-api-button.png) + +8. Touch the **Call API** button, and you should see a "Call API" message in the Debug area in Xcode. + +![Call API debug message in Xcode console](/media/articles/identity-labs/lab-03-call-api-debug-area.png) + +You will now add code to make the API call from the mobile app. However, before doing so, you need to modify the authentication code to include the API's audience for authorization and the necessary scopes so that the required permissions are requested. + +9. In the `actionLogin` method, which contains our authentication call, include the audience for the API we want to access. With this in place, there will be an additional audience inside the access token after successful authentication. + +```swift +// exercise-02/ViewController.swift +// ... + + @IBAction func actionLogin(_ sender: Any) { + Auth0 + .webAuth() + .scope("openid profile") + + // Add the line below 👇 + .audience("https://expenses-api") + + // ... + } + } +// ... +``` + +10. Run the app from Xcode again, click **Log In**, and check the debug logs. You should see a block of output like below: + +```text +Authentication Success +Access Token: eyJ0eXA[..].eyJpc3[..].XeiZaS[..] +ID Token: eyJ0eXA[..].eyJodH[..].Lv1TY8[..] +Token Valid: true +``` + +11. Copy and paste the value of the **Access Token** into [jwt.io](https://jwt.io). Notice the `scope` value of `openid profile`. In Lab 2, the additional scope `read:reports` was added, which is not present in the token yet: + +```js +{ + "iss": "https://${account.namespace}/", + "sub": "auth0|1234567890", + "aud": [ + + // New audience 👇 + "https://expenses-api", + "https://${account.namespace}/userinfo" + ], + "iat": 1566840738, + "exp": 1566840746, + "azp": "${account.clientId}", + + // Existing scopes 👇 + "scope": "openid profile" +} +``` + +12. Now, add the `read:reports` scope to the parameter in the `scope()` method within `actionLogin`: + +```swift +// exercise-02/ViewController.swift +// ... + + @IBAction func actionLogin(_ sender: Any) { + Auth0 + .webAuth() + + // Replace this line ❌ + // .scope("openid profile") + + // ... with the line below 👇 + .scope("openid profile read:reports") + + // ... + } + } +``` + +13. Run the app again, log in, and check the access token in [jwt.io](https://jwt.io) once more. You should now see the `read:reports` scope in the payload. It’s time to make a call to the API! + +14. To use the access token we obtained during login in the `actionAPI` method, you need a way to access this variable. Create a private variable in the `ViewController` class: + +```swift +// exercise-02/ViewController.swift +// ... +import Auth0 + +class ViewController: UIViewController { + + // Add the line below 👇 + private var accessToken: String? + + // ... +} +``` + +15. In the `.success` code block of the `actionLogin` method, set the new `accessToken` value to be what was returned from the token endpoint: + +```swift +// exercise-02/ViewController.swift +// ... + @IBAction func actionLogin(_ sender: Any) { + // ... + case .success(let result): + // ... + + // Add the line below 👇 + self.accessToken = result.accessToken + + case .failure(let error): + // ... + } +// ... +``` + +16. In the `actionAPI` method in the same class, check that the user has authenticated and that you have an access token before making a call to the API: + +```swift +// exercise-02/ViewController.swift +// ... + @IBAction func actionAPI(_ sender: Any) { + print("Call API") + + // Add the code below 👇 + guard let accessToken = self.accessToken else { + print("No Access Token found") + return + } + } +// ... +``` + +Here, you are assigning the class-scoped property `accessToken` to a local `accessToken` variable. If the class-scoped property is empty, an error will be returned. + +17. Again in the `actionAPI` method, add the code below to start an API request: + +```swift +// exercise-02/ViewController.swift +// ... + @IBAction func actionAPI(_ sender: Any) { + // ... code from above + + // Add the code below 👇 + let url = URL(string: "http://localhost:3001")! + var request = URLRequest(url: url) + } +// ... +``` + +::: note +If your API is running on a different port or URL, make sure to change that above. +::: + +18. You also need a way to send the access token to the API. This is done by adding an HTTP Authorization request header: + +```swift +// exercise-02/ViewController.swift +// ... + @IBAction func actionAPI(_ sender: Any) { + // ... code from above + + // Add the code below 👇 + request.addValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization") + request.log() + } +// ... +``` + +19. Finally, the request needs to be executed. You will use the functionality built into the iOS framework - `URLSession` - to perform the network operation: + +```swift +// exercise-02/ViewController.swift +// ... + @IBAction func actionAPI(_ sender: Any) { + // ... code from above + + // Add the code below 👇 + let task = URLSession.shared.dataTask(with: request) { + data, response, error in + print(response ?? "No Response") + } + task.resume() // Execute the request + } +// ... +``` + +20. Let's try calling the API from our mobile app. Save your changes from above, run the app, and tap **Log In**. After successfully authenticating, tap the **Call API** button and check the logs in the Debug area for the API response: + +```text +Call API +GET http://localhost:3001 +Headers: + Optional(["Authorization": "Bearer eyJ0eX[..].eyJpcM[..].dpN8sK[..]"]) + { URL: http://localhost:3001/ } { Status Code: 200, Headers { + Connection = ( + "keep-alive" + ); + "Content-Length" = ( + 195 + ); + "Content-Type" = ( + "application/json; charset=utf-8" + ); + Date = ( + "Tue, 27 Aug 2019 14:53:40 GMT" + ); + Etag = ( + "W/\"c3-oBamo6wQLwSzwYwQczXJ+w5tl5o\"" + ); + "X-Powered-By" = ( + Express + ); +} } +``` + +The `Status Code: 200` (OK) lets us know the request was executed successfully. If you want to see it fail, simply comment out the line that adds the Authorization Bearer header, re-rerun the app, and try logging in again. You will see a `Status Code: 401` (Unauthorized). + +21. You can see from the `Content-Length` header that there is a body in the response; output the raw data from the API by updating the `dataTask` closure with the following code: + +```swift +// exercise-02/ViewController.swift +// ... + @IBAction func actionAPI(_ sender: Any) { + // ... code from above + + let task = URLSession.shared.dataTask(with: request) { + data, response, error in + print(response ?? "No Response") + + // Add the code below 👇 + if let data = data { + print(String(data: data, encoding: .utf8) ?? "No Body") + } + } + // ... + } +// ... +``` + +22. Re-run the app, login, and call the API once more. You should now see the expenses in the debug area in Xcode: + +```js +[{"date":"2019-08-27T15:02:04.838Z","description":"Pizza for a Coding Dojo session.","value":102}, +{"date":"2019-08-27T15:02:04.838Z","description":"Coffee for a Coding Dojo session.","value":42}] +``` + +You have now integrated your native application frontend with a protected API backend! In the next exercise, you will look at how the access token can be refreshed without having the user go through the web-based authentication flow each time. + +
      +
      +
      + +Next → diff --git a/articles/identity-labs/03-mobile-native-app/exercise-03.md b/articles/identity-labs/03-mobile-native-app/exercise-03.md new file mode 100644 index 0000000000..1cf3321b8e --- /dev/null +++ b/articles/identity-labs/03-mobile-native-app/exercise-03.md @@ -0,0 +1,232 @@ +--- +section: exercises +description: Auth0 digital identity Lab 3, Exercise 3: Working with Refresh Tokens +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - index + - concept +--- +# Lab 3, Exercise 3: Working with Refresh Tokens + +::: warning +If you came to this page directly, go to the [first page of this lab](/identity-labs/03-mobile-native-app) and read through the instructions before getting started. +::: + +In this exercise, you will explore the use of refresh tokens. A refresh token is a special kind of token that can be used to obtain a renewed access token. You are able to request new access tokens until the refresh token is blacklisted. It’s important that refresh tokens are stored securely by the application because they essentially allow a user to remain authenticated forever. + +
      + +
      +
      +
      +
      +
      +
      + +For native applications such as our iOS application, refresh tokens improve the authentication experience significantly. The user has to authenticate only once, through the web authentication process. Subsequent re-authentication can take place without user interaction, using the refresh token. + +1. Go to **File > Open** in Xcode and select `lab-03/exercise-03/begin/exercise-03.xcworkspace` (make sure you pick the right file extension), then open `exercise-03/ViewController.swift`. This code picks up where the previous exercise left off and adds a new button to refresh the access token. + +2. Open the `exercise-03/Auth0.plist` file and replace the placeholder values for **ClientId** and **Domain** with the ones from the Auth0 Application created before. + +3. Click the Play button (or **Product > Run** from the Xcode menu) to run the app. Touch the **Refresh Token** button and look for a “Refresh Token” message to the Debug area in Xcode. + +![Refresh token button in iOS application](/media/articles/identity-labs/lab-03-refresh-token-button.png) + +You are now going to add the `offline_access` scope, which gives the iOS application access to resources on behalf of the user for an extended period of time. Before you can use this scope, you need to make sure that Auth0 will allow applications to ask for refresh tokens for your API. + +4. Navigate to the [APIs screen in your Auth0 Dashboard](${manage_url}/#/apis). Open the API that you created to represent your expenses API and ensure the **Allow Offline Access** option is on. + +![Allow offline access for API](/media/articles/identity-labs/lab-03-allow-offline-access.png) + +5. Next, we're going to add the `offline_access` scope to the authentication request. Open `exercise-03/ViewController.swift` and, in the `actionLogin` method, add `offline_access` to the `.scope()` method. + +```swift +// exercise-03/ViewController.swift +// ... + @IBAction func actionLogin(_ sender: Any) { + Auth0 + .webAuth() + + // Replace this line ❌ + // .scope("openid profile read:reports") + + // ... with the line below 👇 + .scope("openid profile read:reports offline_access") + + // ... + } + } +// ... +``` + +6. Click the Play button (or **Product > Run** from the Xcode menu) to run the app. Log in again and check the Debug area in Xcode for the response. + +```js +{ + "access_token":"3tjDJ3hsFOSyCr02spWHUhHNajxLRonv", + + // Here is the refresh token we asked for 👇 + "refresh_token":"sAvc4BJyOGs2I6Yc4e6r9NmReLp0kc-I6peiauDEt-usE", + + "id_token": "eyJ0eX[..].eyJodH[..].thhf0M[..]", + "expires_in": 86400, + "token_type": "Bearer" +} +``` + +7. We're going to send the refresh token to the authorization server using a `refresh_token` grant to get a new access token. In `ViewController.swift` and create a private variable in the `ViewController` class to create a way for `actionRefresh` method to access the refresh token. + +```swift +// exercise-03/ViewController.swift +// ... +class ViewController: UIViewController { + + private var accessToken: String? + + // Add the line below 👇 + private var refreshToken: String? + + // ... +} +// ... +``` + +8. Assign the refresh token obtained during authentication to this private variable in the `.success` code block. + +```swift +// exercise-03/ViewController.swift +// ... + @IBAction func actionLogin(_ sender: Any) { + // ... + case .success(let result): + // ... + self.accessToken = result.accessToken + + // Add the line below 👇 + self.refreshToken = result.refreshToken + + case .failure(let error): + // ... + } +// ... +``` + +9. In the `actionRefresh` method, check that the user has authenticated and that a refresh token is available before making any calls to the authentication API. In the code below, the class-scoped property `refreshToken` is assigned to a local `refreshToken` variable. If the class-scoped property is empty, an error will be returned. + +```swift +// exercise-03/ViewController.swift +// ... + @IBAction func actionRefresh(_ sender: Any) { + print("Refresh Token") + + // Add the code below 👇 + guard let refreshToken = self.refreshToken else { + print("No Refresh Token found") + return + } + } +// ... +``` + +10. The Auth0.swift SDK makes available a `.renew()` method, which takes a refresh token as a parameter and performs a call to the authorization server's token endpoint using the `refresh_token` grant. Add the following code to the `actionRefresh` method after the code from the previous step. + +```swift +// exercise-03/ViewController.swift +// ... + @IBAction func actionRefresh(_ sender: Any) { + // ... code from the previous steps + + // Add the code below 👇 + Auth0 + .authentication() + .logging(enabled: true) + .renew(withRefreshToken: refreshToken) + .start { response in + switch(response) { + case .success(let result): + print("Refresh Success") + print("New Access Token: \(result.accessToken ?? "No Access Token Found")") + self.accessToken = result.accessToken + case .failure(let error): + print("Refresh Failed: \(error)") + } + } + } +// ... +``` + +11. Click the Play button (or **Product > Run** from the Xcode menu) to re-run the app. Tap **Log In** and, after successful authentication, touch the **Refresh Token** button. Look in the Xcode the debug area for the request. You should see a `POST` to the token endpoint, showing the refresh token grant in action. + +```text +POST https://${account.namespace}/oauth/token HTTP/1.1 +Auth0-Client: eyJuYW1lIjoiQXV0aDAuc3dpZnQiLCJ2ZXJzaW9uIjoiMS4xMy4wIiwic3dpZnQtdmVyc2lvbiI6IjMuMCJ9 +Content-Type: application/json + +{"grant_type":"refresh_token","client_id":"${account.clientId}","refresh_token":"2CNxaPe0UIkX_PZkLEkKuoAuRsP6Ycg81XR1jQlTyn1dt"} +``` + +12. Look for the response after the request above. You should see a response including a new `access_token`, new `id_token`, and a new `expires_in` time (some of the trace was omitted for brevity). + +```text +HTTP/1.1 200 +Content-Type: application/json +Date: Tue, 27 Aug 2019 16:25:26 GMT +x-ratelimit-remaining: 29 +x-ratelimit-reset: 1566923126 +x-ratelimit-limit: 30 +Content-Length: 1923 + +{"access_token":"eyJ0eX[..].eyJpc3[..].Smqrd7[..]", +"id_token":"eyJ0eX[..].eyJua[..].Ff5Q5[..]", +"scope":"openid profile read:reports offline_access", +"expires_in":3600,"token_type":"Bearer"} +``` + +Notice that you don’t receive a new `refresh_token` in the response from the authorization server. The `refresh_token` from the initial authentication must be retained. Also, note that in the code added to the `actionRefresh` method the `access_token` received is stored in the `self.accessToken` class property. This is so the new access token can be used in other methods. If you try calling the API again, the request will be made with your new access_token. + +Now that you are able to obtain a fresh access token by using the refresh token, it’s time to see what happens when a token expires. + +13. Navigate to the [APIs screen in your Auth0 Dashboard](${manage_url}/#/apis) and open the expenses API. Set both the **Token Expiration** and the **Token Expiration For Browser Flows** fields to 10 seconds and save the changes. + +14. In your app simulator, tap **Log In** to walk through the authentication process again and get a new access token with the shorter expiration. Immediately tap the **Call API** button to see the API call succeed. + +15. Wait 10 seconds for the token to expire and click the **Call API** button again. You should see the API call fail with a `Status Code: 401` in the debug area. + +```text + { URL: http://localhost:3001/ } { Status Code: 401, Headers { + Date = ( + "Tue, 27 Aug 2019 16:36:10 GMT" + ); + "www-authentication" = ( + "Bearer realm=\"api\", error=\"invalid_token\", error_description=\"invalid token\"" + ); +} } +``` + +16. Tap **Refresh Token** and check the debug area to see the refresh token grant happen. Then, tap **Call API**, and you should get a `Status Code: 200` along with the expenses data again. + +🎉 **You have completed Lab 3 by building a native mobile application calling a secure API with refresh capability!** 🎉 + +
      +
      +
      + +← All Identity Labs diff --git a/articles/identity-labs/03-mobile-native-app/index.md b/articles/identity-labs/03-mobile-native-app/index.md new file mode 100644 index 0000000000..f872387025 --- /dev/null +++ b/articles/identity-labs/03-mobile-native-app/index.md @@ -0,0 +1,37 @@ +--- +section: exercises +description: Auth0 digital identity Lab 3: Mobile Native App +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - index + - concept +--- +# Lab 3: Mobile Native App + +## Prerequisites + +- Read the introduction on the [main Identity Labs page](/labs/) +- Watch the [Desktop and Mobile Apps video](/videos/learn-identity/05-desktop-and-mobile-apps) +- Apple's [Developing iOS Apps: Build a Basic UI](https://developer.apple.com/library/archive/referencelibrary/GettingStarted/DevelopiOSAppsSwift/BuildABasicUI.html) tutorial to get a feeling of the Xcode's UI (optional) + +## What You'll Need + +**A Mac computer** - A Mac is required to install Xcode. + +--- + +**An Apple account** - Required to download Xcode and install Xcode. + +--- + +**Xcode** - Download and install Xcode from the App Store. After installation is complete, open it so that you go through the first-time setup, which can take up to 10 minutes. This will require around 6GB of hard drive space and up to 30 minutes total to complete. + +--- + +<%= include('../_includes/_what-you-need') %> + +Start → diff --git a/articles/identity-labs/04-single-page-app/exercise-01.md b/articles/identity-labs/04-single-page-app/exercise-01.md new file mode 100644 index 0000000000..5318d93499 --- /dev/null +++ b/articles/identity-labs/04-single-page-app/exercise-01.md @@ -0,0 +1,366 @@ +--- +section: exercises +description: Auth0 digital identity Lab 4, Exercise 1: Adding Sign On +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - index + - concept +--- +# Lab 4, Exercise 1: Adding Sign On + +::: warning +If you came to this page directly, go to the [first page of this lab](/identity-labs/04-single-page-app) and read through the instructions before getting started. +::: + +In this lab, you will learn how to add sign-on capabilities to a Single-Page Application (SPA) and how to make this app consume an API that is secured with Auth0. You will integrate the SPA with Auth0 so that your users are able to use the Auth0 Universal Login Page to authenticate. + +The SPA in question is a vanilla JavaScript application that consumes an API similar to the one you have used in previous labs (this API also exposes a secured endpoint that returns a list of expenses). The difference is that the API in this lab does two additional things: + +- The API supports CORS to enable the SPA to consume it from a different domain (or a different port in a local environment). +- The API exposes a public endpoint that returns a summary of its database. The SPA consumes this endpoint on its homepage to share the summary publicly. + +In this exercise, you will focus on integrating the SPA with Auth0 and getting the profile of the logged-in user. Exercise 2 will show how to consume the private endpoint exposed by the API. + +
      + +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + +1. First, you will run a version of the app that is not integrated with Auth0. Open a new terminal and browse to `/lab-04/exercise-01/begin/api` in your locally-cloned copy of the [identity exercise repo](https://github.com/auth0/identity-102-exercises/). This is where the code for your API resides. Install the dependencies using npm. + +```bash +# Make sure we're in the right directory +❯ pwd +/Users/username/identity-102-exercises/lab-04/exercise-01/begin/api + +❯ npm install +# Ignore any warnings + +added XX packages in X.XXs +``` + +2. Make a copy of the `.env-sample` file and name it `.env`. + +```bash +❯ cp .env-sample .env +``` + +3. Edit the new `.env` file to add your tenant domain and save the file. + +```text +PORT=3001 +ISSUER_BASE_URL=https://${account.namespace} +ALLOWED_AUDIENCES=https://expenses-api +``` + +4. Run the API: + +```bash +❯ npm start +``` + +5. Open a new terminal in the `/lab-04/exercise-01/begin/spa` folder and run `http-server` to host the SPA. + +```bash +# Navigating from the previous directory +❯ cd ../spa + +# Make sure we're in the right directory +❯ pwd +/Users/username/identity-102-exercises/lab-04/exercise-01/begin/spa + +❯ npx http-server . -p 5000 -c-1 +npx: installed 26 in 3.459s +Starting up http-server, serving . +Available on: + http://127.0.0.1:5000 + http://10.10.10.10:5000 + http://192.168.1.4:5000 +Hit CTRL-C to stop the server +``` + +::: note +On the command above, `-p 5000` makes the server listen on port 5000, and `-c-1` makes browsers ignore their own cache. This last parameter is important to facilitate the development process. +::: + +6. Open [localhost:5000](http://localhost:5000) in a web browser, and you should see the page below. If you do not see the App Summary section, make sure your API is properly running at port 3001. + +![Initial load for single-page application](/media/articles/identity-labs/lab-04-initial-load.png) + +This is the homepage of your SPA. Right now, this SPA has no integration with Auth0. Also, the app is only consuming the public endpoint provided by the API. This endpoint returns two pieces of information: the total number of expenses recorded in the database (two, in this case), and the sum of their amount ($144.00). The SPA is using this information to feed the "App Summary" section of the page you are seeing. + +7. To register this SPA with Auth0, log into the Auth0 Dashboard, go to the [Applications page](${manage_url}/#/applications), and click the **Create Application** button. + +8. Set a descriptive name (e.g., "Identity Lab 4 - Single Page App"), choose **Single Page Web Application** for the type, and click **Create**. + +9. You should now see the Quickstart section that describes how to integrate Auth0 with a production application. Click the **Settings** tab at the top to see the Application settings. + +10. Add `http://localhost:5000/#callback` to the **Allowed Callback URLs** field. Auth0 will allow redirects **only** to the URLs in this field after authentication. If the one provided in the authorization URL does not match any in this field, an error page will be displayed. + +11. Add `http://localhost:5000` to the **Allowed Web Origins** field. This field defines what URLs will be able to issue HTTP requests to Auth0 during a [silent authentication process](https://auth0.com/docs/api-auth/tutorials/silent-authentication). Your SPA will leverage this mechanism to check whether the current browser has an active session on the Auth0 authorization server. + +12. Add `http://localhost:5000` to the **Allowed Logout URLs** field. Auth0 will allow redirects **only** to the URLs in this field after logging out of the authorization server. + +13. Scroll down and click **Show Advanced Settings**, then **OAuth**. Make sure **JsonWebToken Signature Algorithm** is set to `RS256`. + +14. Scroll down and click **Save Changes** + +Now that you have registered your SPA with Auth0, you can update your code to integrate both. Below is a summary of the steps you will execute: + +- Import [auth0-spa-js](https://github.com/auth0/auth0-spa-js) and configure it with your own Auth0 settings. +- Add code to handle the authentication callback. +- Add code to restrict content to authenticated users only. +- Implement login and logout. +- Obtain and display user profile information. + +The [auth0-spa-js](https://github.com/auth0/auth0-spa-js) SDK is a simple, lightweight, and opinionated client developed by Auth0 that executes the OAuth 2.0 Authorization Code Grant Flow with PKCE. This client allows developers to quickly and securely implement authentication in their browser-based applications. + +15. Open the `spa/index.html` file and search for the ` + + + + +``` + +16. Open `spa/app.js`. This file contains the code that starts your SPA in the browser. At the top of it, you will see several constants that reference DOM elements. Right after those definitions, add the variable declaration to allow `auth0Client` to be used globally. + +```js +// spa/app.js +// ... other constants +const loadingIndicator = document.getElementById('loading-indicator'); + +// Add the line below 👇 +let auth0Client; +``` + +17. In the `window.onload` function, add the code that configures the auth0-spa-js library with your own Auth0 details. Replace both placeholders with the **Domain** and **Client ID** properties for your SPA Application in Auth0. + +```js +// spa/app.js +// ... + +window.onload = async function() { + let requestedView = window.location.hash; + + // Add the code below 👇 + auth0Client = await createAuth0Client({ + domain: '${account.namespace}', + client_id: '${account.clientId}' + }); + + // ... +}; +``` + +18. Implement the authentication callback after the snippet above in the `window.onload` function. + +```js +// spa/app.js +// ... + +window.onload = async function() { + // ... code from the previous step + + // Add the code below 👇 + if (requestedView === '#callback') { + await auth0Client.handleRedirectCallback(); + window.history.replaceState({}, document.title, '/'); + } + + // ... +}; +``` + +The `requestedView` variable is used to identify if the request in question refers to a user coming back from the authentication process (i.e., if this is a user being redirected back to the application by Auth0 after authenticating). + +19. Restrict site content to authenticated users only by finding the `allowAccess` function definition (at the bottom of the file) and replacing it with an authentication check. + +```js +// spa/app.js +// ... + +/* Replace the code below ❌ +async function allowAccess() { + await loadView('#home', content); + return false; +} +*/ + +// ... with this 👇 +async function allowAccess() { + if (await auth0Client.isAuthenticated()) { + return true; + } + await loadView('#home', content); + return false; +} +``` + +The goal of this function is to allow or deny access to whatever route calls it. This function is called from the `#expenses` route to ensure the user is logged in. Although you won't use that route on this exercise (only on the next one), you can check the code in the `spa/scripts/expenses.js` file. The previous version of this function was hardcoded always to deny access and redirect to the #home route because no authentication mechanism was in place yet. + +You are now making use of the `isAuthenticated()` method provided by the SPA SDK to block unauthenticated users from accessing the route calling this function. If an anonymous user tries to access it, the app will detect that they are not authenticated and will redirect them back to the homepage. + +20. To give users a way to log in and view restricted content, open the `spa/scripts/navbar.js` file. There, you will see the definition of a few constants within the `async function()` [IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE). Below that, we'll add code to handle a click event on the login button. + +```js +// spa/scripts/navbar.js +(async function() { + // ... other constants + const logOutButton = document.getElementById('log-out'); + + // Add the code below 👇 + logInButton.onclick = async () => { + await auth0Client.loginWithRedirect({ + redirect_uri: 'http://localhost:5000/#callback' + }); + }; + +})(); +``` + +The logInButton button will now, when clicked, invoke the `loginWithRedirect()` method provided by the SPA SDK to start the authentication process. When users click the login button, they will be redirected to the authorization server. + +The `redirect_uri` property passed to the `loginWithRedirect()` method defines the URL that Auth0 must call after the authentication phase is concluded. This is the same URL listed in the **Allowed Callback URLs** field in the Auth0 Dashboard. If you use another URL without whitelisting it first, Auth0 will show an error page. + +21. To define what happens when users click the logout button, add the code below right after the code from the previous step in the same function. + +```js +// spa/scripts/navbar.js +(async function() { + // ... code from the previous example + + // Add the code below 👇 + logOutButton.onclick = () => { + auth0Client.logout({ + returnTo: 'http://localhost:5000' + }); + }; + +})(); +``` + +In this case, you are making the `logOutButton` button invoke the `logout()` method provided by the SPA SDK to end the user's Auth0 session. The `returnTo` property passed to this method works similar to the `redirect_uri` passed to the `loginWithRedirect()` method. This logout return URL was whitelisted in your Auth0 Application using the **Allowed Logout URLs** field. + +22. Now, you will implement the behavior in your application that depends on whether the user is authenticated or not. After the code from the previous step, add the following code: + +```js +// spa/scripts/navbar.js +(async function() { + // ... code from the previous example + + // Add the code below 👇 + const isAuthenticated = await auth0Client.isAuthenticated(); + if (isAuthenticated) { + const user = await auth0Client.getUser(); + profilePicture.src = user.picture; + userFullname.innerText = user.name; + + logOutButton.style.display = 'inline-block'; + } else { + logInButton.style.display = 'inline-block'; + } + +})(); +``` + +You defined a flag called `isAuthenticated` that defines if the user is authenticated or not. If they are authenticated, you use the `getUser()` method provided by the SPA SDK to extract their profile details. These details populate the screen with the name of the user and their picture. + +The `isAuthenticated` flag also defines what button the app will show based on their authentication status: the `logInButton` or the `logOutButton`. If the user has a session with this application, the app will show the `logOutButton` button. Otherwise, it will show the `logInButton`. + +23. Save all your changes and refresh the browser. You will see a screen that is slightly different from the previous one. + +![Login button for single-page application](/media/articles/identity-labs/lab-04-login-button-showing.png) + +24. In this new screen, click the **Log In** button to start the authentication process. Log in with your database user and accept the consent request. After successful authentication, Auth0 will redirect you back to your app, and your profile details (username and picture) will be shown near the upper-right corner: + +![Login complete on single-page application](/media/articles/identity-labs/lab-04-login-complete.png) + +::: note +If you log in using a social identity provider (Google, Facebook, etc.), you will need to log in every time you refresh the SPA. This happens because you are using Auth0’s test development keys for the identity provider. To prevent this from happening, you would need to register your application with the relevant Identity Provider and replace the test development keys on the Auth0 dashboard with your own. However, for the purposes of this lab, you should log in with a username and password to avoid the aforementioned behavior. + +For more information, see [Test Social Connections with Auth0 Developer Keys](https://auth0.com/docs/connections/social/devkeys). +::: + +If you want to test the `allowAccess()` function, which restricts access for particular routes depending on whether the user is authenticated, try navigating to [localhost:5000/#expenses](http://localhost:5000/#expenses). If you are logged in, the page will load successfully showing a "Loading..." text (the content for this page will be implemented in the next exercise). If you are not logged in, the app will redirect you to the homepage. + +25. Let's explore the relevant network traces of the authentication process used in this lab. First, click the **Log Out** button, then, once you return to the app with your session ended, open Chrome's **Developer Tools** and go to the **Network** tab. + +26. Click the **Log In** button. The first thing you will see in **Developer Tools** is a request similar to this: + +```text +https://${account.namespace}/authorize?client_id=... +``` + +This request is created and triggered by the SPA SDK when a user clicks on the login button. If you check the query parameters passed alongside this URL, you will find, among others, the following: + +- `client_id` - the unique identifier of your application for the authorization server. +- `response_type` - the artifacts needed to authenticate the user in your application. In this case, the SPA SDK is requesting an authorization code. This indicates to Auth0 that you will be using the [Authorization Code Grant Flow](https://auth0.com/docs/api-auth/tutorials/authorization-code-grant) (as defined by the OAuth 2.0 specification). +- `scope` - a space-delimited list of permissions that the application requires. In this case, your app is requesting `openid profile email`. These are scopes defined by the [OpenID Connect specification](/scopes/current/oidc-scopes) and give your app access to specific data in the user profile. +- `code_challenge` - this is a code that the authorization server will store and associate with the authorization request. In a future step, before issuing tokens to your application, the authorization server will use this code to verify (against another code called `code_verifier` that is handled internally by the SPA SDK) if it is secure to issue tokens. By using the code challenge and verifier, the SPA SDK is making the authorization process use a variant of the Authorization Code Grant Flow called PKCE. + +27. Log in again by clicking **Log In**. After Auth0 redirects back to your application, check the **Network** tab in **Developer Tools**, and you will see a list of requests, starting with the callback. Filter the requests and show only the XHR ones (those generated by an XMLHttpRequest JavaScript object). + +28. Click on the "token" request (if there are two, click the second one). You will see that it is a `POST` request to the token endpoint of the authorization server. This request exchanges the code retrieved on the authentication process for the tokens needed in your application. + +29. To see the data sent to the token endpoint, scroll to the bottom of the **Headers** tab. There, you will see that the request payload includes the following fields: `client_id`, `code`, `code_verifier`, `grant_type`, and `redirect_uri`. + +![Network request for token endpoint POST](/media/articles/identity-labs/lab-04-token-ep-post.png) + +30. Switch to the **Preview** tab to see the tokens returned by the authorization server. + +![Network response from token endpoint POST](/media/articles/identity-labs/lab-04-token-ep-response.png) + +::: note +If you are using a content blocker or browser setting that blocks third-party cookies, you will notice that in the step below, when authenticated, you need to log in again after refreshing the page. In that case, try changing your content blocker settings to allow your Auth0 domain (or turning it off altogether for localhost). Blocking all third-party cookies is not generally recommended as it is known to cause issues in some Web sites. This problem does not occur when [Custom Domains](/custom-domains) are used. +::: + +31. If you refresh the SPA and change **Developer Tools** to filter requests by Doc (Documents), you will see a request called `authorize`. This request is similar to the one issued after the authentication process with a few differences: + +- The request uses a different `response_mode`, in this case `web_message`. This is part of a strategy used to [renew tokens silently](/api-auth/tutorials/silent-authentication#renew-expired-tokens). +- The request defines a new query parameter called `prompt` set to `none`. As defined in the OpenID Connect protocol, this parameter is used on [authentication requests that must not display user interaction](https://auth0.com/docs/api-auth/tutorials/silent-authentication). This parameter is also part of the silent authentication process. + +![Silent authentication network request from single-page application](/media/articles/identity-labs/lab-04-silent-auth-request.png) + +For this to work properly, the silent authentication process requires the referrer URL to be whitelisted. This is why you added `http://localhost:5000` to the **Allowed Web Origins** field for your Auth0 Application. Otherwise, the silent authentication process would fail, and your users would need to log in again interactively. + +
      +
      +
      + +Next → diff --git a/articles/identity-labs/04-single-page-app/exercise-02.md b/articles/identity-labs/04-single-page-app/exercise-02.md new file mode 100644 index 0000000000..c04c5c6d4d --- /dev/null +++ b/articles/identity-labs/04-single-page-app/exercise-02.md @@ -0,0 +1,189 @@ +--- +section: exercises +description: Auth0 digital identity Lab 4, Exercise 2: Calling a Protected API +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - index + - concept +--- +# Lab 4, Exercise 2: Calling a Protected API + +::: warning +If you came to this page directly, go to the [first page of this lab](/identity-labs/04-single-page-app) and read through the instructions before getting started. +::: + +In this exercise, you will learn how to make your SPA consume, on behalf of the user, the private endpoint exposed by the API. + +
      + +
      +
      +
      +
      +
      +
      + +::: note +You can continue using the source code from the previous exercise, or if you are starting from scratch, use the code in the `exercise-02/begin` folder. Make sure you run steps 1-6 in [exercise 1](/identity-labs/04-single-page-app/exercise-01) either way. +::: + +To make your SPA consume the private endpoint on the user's behalf, it must fetch an access token first, then call the protected API. The first time your application asks for an access token for an API, the authorization server will request explicit consent from your users. + +To request this consent, your application will open a popup that will load a page from the authorization server. On that page, your users will learn what type of access your application is requesting, and they will be able to grant access or deny it. + +1. Open `spa/scripts/expenses.js`. You will see a few constants that reference DOM elements (like `loadExpensesButton` and `loadingExpenses`). Right after these constants, add the configuration code for the API. + +```js +// spa/scripts/expenses.js +(async function() { + // ... other constants + const loadingExpenses = document.getElementById('loading-expenses'); + + // Add the code below 👇 + const expensesAPIOptions = { + audience: 'https://expenses-api', + scope: 'read:reports', + }; + + // ... +})(); +``` + +The `expensesAPIOptions` constant is a configuration object that will tell the SPA SDK the audience and scope needed in the access token your application will request. The SDK will try to fetch access tokens capable of consuming the `https://expenses-api` API with the `read:reports` scope. + +2. Request the access token required to retrieve the expenses from the protected API on behalf of the user with the code below. + +```js +// spa/scripts/expenses.js +(async function() { + // ... code from the previous example + + // Add the code below 👇 + try { + const accessToken = await auth0Client.getTokenSilently(expensesAPIOptions); + await loadExpenses(accessToken); + } catch (err) { + if (err.error !== 'consent_required') { + alert('Error while fetching access token. Check browser logs.'); + return console.log(err); + } + + loadExpensesButton.onclick = async () => { + accesstoken = await auth0Client.getTokenWithPopup(expensesAPIOptions); + await loadExpenses(accesstoken); + }; + + consentNeeded.style.display = 'block'; + loadExpensesButton.style.display = 'inline-block'; + loadingExpenses.style.display = 'none'; + } + + // ... +})(); +``` + +The lines above are nested inside a `try/catch` block and are executed when the expenses view is requested. First, the application calls the `getTokenSilently()` method (provided by the SPA SDK) to see if your application is able to fetch a token without involving your user. If your app fetches the access token successfully, the application calls the `loadExpenses()` function with this token to load and display expenses (you will define this function in the next step). + +If your application is not able to fetch an access token (an error occurs, or the user is not logged in), the application checks if the problem is `consent_required`, which means that the user has not given consent to access the API yet. If that is not the case, it means an unknown error has been raised, and your application will alert the user and log the error to the browser’s console. + +If `consent_required` is indeed the problem, then you define the behavior of the `loadExpensesButton` and show the `consentNeeded` and `loadExpensesButton` DOM elements. These DOM elements are responsible for letting the user know that they will need to give your application explicit consent to consume the API on their behalf. More specifically, after reading the message, if your users click the `loadExpensesButton`, your application will trigger the SDK-provided `getTokenWithPopup()` method to open a popup where your users will be able to give consent. + +3. Call the API using the access token with the code below. + +```js +// spa/scripts/expenses.js +(async function() { + // ... code from the previous example + + // Add the code below 👇 + async function loadExpenses(accesstoken) { + try { + const response = await fetch('http://localhost:3001/', { + method: 'GET', + headers: { authorization: 'Bearer ' + accesstoken } + }); + + if (!response.ok) { + throw 'Request status: ' + response.status; + } + + const expenses = await response.json(); + displayExpenses(expenses); + } catch (err) { + console.log(err); + alert('Error while fetching expenses. Check browser logs.'); + } + } + + // ... +})(); +``` + +After fetching an access token (silently or explicitly through the popup), your application will invoke the function above to issue a request to the private API on the user's behalf. Note the `authorization` header passed to the `fetch()` function; this header includes the access token required to consume the expenses API. + +After executing the request to the API, if successful, the `displayExpenses()` function is called. This function creates the DOM elements on the page to represent the expenses and is already defined in the `spa/scripts/expenses.js` file at the bottom. + +4. Open `spa/scripts/navbar.js` and search for the block that gets executed when the user `isAuthenticated`. Inside this block, right after changing the display property of the `logOutButton`, add the code below. This will display a link to the expenses view in the navigation bar when the user is authenticated. + +```js +// spa/scripts/navbar.js +(async function() { + // ... code from the previous example + + const isAuthenticated = await auth0Client.isAuthenticated(); + if (isAuthenticated) { + // ... + + // Add the line below 👇 + expensesLink.style.display = 'inline-block'; + } // ... + +})(); +``` + +5. You are now ready to test the new version of the application. Save all the changes and reload the application in your browser. You should see the **Expenses** link in the navigation bar at the top. + +![Expenses link on single-page application](/media/articles/identity-labs/lab-04-expenses-link-showing.png) + +6. Click **Expenses** link, and you should see the consent prompt. + +![Consent link on single-page application](/media/articles/identity-labs/lab-04-consent-link-showing.png) + +7. Because you have not provided consent yet, you will see an **Allow App to Load Expenses** button. Clicking it will open the consent popup; note that the **Reports** scope is now included. + +![Consent prompt on single-page application](/media/articles/identity-labs/lab-04-consent-prompt.png) + +In the popup, click the **Accept** button to give consent. The popup will close, and your application will get the access token it needs. With this token, the SPA will call the `loadExpenses()` function and show the data retrieved from the API. + +![Expenses API data loading in single-page application](/media/articles/identity-labs/lab-04-expenses-data-showing.png) + +::: note +If you want to recreate the scenario where consent is needed, go to the [Users screen of the Auth0 Dashboard](${manage_url}/#/users), view your test user, click the **Authorized Applications** tab, and click **Revoke** for the single-page application with the Expenses API audience. + +![Revoke application permission for an API](/media/articles/identity-labs/lab-04-revoke-app.png) +::: + +🎉 **You have completed Lab 4 by building a single-page application calling a secure API!** 🎉 + +
      +
      +
      + +← All Identity Labs diff --git a/articles/identity-labs/04-single-page-app/index.md b/articles/identity-labs/04-single-page-app/index.md new file mode 100644 index 0000000000..ad3e3e9c30 --- /dev/null +++ b/articles/identity-labs/04-single-page-app/index.md @@ -0,0 +1,28 @@ +--- +section: exercises +description: Auth0 digital identity Lab 4: Single Page App +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - index + - concept +--- +# Lab 4: Single Page App + +## Prerequisites + +- Read the introduction on the [main Identity Labs page](/identity-labs) +- Watch the [Single Page Apps video](/videos/learn-identity/06-single-page-apps) + +## What You'll Need + +<%= include('../_includes/_what-you-need') %> + +--- + +**For Windows users** - We recommend that you use the Windows PowerShell terminal (instead of the Windows command line) so that the terminal commands provided in the lab instructions work as they are. This is because the syntax of the commands used in the labs is the same for the Mac and PowerShell terminals. + +Start → diff --git a/articles/identity-labs/_includes/_git-clone-note.md b/articles/identity-labs/_includes/_git-clone-note.md new file mode 100644 index 0000000000..53e86ad21e --- /dev/null +++ b/articles/identity-labs/_includes/_git-clone-note.md @@ -0,0 +1,3 @@ +::: note +If you've never cloned a repo before, please see [GitHub's instructions](https://help.github.com/en/articles/cloning-a-repository) on how to do so. +::: diff --git a/articles/identity-labs/_includes/_what-you-need.md b/articles/identity-labs/_includes/_what-you-need.md new file mode 100644 index 0000000000..70bdc1ae49 --- /dev/null +++ b/articles/identity-labs/_includes/_what-you-need.md @@ -0,0 +1,21 @@ +**Node environment** - Install [Node.js](https://nodejs.org) directly or using [Homebrew](https://formulae.brew.sh/formula/node) or [NVM](https://github.com/nvm-sh/nvm) on a Mac. The labs were tested on Node.js v10.15.0 and NPM 6.4.1 (though they may work in other versions as well). + +--- + +**An Auth0 account** - Sign up for a free Auth0 account [here](https://auth0.com/signup). We recommend starting with a new, empty tenant that can be deleted when you have completed the exercises. If you're using an existing test or dev tenant, make sure that all Rules are turned **off** and MFA is turned **off**. + +--- + +**An Auth0 database user** - Use a new username/email and password user in a test database connection instead of a social, enterprise, or passwordless login. While social logins might work, using development keys can cause the labs to run differently. Choose a simple password that's easy to type as you will be logging in and out multiple times. You can use the same user across all of the labs. + +--- + +**A web browser** - This lab was built and tested using Google Chrome; Safari, Firefox, and Edge should all work fine as well. Disable any active ad blockers used for the domain of your local site, as well as for the Auth0 domain from your tenant. + +--- + +**The Identity Labs Git repo** - All the code you need to start, as well as the completed exercise for guidance, is located [here](https://github.com/auth0/identity-102-exercises). You need to clone that repo just once for all four labs. Use the correct folder relative to the lab you are working on. All file references in this lab are relative to `/begin` unless otherwise indicated. An `/end` folder is included as well to help with troubleshooting and compare your work with a working sample. + +--- + +**For macOS users** - If you are new to macOS, check [these quick tips](https://blogs.mulesoft.com/dev/newbie/quick-tips-for-developers-new-to-mac/) for developers new to Mac. Make sure you allow the display of hidden files and become familiar with running basic commands in the terminal. diff --git a/articles/identity-labs/index.md b/articles/identity-labs/index.md new file mode 100644 index 0000000000..cc71bbef74 --- /dev/null +++ b/articles/identity-labs/index.md @@ -0,0 +1,73 @@ +--- +section: exercises +description: Auth0 digital identity labs +topics: + - digital identity + - OIDC + - OpenId Connect + - OAuth2 +contentType: + - index +--- +# Auth0 Identity Labs + + **Welcome to the home for Auth0's digital identity labs!** These exercises serve as a learning tool to be combined with our [Learn Identity video series](/videos/learn-identity). Each lab is meant to be completed once a video (or series of videos) is complete. + +_A few general things to keep in mind as you work through these labs:_ + +**Plan to take around 1 hour or so (longer depending on your coding experience) for each lab.** Optionally, video demonstrations of the lab exercises are available. + +**These labs are designed to illustrate the basic concepts of digital identity, OAuth, and OpenID Connect.** The goal is to see the parameters and data that come together to create a complete authentication flow. As such, take your time and read through each section carefully. Completing the lab successfully is less important than understanding the concepts within. + +**The code samples here should not be used as-is in a production app.** The code here was written for instructional purpose and simplicity. For guidance on integrating Auth0 with a new or existing app, please see the Quickstarts listed on our [documentation home page](/) (choose an application type, then the technology you're using). + +Each lab will have a list of pre-requisites to complete or install. Please take note of specific version numbers as these can have an effect on how the labs work. + +ℹ️ The error messages displayed in the browser and in the console can often clue you into something that is going wrong. Auth0 error pages typically include a link under the "Technical Details" header that will give you more information about what went wrong. A "SyntaxError" line in your terminal window when starting the server indicates a typo or missed line. + +ℹ️ The code samples will indicate what lines to add or modify. In most cases, the order of operations (as in, when a particular line of code runs) matters greatly, so pay attention to those lines and the description above each snippet. + +```js +// lab-01/begin/server.js +// 👆 That is the file you should be in for these changes. + +require('dotenv').config(); +// 👆 This is code that should not be changed. + +// ... other required packages +// 👆 This is information to help you place the new code. + +// Add the code below 👇 +const session = require('cookie-session'); +const { auth } = require('express-openid-connect'); +// 👆 This is what should be added + +// ... +// 👆 This indicates that there is other code after that should not be changed. +``` + +ℹ️ Terminal commands are proceeded by a `❯` character. If you're copying those commands, exclude that character and the space that follows. Exclude all lines that do not start with `❯`; those are there to show the expected output. + +```text +# This line is informational; read but don't use. +❯ this line is the command to copy + +This line shows sample output; read but don't use. +``` + +**And with that, let's get started!** + + diff --git a/articles/integrations/_office-365-deep-linking.md b/articles/integrations/_office-365-deep-linking.md index 1ff44d5745..b6d457ae6e 100644 --- a/articles/integrations/_office-365-deep-linking.md +++ b/articles/integrations/_office-365-deep-linking.md @@ -6,7 +6,7 @@ Certain implementations might require deep linking to SharePoint Online for exam https://login.microsoftonline.com/login.srf?wa=wsignin1.0&whr={YOUR_CUSTOM_DOMAIN}&wreply={DEEP_LINK} ``` -The first parameter, `YOUR_CUSTOM_DOMAIN` should be the domain you've configured in Azure AD for SSO (eg: `fabrikam.com`). By specifying this as the `whr`, Azure AD will know it needs to redirect to Auth0 instead of showing the login page. +The first parameter, `YOUR_CUSTOM_DOMAIN` should be the domain you've configured in Azure AD for Single Sign-on (SSO) (e.g., `fabrikam.com`). By specifying this as the `whr`, Azure AD will know it needs to redirect to Auth0 instead of showing the login page. The `DEEP_LINK` parameter should be an encoded url within Office 365 (like a page in SharePoint Online, Exchange, ...). diff --git a/articles/integrations/apigee.md b/articles/integrations/apigee.md new file mode 100644 index 0000000000..4010377b94 --- /dev/null +++ b/articles/integrations/apigee.md @@ -0,0 +1,59 @@ +# Securing Apigee with Auth0 + +If you are using Apigee Edge for developing and managing your backend service APIs, you can use Auth0 to secure access to your API proxies. + +## Prerequisites + +Before you begin, you'll need to: + +1. Have an [Apigee Edge API proxy](https://docs.apigee.com/api-platform/get-started/get-started) that needs to be secured. +2. [Sign up](https://auth0.com/signup) for an account with Auth0. + +The process of building your API proxy is outside the scope of this article. Instead, we will focus on securing an API proxy that you already have using Auth0. + +## Create a custom API + +First, [register your Apigee Edge API Proxy using the Dashboard](/getting-started/set-up-api). Auth0 needs to recognize Apigee as an audience to make sure that any Access Tokens issued are issued with the correct audience. The user authenticates with Auth0 via the application, and the application specifies this audience value to make sure that the Access Token possesses the right scopes for the audience provided. + +You'll need to do the following: + +1. Provide a name for your API (e.g., `apigee`). +2. Provide an identifier for your API: `urn:apigee:target:api` +3. Choose a [signing algorithm](/tokens/concepts/signing-algorithms): `RS256` (default) + +When you register your Apigee Edge API Proxy, Auth0 also creates a **Machine to Machine (M2M)** application on your behalf and names it to match the API you registered. You can use this application for testing; it is automatically configured to be authorized to call your API. + +## Note variables from the test application + +Switch to the test application created when registering your API and make note of the variables that were set during the process of registering your API and creating the associated M2M application. You will need them for subsequent steps of this tutorial. + +1. Navigate to the [Applications](${manage_url}/#/applications) page in the [Auth0 Dashboard](${manage_url}/), and click the name of your test application. + +2. Scroll down and make note of the following variables: + +* API audience +* Auth0 domain +* Client ID +* Allowed callback URL(s): The URLs to which the user can be redirected after authentication. You can specify multiple URLs by comma-separating them. (This is typically done to handle different environments where each needs its own redirects.) + +## Implement the Client Credentials flow + +Now you're ready to implement the [Client Credentials Flow](/flows/guides/client-credentials/call-api-client-credentials#request-token) to request the Access Tokens you can provide to Apigee Edge. Note that in this scenario, you will use the Client Credentials Flow because you are using Apigee with your backend service APIs, which represents a Machine-to-Machine (M2M) application; other scenarios may require the use of different flows. + +To learn how to log in and get an Access Token that can be used to call Apigee Edge, see [Call API Using the Client Credentials Flow](/flows/guides/client-credentials/call-api-client-credentials). + +## Validate the Access Token + +Once you've requested and received an Access Token from Auth0, you'll be able to use it to call the API proxy you set up with Edge. + +When you [use your Access Token](https://docs.apigee.com/api-platform/security/oauth/using-access-tokens.html), the first thing Apigee Edge will do is [verify the token](https://docs.apigee.com/api-platform/security/oauth/using-access-tokens.html#addingaverifyaccesstokenpolicy). + +Auth0 Access Tokens are [JSON Web Tokens (JWTs)](/tokens/concepts/jwts), so you can take advantage of Apigee Edge's [Verify JWT policy](https://docs.apigee.com/api-platform/reference/policies/verify-jwt-policy#verify-a-jwt-signed-with-the-rs256-algorithm) to do this. + +Apigee Edge will verify the token before anything else happens; if the token is rejected, then all processing will stop and Edge will return an error to the client. + +## Testing + +To test your implementation, make an [HTTP POST call to Apigee Edge](https://docs.apigee.com/api-platform/security/oauth/oauth-20-client-credentials-grant-type.html#callingtheprotectedapi) with the Auth0-issued Access Token included in the header of the call. + +When you receive a successful response, extract the token and review it to verify the inclusion of required/requested user claims. diff --git a/articles/integrations/authenticating-a-tessel-device.md b/articles/integrations/authenticating-a-tessel-device.md index f8cdaa7025..98fa54a29c 100644 --- a/articles/integrations/authenticating-a-tessel-device.md +++ b/articles/integrations/authenticating-a-tessel-device.md @@ -1,5 +1,10 @@ --- description: How to authenticate and authorize a Tessel device with Auth0. +topics: + - integrations + - tessel +contentType: how-to +useCase: integrate-saas-sso --- # Authenticating & Authorizing a Tessel device with Auth0 diff --git a/articles/integrations/authenticating-devices-using-mqtt.md b/articles/integrations/authenticating-devices-using-mqtt.md index 6d4ea78eb3..4484950046 100644 --- a/articles/integrations/authenticating-devices-using-mqtt.md +++ b/articles/integrations/authenticating-devices-using-mqtt.md @@ -1,6 +1,11 @@ --- description: How to authenticate and authorize devices using MQTT with Auth0. toc: true +topics: + - integrations + - mqtt +contentType: how-to +useCase: integrate-saas-sso --- # Authenticating & Authorizing Devices using MQTT with Auth0 @@ -90,7 +95,7 @@ Auth0Mosca.prototype.authenticateWithJWT = function(){ if( username !== 'JWT' ) { return callback("Invalid Credentials", false); } - // console.log('Passsord:'+password); + // console.log('Password:'+password); jwt.verify(password, self.clientSecret, function(err,profile){ if( err ) { return callback("Error getting UserInfo", false); } @@ -107,8 +112,8 @@ Auth0Mosca.prototype.authenticateWithCredentials = function(){ var self = this; return function(client, username, password, callback) { - - var data = { + + var data = { client_id: self.clientId, // {client-name} username: username.toString(), password: password.toString(), @@ -156,7 +161,7 @@ module.exports = Auth0Mosca; ``` -`authenticateWithCredentials` uses the [OAuth2 Resource Owner Password Credential Grant](/protocols#oauth-resource-owner-password-credentials-grant) to authenticate the broker and all connections to it. Each time a `publisher` or a `subscriber` send a __CONNECT__ message to the broker the `authenticate` function is called. In it we call the Auth0 endpoint and forward the device's `username`/`password`. Auth0 validates this against it's account store (that is the first `request.post` in the code). If successful, it validates and parses the Json Web Token to obtain the device profile and adds it to the `client` object that represents either the `subscriber` or the `publisher`. That's done in the `jwt.verify` call. +`authenticateWithCredentials` uses the [OAuth2 Resource Owner Password Credential Grant](/protocols#oauth-resource-owner-password-credentials-grant) to authenticate the broker and all connections to it. Each time a `publisher` or a `subscriber` send a __CONNECT__ message to the broker the `authenticate` function is called. In it we call the Auth0 endpoint and forward the device's `username`/`password`. Auth0 validates this against its account store (that is the first `request.post` in the code). If successful, it validates and parses the JSON Web Token (JWT) to obtain the device profile and adds it to the `client` object that represents either the `subscriber` or the `publisher`. That's done in the `jwt.verify` call. By convention, all devices connected to the broker have an account in Auth0: diff --git a/articles/integrations/aws-api-gateway/custom-authorizers/_aws-dev-guide-link.md b/articles/integrations/aws-api-gateway/custom-authorizers/_aws-dev-guide-link.md new file mode 100644 index 0000000000..d628329c10 --- /dev/null +++ b/articles/integrations/aws-api-gateway/custom-authorizers/_aws-dev-guide-link.md @@ -0,0 +1 @@ +For details, see the Amazon API Gateway developer guide: [Use API Gateway Lambda Authorizers](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html). diff --git a/articles/integrations/aws-api-gateway/custom-authorizers/index.md b/articles/integrations/aws-api-gateway/custom-authorizers/index.md index 714e46d00d..cfa8e782f6 100644 --- a/articles/integrations/aws-api-gateway/custom-authorizers/index.md +++ b/articles/integrations/aws-api-gateway/custom-authorizers/index.md @@ -1,22 +1,34 @@ --- description: How to use secure AWS API Gateway using custom authorizers that accept Auth0-issued Access Tokens +topics: + - integrations + - aws + - api-gateway +contentType: + - index + - concept + - tutorial +useCase: + - secure-an-api --- # Secure AWS API Gateway Endpoints Using Custom Authorizers +<%= include('../../../_includes/_webtask') %> + With AWS, you can create powerful, serverless, highly scalable APIs and applications using [Lambda](https://aws.amazon.com/lambda/), [API Gateway](https://aws.amazon.com/api-gateway/), and a JavaScript application for the front-end. -A serverless application runs custom code as a compute service without the need to maintain an operating environment to host your service. Instead, a service like [AWS Lambda](https://aws.amazon.com/lambda/) or [webtask.io](https://webtask.io) executes your code on your behalf. +A serverless application runs custom code as a compute service without the need to maintain an operating environment to host your service. Instead, a service like [AWS Lambda](https://aws.amazon.com/lambda/) executes your code on your behalf. The API Gateway extends the capabilities of Lambda by adding a service layer in front of your Lambda functions to extend security, manage input and output message transformations, and provide capabilities like throttling and auditing. A serverless approach simplifies your operational demands since concerns like scaling out and fault tolerance are now the responsibility of the compute service that is executing your code. -This tutorial will show you how to set up your API with API Gateway, create and configure your Lambda functions (including the custom authorizers) to secure your API endpoints, and implement the authorization flow so that your users can retrieve the Access Tokens needed to gain access to your API from Auth0. +This tutorial will show you how to set up your API with API Gateway, create and configure your Lambda functions (including the custom authorizers) to secure your API endpoints, and implement the authorization flow so that your users can retrieve the Access Tokens needed to gain access to your API from Auth0. More specifically, the custom authorizers will: 1. Confirm that the Access Token has been passed via the `authorization` header of the request to access the API -2. Verify the [RS256 signature](/apis#signing-algorithms) of the Access Token using a public key obtained via a [JWKS endpoint](/jwks) -3. Ensure the Access Token has the required Issuer `iss` and Audience `aud` claims +2. Verify the [RS256 signature](/apis#signing-algorithms) of the Access Token using a public key obtained via a [JWKS endpoint](/tokens/concepts/jwks) +3. Ensure the Access Token has the required Issuer `iss` and Audience `aud` claims ::: note New to OAuth 2.0? Check out our [introduction to OAuth 2.0](/protocols/oauth2). @@ -31,13 +43,13 @@ To that end, this tutorial will be divided into the following sections. ## How API Gateway Custom Authorizers Work -[According to Amazon](http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html), an API Gateway custom authorizer is a "Lambda function you provide to control access to your API using bearer token authentication strategies, such as OAuth or SAML." +[According to Amazon](http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html), an API Gateway custom authorizer is a "Lambda function you provide to control access to your API using bearer token authentication strategies, such as OAuth or SAML." Whenever someone (or some program) attempts to call your API, API Gateway checks to see if there's a custom authorizer configured for the API. If **there is a custom authorizer for the API**, API Gateway calls the custom authorizer and provides the authorization token extracted from the request header received. -You can use the custom authorizer to implement different types of authorization strategies, including [JWT](/jwt) verification, to return IAM policies authorizing the request. If the policy returned is invalid or if the permissions are denied, the API call fails. +You can use the custom authorizer to implement different types of authorization strategies, including [JWT](/tokens/concepts/jwts) verification, to return IAM policies authorizing the request. If the policy returned is invalid or if the permissions are denied, the API call fails. For a valid policy, API caches the returned policy, associating it with the incoming token and using it for the current and subsequent requests. You can configure the amount of time for which the policy is cached. The default value is `300` seconds, and the maximum length of caching is `3600` seconds (you can also set the value to 0 to disable caching). @@ -45,13 +57,13 @@ For a valid policy, API caches the returned policy, associating it with the inco Before beginning this tutorial, you'll need to [sign up for an AWS account](https://portal.aws.amazon.com/gp/aws/developer/registration/index.html). This grants you access to all of the AWS features we'll use in this tutorial, including API Gateway and Lambda. All new members receive twelve months of free tier access to AWS. -## Further Reading +<%= include('./_aws-dev-guide-link') %> + +## Next steps -::: next-steps * [API Authorization](/api-auth) -* [Obtain an Auth0 Access Token](/tokens/access-token#how-to-get-an-access-token) -* [JSON Web Key Sets (JWKS)](/jwks) -::: +* [Get Access Tokens](/tokens/guides/get-access-tokens) +* [JSON Web Key Sets (JWKS)](/tokens/concepts/jwks) <%= include('./_stepnav', { next: ["Configure the Auth0 API", "/integrations/aws-api-gateway/custom-authorizers/part-1"] diff --git a/articles/integrations/aws-api-gateway/custom-authorizers/part-1.md b/articles/integrations/aws-api-gateway/custom-authorizers/part-1.md index dba78fb534..2c6c36ed24 100644 --- a/articles/integrations/aws-api-gateway/custom-authorizers/part-1.md +++ b/articles/integrations/aws-api-gateway/custom-authorizers/part-1.md @@ -1,5 +1,12 @@ --- -desc: Configure Auth0 for use with AWS API Gateway +description: Configure Auth0 for use with AWS API Gateway +topics: + - integrations + - aws + - api-gateway +contentType: tutorial +useCase: + - secure-an-api --- # AWS API Gateway Tutorial, Part 1: Create an Auth0 API @@ -14,9 +21,9 @@ You'll be asked to provide values for the following fields: | Field | Description | | - | - | -| Name | A friendly name for your API. This is the name you'll see in your list of Auth0 APIs | -| Identifier | A logical identifier for your API (we recommend formatting this identifier like a URL `https://your-api-gateway`) | -| Signing Algorithm | The algorithm you want Auth0 to use to sign the issued Access Tokens | +| Name | A friendly name for your API. This is the name you'll see in your list of Auth0 APIs. | +| Identifier | A logical identifier for your API. We recommend formatting this identifier like a URL `https://your-api-gateway`. | +| Signing Algorithm | The algorithm you want Auth0 to use to sign the issued Access Tokens. To learn more, see [Signing Algorithms](/tokens/concepts/signing-algorithms). | Click **Create** to proceed. diff --git a/articles/integrations/aws-api-gateway/custom-authorizers/part-2.md b/articles/integrations/aws-api-gateway/custom-authorizers/part-2.md index 4aaaa44a66..115172a1dd 100644 --- a/articles/integrations/aws-api-gateway/custom-authorizers/part-2.md +++ b/articles/integrations/aws-api-gateway/custom-authorizers/part-2.md @@ -1,6 +1,13 @@ --- description: Step 2 of Amazon API Gateway Tutorial toc: true +topics: + - integrations + - aws + - api-gateway +contentType: tutorial +useCase: + - secure-an-api --- # AWS API Gateway Tutorial, Part 2: Import and Deploy the API Gateway API @@ -110,7 +117,7 @@ Click on the link to submit the `GET / method` request in a browser. This should ![](/media/articles/integrations/aws-api-gateway-2/part-1/aws-pt1-8.png) -Next, we'll make a call to **GET** under `/pets/{petId}`. In the **Stages** page, expand the tree under **Test**. +Next, we'll make a call to **GET** under `/pets/{petId}`. In the **Stages** page, expand the tree under **Test**. Click **GET** under `/pets/{petId}`. ![](/media/articles/integrations/aws-api-gateway-2/part-1/aws-pt1-9.png) @@ -140,4 +147,4 @@ Now that we have a fully functional API that's managed by API Gateway, we'll... <%= include('./_stepnav', { prev: ["Configure the Auth0 API", "/integrations/aws-api-gateway/custom-authorizers/part-1"], next: ["Create the Custom Authorizers", "/integrations/aws-api-gateway/custom-authorizers/part-3"] -}) %> \ No newline at end of file +}) %> diff --git a/articles/integrations/aws-api-gateway/custom-authorizers/part-3.md b/articles/integrations/aws-api-gateway/custom-authorizers/part-3.md index db09a3574c..0e2584b436 100644 --- a/articles/integrations/aws-api-gateway/custom-authorizers/part-3.md +++ b/articles/integrations/aws-api-gateway/custom-authorizers/part-3.md @@ -1,12 +1,19 @@ --- description: Step 3 of Amazon API Gateway Tutorial toc: true +topics: + - integrations + - aws + - api-gateway +contentType: tutorial +useCase: + - secure-an-api --- # AWS API Gateway Tutorial, Part 3: Create the Custom Authorizers In [part 1](/integrations/aws-api-gateway/custom-authorizers/part-1), we showed you how to configure Auth0 for use with API Gateway, and in [part 2](/integrations/aws-api-gateway/custom-authorizers/part-2) of this tutorial, we showed you how to import, test, and deploy an API using Amazon Web Services' (AWS) API Gateway. In this tutorial, we will show you how to secure this API so that only those with the appropriate authorization may access the back-end behind the API. -To do this, we will be using API Gateway's custom [request] authorizers, which allow you to authorize your APIs using bearer token authorization strategies, such as OAuth 2.0 or SAML. For each incoming request, the following happens: +To do this, we will be using API Gateway's custom [request] authorizers, which allow you to authorize your APIs using bearer token authorization strategies, such as OAuth 2.0 or SAML. For each incoming request, the following happens: 1. API Gateway checks for a properly-configured custom authorizer. 2. API Gateway calls the custom authorizer (which is a Lambda function) with the authorization token. @@ -27,13 +34,13 @@ You can [download a sample custom authorizer](https://github.com/auth0-samples/j | - | - | | **`TOKEN_ISSUER`** | The issuer of the token. If Auth0 is the token issuer, use `https://${account.namespace}/`. Be sure to include the trailing slash.| | **`JWKS_URI`** | The URL of the JWKS endpoint. If Auth0 is the token issuer, use `https://${account.namespace}/.well-known/jwks.json` | -| **`AUDIENCE`** | The **audience** value of the API you created in [part 1](/integrations/aws-api-gateway/custom-authorizers/part-1) | +| **`AUDIENCE`** | The **identifier** value of the API you created in [part 1](/integrations/aws-api-gateway/custom-authorizers/part-1) | As an example, the text of your .env file should look something like this when complete: ```text JWKS_URI=https://${account.namespace}/.well-known/jwks.json -AUDIENCE=hVG7...3QA1q +AUDIENCE=https://your-api-gateway TOKEN_ISSUER=https://${account.namespace}/ ``` @@ -41,7 +48,7 @@ TOKEN_ISSUER=https://${account.namespace}/ a. First, obtain a valid JWT Access Token. There are multiple methods by which you can get one, and the method you choose depends on your application's type, trust level, or overall end-user experience. -You can get a test token for your API by going to **APIs > Your API > Test** in the [dashboard](${manage_url}/#/apis). For specific details refer to [How to get an Access Token](/tokens/access-token#how-to-get-an-access-token). +You can get a test token for your API by going to **APIs > Your API > Test** in the [dashboard](${manage_url}/#/apis). For specific details refer to [Get Access Tokens](/tokens/guides/get-access-tokens). b. Create a local `event.json` file containing the token. You can copy the sample file (run `cp event.json.sample event.json`). Replace `ACCESS_TOKEN` with your JWT token, and `methodArn` with the appropriate ARN value for the `GET` method of your API. @@ -82,31 +89,12 @@ If the value of `Effect` is `Allow`, your authorizer would've allowed the call t The IAM role has the required permissions to call Lambda functions; before we can proceed with our custom authorizer, we'll need to create an IAM role that can call our custom authorizer whenever API Gateway receives a request for access. 1. Log in to AWS and navigate to the [IAM Console](https://console.aws.amazon.com/iam). Click **Roles** in the left-hand navigation bar. - 2. Click **Create new role**. - -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-1.png) - -3. Under **AWS Service Role**, find the **AWS Lambda** row and click the associated **Select** button. - -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-2.png) - -4. On the **Attach Policy** screen, select the **AWSLambdaRole**. You can use the provided filter to narrow down the list of options. Click **Next Step** to proceed. - -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-4.png) - -5. On **Set role name and review**, provide a **Role name**, such as `Auth0Integration`. Leave the rest of the fields as is. Click **Create role**. - -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-5.png) - +3. Under **AWS service** select the **AWS Lambda** row and click the **Next: Permissions** button. +4. On the **Attach permissions policy** screen, select the **AWSLambdaRole**. You can use the provided filter to narrow down the list of options. Click **Next: Tags**, then click **Next: Review** to proceed. +5. On the **Review** screen, provide a **Role name**, such as `Auth0Integration`. Leave the rest of the fields as is. Click **Create role**. 6. Once AWS has created your role, you'll be directed back to the **Roles** page of IAM. Select your new role. - -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-6.png) - 7. On the **Summary** page for the role you've just created, click on to the **Trust relationships** tab. - -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-8.png) - 8. Click **Edit trust relationship**, and populate the **Policy Document** field with the following JSON snippet: ```json @@ -145,65 +133,39 @@ Now that you've configured your custom authorizer for your environment and teste ![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-11.png) -3. On the **Select blueprint** page, click **Author from scratch** to create a blank function. - -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-12.png) - -4. On the **Configure triggers** page, click **Next** (you don't need to configure a trigger). - -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-13.png) - -5. On the **Configure function** page, you'll provide all of the information needed for your new Lambda function. Under **Basic information**, provide values for the following parameters: +3. On the **Select blueprint** page, click **Author from scratch** to create a blank function. Under **Basic information**, provide values for the following parameters: | **Parameter** | **Value** | | - | - | | **Name** | A name for your Lambda function, such as `jwtRsaCustomAuthorizer` | | **Description** | A description for your Lambda function (optional) | -| **Runtime** | Select `Node.js 4.3` | +| **Runtime** | Select `Node.js 10.x` | -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-14.png) +![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-12.png) -a. Next, provide the function code. Under **Code entry type**, select **Upload a .ZIP file**. Click **Upload** and select the `custom-authorizer.zip` bundle you created earlier. +4. Click **Create Function** to continue. -b. Then, create the following three **Environment variables**. Note that this information is identical to that which is the `.env` file. +![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-13.png) + +5. On the **Configuration** page of your function, scroll down to the **Function Code** section. +6. Select **Upload a .ZIP file** as the **Code entry type**. +7. Click **Upload** and select the `custom-authorizer.zip` bundle you created earlier. +8. Then, create the following three **Environment variables**. Note that this information is identical to that which is the `.env` file. | **Parameter** | **Value** | | - | - | | **`TOKEN_ISSUER`** | The issuer of the token. If Auth0 is the token issuer, use `https://${account.namespace}/` | | **`JWKS_URI`** | The URL of the JWKS endpoint. If Auth0 is the token issuer, use `https://${account.namespace}/.well-known/jwks.json` | -| **`AUDIENCE`** | The **audience** value of the API you created in [part 1](/integrations/aws-api-gateway/custom-authorizers/part-1) | - -c. In the **Lambda function handler and role** section, set the following values: - -| **Parameter** | **Value** | -| - | - | -| **Handler** | `index.handler` | -| **Role** | `Choose an existing role` | -| **Existing role** | Select the IAM role you created in the steps above. | - -d. Open up the **Advanced settings** area, and set **Timeout** to **30** sec. - -When you've provided all of the information above, click **Next**. - -e. Review the information you've provided for your Lambda function. If everything looks correct, click **Create function**. - -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-15.png) - -If AWS successfully creates your function, you'll see the following. +| **`AUDIENCE`** | The **identifier** value of the API you created in [part 1](/integrations/aws-api-gateway/custom-authorizers/part-1) | -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-16.png) +9. In the **Execution role** section, select **Use an existing role** then select the IAM role you created previously as the **Existing role**. -6. Test the Lambda function you just created. Click **Test** in the top right corner. - -7. Copy the contents of your `event.json` file into the Input test event JSON (you can use the default "Hello World" template). - -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-17.png) - -Click **Save and test**. If the test was successful, you'll see the following. - -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-18.png) - -Expanding the output window should show a message similar to the one you received after your successful local test. +10. Under **Basic settings** set **Timeout** to **30** sec. +11. Click **Save**. +12. Test the Lambda function you just created. Click **Test** in the top right corner. +13. Copy the contents of your `event.json` file into the **Configure test event** form. You can use the default "Hello World" event template. +14. Click **Create**. +15. Run your test by selecting it and clicking **Test**. If the test was successful, you'll see: "Execution result: succeeded". Expanding the output window should show a message similar to the one you received after your successful local test. ![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-19.png) @@ -217,30 +179,23 @@ Open the **PetStore** API we created earlier. ![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-22.png) -Using the left-hand navigation bar, open **Authorizers**. If this is the first authorizer you've created, you'll see the **New custom authorizer** configuration screen by default. If not, you can bring up this screen by clicking **Create > Custom Authorizer** on the center panel. - -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-23.png) - -Set the following parameters: +Using the left-hand navigation bar, open **Authorizers** and select **Create New Authorizer** then set the following parameters: | **Parameter** | **Value** | | - | - | -| **Lambda region** | Use the region for the Lambda function you created previously | -| **Lambda function** | `jwtRsaCustomAuthorizer` | -| **Authorizer name** | `jwt-rsa-custom-authorizer` | -| **Execution role** | The IAM Role ARN you copied above | -| **Identity token source** | `Authorization` | -| **Token validation expression** | `^Bearer [-0-9a-zA-z\.]*$` | -| **Result TTL in seconds** | `3600` | - -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-24.png) +| **Name** | `jwt-rsa-custom-authorizer` | +| **Type** | Select **Lambda** | +| **Lambda Region** | Use the region for the Lambda function you created previously | +| **Lambda Function** | `jwtRsaCustomAuthorizer` | +| **Lambda Invoke Role** | The IAM Role ARN you copied above | +| **Lambda Event Payload** | Select **Token** | +| **Token Source** | `Authorization` | +| **Token Validation** | `^Bearer [-0-9a-zA-z\.]*$` | +| **TTL (seconds)** | `3600` | Click **Create**. -After AWS creates the authorizer and the page refreshes, you'll see a new **Test your authorizer** section at the bottom of the screen. You can test your authorizer by providing the Auth0 token (`Bearer ey...`) you've previously used and clicking **Test**. - -![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-25.png) - +After AWS creates the authorizer and the page refreshes, test your authorizer by clicking **Test** and providing the Auth0 token (`Bearer ey...`) you previously used. If the test was successful, you'll see a response similar to the following. ![](/media/articles/integrations/aws-api-gateway-2/part-2/pt2-26.png) diff --git a/articles/integrations/aws-api-gateway/custom-authorizers/part-4.md b/articles/integrations/aws-api-gateway/custom-authorizers/part-4.md index 4895ae2e1a..148a41cca0 100644 --- a/articles/integrations/aws-api-gateway/custom-authorizers/part-4.md +++ b/articles/integrations/aws-api-gateway/custom-authorizers/part-4.md @@ -1,5 +1,12 @@ --- description: How to set your API methods to use your custom authorizer +topics: + - integrations + - aws + - api-gateway +contentType: tutorial +useCase: + - secure-an-api --- # AWS API Gateway Tutorial, Part 4: Secure the API Using Custom Authorizers @@ -10,13 +17,15 @@ In [part 1](/integrations/aws-api-gateway/custom-authorizers/part-1), you config Log in to AWS and navigate to the [API Gateway Console](http://console.aws.amazon.com/apigateway). +<%= include('./_aws-dev-guide-link') %> + ![](/media/articles/integrations/aws-api-gateway-2/part-3/pt3-1.png) ::: note Custom authorizers are set on a method by method basis; if you want to secure multiple methods using a single authorizer, you'll need to repeat the following instructions for each method. ::: -Open the **PetStore** API we created in [part 2](/integrations/aws-api-gateway-2/part-2) of this tutorial. Under the **Resource** tree in the center pane, select the **GET** method under the `/pets` resource. +Open the **PetStore** API we created in [part 2](/integrations/aws-api-gateway/part-2) of this tutorial. Under the **Resource** tree in the center pane, select the **GET** method under the `/pets` resource. ![](/media/articles/integrations/aws-api-gateway-2/part-3/pt3-2.png) @@ -24,7 +33,7 @@ Select **Method Request**. ![](/media/articles/integrations/aws-api-gateway-2/part-3/pt3-3.png) -Under **Settings**, click the **pencil** icon to the right **Authorization** and choose the `jwt-rsa-custom-authorizer` custom authorizer you created in [part 3](/integrations/aws-api-gateway-2/part-3). +Under **Settings**, click the **pencil** icon to the right **Authorization** and choose the `jwt-rsa-custom-authorizer` custom authorizer you created in [part 3](/integrations/aws-api-gateway/part-3). ![](/media/articles/integrations/aws-api-gateway-2/part-3/pt3-4.png) diff --git a/articles/integrations/aws-api-gateway/delegation/_delegation-version-warning.md b/articles/integrations/aws-api-gateway/delegation/_delegation-version-warning.md new file mode 100644 index 0000000000..f42507d886 --- /dev/null +++ b/articles/integrations/aws-api-gateway/delegation/_delegation-version-warning.md @@ -0,0 +1,5 @@ +::: version-warning +This feature uses delegation. By default, delegation is disabled for tenants without an add-on in use as of 8 June 2017. If you are not already using delegation, please use the drop-down to learn how to implement custom authorizers instead. + +Legacy tenants who currently use an add-on that requires delegation may continue to use this feature. If delegation functionality is changed or removed from service at some point, customers who currently use it will be notified beforehand and given ample time to migrate. +::: \ No newline at end of file diff --git a/articles/integrations/aws-api-gateway/delegation/index.md b/articles/integrations/aws-api-gateway/delegation/index.md index 1164c8fd2c..64c61344ab 100644 --- a/articles/integrations/aws-api-gateway/delegation/index.md +++ b/articles/integrations/aws-api-gateway/delegation/index.md @@ -1,23 +1,31 @@ --- title: Amazon API Gateway Tutorial Introduction description: How to build a serverless application using Token-based Authentication with AWS API Gateway and Lambda. +topics: + - integrations + - aws + - api-gateway +contentType: + - tutorial + - index +useCase: + - secure-an-api --- - # Build a Serverless Application Using Token-Based Authentication with AWS API Gateway and Lambda -::: version-warning -Delegation is considered deprecated in Auth0. Please integrate Auth0 using custom authorizers. Use the drop-down to switch to these docs. -::: +<%= include('./_delegation-version-warning') %> + +<%= include('../../../_includes/_webtask') %> With AWS, you can create powerful, serverless, highly scalable APIs and applications through AWS Lambda, Amazon API Gateway, and a JavaScript application. -A serverless application runs custom code as a compute service without the need to maintain an operating environment to host your service. Instead, a service like [AWS Lambda](https://aws.amazon.com/lambda/) or [webtask.io](https://webtask.io) executes your code on your behalf. +A serverless application runs custom code as a compute service without the need to maintain an operating environment to host your service. Instead, a service like [AWS Lambda](https://aws.amazon.com/lambda/) executes your code on your behalf. Amazon API Gateway extends the capabilities of AWS Lambda by adding a service layer in front of your Lambda functions to extend security, manage input and output message transformations, and provide capabilities like throttling and auditing. A serverless approach simplifies your operational demands, since concerns like scaling out and fault tolerance are now the responsibility of the compute service that is executing your code. However, you often want to tie your APIs to your existing users, either from social providers like Twitter and Facebook, or within your own organization from Active Directory or a customer database. This tutorial demonstrates how to authorize access of your Amazon API Gateway methods for your existing users using Auth0 delegation for AWS and integration with AWS Identity and Access Management (IAM). -Next, the tutorial walks you through setting up the Amazon API Gateway using AWS Lambda functions, securing those functions with AWS IAM roles, and then using Auth0 delegation to obtain a token for the AWS IAM role. It will then show you how to assign different permissions to various classes of users, like internal database or social users, and how to flow identity using a JSON Web Token (JWT). +Next, the tutorial walks you through setting up the Amazon API Gateway using AWS Lambda functions, securing those functions with AWS IAM roles, and then using Auth0 delegation to obtain a token for the AWS IAM role. It will then show you how to assign different permissions to various classes of users, like internal database or social users, and how to flow identity using a JSON Web Token (JWT). You will be taken through the following steps: diff --git a/articles/integrations/aws-api-gateway/delegation/part-1.md b/articles/integrations/aws-api-gateway/delegation/part-1.md index df1887f009..145d08c4e6 100644 --- a/articles/integrations/aws-api-gateway/delegation/part-1.md +++ b/articles/integrations/aws-api-gateway/delegation/part-1.md @@ -1,12 +1,17 @@ --- title: AWS API Gateway Tutorial - Set Up the Amazon API Gateway description: Step 1 of Amazon API Gateway Tutorial +topics: + - integrations + - aws + - api-gateway +contentType: tutorial +useCase: + - secure-an-api --- # AWS API Gateway Tutorial -::: version-warning -Delegation is considered deprecated in Auth0. Please integrate Auth0 using custom authorizers. Use the drop-down to switch to these docs. -::: +<%= include('./_delegation-version-warning') %> ## Step 1 - Set up the Amazon API Gateway diff --git a/articles/integrations/aws-api-gateway/delegation/part-2.md b/articles/integrations/aws-api-gateway/delegation/part-2.md index 877bd10143..e96b9a1882 100644 --- a/articles/integrations/aws-api-gateway/delegation/part-2.md +++ b/articles/integrations/aws-api-gateway/delegation/part-2.md @@ -1,12 +1,17 @@ --- title: Amazon API Gateway Tutorial - Adding Security and Deploying description: Step 2 of Amazon API Gateway Tutorial +topics: + - integrations + - aws + - api-gateway +contentType: tutorial +useCase: + - secure-an-api --- # AWS API Gateway Tutorial -::: version-warning -Delegation is considered deprecated in Auth0. Please integrate Auth0 using custom authorizers. Use the drop-down to switch to these docs. -::: +<%= include('./_delegation-version-warning') %> ## Step 2 - Secure and Deploy the Amazon API Gateway @@ -14,9 +19,9 @@ Now that you have your API running, you need to add security. In this step, you * Secure the update API to limit access to authenticated users with a specific AWS IAM role; * Configure Auth0 delegation to use AWS IAM federation capabilities; -* Obtain an AWS Access Token that uses the AWS IAM role. +* Obtain an AWS Access Token that uses the AWS IAM role. -Once your API is secure, you'll build a serverless, single page application (SPA). The SPA will rely on federating identity to determine which users are allowed access. By combining AWS IAM Integration for AWS Gateway API, AWS IAM Identity Federation for SAML, and Auth0 Delegation for AWS, you can enable users from many different sources, including Social Providers or enterprise connections, to access your APIs. The following diagram illustrates a sample flow using a SAML-based Identity Provider and Auth0 SAML Federation and Delegation for AWS. +Once your API is secure, you'll build a serverless, single-page application (SPA). The SPA will rely on federating identity to determine which users are allowed access. By combining AWS IAM Integration for AWS Gateway API, AWS IAM Identity Federation for SAML, and Auth0 Delegation for AWS, you can enable users from many different sources, including Social Providers or enterprise connections, to access your APIs. The following diagram illustrates a sample flow using a SAML-based Identity Provider and Auth0 SAML Federation and Delegation for AWS. ![Authentication Flow](/media/articles/integrations/aws-api-gateway/auth-flow.png) @@ -54,7 +59,7 @@ Log in to your Auth0 account. You will be brought to the Management Dashboard. C ![Auth0 Management Dashboard](/media/articles/integrations/aws-api-gateway/part-2/mgmt-dashboard.png) -Name your new application *AWS API Gateway*, and indicate that this Application is going to be a *Single Page Application*. Click **Create**. +Name your new application *AWS API Gateway*, and indicate that this Application is going to be a *Single-Page Application*. Click **Create**. ![Create Application](/media/articles/integrations/aws-api-gateway/part-2/create-new-client.png) @@ -183,7 +188,7 @@ Click the edit icon beside the **Authorization Type**, and select *AWS_IAM*. Now ### 2. Set Up CORS and Deploy the API -Our Single Page Application (SPA) will access web API methods from a domain different from that of the page. The *Cross-Origin Resource Sharing* setting needs to explicitly permit this action for the browser to allow access to the AWS API Gateway. Typically, the browser will first issue an `OPTIONS` request to see what actions the site will permit. +Our Single-Page Application (SPA) will access web API methods from a domain different from that of the page. The *Cross-Origin Resource Sharing* setting needs to explicitly permit this action for the browser to allow access to the AWS API Gateway. Typically, the browser will first issue an `OPTIONS` request to see what actions the site will permit. Select `/pets` under Resources, and click **Create Method**. In the drop-down, select **OPTIONS**, and click the **checkmark** to save the setting. diff --git a/articles/integrations/aws-api-gateway/delegation/part-3.md b/articles/integrations/aws-api-gateway/delegation/part-3.md index fbfc58c453..f2049e1858 100644 --- a/articles/integrations/aws-api-gateway/delegation/part-3.md +++ b/articles/integrations/aws-api-gateway/delegation/part-3.md @@ -1,16 +1,21 @@ --- title: Amazon API Gateway Tutorial - Building the App description: Step 3 of Amazon API Gateway Tutorial +topics: + - integrations + - aws + - api-gateway +contentType: tutorial +useCase: + - secure-an-api --- # AWS API Gateway Tutorial -::: version-warning -Delegation is considered deprecated in Auth0. Please integrate Auth0 using custom authorizers. Use the drop-down to switch to these docs. -::: +<%= include('./_delegation-version-warning') %> ## Step 3 - Build the Application -In this step, you will build a single page, serverless application using the AngularJS framework that you will serve out of an AWS S3 bucket configured to act as a static website. +In this step, you will build a single-page, serverless application using the AngularJS framework that you will serve out of an AWS S3 bucket configured to act as a static website. ### 1. Set Up Your Sample Application @@ -51,11 +56,11 @@ You should also see the page for viewing pets. ### Use Delegation to Get an AWS Token -At this point, you have authentication set up with Auth0, and you have an OpenId JWT. Here is the directory structure for the generated code: +At this point, you have authentication set up with Auth0, and you have an OpenID JWT. Here is the directory structure for the generated code: ![S3 website directory structure](/media/articles/integrations/aws-api-gateway/aws-api-gateway-project.png) -You can use Auth0's delegation capability to obtain an AWS Access Token that is based on the Auth0 identity token. Behind the scenes, Auth0 authenticates your identity token, and then uses SAML based on the addon that you configured. +You can use Auth0's delegation capability to obtain an AWS Access Token that is based on the Auth0 identity token. Behind the scenes, Auth0 authenticates your identity token, and then uses SAML based on the addon that you configured. Update `pets/login/login.js` as follows to get an AWS delegation token from the identity token after a successful signin with `auth.signin`. Note that you are treating any user not logged in using a Social Connection as an admin. Later, we'll code a second role and show better ways to enforce role selection. diff --git a/articles/integrations/aws-api-gateway/delegation/part-4.md b/articles/integrations/aws-api-gateway/delegation/part-4.md index 0993354a10..8e2766db92 100644 --- a/articles/integrations/aws-api-gateway/delegation/part-4.md +++ b/articles/integrations/aws-api-gateway/delegation/part-4.md @@ -1,12 +1,17 @@ --- title: Amazon API Gateway Tutorial - Using Multiple Roles description: Step 4 of Amazon API Gateway Tutorial +topics: + - integrations + - aws + - api-gateway +contentType: tutorial +useCase: + - secure-an-api --- # AWS API Gateway Tutorial -::: version-warning -Delegation is considered deprecated in Auth0. Please integrate Auth0 using custom authorizers. Use the drop-down to switch to these docs. -::: +<%= include('./_delegation-version-warning') %> ## Step 4 - Use Multiple Roles with Amazon API Gateway @@ -26,7 +31,7 @@ The following diagram illustrates AWS IAM role assignments for two different use ![AWS Roles in Use](/media/articles/integrations/aws-api-gateway/roles-in-use.png) -For cases where you want to make decisions within your code (for example, you might want a credit check of a user buying a pet), you will want to flow identity as well. This will be demonstrated below in [Step 5 - Using Identity Tokens to Flow Identity](/integrations/aws-api-gateway/part-5). +For cases where you want to make decisions within your code (for example, you might want a credit check of a user buying a pet), you will want to flow identity as well. This will be demonstrated below in [Step 5 - Using Identity Tokens to Flow Identity](/integrations/aws-api-gateway/delegation/part-5). ### 1. Create the PetPurchase API Resource @@ -170,14 +175,14 @@ If you haven't used Login with Amazon before, there is also a link called **How Once you've entered the appropriate information, click **Try** to ensure that everything is set up correctly. ::: note -When you configure LWA using the Amazon console, be sure to enter into *Allowed Return URLs* the callback URL to your Auth0 Application, which should look something like `https://johndoe.auth0.com/login/callback`. The Auth0 help page will show you specifically what to enter. +When you configure LWA using the Amazon console, be sure to enter into *Allowed Return URLs* the callback URL to your Auth0 Application, which should look something like `https://johndoe.auth0.com/login/callback`. The Auth0 help page will show you specifically what to enter. ::: In the Auth0 Dashboard, go back to **Applications**, select your Application, and then open up the **Connections** page. Ensure that *amazon* is enabled under Social Connections. ![AWS Connections](/media/articles/integrations/aws-api-gateway/part-4/aws-connections.png) -#### Deploy the API and Update the Single Page Application +#### Deploy the API and Update the Single-Page Application ##### Deploy the API @@ -222,7 +227,7 @@ function buyPet(user, id) { … ``` -Copy the code to your S3 bucket, log out, and then log back in in as a social user by clicking on the Amazon icon in the Lock login dialog. You may need to click **SHOW ALL** if your previous login persists in the Lock pane. +Copy the code to your S3 bucket, log out, and then log back in in as a social user by clicking on the Amazon icon in the Lock login dialog. You may need to click **SHOW ALL** if your previous login persists in the Lock pane. ![Login using AWS](/media/articles/integrations/aws-api-gateway/part-4/login-using-amazon.png) diff --git a/articles/integrations/aws-api-gateway/delegation/part-5.md b/articles/integrations/aws-api-gateway/delegation/part-5.md index 036f52bfca..0b8697e298 100644 --- a/articles/integrations/aws-api-gateway/delegation/part-5.md +++ b/articles/integrations/aws-api-gateway/delegation/part-5.md @@ -1,18 +1,23 @@ --- title: Amazon API Gateway Tutorial - Flowing Identity description: Step 5 of Amazon API Gateway Tutorial +topics: + - integrations + - aws + - api-gateway +contentType: tutorial +useCase: + - secure-an-api --- # AWS API Gateway Tutorial -::: version-warning -Delegation is considered deprecated in Auth0. Please integrate Auth0 using custom authorizers. Use the drop-down to switch to these docs. -::: +<%= include('./_delegation-version-warning') %> ## Step 5 - Use Identity Tokens to Flow Identity In this final step, you will: -* Flow identity to the service by passing your OpenID JSON Web Token (JWT); +* Flow identity to the service by passing your OpenID JSON Web Token (JWT); * Validate the token; * Extract profile information to assign a buyer for a pet. @@ -37,7 +42,7 @@ There are several ways of adding a user's information to the JWT. The following One way to add a user's email address to the JWT is to use a [rule](/rules). This is a good approach if you want to make sure that this value is always available in the JWT for an authenticating user. -In `login.js`, you can see this scope specified in the parameters passed to `auth.signin`: +In `login.js`, you can see this scope specified in the parameters passed to `auth.signin`: ```js $scope.login = function() { @@ -162,7 +167,7 @@ In this tutorial, you have: * Created an API using AWS API Gateway that includes methods using AWS Lamdba functions; * Secured access to your API using IAM roles; -* Integrated a SAML identity provider with IAM to tie access to the API to your user base; +* Integrated a SAML identity provider with IAM to tie access to the API to your user base; * Provided different levels of access based on whether a user authenticated from the Database or Social Connection; * Used an Auth0 rule to enforce role assignment; * Used a JWT to provide further authorization context and pass identity information into the appropriate Lambda function. diff --git a/articles/integrations/aws-api-gateway/delegation/secure-api-with-cognito.md b/articles/integrations/aws-api-gateway/delegation/secure-api-with-cognito.md index 72c5c1e8de..09bdb2005f 100644 --- a/articles/integrations/aws-api-gateway/delegation/secure-api-with-cognito.md +++ b/articles/integrations/aws-api-gateway/delegation/secure-api-with-cognito.md @@ -1,6 +1,14 @@ --- title: Amazon API Gateway Tutorial - Secure AWS API Gateway Using Cognito description: How to secure the API Gateway Tutorial using Cognito instead of IAM roles and policies. +topics: + - integrations + - aws + - api-gateway + - cognito +contentType: tutorial +useCase: + - secure-an-api --- # Secure AWS API Gateway Using Cognito @@ -27,7 +35,7 @@ To configure your authorizer: 1. Choose the **Cognito region** in which you created your User Pool. 2. Customize the **Authorizer name** field, if desired (it will be automatically populated with the name of the chosen User Pool, so you can opt to leave it as is) -3. Customize the **Identity token source** field. By default, this field is set to `method.request.header.Authorization`, which sets the the name of the incoming request header containing the API caller's identity token to `Authorization`. +3. Customize the **Identity token source** field. By default, this field is set to `method.request.header.Authorization`, which sets the name of the incoming request header containing the API caller's identity token to `Authorization`. 4. If desired, add a regular expression to the **App client ID regex** field to validate client IDs associated with the User Pool. When you've finished configuring your authorizer, click **Create** to integrate the User Pool with your API. diff --git a/articles/integrations/aws/aws-api-setup.md b/articles/integrations/aws/aws-api-setup.md index 68da2facad..4612c92ce4 100644 --- a/articles/integrations/aws/aws-api-setup.md +++ b/articles/integrations/aws/aws-api-setup.md @@ -2,10 +2,15 @@ description: How to Set Up AWS for Delegated Authentication url: /aws-api-setup toc: true +topics: + - integrations + - aws +contentType: how-to +useCase: secure-an-api --- # How to Set Up AWS for Delegated Authentication -The doc will walk you through setting up AWS for delegated authentication. You'll need to perform these steps any time you want to use Auth0 with AWS. Note that this tutorial does not walk you through a full integration. See the [Enable SSO to the AWS Console](/aws/integrations/sso) or [API Gateway](/integrations/aws-api-gateway) tutorials for complete examples. +This doc will walk you through setting up AWS for delegated authentication. You'll need to perform these steps any time you want to use Auth0 with AWS. Note that this tutorial does not walk you through a full integration. See the [Configure Single Sign-on (SSO) with the AWS Console](/integrations/aws/sso) or [API Gateway](/integrations/aws-api-gateway) tutorials for complete examples. ## Step 1: Create a SAML Provider in AWS @@ -17,7 +22,7 @@ Set the following parameters: | Parameter | Description and Sample Value | | - | - | -| Provider Type | The type of provider. Set as `SAML` | +| Provider Type | The type of provider. Set as `SAML` | | Provider Name | A descriptive name for the provider, such as `auth0SamlProvider` | | Metadata Document | Upload the file containing the Auth0 metadata, found in **Dashboard > Applications > Application Settings > Advanced Settings > Endpoints > SAML Metadata URL** | @@ -122,4 +127,4 @@ In the IAM console, navigate to [Roles](https://console.aws.amazon.com/iam/home# ### Next Steps -* [AWS Services Supported by IAM](http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_SpecificProducts.html). \ No newline at end of file +* [AWS Services Supported by IAM](http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_SpecificProducts.html). diff --git a/articles/integrations/aws/index.md b/articles/integrations/aws/index.md index 6c59531d37..e61b193cd1 100644 --- a/articles/integrations/aws/index.md +++ b/articles/integrations/aws/index.md @@ -2,6 +2,13 @@ classes: topic-page title: Amazon Web Services (AWS) url: /integrations/aws +topics: + - integrations + - aws +contentType: index +useCase: + - secure-an-api + - integrate-third-party-apps ---
      @@ -14,7 +21,7 @@ url: /integrations/aws \ No newline at end of file diff --git a/articles/integrations/aws/session-tags.md b/articles/integrations/aws/session-tags.md new file mode 100644 index 0000000000..d147362eae --- /dev/null +++ b/articles/integrations/aws/session-tags.md @@ -0,0 +1,152 @@ +--- +title: Use AWS Session Tags with AWS APIs and Resources +description: Learn how to use AWS Session Tags to implement role-based access control (RBAC) for AWS APIs and Resources. +toc: true +topics: + - integrations + - aws + - session-tags + - rbac +contentType: how-to +useCase: + - secure-an-api + - integrate-third-party-apps + - integrate-saas-sso +--- +# Use AWS Session Tags with AWS APIs and Resources + +With AWS Session Tags, you can tag resources and assign users key/value pairs, which allows you to implement role-based access control (RBAC) for AWS APIs and Resources. + +In the example included in this guide, we will tag our AWS resources with AWS Session Tags, then create a policy for an AWS IAM role that will allow users with this role and the appropriate tags to perform specific actions on our AWS resources. We will then create a rule in Auth0 that will attach our AWS IAM role and appropriate AWS Session Tags to an Auth0 user and pass them through SAML assertions in the token. This example builds on the example provided in our [Configure Single-Sign-on (SSO) with the AWS Console](/integrations/aws/sso) guide. + +## Prerequisites + +::: panel Amazon Web Services (AWS) Account +Before proceeding, you will need a valid [Amazon Web Services (AWS) account](https://portal.aws.amazon.com/billing/signup#/start) for which you are an administrator. +::: + +**Before beginning this guide:** + +* [Configure Single Sign-on (SSO) with the AWS Console](/integrations/aws/sso) +* [Set up some AWS VM Instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html#ec2-launch-instance). For the example in this guide, we use three separate instances. + +## Steps + +To use AWS Session Tags with AWS APIs and Resources, you must: + +1. [Tag AWS instances](#tag-aws-instances) +2. [Create a specialized AWS IAM role](#create-a-specialized-AWS-IAM-role) +3. [Create an Auth0 rule](#create-an-auth0-rule) +4. [Test your setup](#test-your-setup) + +### Tag AWS instances + +First, you'll need to add tags to your AWS resources. To learn how to do so, follow instructions in [Amazon Elastic Compute Cloud User Guide for Linux Instances: Adding and Deleting Tags on an Individual Resource](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#adding-or-deleting-tags). + +For the example in this guide, you should have created three instances. Add the following tags: + +| Instance | Tags | +| -------- | ---- | +| 1  | Key: `CostCenter`, Value: `marketing`.
      Key: `Project`, Value: `website`. | +| 2  | Key: `CostCenter`, Value: `engineering`.
      Key: `Project`, Value: `management_dashboard`. | +| 3  | Key: `CostCenter`, Value: `marketing`.
      Key: `Project`, Value: `community_site`. | + +### Create a specialized AWS IAM role + +Now, create an IAM role using the AWS SAML identity provider you set up during the [prerequisites for this guide](#prerequisites).  + +To learn how to set up an IAM user role with AWS, follow [AWS Identity and Access Management User Guide: Creating a Role for SAML 2.0 Federation (Console)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html). + +While setting up your role, make sure you use the following parameters: + +| Parameter | Description and Sample Value | +| --------- | ---------------------------- | +| SAML Provider | Name of the identity provider you created in the prerequisites, such as `auth0SamlProvider`. Select **Allow programmatic and AWS Management Console access**. | + +When asked to **Attach permissions policies**, create a policy with the following JSON and name it `VirtualMachineAccessByCostCenter`. + +```json +{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "ec2:DescribeInstances" + ], + "Resource": "*" + }, + { + "Effect": "Allow", + "Action": [ + "ec2:StartInstances", + "ec2:StopInstances" + ], + "Resource": "*", + "Condition": { + "StringEquals": { + "ec2:ResourceTag/CostCenter": "<%= "${aws:PrincipalTag/CostCenter}" %>" + } + } + } + ] +} +``` + +Once the policy has been created, refresh the policy list for the role, then filter and select the new policy. + +When reviewing your settings, make sure you use the following parameters: + +| Parameter | Description |  +| --------- | ----------- | +| Role name | Descriptive name for your role, such as `AccessByCostCenter`. | +| Role description | Description of the purpose for which your role is used. | + +### Create an Auth0 rule + +To map the AWS role and tags to a user, you'll need to create a [rule](/rules) in Auth0. These values will then be passed through the SAML assertions in the token. + +For the example in this guide, [create the following rule](/dashboard/guides/rules/create-rules): + +::: note +Notice that you'll need to replace the `awsAccount` variable value with your own account number. +::: + +```js +function(user, context, callback) { + var awsAccount = '013823792818'; + var rolePrefix = `arn:aws:iam::` + awsAccount; + var samlIdP = rolePrefix + `:saml-provider/auth0SamlProvider`; + + user.awsRole = rolePrefix + `:role/AccessByCostCenter,` + samlIdP; + user.awsRoleSession = user.email; + user.awsTagKeys = ['CostCenter', 'Project']; + user.CostCenter = 'marketing'; + user.Project = 'website'; + + context.samlConfiguration.mappings = { + 'https://aws.amazon.com/SAML/Attributes/Role': 'awsRole', + 'https://aws.amazon.com/SAML/Attributes/RoleSessionName': 'awsRoleSession', + 'https://aws.amazon.com/SAML/Attributes/PrincipalTag:CostCenter': 'CostCenter', + 'https://aws.amazon.com/SAML/Attributes/PrincipalTag:Project': 'Project' + }; + + callback(null, user, context); +} +``` + +### Test your setup + +You should now be able to log in to the AWS Console using an Auth0 user and test your implementation. + +To log in, you will need the SSO login for the AWS Console. To find it: + +1. Navigate to the [Applications](${manage_url}/#/applications) page in the [Auth0 Dashboard](${manage_url}/), and click the name of the Application to view. + +2. Click **Add-ons**, then the **SAML2 Web App** add-on. + +3. Click the **Usage** tab, and locate **Identity Provider Login URL**. Navigate to the indicated URL. + +Once you have signed in, from **EC2**, select **Instances**. Click one of the instances tagged with a `CostCenter` of `marketing`, and click **Actions** > **Instance State** > **Stop**. Notice that the action completes successfully. + +Next, click the instance tagged with a `CostCenter` of `engineering`, and click **Actions** > **Instance State** > **Stop**. Notice that the action fails with an error. diff --git a/articles/integrations/aws/sso.md b/articles/integrations/aws/sso.md index 76c9b4e137..cd4f6d2506 100644 --- a/articles/integrations/aws/sso.md +++ b/articles/integrations/aws/sso.md @@ -1,25 +1,43 @@ --- -description: How to use SSO with AWS +description: Learn how to use Single Sign-on (SSO) with AWS using the SAML2 Web App addon. toc: true +topics: + - integrations + - aws + - sso +contentType: how-to +useCase: + - secure-an-api + - integrate-third-party-apps + - integrate-saas-sso --- -# Enable SSO to the AWS Console +# Configure Single Sign-On with the AWS Console By integrating Auth0 with AWS, you'll allow your users to log in to AWS using any supported [identity provider](/identityproviders). +## Configure external Identity Provider in AWS + +Set up an external identity provider in AWS using AWS's [Connect to your External Identity Provider](https://docs.aws.amazon.com/singlesignon/latest/userguide/manage-your-identity-source-idp.html) doc--with one slight change. Rather than downloading the AWS metadata file, click **Show Individual Metadata Values**, and copy the **AWS SSO issuer URL** and **AWS SSO ACS URL**. You will use these in the next section. + +Leave this page open in your browser, as you'll need to complete configuration in a future section. + ## Configure Auth0 -Log in to the [Management Dashboard](${manage_url}/#/applications), and create a new [Application](/application) (you can also use an existing Application if you'd like). On the **Addons** tab, enable the **SAML2 Web App** addon. +1. Log in to the [Auth0 Dashboard](${manage_url}/#/applications), and create a new [Application](/application) (you can also use an existing Application if you'd like). On the **Addons** tab, enable the **SAML2 Web App** addon. -![](/media/articles/integrations/aws/addons.png) + ![Applications](/media/articles/dashboard/guides/app-list.png) -You'll be asked to configure this add-on using the pop-up that appears immediately after you've enabled the SAML2 Web App. +2. When the configuration pop-up appears, on the **Settings** tab, populate **Application Callback URL** with `https://signin.aws.amazon.com/saml`. -On the **Settings** tab, populate **Application Callback URL** with `https://signin.aws.amazon.com/saml` and paste the following SAML configuration code into **Settings**: + ![SAML2 Web App Settings](/media/articles/integrations/aws/configure.png) + +Then paste the following SAML configuration code into **Settings**. Be sure to replace the AWS_SSO_ISSUER_URL and AWS_SSO_ACS_URL placeholders with the values you copied from AWS in the previous section. ```js { - "audience": "https://signin.aws.amazon.com/saml", + "audience": "AWS_SSO_ISSUER_URL", + "destination": "AWS_SSO_ACS_URL", "mappings": { "email": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress", "name": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" @@ -28,85 +46,55 @@ On the **Settings** tab, populate **Application Callback URL** with `https://sig "passthroughClaimsWithNoMapping": false, "mapUnknownClaimsAsIs": false, "mapIdentities": false, - "nameIdentifierFormat": "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent", + "nameIdentifierFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", "nameIdentifierProbes": [ "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" ] } ``` -![](/media/articles/integrations/aws/configure.png) - -Scroll to the bottom and click **Save**. - -Click over to the **Usage** tab. You'll need to configure Auth0 as the identity provider (IdP) for AWS, which requires you to provide the appropriate metadata to AWS. You can obtain a file containing this information by clicking **Identity Provider Metadata**. - -![](/media/articles/integrations/aws/idp-download.png) - -## Configure AWS - -At this point, you're ready to continue the configuration process from the AWS side. - -Log in to AWS, and navigate to the [IAM console](https://console.aws.amazon.com/iam). Using the left-hand navigation menu, select **Identity Providers**. Click **Create Provider**. +3. Scroll to the bottom, and click **Enable**. -![](/media/articles/integrations/aws/create-provider.png) +4. Click over to the **Usage** tab. You'll need to complete your AWS configuration of Auth0 as the external identity provider (IdP) in the next section, which requires you to provide the appropriate metadata to AWS. To download a file containing this information, click **Identity Provider Metadata**. -Set the following parameters: + ![SAML2 Web App Usage](/media/articles/integrations/aws/idp-download.png) -| Parameter | Description and Sample Value | -| - | - | -| Provider Type | The type of provider. Set as `SAML` | -| Provider Name | A descriptive name for the provider, such as `auth0SamlProvider` | -| Metadata Document | Upload the file containing the Auth0 metadata you downloaded in the previous step here. | +## Complete external Identity Provider configuration in AWS -![](/media/articles/integrations/aws/aws-configure-provider.png) +Return to the AWS SSO page you left open during the first section, and upload the metadata file you downloaded and saved in the previous section. Review and Confirm that you are changing the identity source. -Click **Next Step**. Verify your settings and click **Create** if everything is correct. +## Create an AWS IAM Role -![](/media/articles/integrations/aws/create-provider-confirm.png) +To use the provider, you must create an IAM role using the provider in the role's trust policy. -To use the provider, you must create an IAM role using the provider in the role's trust policy. +1. In the sidebar, under **Access Management**, navigate to **[Roles](https://console.aws.amazon.com/iam/home#/roles)**. Click **Create Role**. -In the IAM console, navigate to [Roles](https://console.aws.amazon.com/iam/home#/roles). Click **Create New Role**. +2. On the next page, you will be asked to select the type of trusted entity. Select **SAML 2.0 Federation**. -![](/media/articles/integrations/aws/iam-new-role.png) +3. When prompted, set the provider you created above as the **SAML provider**. Select **Allow programmatic and AWS Management Console access**. Click **Next** to proceed. -On the **Select role type** page, select **Role for identity provider access**. +4. On the **Attach Permission Policies** page, select the appropriate policies to attach to the role. These define the permissions that users granted this role will have with AWS. For example, to grant your users read-only access to IAM, filter for and select the `IAMReadOnlyAccess` policy. Once you are done, click **Next Step**. -![](/media/articles/integrations/aws/select-role-type.png) +5. The third **Create Role** screen is **Add Tags**. You can use tags to organize the roles you create if you will be creating a significant number of them. -Click **Select** for the **Grant Web Single Sign-On (WebSSO) access to SAML providers** option. When prompted, set the provider you created above as the **SAML provider** and click **Next Step** to proceed. +6. On the **Review** page, set the **Role Name** and review your settings. Provide values for the following parameters: -![](/media/articles/integrations/aws/select-saml-provider-to-trust.png) + | Parameter | Definition | + | - | - | + | Role name | A descriptive name for your role | + | Role description | A description of what your role is used for | -On the **Verify Role Trust** page, accept the **Policy Document** proposed (this policy tells IAM to trust the Auth0 SAML IdP). Click **Next Step**. - -On **Attach Policy**, select the appropriate policies to attach to the role. These define the permissions that users granted this role will have with AWS. For example, to grant your users read-only access to IAM, filter for and select the `IAMReadOnlyAccess` policy. Click **Next Step**. - -Finally, set the role name and review your settings. Provide values for the following parameters: - -| Parameter | Definition | -| - | - | -| Role name | A descriptive name for your role | -| Role description | A description of what your role is used for | - -Review the **Trusted entities** and **Policies** information, then click **Create Role**. - -![](/media/articles/integrations/aws/iam-review-role.png) - -At this point, you'll have created the necessary role to associate with your provider. +7. Review the **Trusted entities** and **Policies** information, then click **Create Role**. At this point, you'll have created the necessary role to associate with your provider. ## Map the AWS Role to a User ::: note -For an example of how to define a server-side rule for assigning a role in an advanced use case, see the [Amazon API Gateway tutorial](/integrations/aws-api-gateway). +For an example of defining a server-side rule that assigns a role in an advanced use case, see the [Amazon API Gateway tutorial](/integrations/aws-api-gateway). ::: -The **AWS roles** specified will be associated with an **IAM policy** that enforces the type of access allowed to a resource, including the AWS Consoles. To map an AWS role to a user, you'll need to create a [rule](/rules) for this purpose. +The **AWS roles** specified will be associated with an **IAM policy** that enforces the type of access allowed to a resource, including the AWS Consoles. To learn more about roles and policies, see [Creating IAM Roles](http://docs.aws.amazon.com/IAM/latest/UserGuide/roles-creatingrole.html). -::: note -For more information on roles and policies, see [Creating IAM Roles](http://docs.aws.amazon.com/IAM/latest/UserGuide/roles-creatingrole.html). -::: +To map an AWS role to a user, you'll need to create a [rule](/rules): ```js function (user, context, callback) { @@ -126,9 +114,9 @@ function (user, context, callback) { In the code snippet above, `user.awsRole` identifies the AWS role and the IdP. The AWS role identifier comes before the comma, and the IdP identifier comes after the comma. -There are multiple ways by which you can obtain these two values. In the example above, both of these values are hard-coded into the rules. You might also store these values in the [user profile](/user-profile), or you might derive them using other attributes. +Your rule can obtain these two values in multiple ways. You can get these values from the IAM Console by selecting the items you created in AWS in the previous steps from the left sidebar. Both the Identity Provider and the Role you created have an ARN available to copy if you select them in the Console. -For example, if you're using Active Directory, you can map properties associated with users, such as `group` to the appropriate AWS role: +In the example above, both of these values are hard-coded into the rule. Alternatively, you might also store these values in the [user profile](/users/concepts/overview-user-profile) or derive them using other attributes. For example, if you're using Active Directory, you can map properties associated with users, such as group to the appropriate AWS role: ```js var awsRoles = { @@ -144,7 +132,7 @@ context.samlConfiguration.mappings = { }; ``` -### Mapping Multiple Roles +### Map Multiple Roles You can also assign an array to the role mapping (so you'd have `awsRoles = [ role1, role2 ]` instead of `awsRoles: role1`) @@ -213,10 +201,11 @@ function (user, context, callback) { } ``` -## Test Your Setup - -You are now set up for single sign-on to AWS. You can find the `Identity Provider Login URL` on the [Management Dashboard](${manage_url}). Open up your [application](${manage_url}/#/applications) to the **SAML2 Addon** settings area, and click over to the **Usage** tab. +## Test setup -![](/media/articles/integrations/aws/idp-download.png) +You are now set up for Single Sign-on (SSO) to AWS and can test your setup. -To test the single sign-on, navigate to the URL indicated. You should be redirected to the Auth0 sign in page. If you successfully sign in, you'll be redirected again, this time to AWS. +1. Go to [Auth0 Dashboard > Application](${manage_url}/#/applications), and click the name of your application. +2. Click the **Addons** tab, and select the **SAML2 Web App** add-on. +3. Click the **Usage** tab. +4. Navigate to the **Identity Provider Login URL**. You should be redirected to the Auth0 login page. If you successfully sign in, you'll be redirected again--this time to AWS. diff --git a/articles/integrations/aws/tokens.md b/articles/integrations/aws/tokens.md index ef46fc997b..cd984901df 100644 --- a/articles/integrations/aws/tokens.md +++ b/articles/integrations/aws/tokens.md @@ -1,12 +1,19 @@ --- description: How to call AWS APIs and Resources Using Tokens toc: true +topics: + - integrations + - aws + - tokens +contentType: tutorial +useCase: + - secure-an-api + - integrate-third-party-apps + - integrate-saas-sso --- # Call AWS APIs and Resources Securely with Tokens -::: panel-warning Legacy Grant Types -As of 8 June 2017, new Auth0 customers cannot add any of the legacy grant types to their applications, which are required for use with the [Delegation endpoint](/api/authentication#get-token-info). Legacy grant types are only available for previous customers while they migrate to new flows, to avoid breaking changes. To find the secure alternative for your case refer to [Secure Alternatives to the Legacy Grant Types](/applications/application-grant-types#secure-alternatives-to-the-legacy-grant-types). If you have any questions about which alternative you should use, please contact [Support](${env.DOMAIN_URL_SUPPORT}). -::: +<%= include('../../_includes/_uses-delegation') %> Auth0 integrates with the AWS Security Token Service (STS) to obtain an limited-privilege credentials for AWS Identity and Access Management (IAM) users or for users that you authenticate (federated users). These credentials can then be used to call the AWS API of any Auth0-supported [identity provider](/identityproviders). @@ -30,7 +37,7 @@ Log in to Auth0's Management Dashboard, navigate to the [Applications](${manage_ ![](/media/articles/integrations/aws/aws-addon.png) ::: panel Username Length with AWS -Users of Auth0's database or a custom database should note that [AWS usernames must be between 2-64 characters in length](http://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_saml.html#troubleshoot_saml_invalid-rolesessionname). If you're using an Auth0 database, you can enforce this by setting your [username length settings](/connections/database/require-username#length) accordingly. If you're using a custom database, you can implement a similar policy within your application. +Users of Auth0's database or a custom database should note that [AWS usernames must be between 2-64 characters in length](http://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_saml.html#troubleshoot_saml_invalid-rolesessionname). If you're using an Auth0 database, you can enforce this by setting your [username length settings](/connections/database/require-username#length) accordingly. If you're using a custom database, you can implement a similar policy within your application. ::: #### IAM policy @@ -57,13 +64,13 @@ The following is a sample AWS IAM policy: } ``` -The IAM policy is a dynamic policy that gives access to a folder in a bucket. The folder name is set based on an attribute of the digitally-signed SAML token that Auth0 exchanges with AWS on your behalf. +The IAM policy is a dynamic policy that gives access to a folder in a bucket. The folder name is set based on an attribute of the digitally-signed SAML token that Auth0 exchanges with AWS on your behalf. The `<%= "${saml:sub}" %>` will be automatically mapped from the authenticated user (`sub` means `subject` and is equal to the user identifier), which allows the *original* identity of the user to be used throughout your app and AWS. ### Get the AWS Token for an Authenticated User -When a user successfully authenticates, Auth0 returns an `id_token`, which is a [JWT](/jwt)). This `id_token` is then used to request an Auth0 and AWS token using the delegation endpoint. +When a user successfully authenticates, Auth0 returns an ID Token, which is a [JWT](/tokens/concepts/jwts)). This ID Token is then used to request an Auth0 and AWS token using the delegation endpoint. Here is a sample request on the delegation endpoint: diff --git a/articles/integrations/azure-api-management/configure-auth0.md b/articles/integrations/azure-api-management/configure-auth0.md index 74a89eb908..d8eb7151d5 100644 --- a/articles/integrations/azure-api-management/configure-auth0.md +++ b/articles/integrations/azure-api-management/configure-auth0.md @@ -1,6 +1,13 @@ --- description: Configure Auth0 for use as an OAuth 2.0 server to authenticate users wanting access to an API managed by the Azure API Management service toc: true +topics: + - integrations + - azure + - api-management +contentType: tutorial +useCase: + - secure-an-api --- # Configure Auth0 @@ -14,7 +21,7 @@ To use Auth0 as an [OAuth 2.0 authorization server](/protocols/oauth2#oauth-role An API is an entity that represents an external resource that's capable of accepting and responding to requests made by applications. You'll need to create an [Auth0 API](/apis) using the Management Dashboard to represent the API managed by Azure's API Management Service that you want secured by Auth0. -You'll also need a [Machine to Machine Application](/applications#application-types), which represents your application and allows use of Auth0 for authentication. When you create an API, Auth0 automatically creates an associated Machine to Machine Application by default. +You'll also need a [Machine to Machine Application](/applications), which represents your application and allows use of Auth0 for authentication. When you create an API, Auth0 automatically creates an associated Machine to Machine Application by default. To begin, you'll need to log into the Auth0 Management Dashboard. Go the [APIs](${manage_url}/#/apis) and click **Create API**. @@ -25,8 +32,8 @@ Set the following parameters to create your new API: | Parameter | Description | | --------- | ----------- | | Name | A descriptive name for your API. In this example, we'll use `Basic Calculator` | -| Identifier | A logical and unique identifier for your API. We recommend using a URL, but it doesn't have to be a publicly-available URL since Auth0 doesn't call your API. You cannot modify this value at a later point. We'll use `basic-calculator` | -| Signing Algorithm | The method used to sign the tokens issued by Auth0. Choose from `HS256` and `RS256` (we'll use the latter for this example). If you choose `RS256`, Auth0 signs your tokens with your private key. See [Signing Algorithms](/apis#signing-algorithms) for additional information | +| Identifier | A logical and unique identifier for your API. We recommend using a URL, but it doesn't have to be a publicly-available URL since Auth0 doesn't call your API. You cannot modify this value at a later point. We'll use `basic-calculator`. | +| Signing Algorithm | The method used to sign the tokens issued by Auth0. Choose from `HS256` and `RS256` (we'll use the latter for this example). If you choose `RS256`, Auth0 signs your tokens with your private key. To learn more, see [Signing Algorithms](/tokens/concepts/signing-algorithms). | When complete, click **Create**. @@ -38,7 +45,6 @@ When your API is ready, you'll be shown the **Quick Start** page for the API. Sw ## Step 2: Create a Connection -After you've created your API and your Application, you'll need to create a [Connection](/applications/connections), which is a source of users. For the purposes of this example, we'll create a [Database Connection](/connections/database). ::: note If you already have a set of users, you may [import them](/extensions/user-import-export) or create a [custom database connection](https://auth0.com/docs/connections/database/mysql). @@ -64,7 +70,7 @@ Once Auth0 has created your Connection, you'll be redirected to your Connection' Finally, we'll create a user that we use later on to test the integration. -Go to the [Users section]((${manage_url}/#/users)) of the Management Dashboard. Click **Create User**. +Go to the [Users section](${manage_url}/#/users) of the Management Dashboard. Click **Create User**. ![](/media/articles/integrations/azure-api-mgmt/auth0/user.png) diff --git a/articles/integrations/azure-api-management/configure-azure.md b/articles/integrations/azure-api-management/configure-azure.md index 9b6bdcdaa2..fd8219189b 100644 --- a/articles/integrations/azure-api-management/configure-azure.md +++ b/articles/integrations/azure-api-management/configure-azure.md @@ -1,6 +1,13 @@ --- description: Configure Azure to accept Auth0 for use as an OAuth 2.0 server to authenticate users wanting access to an API managed by the Azure API Management service toc: true +topics: + - integrations + - azure + - api-management +contentType: tutorial +useCase: + - secure-an-api --- # Configure Azure @@ -18,9 +25,7 @@ In this section, you'll: ## Step 1: Create Your API Management Instance -To create a new API management service, click on **New** > **Web + Mobile** > **API management**. - -![](/media/articles/integrations/azure-api-mgmt/azure/azure-portal-api-management.png) +To create a new API management service, click **Create a resource** in the left-hand navigation bar. Once redirected, click **Web** > **API Management**. You'll be asked to provide the following configuration variables: @@ -32,87 +37,55 @@ You'll be asked to provide the following configuration variables: | Location | Choose the location that services your API instance | | Organization name | The name of your organization | | Administrator email | The email address of the person who will be administering this instance | -| Pricing tier | The pricing tier you want, which determines the number of calls you can make to your API, as well as the maximum amount of data transfer allowed | +| Pricing tier | The pricing tier you want, which determines the number of calls you can make to your API, as well as the maximum amount of data transfer allowed. You must opt for the [Developer plan](https://azure.microsoft.com/en-us/pricing/details/api-management/) or higher; the Consumption plan does not offer sufficient functionality for this integration to work. | -![](/media/articles/integrations/azure-api-mgmt/azure/api-mgmt-service-config.png) +You can also choose to **Enable Application Insights**. If you do, select the **Application Insights instance** you would like to use. Click **Create** to begin provisioning your service. -![](/media/articles/integrations/azure-api-mgmt/azure/deployment-in-progress.png) - ## Step 2: Import Your API For this tutorial, we will be importing and using the Calculator API provided by Microsoft. You can, however, create your own API instead of using the Calculator API. -Launch the API Management service that you created in the previous step. - -![](/media/articles/integrations/azure-api-mgmt/azure/api-mgmt-service-home.png) - -Open up the Publisher Portal, and click on **Import API**. +For detailed instructions on how to do so, see [Import and Publish Your First API](https://docs.microsoft.com/en-us/azure/api-management/import-and-publish#go-to-your-api-management-instance) -![](/media/articles/integrations/azure-api-mgmt/azure/publisher-portal.png) - -You'll be importing an API **from URL**. - -![](/media/articles/integrations/azure-api-mgmt/azure/import-api.png) - -Set the following parameters: - -| Parameter | Description | -| --------- | ----------- | -| Specification document URL | The URL Azure will use to retrieve your API's specification. For this example, use `http://calcapi.cloudapp.net/calcapi.json`. | -| Specification format | The API specification format. Use `Swagger`. | -| New/Existing API | set this to **New** | -| Web API URL suffix | The value appended to the base URL of your API management service that uniquely identifies the API you're currently creating, such as `calc` | -| Web API URL scheme | The protocol used to access your API (for this example, set this to `HTTPs`) | -| Products | Add this API to the `Starter` product. This is a basic, getting-started-with-Azure container that holds your sample products and applies entry-level rate limits to your calls. | - -![](/media/articles/integrations/azure-api-mgmt/azure/import-api-config.png) - -When done, click **Save** to import your API. You'll be redirected to the summary page for your API when it's fully imported. - -![](/media/articles/integrations/azure-api-mgmt/azure/basic-calc-api.png) +When done, click **Create** to import your API. You'll be redirected to the summary page for your API when it's fully imported. ## Step 3: Configure Your OAuth 2.0 Authorization Server To use Auth0 to secure your API, you'll need to register Auth0 as an OAuth 2.0 Authorization Server. You can do so using the Azure Publisher Portal. -Navigate to **Security** > **OAuth 2.0**. - -![](/media/articles/integrations/azure-api-mgmt/azure/oauth2-servers.png) +Find the **Security** area of your API Management service instance's near left navigation bar, and click **OAuth 2.0**. -Click on **Add Authorization Server**. You'll see the configuration screen that lets you provide details about your Auth0 tenant. +Click on **Add**. You'll see the **Add OAuth2 service** configuration screen that lets you provide details about your Auth0 tenant. -![](/media/articles/integrations/azure-api-mgmt/azure/new-oauth2-server-config.png) - -For the purposes of this example, we'll use the **Authorization Code grant type**, but you're free to use whichever grant type is most appropriate for your use case. Azure currently supports the following grant types: [Authorization Code](/api-auth/grant/authorization-code), [Implicit](/api-auth/grant/implicit), [Resource Owner Password](/api-auth/grant/password), [Client Credentials](/api-auth/grant/client-credentials). +For the purposes of this example, we'll use the **Authorization Code grant type**, but you're free to use whichever grant type is most appropriate for your use case. Azure currently supports the following grant types: [Authorization Code](/flows/concepts/auth-code), [Implicit](/flows/concepts/implicit), [Resource Owner Password](/api-auth/grant/password), [Client Credentials](/flows/concepts/client-credentials). Set the following parameters: | Parameter | Description | | --------- | ----------- | -| Name | A descriptive name for your authorization server, such as `Auth0` | +| Display name | A descriptive name for your authorization server, such as `Auth0` | +| Id | The identifying name for this Azure resource -- this field should auto-populate based on the display name you provide | | Description | A description for your authorization server, such as `Auth0 API Authentication` | -| Application registration page URL | The page where users can create or manage their accounts; for the purposes of this example, we'll use `https://placeholder.contoso.com` as the placeholder | +| Client registration page URL | The page where users can create or manage their accounts; for the purposes of this example, we'll use `https://placeholder.contoso.com` as the placeholder | | Authorization code grant types | The grant type used for authorization. Select `authorization code` | -| Authorization endpoint URL | The URL Azure uses to make the authorization request. See the [Auth0 docs on generating the URL](/api-auth/tutorials/authorization-code-grant#1-get-the-user-s-authorization) | +| Authorization endpoint URL | The URL Azure uses to make the authorization request. See the [Auth0 docs on generating the URL](/flows/guides/auth-code/call-api-auth-code#authorize-the-user) | | Authorization request method | The HTTP method used by Azure to make the authorization request. By default, this is `GET` | -| Token endpoint URL | The endpoint used to exchange authorization grants for Access Tokens; Auth0's can be reached at `https://auth0user.auth0.com/oauth/token` | -| Application authentication methods | Method used to authenticate the application; Auth0's is `BASIC` | +| Token endpoint URL | The endpoint used to exchange authorization grants for Access Tokens; Auth0's can be reached at `https://auth0user.auth0.com/oauth/token` | +| Client authentication methods | Method used to authenticate the application; Auth0's is `BASIC` | | Access Token sending method | The location of the Access Token in the sending method (typically the **Authorization header**) | -| Default scope | Specify a default scope (if necessary) | +| Default scope | Specify a default scope (if necessary) | Because we're using the **authorization code** grant, we'll need to provide the **client ID** and **client secret** for the [Auth0 Application we previously registered](/integrations/azure-api-management/configure-auth0#step-1-create-an-api-and-machine-to-machine-application). You can find both values in the [Application Settings](${manage_url}/#/applications/${account.clientId}/settings). -Once you've provided both the client ID and client secret, you'll see an auto-generated **redirect URI**. Copy this URL, since you'll need to provide this URI in your Auth0 Application Settings page in the Allowed Callback URLs section. +Once you've provided both the client ID and client secret, you'll see an auto-generated **redirect URI**. Copy this URL, since you'll need to provide this URI in your Auth0 Application Settings page in the Allowed Callback URLs section. ::: note If you're using the [resource owner password](/api-auth/grant/password) flow, you'll need to provide the **resource owner username** and **resource owner password** instead of the client ID and secret. ::: -When complete, click **Save** to persist your changes. - -![](/media/articles/integrations/azure-api-mgmt/azure/new-server-saved.png) +When complete, click **Create** to persist your changes. ### Set the Allowed Callback URL @@ -124,53 +97,37 @@ Click **Save**. ## Step 4: Authorize Auth0 for Use with Your API -Before you can use Auth0 to secure your API, you'll need to set your API to use Auth0. You can do so using the Azure Publisher Portal. - -Begin by navigating to the APIs tab, and select the Basic Calculator API. - -![](/media/articles/integrations/azure-api-mgmt/azure/api-list.png) +Before you can use Auth0 to secure your API, you'll need to set your API to use Auth0. -Click over to the **Security** tab. +In the near-left navigation column, click **APIs**. Select the Basic Calculator API; this redirects you to the **Design** tab. -![](/media/articles/integrations/azure-api-mgmt/azure/security.png) +Click over to the **Settings** tab. -Under **User Authorization**, select **OAuth 2.0**. In the new **Authorization Server** field that appears, select the server you configured in the previous step. - -![](/media/articles/integrations/azure-api-mgmt/azure/set-auth0-as-authserver.png) +Scroll to the **Security** section, and under **User Authorization**, select **OAuth 2.0**. In the **Authorization Server** field that appears, select the server you configured in the previous step. Click **Save**. ## Step 5: Test Your Integration -While logged in to the Azure Portal, open up your instance of the API Management Service. Click **Developer Portal** to launch the developer-facing side of your APIs. - -![](/media/articles/integrations/azure-api-mgmt/azure/developer-portal.png) - -Go to APIs > Basic Calculator (or the API you've created for this tutorial). +While logged in to the Azure Portal, open up your instance of the API Management Service. Click **Developer Console** to launch the developer-facing side of your APIs. -![](/media/articles/integrations/azure-api-mgmt/azure/dev-portal-apis.png) +Go to APIs > Basic Calculator (or the API you've created for this tutorial). This opens up to the page where you can make a `GET` call that allows you to add two integers. -This opens up to the page where you can make a `GET` call that allows you to add two integers. - -![](/media/articles/integrations/azure-api-mgmt/azure/dev-portal-calculator.png) - -Click Try It. This will bring up the page where you can provide the parameters for your call. +Click **Try It**. This will bring up the page where you can provide the parameters for your call. Scroll down to the **Authorization** section. Next to the **Auth0** field, select **Authorization Code**. -![](/media/articles/integrations/azure-api-mgmt/azure/dev-portal-try-it.png) - At this point, you'll see the Auth0 login widget in a popup window (if you don't, disable your popup blocker). Provide the credentials for the Auth0 user you created earlier in the tutorial, and sign in. -![](/media/articles/integrations/azure-api-mgmt/azure/dev-portal-auth.png) - If you were able to successfully sign in, you'll see a message appear with the expiration date of the Access Token you need to call the API. -![](/media/articles/integrations/azure-api-mgmt/azure/dev-portal-token.png) - Scroll to the bottom, and click **Send** to send your request. If successful, you'll see a message containing the `HTTP 200` response at the bottom of the page. -![](/media/articles/integrations/azure-api-mgmt/azure/dev-portal-200-response.png) +## Configure a JWT validation policy for Access Tokens + +In the previous step, the user is prompted to sign in when they try to make a call from the Developer Console. The Developer Console attempts to obtain an Access Token on behalf of the user to be included in the API request. All Access Tokens will be passed to the API via the `Authorization` header. + +If you want to validate the Access Token included with each request, you can do so by using the [Validate JWT](https://docs.microsoft.com/en-us/azure/api-management/api-management-access-restriction-policies#ValidateJWT) policy. Please refer to Microsoft's documentation on [setting an API Management policy](https://docs.microsoft.com/en-us/azure/api-management/set-edit-policies). ## Summary @@ -179,7 +136,7 @@ In this tutorial, you: 1. Configured your Auth0 tenant to act as an OAuth 2.0 server. 2. Set up an API Management Service in Azure. 3. Imported an API that's managed by Azure's API Management Service. -4. Secured your API using Auth0. +4. Secured your API using Auth0 and (optionally) verified the Access Token. <%= include('./_stepnav', { prev: ["1. Configure Auth0", "/integrations/azure-api-management/configure-auth0"] diff --git a/articles/integrations/azure-api-management/index.md b/articles/integrations/azure-api-management/index.md index 5eb9c2eb7d..f3419f00af 100644 --- a/articles/integrations/azure-api-management/index.md +++ b/articles/integrations/azure-api-management/index.md @@ -1,5 +1,12 @@ --- description: Using Auth0 as an OAuth 2.0 server to authenticate users wanting access to an API managed by the Azure API Management service +topics: + - integrations + - azure + - api-management +contentType: tutorial +useCase: + - secure-an-api --- # Integrate Azure API Management Service with Auth0 diff --git a/articles/integrations/azure-tutorial.md b/articles/integrations/azure-tutorial.md index fe86d8bceb..e3f8078c28 100644 --- a/articles/integrations/azure-tutorial.md +++ b/articles/integrations/azure-tutorial.md @@ -1,41 +1,47 @@ --- description: How to use Auth0 with Microsoft Azure. url: /azure-tutorial +topics: + - integrations + - microsoft + - azure +contentType: +- how-to +- index +useCase: integrate-saas-sso --- # Using Auth0 with Microsoft Azure -From an Auth0 integration perspective, the code is the same, regardless of where your app is running: on Microsoft Azure or your local dev environment. +Auth0 is as simple to integrate in an application deployed on [Microsoft Azure](https://azure.microsoft.com) as it is for any other environment. To get started, please see: -To integrate applications supported by the Microsoft Azure platform, consider these tutorials: - -* [ASP.NET application](/server-platforms/aspnet)
      +* [ASP.NET application](/quickstart/backend/aspnet-core-webapi-v1_1)
      Simple non-intrusive integration with any version of ASP.NET. -* [Node.js application](/server-platforms/nodejs)
      +* [Node.js application](/quickstart/backend/nodejs)
      Integration using [passport](http://passportjs.org/). -* [Microsoft Azure Mobile Services](http://blog.auth0.com/2013/03/17/Authenticate-Azure-Mobile-Services-apps-with-Everything-using-Auth0/)
      -Blog post explaining how to integrate with a Microsoft Azure Mobile Services backend. - --- ### Tip: change Auth0 configuration when deploying to Microsoft Azure -There is one consideration that you might want to take into account when deploying to Microsoft Azure (or any other environment). +You'll need to make some configuration changes when deploying to Microsoft Azure. Auth0 recommends creating one application per environment (e.g. Development, Test, Production). This is because each environment should have and use a different `Client Id` and `Client Secret`, as well as the appropriate `Callback URL`. -We recommend creating one application per environment in Auth0 (such as "Dev", "Test", "QA", and so on). +For ASP.NET applications, we recommend utilizing [Web.config transformations](http://msdn.microsoft.com/en-us/library/dd465326.aspx) to make configuration changes targeted for each environment. Application settings that appear in the transformed `web.config` will depend on the build target name used at compilation and deployment. -Each application has a different `Client Id` and `Client Secret` and can be configured with a different callback URL. You can use the [Web.config transformations](http://msdn.microsoft.com/en-us/library/dd465326.aspx) to apply a transformation depening on the Build Configuration you use. For instance +The following is an example of how you can compile and deploy your application. The example focuses on deploying to Production, but you can use it to create builds in your ASP.NET application targeting your other environments. -`Web.config` -``` + +This is the base configuration in `Web.config`: + +```xml ``` -`Web.Release.config` -``` +The following snippet, `Web.Release.config`, contains the necessary transformations. We want to utilize the `Release` build and are targeting Production. + +```xml @@ -45,9 +51,9 @@ Each application has a different `Client Id` and `Client Secret` and can be conf ``` -Then, whenever you have to reference the ClientID, Secret or callback, you use this syntax: +If you need to refer to the `Client Id`, `Client Secret` or `Callback URL`, you can do so using the [`ConfigurationManager`](https://docs.microsoft.com/en-us/dotnet/api/system.configuration.configurationmanager?view=netframework-4.7.2) class. Below is an example of using the `ConfigurationManager` within an ASP.NET MVC Razor view. -``` +```html ``` -Whether you deploy to Microsoft Azure Web Sites or a Cloud Service the Web.config transformation will run. +Running `web.config` transformations are helpful whether deploying to a [Microsoft Azure App Service](https://azure.microsoft.com/en-us/services/app-service/) or a [Microsoft Azure Cloud Service](https://azure.microsoft.com/en-us/services/cloud-services/). ::: note -To test your web.config transforms you can use this [awesome tool](http://webconfigtransformationtester.apphb.com/). +Use the [Web.config Transformation Tester](http://webconfigtransformationtester.apphb.com/) to verify the results of any `web.config` transformations. ::: diff --git a/articles/integrations/configuration-to-query-users-from-google-apps.md b/articles/integrations/configuration-to-query-users-from-google-apps.md deleted file mode 100644 index d94aad38df..0000000000 --- a/articles/integrations/configuration-to-query-users-from-google-apps.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -description: How to setup the configuration needed to query users from a Google Apps domain. ---- -# Enable Ability to Query Users from a Google Apps Domain - -In order to query [Google Apps](https://admin.google.com) domain users, you must enable API access. - -::: note -You must be a Google Apps domain administrator to make these changes. -::: - -1. Log in to the Google Apps Admin console, and select **Security**. - -![Google Admin Console](/media/articles/google-admin-sdk/google-apps-admin.png) - -2. Check **Enable API access**. - -![Google Apps API Reference](/media/articles/google-admin-sdk/api-reference.png) - -## Keep reading - -:::next-steps -* [Google Apps Admin SDK](https://developers.google.com/admin-sdk/) -* [Enable API access in the Admin console](https://support.google.com/a/answer/60757?hl=en) -::: \ No newline at end of file diff --git a/articles/integrations/configure-wsfed-application.md b/articles/integrations/configure-wsfed-application.md index e871f688bf..d6629e86c7 100644 --- a/articles/integrations/configure-wsfed-application.md +++ b/articles/integrations/configure-wsfed-application.md @@ -1,18 +1,23 @@ --- description: How to configure a WS-Fed application to use Auth0 as an identity provider. +topics: + - integrations + - ws-fed +contentType: how-to +useCase: integrate-saas-sso --- # How to configure a WS-Fed application If a WS-Fed application (Service Provider) is to use Auth0 as an Identity Provider, this is configured in one of two places. -Some commonly used WS-Fed applications are pre-configured in Auth0 and available via `Single Sign On Integrations`. +Some commonly used WS-Fed applications are pre-configured in Auth0 and available via `Single Sign-On Integrations`. -If a WS-Fed application is not listed in `Single Sign On Integrations`, the generic WS-Fed application configuration can be accessed via: +If a WS-Fed application is not listed in `Single Sign-On Integrations`, the generic WS-Fed application configuration can be accessed via: 1. In the Auth0 Dashboard, click on `Applications`, `+ CREATE APP`, enter a name and press Save. 2. Then click on the `Addons` tab -> `WS-Fed Web App`. -3. Enter the `Application Callback URL` - this is the URL in the WS-Fed application to which the WS-Fed response will be posted. It may also called the `ACS` or `Assertion Consumer Service URL` in some applications. +3. Enter the `Application Callback URL` - this is the your callback URL in the WS-Fed application to which the WS-Fed response will be posted. It may also called the `ACS` or `Assertion Consumer Service URL` in some applications. 4. Enter the `Realm` - this is an identifier sent by the WS-Fed application and is used to identify the application in the response. ::: note diff --git a/articles/integrations/google-cloud-platform.md b/articles/integrations/google-cloud-platform.md index 0f8d1a334c..5b8581ee99 100644 --- a/articles/integrations/google-cloud-platform.md +++ b/articles/integrations/google-cloud-platform.md @@ -2,6 +2,11 @@ title: Securing Google Cloud Endpoints with Auth0 description: How to secure a Google Cloud Endpoints API with Auth0. toc: true +topics: + - integrations + - google-cloud +contentType: how-to +useCase: integrate-saas-sso --- # Securing Google Cloud Endpoints with Auth0 @@ -56,7 +61,7 @@ Field | Description `flow` | The flow used by the OAuth2 security scheme. Valid values are `"implicit"`, `"password"`, `"application"` or `"accessCode"`. `type` | The type of the security scheme. Valid values are `"basic"`, `"apiKey"` or `"oauth2"` `x-google-issuer` | The issuer of a credential, should be set to `"https://${account.namespace}/"` -`x-google-jwks_uri` | The URI of the public key set to validate the JSON Web Token signature. Set this to `"https://${account.namespace}/.well-known/jwks.json"` +`x-google-jwks_uri` | The URI of the public key set to validate the JSON Web Token (JWT) signature. Set this to `"https://${account.namespace}/.well-known/jwks.json"` `x-google-audiences` | The API's identifier, make sure this value matches what you defined on the Auth0 dashboard for the API. @@ -187,7 +192,7 @@ You'll get the following response: Which is exactly what we want! -Now go to the **Test** page of your Google Endpoints API definition on the [Auth0 Dashboard](${manage_url}/#/apis), and copy the `access_token`: +Now go to the **Test** page of your Google Endpoints API definition on the [Auth0 Dashboard](${manage_url}/#/apis), and copy the Access Token: ![Copy Token](/media/articles/tutorials/gce-copy-token.png) @@ -209,4 +214,4 @@ Perform a `GET` request to your API with an Authorization Header of `Bearer {ACC } ``` -And that's it! \ No newline at end of file +And that's it! diff --git a/articles/integrations/index.md b/articles/integrations/index.md index c5106ee5a8..c73d303ef5 100644 --- a/articles/integrations/index.md +++ b/articles/integrations/index.md @@ -2,33 +2,181 @@ classes: topic-page title: Auth0 Integrations description: Learn how to integrate Auth0 with other applications and services. +topics: + - integrations +contentType: index +useCase: + - integrate-third-party-apps + - integrate-analytics + - integrate-marketing + - integrate-saas-sso ---

      Auth0 Integrations

      -

      - Take a look below to find tutorials on integrating Auth0 with other applications and services! +

      Tailor your identity flows with custom code and integrate with third-party systems.

    • -
    • - Single Sign On Integrations -

      - Learn how to set up Single Sign On between Auth0 and various services. -

      -
    • -
    \ No newline at end of file + diff --git a/articles/integrations/integrating-auth0-amazon-cognito-mobile-apps.md b/articles/integrations/integrating-auth0-amazon-cognito-mobile-apps.md index 7e804f2e03..77803499d1 100644 --- a/articles/integrations/integrating-auth0-amazon-cognito-mobile-apps.md +++ b/articles/integrations/integrating-auth0-amazon-cognito-mobile-apps.md @@ -1,17 +1,24 @@ --- -description: How to integrate Auth0 with Amazon Cognito using an OpenID Connect Provider. +description: How to integrate Auth0 with Amazon Cognito using an OpenID Connect (OIDC) Provider. +topics: + - integrations + - amazon + - cognito + - oidc +contentType: how-to +useCase: integrate-saas-sso --- # Integrate Auth0 with Amazon Cognito **Amazon Cognito** is a backend as a service that lets you focus on writing a fantastic user experience for your application (native or web). -This document will explain how you can integrate your app with two solutions: Auth0 to get authentication with either [Social Providers](/identityproviders#social) (Facebook, Twitter, and so on), [Enterprise providers](/identityproviders#enterprise) or regular Username and Password, and [Amazon Cognito](http://aws.amazon.com/cognito/), to get a backend for your app without writing a line of code. +This document will explain how you can integrate your app with two solutions: Auth0 to get authentication with either [Social Providers](/connections/identity-providers-social) (Facebook, Twitter, and so on), [Enterprise providers](/connections/identity-providers-enterprise) or regular Username and Password, and [Amazon Cognito](http://aws.amazon.com/cognito/), to get a backend for your app without writing a line of code. ## Configure Amazon Web Services ### Create a new OpenID Connect Provider -The first step is to create an OpenID Connect Provider pointing to your Auth0 account. Please take a note of your Auth0 **domain** (`${account.namespace}`) and your **applicationId** these values can be found in the [Settings of your chosen Application](${manage_url}/#/clients/). These values will be used to create the Identity Pool in the [IAM Console](https://console.aws.amazon.com/iam/home). +The first step is to create an OpenID Connect (OIDC) Provider pointing to your Auth0 account. Please take a note of your Auth0 **domain** (`${account.namespace}`) and your **applicationId** these values can be found in the [Settings of your chosen Application](${manage_url}/#/clients/). These values will be used to create the Identity Pool in the [IAM Console](https://console.aws.amazon.com/iam/home). 1. In the [IAM Console](https://console.aws.amazon.com/iam/home) click on the **Identity Providers** link in the left sidebar. Click the **Create Provider** button. @@ -57,7 +64,7 @@ Now, you need to create an Identity Pool in the [Cognito Console](https://consol ![Confirmation page](/media/articles/scenarios/amazon-cognito/allow-role.png) -1. Click **Edit Identity Pool** to view the the Identity Pool ID. +1. Click **Edit Identity Pool** to view the Identity Pool ID. ![View the Identity Pool ID](/media/articles/scenarios/amazon-cognito/pool-id.png) @@ -67,7 +74,7 @@ Now, you need to create an Identity Pool in the [Cognito Console](https://consol ## Auth0 Configuration -Amazon will use the public signing key from the [OpenID Provider Metadata](https://subscription.auth0.com/.well-known/jwks.json) to validate the signature of the JSON Web Token. +Amazon will use the public signing key from the [OpenID Provider Metadata](https://subscription.auth0.com/.well-known/jwks.json) to validate the signature of the JSON Web Token (JWT). By default Auth0 will use the HS256 signature algorithm which is not supported in this scenario (this will result in "Invalid login token" errors). Go to your application in the [dashboard](${manage_url}/#/applications), click the **Show Advanced Settings** link and then **OAuth** and change the algorithm to **RS256**. @@ -75,7 +82,7 @@ By default Auth0 will use the HS256 signature algorithm which is not supported i ## Implementation -You can use [Auth0 Lock](https://github.com/auth0/lock) to log the user in. You can read detailed instructions on how to implement Lock in [the libraries documentation](/libraries#lock-login-signup-widgets). +You can use Auth0 Lock to log the user in. You can read detailed instructions on how to implement Lock in [the libraries documentation](/libraries#lock-login-signup-widgets). Once the user is successfully logged in with Auth0, the next step is to send their credentials to Amazon Cognito [see the Cognito docs](http://docs.aws.amazon.com/cognito/latest/developerguide/open-id.html) to see how to implement this with depending on the platform. @@ -102,6 +109,6 @@ dataset.synchronize() ## Keep reading ::: next-steps -* [Amazon Cognito: Open ID Connect Providers](http://docs.aws.amazon.com/cognito/latest/developerguide/open-id.html) +* [Amazon Cognito: OpenID Connect Providers](http://docs.aws.amazon.com/cognito/latest/developerguide/open-id.html) * [Amazon IAM: Creating OpenID Connect (OIDC) Identity Providers](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc.html) ::: diff --git a/articles/integrations/marketing/adobe-campaign/index.md b/articles/integrations/marketing/adobe-campaign/index.md index 21b8e1d1f8..9e1dcd8e58 100644 --- a/articles/integrations/marketing/adobe-campaign/index.md +++ b/articles/integrations/marketing/adobe-campaign/index.md @@ -1,19 +1,20 @@ --- -title: Adobe Campaign Integration -description: Learn how to import your Auth0 user data into Adobe Campaign. +title: Export User Data To Adobe Campaign +description: Learn how to export your Auth0 user data and import it into Adobe Campaign. toc: true +topics: + - marketing + - adobe + - adobe-campaign +contentType: how-to +useCase: export-users-marketing --- -# Adobe Campaign Integration +# Export User Data To Adobe Campaign -## Import Users to Adobe Campaign +In this article, you’ll learn how to export user data in Auth0 to a CSV file then import it into Adobe Campaign with the [Adobe Campaign Import Wizard](https://docs.campaign.adobe.com/doc/AC/en/PTF_Importing_and_exporting_data_Importing_data.html). -To import your Auth0 users into Adobe Campaign: - -- Export your user data as a CSV file with the [User Import / Export Extension](/extensions/user-import-export). -- Import the file into Adobe Campaign with the [Adobe Campaign Import Wizard](https://docs.campaign.adobe.com/doc/AC/en/PTF_Importing-Exporting_data_About_generic_import_and_export.html). - -### Create a User Data File +## Create a user data file Start by navigating to the [Extensions](${manage_url}/#/extensions) section of the Dashboard and open the **User Import / Export Extension**. On the extension page, select **Export** from the menu. @@ -34,10 +35,10 @@ User Field | Column Name After adding the user fields, click on the **Export Users** button to start the export. Once the export is complete, download the CSV file to use in the following section. -### Import a User Data File +## Import a user data file ::: note -[Adobe Campaign Documentation: Importing Data](https://docs.campaign.adobe.com/doc/AC/en/PTF_Importing-Exporting_data_Importing_data.html) +[Adobe Campaign Documentation: Importing Data](https://docs.adobe.com/content/help/en/campaign-classic/using/getting-started/importing-and-exporting-data/importing-data.html) ::: Log in to your Adobe Campaign client dashboard and navigate to **Profiles and Targets > Jobs**. Create a new import job by clicking the **Create** button and selecting **New Import**. @@ -52,20 +53,14 @@ Description | A brief description of the job. Import type | Set to `Simple import` for single file imports and `Multiple import` for multiple file imports. Folder | Select the folder to save the import file to. -![Adobe Campaign Import Wizard Template Selection](/media/articles/integrations/marketing/adobe-campaign/template-selection.png) - Once you've configured your import parameters, click the **Next** button to continue. On the **File to Import** step upload the user data CSV file you exported from Auth0 in the previous section. Click the **Next** button to proceed to **Field Mapping**. Next, map the export file schema to your Adobe Campaign database schema. Check that the field names and field types are correct, then click the **Next** button. -![Adobe Campaign Import Wizard Field Mapping](/media/articles/integrations/marketing/adobe-campaign/field-mapping.png) - Complete the remaining configuration steps by defining your data reconciliation mode and selecting a folder, list, or service for the users being imported. Finally, begin the import by clicking the **Start** button on the **Data Import Execution** window. -![Adobe Campaign Import Wizard Data Import Execution](/media/articles/integrations/marketing/adobe-campaign/import-execution.png) - That's it! You successfully imported your Auth0 users into Adobe Campaign. diff --git a/articles/integrations/marketing/alterian/index.md b/articles/integrations/marketing/alterian/index.md index 689adc8fac..5f39fbdff9 100644 --- a/articles/integrations/marketing/alterian/index.md +++ b/articles/integrations/marketing/alterian/index.md @@ -1,19 +1,19 @@ --- -title: Alterian Integration -description: Learn how to import your Auth0 user data into Alterian. +title: Export User Data To Alterian +description: Learn how to export your Auth0 user data and import it into Alterian. toc: true +topics: + - marketing + - alterian +contentType: how-to +useCase: export-users-marketing --- -# Alterian Integration +# Export User Data To Alterian -## Import Users to Alterian +In this article, you’ll learn how to export user data in Auth0 to a CSV file then import it into Alterian with the campaign manager's data import tool. -To import your Auth0 users into Alterian: - -- Export your user data as a CSV file with the [User Import / Export Extension](/extensions/user-import-export). -- Import the file into Alterian with the Campaign Manager's Data Import tool. - -### Create a User Data File +## Create a user data file Start by navigating to the [Extensions](${manage_url}/#/extensions) section of the Dashboard and open the **User Import / Export Extension**. On the extension page, select **Export** from the menu. @@ -34,7 +34,7 @@ User Field | Column Name After adding the user fields, click on the **Export Users** button to start the export. Once the export is complete, download the CSV file to use in the following section. -### Import a User Data File +## Import a user data file ::: note [Alterian Campaign Manager: Data Import](http://cm.help.alterian.com/CM404/Default.htm#Customer_Analytics/Import_Export/Data_Import.htm) @@ -56,6 +56,6 @@ To import your CSV file into Alterian, follow these steps: ![Data Import: New Imports](/media/articles/integrations/marketing/alterian/new-data-imports.png) -7. After you've reviewed your settings, click **Run Processess**. +7. After you've reviewed your settings, click **Run Processes**. That's it! You successfully imported your Auth0 users into Alterian. diff --git a/articles/integrations/marketing/constant-contact/index.md b/articles/integrations/marketing/constant-contact/index.md index 6bbb815a23..55048e1ca4 100644 --- a/articles/integrations/marketing/constant-contact/index.md +++ b/articles/integrations/marketing/constant-contact/index.md @@ -1,19 +1,19 @@ --- -title: Constant Contact Integration -description: Learn how to import your Auth0 user data into Constant Contact. +title: Export User Data To Constant Contact +description: Learn how to export your Auth0 user data and import it into Constant Contact. toc: true +topics: + - marketing + - constant-contact +contentType: how-to +useCase: export-users-marketing --- -# Constant Contact Integration +# Export User Data To Constant Contact -## Import Users to Constant Contact +In this article, you’ll learn how to export user data in Auth0 to a CSV file then import it into the Constant Contact dashboard. -To import your Auth0 users into Constant Contact: - -- Export your user data as a CSV file with the [User Import / Export Extension](/extensions/user-import-export). -- Import the file on the Constant Contact dashboard. - -### Create a User Data File +## Create a user data file Start by navigating to the [Extensions](${manage_url}/#/extensions) section of the Dashboard and open the **User Import / Export Extension**. On the extension page, select **Export** from the menu. @@ -34,7 +34,7 @@ User Field | Column Name After adding the user fields, click on the **Export Users** button to start the export. Once the export is complete, download the CSV file to use in the following section. -### Import a User Data File +## Import a user data file ::: note [Constant Contact Knowledge Base: Import or Upload a File of Contact Email Addresses](https://knowledgebase.constantcontact.com/articles/KnowledgeBase/5296-import-or-upload-a-file-of-contact-email-addresses) diff --git a/articles/integrations/marketing/eloqua/index.md b/articles/integrations/marketing/eloqua/index.md index e5b57bc699..7b3e3bad71 100644 --- a/articles/integrations/marketing/eloqua/index.md +++ b/articles/integrations/marketing/eloqua/index.md @@ -1,19 +1,20 @@ --- -title: Oracle Eloqua Integration -description: Learn how to import your Auth0 user data into Eloqua. +title: Export User Data To Oracle Eloqua +description: Learn how to export your Auth0 user data and import it into Oracle Eloqua. toc: true +topics: + - marketing + - eloqua + - oracle +contentType: how-to +useCase: export-users-marketing --- -# Oracle Eloqua Integration +# Export User Data To Oracle Eloqua -## Import Users to Eloqua +In this article, you’ll learn how to export user data in Auth0 to a CSV file then import it into Eloqua with the contact upload wizard. -To import your Auth0 users into Eloqua: - -- Export your user data as a CSV file with the [User Import / Export Extension](/extensions/user-import-export). -- Import the file using Oracl Eloqua's contact upload wizard. - -### Create a User Data File +## Create a user data file Start by navigating to the [Extensions](${manage_url}/#/extensions) section of the Dashboard and open the **User Import / Export Extension**. On the extension page, select **Export** from the menu. @@ -34,7 +35,7 @@ User Field | Column Name After adding the user fields, click on the **Export Users** button to start the export. Once the export is complete, download the CSV file to use in the following section. -### Import a User Data File +## Import a user data file ::: note [Oracle Eloqua Help Center: Uploading Contacts](https://docs.oracle.com/cloud/latest/marketingcs_gs/OMCAA/index.html#Help/Contacts/Tasks/UploadingContacts.htm) diff --git a/articles/integrations/marketing/index.md b/articles/integrations/marketing/index.md index a11730596e..b562fe8e1b 100644 --- a/articles/integrations/marketing/index.md +++ b/articles/integrations/marketing/index.md @@ -1,12 +1,16 @@ --- classes: topic-page -title: Marketing Integrations -description: Learn how to integrate Auth0 with marketing applications and services. +title: Export User Data To Marketing Tools +description: Learn how to export Auth0 user data to marketing applications and services. +topics: + - marketing +contentType: index +useCase: export-users-marketing ---
    -

    Marketing Integrations

    +

    Export User Data To Marketing Tools

    The better the data, the better the marketing campaign. With Auth0 you can provide user data for your marketing tools to personalize marketing and increase user engagement. Take a look below for tutorials to get started!

    diff --git a/articles/integrations/marketing/mailchimp/index.md b/articles/integrations/marketing/mailchimp/index.md index e3c7f2e62b..6b9c68dafc 100644 --- a/articles/integrations/marketing/mailchimp/index.md +++ b/articles/integrations/marketing/mailchimp/index.md @@ -1,19 +1,19 @@ --- -title: MailChimp Integration -description: Learn how to import your Auth0 user data into MailChimp. +title: Export User Data To MailChimp +description: Learn how to export your Auth0 user data and import it into MailChimp. toc: true +topics: + - marketing + - mailchimp +contentType: how-to +useCase: export-users-marketing --- -# MailChimp Integration +# Export User Data To MailChimp -## Import Users to MailChimp +In this article, you’ll learn how to export user data in Auth0 to a CSV file then import it into the [MailChimp dashboard](https://login.mailchimp.com/). -To import your Auth0 users into MailChimp: - -- Export your user data as a CSV file with the [User Import / Export Extension](/extensions/user-import-export). -- Import the file into MailChimp on the [MailChimp Dashboard](https://login.mailchimp.com/). - -### Create a User Data File +## Create a user data file Start by navigating to the [Extensions](${manage_url}/#/extensions) section of the Dashboard and open the **User Import / Export Extension**. On the extension page, select **Export** from the menu. @@ -38,7 +38,7 @@ User Field | Column Name After adding the user fields, click on the **Export Users** button to start the export. Once the export is complete, download the CSV file to use in the following section. -### Import a User Data File +## Import a user data file ::: note [MailChimp Knowledge Base: Import Subscribers to a List](https://kb.mailchimp.com/lists/growth/import-subscribers-to-a-list) diff --git a/articles/integrations/marketing/marketo/index.md b/articles/integrations/marketing/marketo/index.md index 06e062f8ae..4df61e62c9 100644 --- a/articles/integrations/marketing/marketo/index.md +++ b/articles/integrations/marketing/marketo/index.md @@ -1,19 +1,19 @@ --- -title: Marketo Integration -description: Learn how to import your Auth0 user data into Marketo. +title: Export User Data To Marketo +description: Learn how to export your Auth0 user data and import it into Marketo. toc: true +topics: + - marketing + - marketo +contentType: how-to +useCase: export-users-marketing --- -# Marketo Integration +# Export User Data To Marketo -## Import Users to Marketo +In this article, you’ll learn how to export user data in Auth0 to a CSV file then import it into Marketo using the [Bulk Leads endpoint](http://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#/Bulk_Leads) of the Marketo REST API. -To import your Auth0 users into Marketo: - -- Export your user data as a CSV file with the [User Import / Export Extension](/extensions/user-import-export). -- Import the file into Marketo using the [Bulk Leads endpoint](http://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#/Bulk_Leads) of the Marketo REST API. - -### Create a User Data File +## Create a user data file Start by navigating to the [Extensions](${manage_url}/#/extensions) section of the Dashboard and open the **User Import / Export Extension**. On the extension page, select **Export** from the menu. @@ -34,7 +34,7 @@ User Field | Column Name After adding the user fields, click on the **Export Users** button to start the export. Once the export is complete, download the CSV file to use in the following section. -### Import a User Data File +### Import a user data file ::: note [Marketo Documentation: Bulk Lead Import](http://developers.marketo.com/rest-api/bulk-import/bulk-lead-import/) diff --git a/articles/integrations/marketing/sailthru/index.md b/articles/integrations/marketing/sailthru/index.md index 2a8ecfc2e9..c4eaeb32a1 100644 --- a/articles/integrations/marketing/sailthru/index.md +++ b/articles/integrations/marketing/sailthru/index.md @@ -1,19 +1,19 @@ --- -title: Sailthru Integration -description: Learn how to import your Auth0 user data into Sailthru. +title: Export User Data To Sailthru +description: Learn how to export your Auth0 user data and import it into Sailthru. toc: true +topics: + - marketing + - sailthru +contentType: how-to +useCase: export-users-marketing --- -# Sailthru Integration +# Export User Data To Sailthru -## Import Users to Sailthru +In this article, you’ll learn how to export user data in Auth0 to a CSV file then import it into the Sailthru dashboard. -To import your Auth0 users into Sailthru: - -- Export your user data as a CSV file with the [User Import / Export Extension](/extensions/user-import-export). -- Import the file to a list on your Sailthru dashboard. - -### Create a User Data File +## Create a user data file Start by navigating to the [Extensions](${manage_url}/#/extensions) section of the Dashboard and open the **User Import / Export Extension**. On the extension page, select **Export** from the menu. @@ -34,7 +34,7 @@ User Field | Column Name After adding the user fields, click on the **Export Users** button to start the export. Once the export is complete, download the CSV file to use in the following section. -### Import a User Data File +### Import a user data file ::: note [Sailthru Documentation: Adding Users to Sailthru and Sailthru Lists](https://getstarted.sailthru.com/audience/managing-users/add-users-to-sailthru-and-lists/#List_File_Upload) diff --git a/articles/integrations/marketing/salesforce-marketing-cloud/index.md b/articles/integrations/marketing/salesforce-marketing-cloud/index.md index c7cc7a1c73..95a203e3a0 100644 --- a/articles/integrations/marketing/salesforce-marketing-cloud/index.md +++ b/articles/integrations/marketing/salesforce-marketing-cloud/index.md @@ -1,19 +1,20 @@ --- -title: Salesforce Marketing Cloud Integration -description: Learn how to import your Auth0 user data into Salesforce Marketing Cloud. +title: Export User Data To Salesforce Marketing Cloud +description: Learn how to export your Auth0 user data and import it into Salesforce Marketing Cloud. toc: true +topics: + - marketing + - salesforce + - marketing-cloud +contentType: how-to +useCase: export-users-marketing --- -# Salesforce Marketing Cloud Integration +# Export User Data To Salesforce Marketing Cloud -## Import Users to Salesforce Marketing Cloud +In this article, you’ll learn how to export user data in Auth0 to a CSV file then import it into Salesforce Marketing Cloud using [Email Studio](https://help.salesforce.com/articleView?id=mc_es_get_started_with_email_studio.htm&type=5). -To import your Auth0 users into Salesforce Marketing Cloud: - -- Export your user data as a CSV file with the [User Import / Export Extension](/extensions/user-import-export). -- Import the file into Salesforce Marketing Cloud using [Email Studio](https://help.marketingcloud.com/en/documentation/exacttarget/getting_started/). - -### Create a User Data File +## Create a user data file Start by navigating to the [Extensions](${manage_url}/#/extensions) section of the Dashboard and open the **User Import / Export Extension**. On the extension page, select **Export** from the menu. @@ -34,7 +35,7 @@ User Field | Column Name After adding the user fields, click on the **Export Users** button to start the export. Once the export is complete, download the CSV file to use in the following section. -### Import a User Data File +## Import a user data file ::: note [Email Studio: Import Subscribers](https://help.marketingcloud.com/en/documentation/exacttarget/subscribers/subscribers_for_interactive_marketing_hub/imports/importing_subscribers/) diff --git a/articles/integrations/marketing/salesforce/index.md b/articles/integrations/marketing/salesforce/index.md index 5c3b49aa12..586964c0f1 100644 --- a/articles/integrations/marketing/salesforce/index.md +++ b/articles/integrations/marketing/salesforce/index.md @@ -1,19 +1,19 @@ --- -title: Salesforce Integration -description: Learn how to import your Auth0 user data into Salesforce. +title: Export User Data To Salesforce +description: Learn how to export your Auth0 user data and import it into Salesforce. toc: true +topics: + - marketing + - salesforce +contentType: how-to +useCase: export-users-marketing --- -# Salesforce Integration +# Export User Data To Salesforce -## Import Users to Salesforce +In this article, you’ll learn how to export user data in Auth0 to a CSV file then import it into Salesforce using the [Data Import Wizard](https://help.salesforce.com/articleView?id=data_import_wizard.htm). -To import your Auth0 users into Salesforce: - -- Export your user data as a CSV file with the [User Import / Export Extension](/extensions/user-import-export). -- Import the file into Salesforce using the [Data Import Wizard](https://help.salesforce.com/articleView?id=data_import_wizard.htm). - -### Create a User Data File +## Create a user data file Start by navigating to the [Extensions](${manage_url}/#/extensions) section of the Dashboard and open the **User Import / Export Extension**. On the extension page, select **Export** from the menu. @@ -38,7 +38,7 @@ User Field | Column Name After adding the user fields, click on the **Export Users** button to start the export. Once the export is complete, download the CSV file to use in the following section. -### Import a User Data File +## Import a user data file ::: note [Salesforce: Import Data with the Data Import Wizard](https://help.salesforce.com/articleView?id=import_with_data_import_wizard.htm) diff --git a/articles/integrations/marketing/watson-campaign-automation/index.md b/articles/integrations/marketing/watson-campaign-automation/index.md index c3c72a65df..5f65f357ce 100644 --- a/articles/integrations/marketing/watson-campaign-automation/index.md +++ b/articles/integrations/marketing/watson-campaign-automation/index.md @@ -1,19 +1,19 @@ --- -title: Watson Campaign Automation Integration -description: Learn how to import your Auth0 user data into Watson Campaign Automation. +title: Export User Data To Watson Campaign Automation +description: Learn how to export your Auth0 user data and import it into Watson Campaign Automation. toc: true +topics: + - marketing + - watson-campaign +contentType: how-to +useCase: export-users-marketing --- -# Watson Campaign Automation Integration +# Export User Data To Watson Campaign Automation -## Import Users to Watson Campaign Automation +In this article, you’ll learn how to export user data in Auth0 to a CSV file then import it into the Watson Campaign Automation dashboard. -To import your Auth0 users into Watson Campaign Automation: - -- Export your user data as a CSV file with the [User Import / Export Extension](/extensions/user-import-export). -- Import the file (database) on your Watson Campaign Automation dashboard. - -### Create a User Data File +## Create a user data file Start by navigating to the [Extensions](${manage_url}/#/extensions) section of the Dashboard and open the **User Import / Export Extension**. On the extension page, select **Export** from the menu. @@ -38,7 +38,7 @@ User Field | Column Name After adding the user fields, click on the **Export Users** button to start the export. Once the export is complete, download the CSV file to use in the following section. -### Import a User Data File +## Import a user data file ::: note [Watson Campaign Automation: About importing a database](https://www.ibm.com/support/knowledgecenter/en/SSWU4L/Data/imc_Data/Import_a_Database.html) diff --git a/articles/integrations/office-365-custom-provisioning.md b/articles/integrations/office-365-custom-provisioning.md index 2cefb0cf2d..cddf7399d4 100644 --- a/articles/integrations/office-365-custom-provisioning.md +++ b/articles/integrations/office-365-custom-provisioning.md @@ -1,12 +1,20 @@ --- description: How to setup Microsoft Office 365 custom provisioning. +topics: + - integrations + - microsoft + - office-365 +contentType: + - how-to + - concept +useCase: integrate-saas-sso --- # Office 365 Custom Provisioning -The default Office 365 setup will include Active Directory and DirSync/Azure AD Sync Services to synchronize and provision your AD users in Azure AD for SSO. Auth0 will then be configured to be an identity provider which is providing SSO for these users. +The default Office 365 setup will include Active Directory and DirSync/Azure AD Sync Services to synchronize and provision your AD users in Azure AD for SSO. Auth0 will then be configured to be an identity provider which is providing Single Sign-on (SSO) for these users. -All of this is fine when you want SSO for your own users living in your AD. But for scenarios where you want to allow contractors, partners or even customers to access your Office 365 environment (eg: SharePoint) this approach is not optimal since these users would need to be created in your own AD environment. This is why Auth0 allows custom provisioning of Azure AD users from our rules. This would allow you to create users in Azure AD (and effectively Office 365) just as they login from any connection available in Auth0 (in that case your rule will take over DirSync's task for any type of connection where DirSync would not work). This will allow you to offer Facebook, LinkedIn, Google Apps, ... logins to your Office 365 environment. +All of this is fine when you want SSO for your own users living in your AD. But for scenarios where you want to allow contractors, partners or even customers to access your Office 365 environment (eg: SharePoint) this approach is not optimal since these users would need to be created in your own AD environment. This is why Auth0 allows custom provisioning of Azure AD users from our rules. This would allow you to create users in Azure AD (and effectively Office 365) just as they login from any connection available in Auth0 (in that case your rule will take over DirSync's task for any type of connection where DirSync would not work). This will allow you to offer Facebook, LinkedIn, G Suite, ... logins to your Office 365 environment. ## Configuring Office 365 @@ -39,14 +47,14 @@ The following rule shows the provisioning process: 1. If the user comes from the AD connection, skip the provisioning process (because this will be handled by DirSync) 2. If the user was already provisioned in Azure AD, just continue with the login transaction. - 3. Get an Access Token of the Graph API using the Azure AD Client ID and Key + 3. Get an Access Token of the Graph API using the Azure AD Client ID and Key 4. Create a user in Azure AD 5. Assign a license to the user. 6. Continue with the login transaction. The username is generated with the `createAzureADUser` function, which by default generates a username in the format `auth0-c3fb6eec-3afd-4d52-8e0a-d9f357dd19ab@fabrikamcorp.be`. You can change this to whatever you like, just make sure this value is unique for all your users. -Make sure you set the correct values for the `AUTH0_OFFICE365_CLIENT_ID`, `AAD_CUSTOM_DOMAIN`, `AAD_DOMAIN`, `AAD_APPLICATION_ID` and `AAD_APPLICATION_API_KEY` values in the rule code. +Make sure you set the correct values for the `AUTH0_OFFICE365_CLIENT_ID`, `AAD_CUSTOM_DOMAIN`, `AAD_DOMAIN`, `AAD_APPLICATION_ID` and `AAD_APPLICATION_API_KEY` values in your [configuration object](/rules/current#use-the-configuration-object) to make the values available in your rule code. In the code you'll also see that the rule will wait about 15 seconds after the user is provisioned. This is because it takes a few seconds before the provisioned user is available for Office 365. @@ -54,7 +62,7 @@ In the code you'll also see that the rule will wait about 15 seconds after the u function (user, context, callback) { // Require the Node.js packages that we are going to use. // Check this website for a complete list of the packages available: - // https://tehsis.github.io/webtaskio-canirequire/ + // https://auth0-extensions.github.io/canirequire/ var rp = require('request-promise'); var uuidv4 = require('uuid'); @@ -62,17 +70,17 @@ function (user, context, callback) { var AUTH0_AD_CONNECTION = 'FabrikamAD'; // The client_id of your Office 365 SSO integration // You can get it from the URL when editing the SSO integration, - // it will look like + // it will look like // https://manage.auth0.com/#/externalapps/{the_client_id}/settings - var AUTH0_OFFICE365_CLIENT_ID = 'CLIENT_ID_OF_MY_THIRD_PARTY_APP_IN_AUTH0'; + var AUTH0_OFFICE365_CLIENT_ID = configuration.AUTH0_OFFICE365_CLIENT_ID; // The main domain of our company. var YOUR_COMPANY_DOMAIN = 'mycompanyurl.com'; // Your Azure AD domain. - var AAD_DOMAIN = 'mycompanyurl.onmicrosoft.com'; + var AAD_DOMAIN = configuration.AAD_DOMAIN; // The Application ID generated while creating the Azure AD app. - var AAD_APPLICATION_ID = 'fc885c73-ce83-4d1e-9fo3-kako45460489'; + var AAD_APPLICATION_ID = configuration.AAD_APPLICATION_ID; // The generated API key for the Azure AD app. - var AAD_APPLICATION_API_KEY = 'ZqnwPIsiMP07Wz7AQkx0RsD7mYTElny1tpKot8lizE9='; + var AAD_APPLICATION_API_KEY = configuration.AAD_APPLICATION_API_KEY; // The location of the users that are going to access Microsoft products. var AAD_USAGE_LOCATION = 'US'; // Azure AD doesn't recognize the user instantly, it needs a few seconds @@ -119,7 +127,7 @@ function (user, context, callback) { .then(connectWithUser) .catch(callback); - // Requests an access_token to interact with Windows Graph API. + // Requests an Access Token to interact with Windows Graph API. function getAzureADToken() { var options = { method: 'POST', @@ -139,7 +147,7 @@ function (user, context, callback) { return rp(options); } - // Gets the access_token requested above and assembles a new request + // Gets the Access Token requested above and assembles a new request // to provision the new Microsoft AD user. function createAzureADUser(response) { token = response.access_token; @@ -219,7 +227,7 @@ function (user, context, callback) { } // After provisioning the user and giving a license to them, we record - // (on Auth) that this Google Apps user has already been provisioned. We + // (on Auth) that this G Suite user has already been provisioned. We // also record the user's principal username and immutableId to properly // redirect them on future logins. function saveUserMetadata() { diff --git a/articles/integrations/office-365.md b/articles/integrations/office-365.md index eccdf8653a..03c17657ba 100644 --- a/articles/integrations/office-365.md +++ b/articles/integrations/office-365.md @@ -1,10 +1,16 @@ --- description: Overview of Microsoft Office 365 Integration with Auth0. toc: true +topics: + - integrations + - microsoft + - office-365 +contentType: how-to +useCase: integrate-saas-sso --- # Office 365 Integration -Auth0 can help radically simplify the authentication process for Office 365. In this tutorial, you'll learn how to add Single Sign On (SSO) to Office 365 using Auth0. +Auth0 can help radically simplify the authentication process for Office 365. In this tutorial, you'll learn how to add Single Sign-on (SSO) to Office 365 using Auth0. ## Why use Auth0 for Office 365 @@ -24,7 +30,7 @@ Office 365 uses Azure AD as an identity store which supports different account m 1. **Cloud Identity**: Users are created in the cloud (Office 365/Azure AD) with no relation to an on-premises directory. Authentication happens with Azure AD. 2. **Synchronized Identity**: Users are synchronized from an on-premises LDAP directory (like Active Directory) to Azure AD. This means the user management can happen on-premises but authentication will always happen in the cloud using Azure AD. -3. **Federated Identity**: Users are synchronized from an on-premises LDAP directory (like Active Directory) to Azure AD. In this case Azure AD will act as the user store, but authentication will happen with a SAML 2.0 identity provider configured by the customer. This can be an ADFS server, Shibboleth, or in our case, Auth0. With this third model you can add SSO support to Office 365. +3. **Federated Identity**: Users are synchronized from an on-premises LDAP directory (like Active Directory) to Azure AD. In this case Azure AD will act as the user store, but authentication will happen with a SAML 2.0 identity provider configured by the customer. This can be an ADFS server, Shibboleth, or in our case, Auth0. With this third model you can add SSO support to Office 365. This means that even if you use Auth0 for SSO support in Office 365, you will always need to synchronize your on-premises users to Office 365/Azure AD because it will be used as a user store (for user information, assigning licenses to those users, and so on.). @@ -76,7 +82,7 @@ Set-MsolDomainAuthentication -Authentication Federated -PassiveLogOnUri "https://fabrikam.auth0.com/wsfed/yNqQMENaYIONxAaQmrct341tZ9joEjTi" -ActiveLogonUri "https://fabrikam.auth0.com/yNqQMENaYIONxAaQmrct341tZ9joEjTi/trust/usernamemixed?connection=FabrikamAD" - -MetadataExchangeUri "https://fabrikam.auth0.com/wsfed/yNqQMENaYIONxAaQmrct341tZ9joEjTi/FederationMetadata/2007-06/FederationMetadata.xml?connection=FabrikamAD" + -MetadataExchangeUri "https://fabrikam.auth0.com/wsfed/FederationMetadata/2007-06/FederationMetadata.xml?connection=FabrikamAD" -SigningCertificate "MIID..." -IssuerUri "urn:fabrikam" -LogOffUri "https://fabrikam.auth0.com/logout" @@ -159,19 +165,23 @@ You will need the `YOUR_CLIENT_ID` part of the segment. 2. Go to the **Rules** section and create a new rule. Start from the **Empty** template, name it `Set Issuer for Office 365 SSO Integration` and write code similar to this to set the issuer according to the domain of the user's email: -```JavaScript +```js function (user, context, callback) { - const office365ClientId = 'xxxxxx'; // put the right client id + // retrieve values from the configuration object + const office365ClientId = configuration.OFFICE365_CLIENT_ID; // put the right client id + const primaryDomain = configuration.PRIMARY_DOMAIN; // for example, exampleco.com + const secondaryDomain = configuration.SECONDARY_DOMAIN; + if (context.clientID !== office365ClientId) return callback(null, user, context); var getIssuerURI = function(domain) { // write code that returns the right issuer URI // for each domain - if (domain === 'fabrikam.be') { - return 'urn:fabrikam.be'; - } else if (domain === 'contoso.com') { - return 'urn:contoso.com'; + if (domain === primaryDomain) { + return 'urn:' + primaryDomain; + } else if (domain === secondaryDomain) { + return 'urn:' + secondaryDomain; } return null; } diff --git a/articles/integrations/office365-connection-deprecation-guide.md b/articles/integrations/office365-connection-deprecation-guide.md index 675e313065..28a608c5ca 100644 --- a/articles/integrations/office365-connection-deprecation-guide.md +++ b/articles/integrations/office365-connection-deprecation-guide.md @@ -1,5 +1,14 @@ --- description: Details migrating Office365 connections to Windows Azure AD. +topics: + - integrations + - microsoft + - office-365 + - windows + - azure-ad + - active-directory +contentType: how-to +useCase: integrate-saas-sso --- # Migrate Office365 Connections to Windows Azure AD diff --git a/articles/integrations/sharepoint-apps.md b/articles/integrations/sharepoint-apps.md index ebc09afba0..54666c43c3 100644 --- a/articles/integrations/sharepoint-apps.md +++ b/articles/integrations/sharepoint-apps.md @@ -1,9 +1,14 @@ --- description: How to connect provider hosted apps to SharePoint Online. +topics: + - integrations + - sharepoint +contentType: how-to +useCase: integrate-saas-sso --- # Connecting Provider Hosted Apps to SharePoint Online -Auth0 can help radically simplify the authentication process for SharePoint Apps. Auth0 will negotiate an Access Token you can the use to call SharePoint APIs. +Auth0 can help radically simplify the authentication process for SharePoint Apps. Auth0 will negotiate an Access Token you can the use to call SharePoint APIs. You won't need any special libraries. You can use any of the SDKs supported by Auth0. @@ -41,7 +46,7 @@ Since Auth0 is in between your app and the Office 365 infrastructure, you need t * `connection` is just the name you will use in Auth0's connections (such as "sharepoint"). * `client_id` identifies your app in Auth0 (created in steps 1). -* `redirect_uri` is the location in your actual app, where your users will land eventually after all negotiations complete. If you don't specify it, it will always be the app's callback URL defined in Auth0 (it could be localhost) +* `redirect_uri` is the location in your actual app, where your users will land eventually after all negotiations complete. If you don't specify it, it will always be the app's callback URL defined in Auth0 (it could be localhost) ### Package the app and upload to SharePoint: @@ -76,7 +81,7 @@ Users will install your app from the Office Marketplace. When they click on the ![](/media/articles/integrations/sharepoint-apps/8Xp6x.png) ::: note -Notice that the following properties will be included: `cacheKey`, `refresh_token`, `host` and `site`. These will allow you to call back SharePoint APIs (such as lists). +Notice that the following properties will be included: `cacheKey`, `refresh_token`, `host`, and `site`. These will allow you to call back SharePoint APIs (such as lists). ::: ```text diff --git a/articles/integrations/sharepoint.md b/articles/integrations/sharepoint.md index 73c8ed6552..4870a916cb 100644 --- a/articles/integrations/sharepoint.md +++ b/articles/integrations/sharepoint.md @@ -1,10 +1,15 @@ --- -description: How to integrate with SharePoint 2010/2013, including setup, troubleshooting, acessing logs and next steps. +description: How to integrate with SharePoint 2010/2013, including setup, troubleshooting, accessing logs and next steps. +topics: + - integrations + - sharepoint +contentType: how-to +useCase: integrate-saas-sso --- # SharePoint 2010/2013 Integration -Auth0 can help to radically simplify the authentication process for SharePoint. In this tutorial, you'll learn how to add Single Sign On (SSO) to Sharepoint using Auth0. Your users will be able to log in using any of our [Social Identity Providers](/identityproviders) (Facebook, Twitter, Github, and so on), [Enterprise Providers](/identityproviders) (LDAP, Active Directory, ADFS, and so on) or with a username and password. +Auth0 can help to radically simplify the authentication process for SharePoint. In this tutorial, you'll learn how to add Single Sign-on (SSO) to Sharepoint using Auth0. Your users will be able to log in using any of our [Social Identity Providers](/identityproviders) (Facebook, Twitter, Github, and so on), [Enterprise Providers](/identityproviders) (LDAP, Active Directory, ADFS, and so on) or with a username and password. ## Setup @@ -74,11 +79,11 @@ Depending on which claims have been mapped when installing the claims provider t ## Customizing the Login Page -You can customize the login page by following the instructions in the [documentation on customizing the login page](/hosted-pages/login#how-to-customize-your-login-page). +You can customize the login page by following the instructions in the [documentation on customizing the login page](/universal-login#simple-customization). You might wish to provide a way to let users authenticate with Sharepoint using Windows Authentication, bypassing Auth0. You can do that by customizing the login page, adding a link to the Windows Authentication endpoint (usually similar to `https://yoursharepointserver/_windows/default.aspx?ReturnUrl=/_layouts/15/Authenticate.aspx`). -On way of doing it is by using jQuery to modify the Lock widget and add a link to the Windows Authentication endpoint. +On way of doing it is by using jQuery to modify the Lock widget and add a link to the Windows Authentication endpoint. You need to add a reference to jQuery at the top of the `` section of the customized login page. @@ -89,14 +94,43 @@ You need to add a reference to jQuery at the top of the `` section of the Before calling `lock.show()`, add code to modify the HTML DOM that adds the link. ```js -lock.on('signin ready', function() { - $('.auth0-lock-tabs-container') - .after(''); - }); +// construct Lock +// var lock = ... +[...] +// One or more SharePoint client IDs here for which you want +// a Windows Auth button +var sharepointClientIDs = ['your_sharepoint_client_id']; + +if (sharepointClientIDs.indexOf(config.clientID) >= 0) { + lock.on('signin ready', function() { + var getParameterByName = function(name) { + name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); + var regexS = "[\\?&]" + name + "=([^&#]*)"; + var regex = new RegExp(regexS); + var results = regex.exec(window.location.search); + if (results == null) return null; + else return results[1]; + }; + // get the host from the callback URL + var parser = document.createElement('a'); + parser.href = config.callbackURL; + var host = parser.host; + var windowsAuthURL = "https://" + host + "/_windows/default.aspx?ReturnUrl=/_layouts/15/Authenticate.aspx"; + var wctx = getParameterByName("wctx"); + if (wctx) { + windowsAuthURL += "&Source=" + wctx; + } + + $('.auth0-lock-tabs-container') + .after('').attr('href','https://nowhere'); + }); +} + +lock.show(); ``` ![SharePoint Login Page Windows Auth](/media/articles/integrations/sharepoint/sharepoint-login-page-windows-auth.png) @@ -135,7 +169,7 @@ When David logs in using his Azure AD account (and the Security Groups attribute ![User Groups](/media/articles/integrations/sharepoint/sharepoint-profile-groups.png) -If we want to make these groups available as Roles in SharePoint we'll need to write a [Rule](${manage_url}/#/rules) that adds this to the SAML configuration. This rule will only run for the application named **Fabrikam Intranet (SharePoint)**. +If we want to make these groups available as Roles in SharePoint we'll need to write a [Rule](${manage_url}/#/rules) that adds this to the SAML configuration. This rule will only run for the application named **Fabrikam Intranet (SharePoint)**. ``` function (user, context, callback) { diff --git a/articles/integrations/sso/_template.md b/articles/integrations/sso/_template.md index b103547d16..3cf0d599a6 100644 --- a/articles/integrations/sso/_template.md +++ b/articles/integrations/sso/_template.md @@ -1,20 +1,22 @@ -# ${service} Single Sign On Integration +# Configure SSO Integration for ${service} + +This guide will show you how to configure an SSO integration. <% if (service === "Active Directory RMS") { %> ::: warning -The steps in this tutorial are valid for Active Directory Rights Management Services 2008 and earlier. +The steps in this guide are valid for Active Directory Rights Management Services 2008 and earlier. ::: <% } %> -The ${service} Single Sign On (SSO) Integration lets your users log in to ${service} with Auth0 [identity providers](/identityproviders), and provides SSO to [configured applicationss](/sso/current/setup). +The ${service} [Single Sign-on (SSO)](/sso) Integration lets you create a client application that uses Auth0 for authentication and provides SSO capabilities. Your users log in to ${service} with Auth0 [identity providers](/identityproviders), which means they perform the identity credentials verification. -## Create a New SSO Integration +## Create an SSO Integration -Navigate to [Dashboard > SSO Integrations](${manage_url}/#/externalapps) and click **+ Create New SSO Integration**. +To create a new SSO Integration, navigate to [Dashboard > SSO Integrations](https://manage.auth0.com/#/externalapps) and click **+ Create SSO Integration**. ![](/media/articles/sso/integrations/new.png) -Select the **${service}** option. +Next, select a provider. ![](/media/articles/sso/integrations/options.png) @@ -22,13 +24,16 @@ Set the name for your SSO Integration. Click **Create**. ![](/media/articles/sso/integrations/name.png) -You will be brought to the **${service} Configuration Instructions** page. We'll perform these steps in a later section. +You will be brought to the **Tutorial** page for the provider, which contains instructions on how you can complete the integration with the external services provider so that it works with Auth0 for authentication. ![](/media/articles/sso/integrations/${img}.png) -Next, click on the **Settings** tab to configure the integration's settings. +Once you're done configuring your integration, note that there are two additional tabs with additional options for you to manage: + +1. **Settings**, which will allow you to change the integration's settings +2. **Connections**, which will allow you to enable/disable the integration for the connections associated with your tenant -## Configure Settings +### Settings On the **Settings** page, configure the following values: @@ -88,6 +93,16 @@ On the **Settings** page, configure the following values: The connection to use with this integration, typically an Active Directory connection. <% } %> + <% if (service === "Sentry") { %> + + Organization Slug + The generated slug for your Sentry organization found in your URL (i.e., the slug for `https://sentry.acme.com/acme-org/` would `acme-org`. + + + Sentry URL Prefix + Your URL prefix if you're using Sentry Community Edition; otherwise, leave blank. + + <% } %> <% if (service === "Slack") { %> Team Name @@ -133,24 +148,27 @@ On the **Settings** page, configure the following values: <% } %> - Use Auth0 instead of the IdP to do single sign on - If enabled, Auth0 will handle Single Sign On instead of ${service}. + Use Auth0 instead of the IdP to do Single Sign-on (SSO). **Legacy tenants only.** + If enabled, Auth0 will handle SSO instead of ${service}. Click **Save**. -## Configure ${service} - -When you configure ${service}, refer to the **${service} Configuration Instructions** page on [Dashboard > SSO Integrations > ${service}](${manage_url}/#/externalapps/) and follow each of the steps as shown. +### Enable Connections -![](/media/articles/sso/integrations/${img}.png) +<% if (service === "Zendesk") { %> +::: warning +Zendesk **requires** that all users have an email address. When enabling Enterprise or Social connections, make sure that they will provide an email address +that can be sent to Zendesk. +::: -## Enable Connections +<% } %> +The **Connections** tab features a list of user sources available to your tenant. Your connections are organized by type (e.g., Database, Social, Enterprise, Passwordless). -Click the **Connections** tab for the integration to select which connections you want to enable for this integration. +You can choose the connections that you want used with your newly-created SSO integration; this allows the users in those connections to log in to ${service}. -## Setup Complete +## Complete Set Up -That's it! You've set up a Single Sign On integration with ${service} and Auth0. Your users can now choose this as a way to authenticate. \ No newline at end of file +Once you've followed the configuration instructions in the tutorial, modified your settings (if necessary), and enabled your connection(s), you're done with setting up an SSO integration between ${service} and Auth0. diff --git a/articles/integrations/sso/ad-rms.md b/articles/integrations/sso/ad-rms.md index 7f835a1f2b..c54065deb4 100644 --- a/articles/integrations/sso/ad-rms.md +++ b/articles/integrations/sso/ad-rms.md @@ -1,11 +1,21 @@ --- -title: Active Directory RMS Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with Active Directory RMS and Auth0. +title: Active Directory RMS Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Active Directory RMS and Auth0. toc: true public: true +topics: + - sso + - microsoft + - active-directory-rms + - windows +contentType: how-to +useCase: integrate-saas-sso --- - -<%= include('./_template', { - service: "Active Directory RMS", - img: "ad-rms" -}) %> +<%= include('../../../snippets/sso-integrations/ad-rms/0') %> +<%= include('../../../snippets/sso-integrations/ad-rms/1') %> +<%= include('../../../snippets/sso-integrations/ad-rms/2') %> +<%= include('../../../snippets/sso-integrations/ad-rms/3') %> +<%= include('../../../snippets/sso-integrations/ad-rms/4') %> +<%= include('../../../snippets/sso-integrations/ad-rms/5') %> +<%= include('../../../snippets/sso-integrations/ad-rms/6') %> +<%= include('../../../snippets/sso-integrations/ad-rms/7') %> diff --git a/articles/integrations/sso/adobe-sign.md b/articles/integrations/sso/adobe-sign.md new file mode 100644 index 0000000000..ade392a1f9 --- /dev/null +++ b/articles/integrations/sso/adobe-sign.md @@ -0,0 +1,21 @@ +--- +title: Adobe Sign Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Adobe Sign and Auth0. +toc: true +public: true +topics: + - sso + - adobe + - sign + - echosign +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/adobe-sign/0') %> +<%= include('../../../snippets/sso-integrations/adobe-sign/1') %> +<%= include('../../../snippets/sso-integrations/adobe-sign/2') %> +<%= include('../../../snippets/sso-integrations/adobe-sign/3') %> +<%= include('../../../snippets/sso-integrations/adobe-sign/4') %> +<%= include('../../../snippets/sso-integrations/adobe-sign/5') %> +<%= include('../../../snippets/sso-integrations/adobe-sign/6') %> +<%= include('../../../snippets/sso-integrations/adobe-sign/7') %> diff --git a/articles/integrations/sso/box.md b/articles/integrations/sso/box.md index 1eff9a1a8d..808a65ec41 100644 --- a/articles/integrations/sso/box.md +++ b/articles/integrations/sso/box.md @@ -1,11 +1,19 @@ --- -title: Box Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with Box and Auth0. +title: Box Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Box and Auth0. toc: true public: true +topics: + - sso + - box +contentType: how-to +useCase: integrate-saas-sso --- - -<%= include('./_template', { - service: "Box", - img: "box" -}) %> +<%= include('../../../snippets/sso-integrations/box/0') %> +<%= include('../../../snippets/sso-integrations/box/1') %> +<%= include('../../../snippets/sso-integrations/box/2') %> +<%= include('../../../snippets/sso-integrations/box/3') %> +<%= include('../../../snippets/sso-integrations/box/4') %> +<%= include('../../../snippets/sso-integrations/box/5') %> +<%= include('../../../snippets/sso-integrations/box/6') %> +<%= include('../../../snippets/sso-integrations/box/7') %> \ No newline at end of file diff --git a/articles/integrations/sso/cisco-webex.md b/articles/integrations/sso/cisco-webex.md new file mode 100644 index 0000000000..2619fcdd71 --- /dev/null +++ b/articles/integrations/sso/cisco-webex.md @@ -0,0 +1,19 @@ +--- +title: Cisco WebEx Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Cisco WebEx and Auth0. +toc: true +public: true +topics: + - sso + - cisco-webex +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/cisco-webex/0') %> +<%= include('../../../snippets/sso-integrations/cisco-webex/1') %> +<%= include('../../../snippets/sso-integrations/cisco-webex/2') %> +<%= include('../../../snippets/sso-integrations/cisco-webex/3') %> +<%= include('../../../snippets/sso-integrations/cisco-webex/4') %> +<%= include('../../../snippets/sso-integrations/cisco-webex/5') %> +<%= include('../../../snippets/sso-integrations/cisco-webex/6') %> +<%= include('../../../snippets/sso-integrations/cisco-webex/7') %> diff --git a/articles/integrations/sso/cloudbees.md b/articles/integrations/sso/cloudbees.md index ef7a05345f..912c641323 100644 --- a/articles/integrations/sso/cloudbees.md +++ b/articles/integrations/sso/cloudbees.md @@ -1,11 +1,19 @@ --- -title: CloudBees Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with CloudBees and Auth0. +title: CloudBees Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with CloudBees and Auth0. toc: true public: true +topics: + - sso + - cloudbees +contentType: how-to +useCase: integrate-saas-sso --- - -<%= include('./_template', { - service: "CloudBees", - img: "cloudbees" -}) %> +<%= include('../../../snippets/sso-integrations/cloudbees/0') %> +<%= include('../../../snippets/sso-integrations/cloudbees/1') %> +<%= include('../../../snippets/sso-integrations/cloudbees/2') %> +<%= include('../../../snippets/sso-integrations/cloudbees/3') %> +<%= include('../../../snippets/sso-integrations/cloudbees/4') %> +<%= include('../../../snippets/sso-integrations/cloudbees/5') %> +<%= include('../../../snippets/sso-integrations/cloudbees/6') %> +<%= include('../../../snippets/sso-integrations/cloudbees/7') %> diff --git a/articles/integrations/sso/concur.md b/articles/integrations/sso/concur.md index 510ff39fe0..96a7527cca 100644 --- a/articles/integrations/sso/concur.md +++ b/articles/integrations/sso/concur.md @@ -1,11 +1,19 @@ --- -title: Concur Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with Concur and Auth0. +title: Concur Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Concur and Auth0. toc: true public: true +topics: + - sso + - concur +contentType: how-to +useCase: integrate-saas-sso --- - -<%= include('./_template', { - service: "Concur", - img: "concur" -}) %> +<%= include('../../../snippets/sso-integrations/concur/0') %> +<%= include('../../../snippets/sso-integrations/concur/1') %> +<%= include('../../../snippets/sso-integrations/concur/2') %> +<%= include('../../../snippets/sso-integrations/concur/3') %> +<%= include('../../../snippets/sso-integrations/concur/4') %> +<%= include('../../../snippets/sso-integrations/concur/5') %> +<%= include('../../../snippets/sso-integrations/concur/6') %> +<%= include('../../../snippets/sso-integrations/concur/7') %> diff --git a/articles/integrations/sso/datadog.md b/articles/integrations/sso/datadog.md new file mode 100644 index 0000000000..3cf7f55a83 --- /dev/null +++ b/articles/integrations/sso/datadog.md @@ -0,0 +1,19 @@ +--- +title: Datadog Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Datadog and Auth0. +toc: true +public: true +topics: + - sso + - dropxbox +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/datadog/0') %> +<%= include('../../../snippets/sso-integrations/datadog/1') %> +<%= include('../../../snippets/sso-integrations/datadog/2') %> +<%= include('../../../snippets/sso-integrations/datadog/3') %> +<%= include('../../../snippets/sso-integrations/datadog/4') %> +<%= include('../../../snippets/sso-integrations/datadog/5') %> +<%= include('../../../snippets/sso-integrations/datadog/6') %> +<%= include('../../../snippets/sso-integrations/datadog/7') %> diff --git a/articles/integrations/sso/disqus.md b/articles/integrations/sso/disqus.md index 6e840e7fa1..def0e7328a 100644 --- a/articles/integrations/sso/disqus.md +++ b/articles/integrations/sso/disqus.md @@ -1,13 +1,18 @@ --- -title: Disqus Single Sign On Integration -description: How to set up Single Sign On (SSO) integration with Disqus and Auth0. +title: Disqus Single Sign-On Integration +description: Learn how to set up Single Sign-on (SSO) integration with Disqus and Auth0. toc: true -public: true +public: false +topics: + - sso + - disqus +contentType: how-to +useCase: integrate-saas-sso --- -# Disqus Single Sign On Integration +# Disqus Single Sign-On Integration -Disqus allows you to embed a discussion section onto your site where your users can enter comments and interact with you and your other visitors. By implementing a Single Sign On (SSO) integration between Disqus and Auth0, users that have signed in and authenticated via Auth0 can leave comments as themselves in your Disqus discussion section. +Disqus allows you to embed a discussion section onto your site where your users can enter comments and interact with you and your other visitors. By implementing a Single Sign-on (SSO) integration between Disqus and Auth0, users that have signed in and authenticated via Auth0 can leave comments as themselves in your Disqus discussion section. ## Install and Configure Disqus @@ -32,12 +37,12 @@ Disqus allows you to embed a discussion section onto your site where your users 5. Configure your Disqus installation by providing the requested information about your website. When done (or if you want to complete this at a later time using the *Settings* page), click **Complete Setup**. -## Enable and Configure Single Sign On with Disqus +## Enable and Configure Single Sign-on with Disqus -Once you have installed and configured your Disqus instance, you need to enable Single Sign On. +Once you have installed and configured your Disqus instance, you need to enable SSO. ::: warning -A Disqus Pro level subscription is required to use the [Disqus Single Sign-On (SSO) add-on](https://help.disqus.com/customer/portal/articles/236206-integrating-single-sign-on). +A Disqus Pro level subscription is required to use the [Disqus Single Sign-on (SSO) add-on](https://help.disqus.com/customer/portal/articles/236206-integrating-single-sign-on). ::: 1. Navigate to the [Applications section of the Disqus API](https://disqus.com/api/applications/) to register your application. diff --git a/articles/integrations/sso/dropbox.md b/articles/integrations/sso/dropbox.md index aae1f6212d..8e4f2b3105 100644 --- a/articles/integrations/sso/dropbox.md +++ b/articles/integrations/sso/dropbox.md @@ -1,11 +1,19 @@ --- -title: Dropbox Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with Dropbox and Auth0. +title: Dropbox Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Dropbox and Auth0. toc: true public: true +topics: + - sso + - dropxbox +contentType: how-to +useCase: integrate-saas-sso --- - -<%= include('./_template', { - service: "Dropbox", - img: "dropbox" -}) %> +<%= include('../../../snippets/sso-integrations/dropbox/0') %> +<%= include('../../../snippets/sso-integrations/dropbox/1') %> +<%= include('../../../snippets/sso-integrations/dropbox/2') %> +<%= include('../../../snippets/sso-integrations/dropbox/3') %> +<%= include('../../../snippets/sso-integrations/dropbox/4') %> +<%= include('../../../snippets/sso-integrations/dropbox/5') %> +<%= include('../../../snippets/sso-integrations/dropbox/6') %> +<%= include('../../../snippets/sso-integrations/dropbox/7') %> diff --git a/articles/integrations/sso/dynamics-crm.md b/articles/integrations/sso/dynamics-crm.md index de51ff191b..70382fd3bc 100644 --- a/articles/integrations/sso/dynamics-crm.md +++ b/articles/integrations/sso/dynamics-crm.md @@ -1,11 +1,20 @@ --- -title: Microsoft Dynamics CRM Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with Microsoft Dynamics CRM and Auth0. +title: Microsoft Dynamics CRM Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Microsoft Dynamics CRM and Auth0. toc: true public: true +topics: + - sso + - microsoft + - dynamics-crm +contentType: how-to +useCase: integrate-saas-sso --- - -<%= include('./_template', { - service: "Microsoft Dynamics CRM", - img: "dynamics-crm" -}) %> +<%= include('../../../snippets/sso-integrations/dynamics-crm/0') %> +<%= include('../../../snippets/sso-integrations/dynamics-crm/1') %> +<%= include('../../../snippets/sso-integrations/dynamics-crm/2') %> +<%= include('../../../snippets/sso-integrations/dynamics-crm/3') %> +<%= include('../../../snippets/sso-integrations/dynamics-crm/4') %> +<%= include('../../../snippets/sso-integrations/dynamics-crm/5') %> +<%= include('../../../snippets/sso-integrations/dynamics-crm/6') %> +<%= include('../../../snippets/sso-integrations/dynamics-crm/7') %> diff --git a/articles/integrations/sso/echosign.md b/articles/integrations/sso/echosign.md deleted file mode 100644 index c0817a0655..0000000000 --- a/articles/integrations/sso/echosign.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: EchoSign Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with Adobe EchoSign and Auth0. -toc: true -public: true ---- - -<%= include('./_template', { - service: "EchoSign", - img: "echosign" -}) %> diff --git a/articles/integrations/sso/egencia.md b/articles/integrations/sso/egencia.md new file mode 100644 index 0000000000..032d4f2031 --- /dev/null +++ b/articles/integrations/sso/egencia.md @@ -0,0 +1,19 @@ +--- +title: Egencia Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Egencia and Auth0. +toc: true +public: true +topics: + - sso + - egencia +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/egencia/0') %> +<%= include('../../../snippets/sso-integrations/egencia/1') %> +<%= include('../../../snippets/sso-integrations/egencia/2') %> +<%= include('../../../snippets/sso-integrations/egencia/3') %> +<%= include('../../../snippets/sso-integrations/egencia/4') %> +<%= include('../../../snippets/sso-integrations/egencia/5') %> +<%= include('../../../snippets/sso-integrations/egencia/6') %> +<%= include('../../../snippets/sso-integrations/egencia/7') %> diff --git a/articles/integrations/sso/egnyte.md b/articles/integrations/sso/egnyte.md index 682c83d828..fd5395bcac 100644 --- a/articles/integrations/sso/egnyte.md +++ b/articles/integrations/sso/egnyte.md @@ -1,11 +1,19 @@ --- -title: Egnyte Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with Egnyte and Auth0. +title: Egnyte Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Egnyte and Auth0. toc: true public: true +topics: + - sso + - egnyte +contentType: how-to +useCase: integrate-saas-sso --- - -<%= include('./_template', { - service: "Egnyte", - img: "egnyte" -}) %> +<%= include('../../../snippets/sso-integrations/egnyte/0') %> +<%= include('../../../snippets/sso-integrations/egnyte/1') %> +<%= include('../../../snippets/sso-integrations/egnyte/2') %> +<%= include('../../../snippets/sso-integrations/egnyte/3') %> +<%= include('../../../snippets/sso-integrations/egnyte/4') %> +<%= include('../../../snippets/sso-integrations/egnyte/5') %> +<%= include('../../../snippets/sso-integrations/egnyte/6') %> +<%= include('../../../snippets/sso-integrations/egnyte/7') %> diff --git a/articles/integrations/sso/eloqua.md b/articles/integrations/sso/eloqua.md new file mode 100644 index 0000000000..3c1fe2c7e2 --- /dev/null +++ b/articles/integrations/sso/eloqua.md @@ -0,0 +1,19 @@ +--- +title: Eloqua Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Eloqua and Auth0. +toc: true +public: true +topics: + - sso + - eloqua +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/eloqua/0') %> +<%= include('../../../snippets/sso-integrations/eloqua/1') %> +<%= include('../../../snippets/sso-integrations/eloqua/2') %> +<%= include('../../../snippets/sso-integrations/eloqua/3') %> +<%= include('../../../snippets/sso-integrations/eloqua/4') %> +<%= include('../../../snippets/sso-integrations/eloqua/5') %> +<%= include('../../../snippets/sso-integrations/eloqua/6') %> +<%= include('../../../snippets/sso-integrations/eloqua/7') %> diff --git a/articles/integrations/sso/freshdesk.md b/articles/integrations/sso/freshdesk.md new file mode 100644 index 0000000000..46018221fe --- /dev/null +++ b/articles/integrations/sso/freshdesk.md @@ -0,0 +1,19 @@ +--- +title: Freshdesk Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Freshdesk and Auth0. +toc: true +public: true +topics: + - sso + - freshdesk +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/freshdesk/0') %> +<%= include('../../../snippets/sso-integrations/freshdesk/1') %> +<%= include('../../../snippets/sso-integrations/freshdesk/2') %> +<%= include('../../../snippets/sso-integrations/freshdesk/3') %> +<%= include('../../../snippets/sso-integrations/freshdesk/4') %> +<%= include('../../../snippets/sso-integrations/freshdesk/5') %> +<%= include('../../../snippets/sso-integrations/freshdesk/6') %> +<%= include('../../../snippets/sso-integrations/freshdesk/7') %> diff --git a/articles/integrations/sso/github-enterprise-cloud.md b/articles/integrations/sso/github-enterprise-cloud.md new file mode 100644 index 0000000000..8ad8b8220d --- /dev/null +++ b/articles/integrations/sso/github-enterprise-cloud.md @@ -0,0 +1,19 @@ +--- +title: GitHub Enterprise Cloud Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with GitHub Enterprise Cloud and Auth0. +toc: true +public: true +topics: + - sso + - github-enterprise-cloud +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/github-enterprise-cloud/0') %> +<%= include('../../../snippets/sso-integrations/github-enterprise-cloud/1') %> +<%= include('../../../snippets/sso-integrations/github-enterprise-cloud/2') %> +<%= include('../../../snippets/sso-integrations/github-enterprise-cloud/3') %> +<%= include('../../../snippets/sso-integrations/github-enterprise-cloud/4') %> +<%= include('../../../snippets/sso-integrations/github-enterprise-cloud/5') %> +<%= include('../../../snippets/sso-integrations/github-enterprise-cloud/6') %> +<%= include('../../../snippets/sso-integrations/github-enterprise-cloud/7') %> diff --git a/articles/integrations/sso/github-enterprise-server.md b/articles/integrations/sso/github-enterprise-server.md new file mode 100644 index 0000000000..3a49e22ce5 --- /dev/null +++ b/articles/integrations/sso/github-enterprise-server.md @@ -0,0 +1,19 @@ +--- +title: GitHub Enterprise Server Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with GitHub Enterprise Server and Auth0. +toc: true +public: true +topics: + - sso + - github-enterprise-server +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/github-enterprise-server/0') %> +<%= include('../../../snippets/sso-integrations/github-enterprise-server/1') %> +<%= include('../../../snippets/sso-integrations/github-enterprise-server/2') %> +<%= include('../../../snippets/sso-integrations/github-enterprise-server/3') %> +<%= include('../../../snippets/sso-integrations/github-enterprise-server/4') %> +<%= include('../../../snippets/sso-integrations/github-enterprise-server/5') %> +<%= include('../../../snippets/sso-integrations/github-enterprise-server/6') %> +<%= include('../../../snippets/sso-integrations/github-enterprise-server/7') %> diff --git a/articles/integrations/sso/google-workspace.md b/articles/integrations/sso/google-workspace.md new file mode 100644 index 0000000000..b9abad69f3 --- /dev/null +++ b/articles/integrations/sso/google-workspace.md @@ -0,0 +1,19 @@ +--- +title: Google Workspace Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Google Workspace and Auth0. +toc: true +public: true +topics: + - sso + - Google Workspace +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/google-workspace/0') %> +<%= include('../../../snippets/sso-integrations/google-workspace/1') %> +<%= include('../../../snippets/sso-integrations/google-workspace/2') %> +<%= include('../../../snippets/sso-integrations/google-workspace/3') %> +<%= include('../../../snippets/sso-integrations/google-workspace/4') %> +<%= include('../../../snippets/sso-integrations/google-workspace/5') %> +<%= include('../../../snippets/sso-integrations/google-workspace/6') %> +<%= include('../../../snippets/sso-integrations/google-workspace/7') %> diff --git a/articles/integrations/sso/heroku.md b/articles/integrations/sso/heroku.md new file mode 100644 index 0000000000..9ad96804fb --- /dev/null +++ b/articles/integrations/sso/heroku.md @@ -0,0 +1,19 @@ +--- +title: Heroku Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Heroku and Auth0. +toc: true +public: true +topics: + - sso + - heroku +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/heroku/0') %> +<%= include('../../../snippets/sso-integrations/heroku/1') %> +<%= include('../../../snippets/sso-integrations/heroku/2') %> +<%= include('../../../snippets/sso-integrations/heroku/3') %> +<%= include('../../../snippets/sso-integrations/heroku/4') %> +<%= include('../../../snippets/sso-integrations/heroku/5') %> +<%= include('../../../snippets/sso-integrations/heroku/6') %> +<%= include('../../../snippets/sso-integrations/heroku/7') %> diff --git a/articles/integrations/sso/hosted-graphite.md b/articles/integrations/sso/hosted-graphite.md new file mode 100644 index 0000000000..e72168fcc7 --- /dev/null +++ b/articles/integrations/sso/hosted-graphite.md @@ -0,0 +1,19 @@ +--- +title: Hosted Graphite Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Hosted Graphite and Auth0. +toc: true +public: true +topics: + - sso + - hosted-graphite +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/hosted-graphite/0') %> +<%= include('../../../snippets/sso-integrations/hosted-graphite/1') %> +<%= include('../../../snippets/sso-integrations/hosted-graphite/2') %> +<%= include('../../../snippets/sso-integrations/hosted-graphite/3') %> +<%= include('../../../snippets/sso-integrations/hosted-graphite/4') %> +<%= include('../../../snippets/sso-integrations/hosted-graphite/5') %> +<%= include('../../../snippets/sso-integrations/hosted-graphite/6') %> +<%= include('../../../snippets/sso-integrations/hosted-graphite/7') %> diff --git a/articles/integrations/sso/index.md b/articles/integrations/sso/index.md index d01d7da474..afe2efda39 100644 --- a/articles/integrations/sso/index.md +++ b/articles/integrations/sso/index.md @@ -1,44 +1,48 @@ --- -title: Single Sign On Integrations -description: Overview of Auth0 Single Sign On (SSO) Integrations. +title: Single Sign-On Integrations +description: Learn about Auth0 Single Sign-on (SSO) Integrations. +topics: + - sso +contentType: + - index +useCase: integrate-saas-sso --- +# Single Sign-On Integrations -# Single Sign On Integrations - -Single Sign On (SSO) Integrations enable the use of external services for single sign-on. +Single Sign-on (SSO) Integrations are client applications that enable the use of external services (e.g., Dropbox, Slack, or Zoom) for SSO. The integration allows your users to log in using Auth0's [identity providers](/identityproviders). Auth0 provides SSO Integrations for the following services: - [Active Directory RMS](/integrations/sso/ad-rms) +- [Adobe Sign](/integrations/sso/adobe-sign) - [Box](/integrations/sso/box) +- [Cisco WebEx](/integrations/sso/cisco-webex) - [CloudBees](/integrations/sso/cloudbees) - [Concur](/integrations/sso/concur) -- [Disqus](/integrations/sso/disqus) +- [Datadog](/integrations/sso/datadog) - [Dropbox](/integrations/sso/dropbox) -- [Microsoft Dynamics CRM](/integrations/sso/dynamics-crm) -- [Adobe Echosign](/integrations/sso/echosign) +- [Dynamics CRM](/integrations/sso/dynamics-crm) +- [Egencia](/integrations/sso/egencia) - [Egnyte](/integrations/sso/egnyte) +- [Eloqua](/integrations/sso/eloqua) +- [Freshdesk](/integrations/sso/freshdesk) +- [Google Workspace](/integrations/sso/google-workspace) +- [GitHub Enterprise Cloud](/integrations/sso/github-enterprise-cloud) +- [GitHub Enterprise Server](/integrations/sso/github-enterprise-server) +- [Heroku](/integrations/sso/heroku) +- [Hosted Graphite](/integrations/sso/hosted-graphite) +- [Litmos](/integrations/sso/litmos) - [New Relic](/integrations/sso/new-relic) - [Office 365](/integrations/sso/office-365) -- [SalesForce](/integrations/sso/salesforce) -- [SharePoint](/integrations/sso/sharepoint) +- [Pluralsight](/integrations/sso/pluralsight) +- [Salesforce](/integrations/sso/salesforce) +- [Sentry](/integrations/sso/sentry) - [Slack](/integrations/sso/slack) - [SpringCM](/integrations/sso/springcm) +- [Sprout Video](/integrations/sso/sprout-video) +- [Tableau Online](/integrations/sso/tableau-online) +- [Tableau Server](/integrations/sso/tableau-server) +- [Workday](/integrations/sso/workday) +- [Workpath](/integrations/sso/workpath) - [Zendesk](/integrations/sso/zendesk) - [Zoom](/integrations/sso/zoom) - -## Create an SSO Integration - -To create a new SSO Integration, navigate to [Dashboard > SSO Integrations](https://manage.auth0.com/#/externalapps) and click **+ Create SSO Integration**. - -![](/media/articles/sso/integrations/new.png) - -Next, select a provider. - -![](/media/articles/sso/integrations/options.png) - -Set the name for your SSO Integration. Click **Create**. - -![](/media/articles/sso/integrations/name.png) - -You will be brought to the **Configuration Instructions** page for the provider, follow the instructions to complete the SSO Integration. diff --git a/articles/integrations/sso/litmos.md b/articles/integrations/sso/litmos.md new file mode 100644 index 0000000000..d29d7ccc42 --- /dev/null +++ b/articles/integrations/sso/litmos.md @@ -0,0 +1,19 @@ +--- +title: Litmos Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Litmos and Auth0. +toc: true +public: true +topics: + - sso + - litmos +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/litmos/0') %> +<%= include('../../../snippets/sso-integrations/litmos/1') %> +<%= include('../../../snippets/sso-integrations/litmos/2') %> +<%= include('../../../snippets/sso-integrations/litmos/3') %> +<%= include('../../../snippets/sso-integrations/litmos/4') %> +<%= include('../../../snippets/sso-integrations/litmos/5') %> +<%= include('../../../snippets/sso-integrations/litmos/6') %> +<%= include('../../../snippets/sso-integrations/litmos/7') %> diff --git a/articles/integrations/sso/new-relic.md b/articles/integrations/sso/new-relic.md index 8838d04cb3..68fbf8906b 100644 --- a/articles/integrations/sso/new-relic.md +++ b/articles/integrations/sso/new-relic.md @@ -1,11 +1,20 @@ --- -title: New Relic Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with New Relic and Auth0. +title: New Relic Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with New Relic and Auth0. toc: true public: true +topics: + - sso + - new-relic +contentType: how-to +useCase: integrate-saas-sso --- +<%= include('../../../snippets/sso-integrations/new-relic/0') %> +<%= include('../../../snippets/sso-integrations/new-relic/1') %> +<%= include('../../../snippets/sso-integrations/new-relic/2') %> +<%= include('../../../snippets/sso-integrations/new-relic/3') %> +<%= include('../../../snippets/sso-integrations/new-relic/4') %> +<%= include('../../../snippets/sso-integrations/new-relic/5') %> +<%= include('../../../snippets/sso-integrations/new-relic/6') %> +<%= include('../../../snippets/sso-integrations/new-relic/7') %> -<%= include('./_template', { - service: "New Relic", - img: "new-relic" -}) %> diff --git a/articles/integrations/sso/office-365.md b/articles/integrations/sso/office-365.md index 7df5a3843b..155d016fdd 100644 --- a/articles/integrations/sso/office-365.md +++ b/articles/integrations/sso/office-365.md @@ -1,11 +1,19 @@ --- -title: Office 365 Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with Office 365 and Auth0. +title: Office 365 Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Office 365 and Auth0. toc: true public: true +topics: + - sso + - office-365 +contentType: how-to +useCase: integrate-saas-sso --- - -<%= include('./_template', { - service: "Office 365", - img: "office-365" -}) %> +<%= include('../../../snippets/sso-integrations/office-365/0') %> +<%= include('../../../snippets/sso-integrations/office-365/1') %> +<%= include('../../../snippets/sso-integrations/office-365/2') %> +<%= include('../../../snippets/sso-integrations/office-365/3') %> +<%= include('../../../snippets/sso-integrations/office-365/4') %> +<%= include('../../../snippets/sso-integrations/office-365/5') %> +<%= include('../../../snippets/sso-integrations/office-365/6') %> +<%= include('../../../snippets/sso-integrations/office-365/7') %> diff --git a/articles/integrations/sso/pluralsight.md b/articles/integrations/sso/pluralsight.md new file mode 100644 index 0000000000..48c55cfa21 --- /dev/null +++ b/articles/integrations/sso/pluralsight.md @@ -0,0 +1,19 @@ +--- +title: Pluralsight Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Pluralsight and Auth0. +toc: true +public: true +topics: + - sso + - dropxbox +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/pluralsight/0') %> +<%= include('../../../snippets/sso-integrations/pluralsight/1') %> +<%= include('../../../snippets/sso-integrations/pluralsight/2') %> +<%= include('../../../snippets/sso-integrations/pluralsight/3') %> +<%= include('../../../snippets/sso-integrations/pluralsight/4') %> +<%= include('../../../snippets/sso-integrations/pluralsight/5') %> +<%= include('../../../snippets/sso-integrations/pluralsight/6') %> +<%= include('../../../snippets/sso-integrations/pluralsight/7') %> diff --git a/articles/integrations/sso/salesforce.md b/articles/integrations/sso/salesforce.md index 3f615d329d..2946044f0f 100644 --- a/articles/integrations/sso/salesforce.md +++ b/articles/integrations/sso/salesforce.md @@ -1,11 +1,19 @@ --- -title: Salesforce Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with Salesforce and Auth0. +title: Salesforce Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Salesforce and Auth0. toc: true public: true +topics: + - sso + - salesforce +contentType: how-to +useCase: integrate-saas-sso --- - -<%= include('./_template', { - service: "Salesforce", - img: "salesforce" -}) %> +<%= include('../../../snippets/sso-integrations/salesforce/0') %> +<%= include('../../../snippets/sso-integrations/salesforce/1') %> +<%= include('../../../snippets/sso-integrations/salesforce/2') %> +<%= include('../../../snippets/sso-integrations/salesforce/3') %> +<%= include('../../../snippets/sso-integrations/salesforce/4') %> +<%= include('../../../snippets/sso-integrations/salesforce/5') %> +<%= include('../../../snippets/sso-integrations/salesforce/6') %> +<%= include('../../../snippets/sso-integrations/salesforce/7') %> diff --git a/articles/integrations/sso/sentry.md b/articles/integrations/sso/sentry.md new file mode 100644 index 0000000000..5bf371deb2 --- /dev/null +++ b/articles/integrations/sso/sentry.md @@ -0,0 +1,19 @@ +--- +title: Sentry Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Sentry and Auth0. +toc: true +public: true +topics: + - sso + - sentry +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/sentry/0') %> +<%= include('../../../snippets/sso-integrations/sentry/1') %> +<%= include('../../../snippets/sso-integrations/sentry/2') %> +<%= include('../../../snippets/sso-integrations/sentry/3') %> +<%= include('../../../snippets/sso-integrations/sentry/4') %> +<%= include('../../../snippets/sso-integrations/sentry/5') %> +<%= include('../../../snippets/sso-integrations/sentry/6') %> +<%= include('../../../snippets/sso-integrations/sentry/7') %> diff --git a/articles/integrations/sso/sharepoint.md b/articles/integrations/sso/sharepoint.md index f770cc10e6..8fde6b36df 100644 --- a/articles/integrations/sso/sharepoint.md +++ b/articles/integrations/sso/sharepoint.md @@ -1,11 +1,19 @@ --- -title: SharePoint Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with SharePoint and Auth0. +title: SharePoint Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with SharePoint and Auth0. toc: true -public: true +public: false +topics: + - sso + - sharepoint +contentType: how-to +useCase: integrate-saas-sso --- - -<%= include('./_template', { - service: "SharePoint", - img: "sharepoint" -}) %> +<%= include('../../../snippets/sso-integrations/sharepoint/0') %> +<%= include('../../../snippets/sso-integrations/sharepoint/1') %> +<%= include('../../../snippets/sso-integrations/sharepoint/2') %> +<%= include('../../../snippets/sso-integrations/sharepoint/3') %> +<%= include('../../../snippets/sso-integrations/sharepoint/4') %> +<%= include('../../../snippets/sso-integrations/sharepoint/5') %> +<%= include('../../../snippets/sso-integrations/sharepoint/6') %> +<%= include('../../../snippets/sso-integrations/sharepoint/7') %> diff --git a/articles/integrations/sso/slack.md b/articles/integrations/sso/slack.md index f450bd207b..7fff98bb76 100644 --- a/articles/integrations/sso/slack.md +++ b/articles/integrations/sso/slack.md @@ -1,15 +1,23 @@ --- -title: Slack Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with Slack and Auth0. +title: Slack Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Slack and Auth0. toc: true public: true +topics: + - sso + - slack +contentType: how-to +useCase: integrate-saas-sso --- - -<%= include('./_template', { - service: "Slack", - img: "slack" -}) %> +<%= include('../../../snippets/sso-integrations/slack/0') %> +<%= include('../../../snippets/sso-integrations/slack/1') %> +<%= include('../../../snippets/sso-integrations/slack/2') %> +<%= include('../../../snippets/sso-integrations/slack/3') %> +<%= include('../../../snippets/sso-integrations/slack/4') %> +<%= include('../../../snippets/sso-integrations/slack/5') %> +<%= include('../../../snippets/sso-integrations/slack/6') %> +<%= include('../../../snippets/sso-integrations/slack/7') %> ::: note -For more information, check out Slack's article on [enabling SAML-based single sign-on](https://get.slack.help/hc/en-us/articles/203772216-Enabling-SAML-based-single-sign-on). +For more information, check out Slack's article on [enabling SAML-based Single Sign-on (SSO)](https://get.slack.help/hc/en-us/articles/203772216-Enabling-SAML-based-single-sign-on). ::: diff --git a/articles/integrations/sso/springcm.md b/articles/integrations/sso/springcm.md index 10d1ac7406..ca7ea7e521 100644 --- a/articles/integrations/sso/springcm.md +++ b/articles/integrations/sso/springcm.md @@ -1,11 +1,19 @@ --- -title: SpringCM Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with SpringCM and Auth0. +title: SpringCM Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with SpringCM and Auth0. toc: true public: true +topics: + - sso + - springcm +contentType: how-to +useCase: integrate-saas-sso --- - -<%= include('./_template', { - service: "SpringCM", - img: "springcm" -}) %> +<%= include('../../../snippets/sso-integrations/springcm/0') %> +<%= include('../../../snippets/sso-integrations/springcm/1') %> +<%= include('../../../snippets/sso-integrations/springcm/2') %> +<%= include('../../../snippets/sso-integrations/springcm/3') %> +<%= include('../../../snippets/sso-integrations/springcm/4') %> +<%= include('../../../snippets/sso-integrations/springcm/5') %> +<%= include('../../../snippets/sso-integrations/springcm/6') %> +<%= include('../../../snippets/sso-integrations/springcm/7') %> diff --git a/articles/integrations/sso/sprout-video.md b/articles/integrations/sso/sprout-video.md new file mode 100644 index 0000000000..9299a866ec --- /dev/null +++ b/articles/integrations/sso/sprout-video.md @@ -0,0 +1,19 @@ +--- +title: Sprout Video Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Sprout Video and Auth0. +toc: true +public: true +topics: + - sso + - sprout-video +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/sprout-video/0') %> +<%= include('../../../snippets/sso-integrations/sprout-video/1') %> +<%= include('../../../snippets/sso-integrations/sprout-video/2') %> +<%= include('../../../snippets/sso-integrations/sprout-video/3') %> +<%= include('../../../snippets/sso-integrations/sprout-video/4') %> +<%= include('../../../snippets/sso-integrations/sprout-video/5') %> +<%= include('../../../snippets/sso-integrations/sprout-video/6') %> +<%= include('../../../snippets/sso-integrations/sprout-video/7') %> diff --git a/articles/integrations/sso/tableau-online.md b/articles/integrations/sso/tableau-online.md new file mode 100644 index 0000000000..89848db4c2 --- /dev/null +++ b/articles/integrations/sso/tableau-online.md @@ -0,0 +1,19 @@ +--- +title: Tableau Online Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Tableau Online and Auth0. +toc: true +public: true +topics: + - sso + - tableau-online +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/tableau-online/0') %> +<%= include('../../../snippets/sso-integrations/tableau-online/1') %> +<%= include('../../../snippets/sso-integrations/tableau-online/2') %> +<%= include('../../../snippets/sso-integrations/tableau-online/3') %> +<%= include('../../../snippets/sso-integrations/tableau-online/4') %> +<%= include('../../../snippets/sso-integrations/tableau-online/5') %> +<%= include('../../../snippets/sso-integrations/tableau-online/6') %> +<%= include('../../../snippets/sso-integrations/tableau-online/7') %> diff --git a/articles/integrations/sso/tableau-server.md b/articles/integrations/sso/tableau-server.md new file mode 100644 index 0000000000..648e77c4ab --- /dev/null +++ b/articles/integrations/sso/tableau-server.md @@ -0,0 +1,19 @@ +--- +title: Tableau Server Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Tableau Server and Auth0. +toc: true +public: true +topics: + - sso + - tableau-server +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/tableau-server/0') %> +<%= include('../../../snippets/sso-integrations/tableau-server/1') %> +<%= include('../../../snippets/sso-integrations/tableau-server/2') %> +<%= include('../../../snippets/sso-integrations/tableau-server/3') %> +<%= include('../../../snippets/sso-integrations/tableau-server/4') %> +<%= include('../../../snippets/sso-integrations/tableau-server/5') %> +<%= include('../../../snippets/sso-integrations/tableau-server/6') %> +<%= include('../../../snippets/sso-integrations/tableau-server/7') %> diff --git a/articles/integrations/sso/workday.md b/articles/integrations/sso/workday.md new file mode 100644 index 0000000000..d77f02f586 --- /dev/null +++ b/articles/integrations/sso/workday.md @@ -0,0 +1,19 @@ +--- +title: Workday Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Workday and Auth0. +toc: true +public: true +topics: + - sso + - workday +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/workday/0') %> +<%= include('../../../snippets/sso-integrations/workday/1') %> +<%= include('../../../snippets/sso-integrations/workday/2') %> +<%= include('../../../snippets/sso-integrations/workday/3') %> +<%= include('../../../snippets/sso-integrations/workday/4') %> +<%= include('../../../snippets/sso-integrations/workday/5') %> +<%= include('../../../snippets/sso-integrations/workday/6') %> +<%= include('../../../snippets/sso-integrations/workday/7') %> diff --git a/articles/integrations/sso/workpath.md b/articles/integrations/sso/workpath.md new file mode 100644 index 0000000000..6857d56b43 --- /dev/null +++ b/articles/integrations/sso/workpath.md @@ -0,0 +1,19 @@ +--- +title: Workpath Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Workpath and Auth0. +toc: true +public: true +topics: + - sso + - workpath +contentType: how-to +useCase: integrate-saas-sso +--- +<%= include('../../../snippets/sso-integrations/workpath/0') %> +<%= include('../../../snippets/sso-integrations/workpath/1') %> +<%= include('../../../snippets/sso-integrations/workpath/2') %> +<%= include('../../../snippets/sso-integrations/workpath/3') %> +<%= include('../../../snippets/sso-integrations/workpath/4') %> +<%= include('../../../snippets/sso-integrations/workpath/5') %> +<%= include('../../../snippets/sso-integrations/workpath/6') %> +<%= include('../../../snippets/sso-integrations/workpath/7') %> diff --git a/articles/integrations/sso/zendesk.md b/articles/integrations/sso/zendesk.md index 97e8dbb037..f4409ec17d 100644 --- a/articles/integrations/sso/zendesk.md +++ b/articles/integrations/sso/zendesk.md @@ -1,11 +1,19 @@ --- -title: Zendesk Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with Zendesk and Auth0. +title: Zendesk Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Zendesk and Auth0. toc: true public: true +topics: + - sso + - zendesk +contentType: how-to +useCase: integrate-saas-sso --- - -<%= include('./_template', { - service: "Zendesk", - img: "zendesk" -}) %> +<%= include('../../../snippets/sso-integrations/zendesk/0') %> +<%= include('../../../snippets/sso-integrations/zendesk/1') %> +<%= include('../../../snippets/sso-integrations/zendesk/2') %> +<%= include('../../../snippets/sso-integrations/zendesk/3') %> +<%= include('../../../snippets/sso-integrations/zendesk/4') %> +<%= include('../../../snippets/sso-integrations/zendesk/5') %> +<%= include('../../../snippets/sso-integrations/zendesk/6') %> +<%= include('../../../snippets/sso-integrations/zendesk/7') %> diff --git a/articles/integrations/sso/zoom.md b/articles/integrations/sso/zoom.md index e160025877..c987b3d838 100644 --- a/articles/integrations/sso/zoom.md +++ b/articles/integrations/sso/zoom.md @@ -1,11 +1,19 @@ --- -title: Zoom Single Sign On Integration -description: How to set up a Single Sign On (SSO) integration with Zoom and Auth0. +title: Zoom Single Sign-On Integration +description: Learn how to set up a Single Sign-on (SSO) integration with Zoom and Auth0. toc: true public: true +topics: + - sso + - zoom +contentType: how-to +useCase: integrate-saas-sso --- - -<%= include('./_template', { - service: "Zoom", - img: "zoom" -}) %> +<%= include('../../../snippets/sso-integrations/zoom/0') %> +<%= include('../../../snippets/sso-integrations/zoom/1') %> +<%= include('../../../snippets/sso-integrations/zoom/2') %> +<%= include('../../../snippets/sso-integrations/zoom/3') %> +<%= include('../../../snippets/sso-integrations/zoom/4') %> +<%= include('../../../snippets/sso-integrations/zoom/5') %> +<%= include('../../../snippets/sso-integrations/zoom/6') %> +<%= include('../../../snippets/sso-integrations/zoom/7') %> diff --git a/articles/integrations/using-auth0-as-an-identity-provider-with-github-enterprise.md b/articles/integrations/using-auth0-as-an-identity-provider-with-github-enterprise.md deleted file mode 100644 index 024189639e..0000000000 --- a/articles/integrations/using-auth0-as-an-identity-provider-with-github-enterprise.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -description: How to use Auth0 as an identity provider with GitHub Enterprise. -crews: crew-2 ---- - -# Using Auth0 as an Identity Provider with GitHub Enterprise - -When using GitHub Enterprise, you can configure Auth0 to act as an identity provider. - -## Configure Your Auth0 Application - -Create a new or select an existing Application using the [Applications](${manage_url}/#/applications) page of the Management Dashboard. - -On the row associated with your chosen Application, click on the **Addons** button, which is the second button from the right on the appropriate Application row. - -![](/media/articles/scenarios/github-enterprise/clients.png) - -When the **Addons** page opens, set the slider in the box called **SAML2 WEB APP** to the right. The slider will turn green to indicate that the Addon is active. - -![](/media/articles/scenarios/github-enterprise/addons.png) - -You will then be presented with the Addon Settings page: - -![](/media/articles/scenarios/github-enterprise/addon-settings.png) - -Set the following configuration variables: - -* **Application Callback URL**: the Assertion consumption URL of your GitHub Exterprise instance; - * Example: `https://your_github_enterprise_url/saml/consume` -* **Settings**: the URL for your GitHub Enterprise instance set as the `audience`. - * Example: `{ "audience": "https://your_github_enterprise_url" }` - -You can check the validity of these settings by clicking **Debug**. - -To persist your changes, click **Save**. - -To obtain the values necessary for configuring your GitHub Enterprise account, switch over to the **Usage** tab. - -![](/media/articles/scenarios/github-enterprise/addon-usage.png) - -You will need values/files for the following configuration settings: - -* Issuer; -* Auth0 Certificate (download this file so that you can upload it to GitHub); -* Identity Provider Login URL. - -## Configure Your GitHub Enterprise Account - -Log in to your GitHub Enterprise Management Console. You should have a custom URL that follows this format: `https:// your_github_enterprise_url:8443/setup/settings`. - -Navigate to the **Authentication** section under the **Settings** page. - -![](/media/articles/scenarios/github-enterprise/auth-settings.png) - -Set the following configuration variables: - -* **Authentication Type**: Set as *SAML*; -* **Single sign-on URL**: Paste the *Identity Provider Login URL* copied from the Auth0 Dashboard here; -* **Issuer**: Paste the *Issuer* value copied from the Auth0 Dashboard here. The format of the value is `urn:.auth0.com`. - -Upload the Auth0 Certificate you downloaded under **Replace Certificate**. - -![](/media/articles/scenarios/github-enterprise/auth-certificate.png) - -Click **Save** to persist your changes. Saving automatically restarts your GitHub Enterprise instance. At this point, anyone accessing your GitHub Enterprise will be prompted to sign in with Auth0. diff --git a/articles/integrations/using-auth0-to-secure-a-cli.md b/articles/integrations/using-auth0-to-secure-a-cli.md index 6baac904f5..deacfe2ad6 100644 --- a/articles/integrations/using-auth0-to-secure-a-cli.md +++ b/articles/integrations/using-auth0-to-secure-a-cli.md @@ -1,40 +1,44 @@ --- -title: Using Auth0 to secure a CLI +title: Secure a CLI with Auth0 description: How to use Auth0 to secure a CLI. +topics: + - integrations + - cli +contentType: how-to +useCase: + - integrate-saas-sso + - cli-authentication + - --- -# Using Auth0 to secure a CLI +# Secure a CLI with Auth0 -Authentication in CLI programs is straightforward if the identity provider supports sending credentials, like database connections, SMS passwordless and AD. If the identity provider requires a browser redirect, then the process is slightly more complicated. +There are three ways to secure a CLI with Auth0 in order of most secure to least secure: -::: note - If your identity provider supports sending credentials, then the grant you should implement is the [Client Credentials](/api-auth/grant/client-credentials). For details on how to implement this refer to [How to implement the Client Credentials Grant](/api-auth/tutorials/client-credentials). -::: - -Auth0 implements the [Proof Key for Code Exchange by OAuth Public Clients](https://tools.ietf.org/html/rfc7636). This flow makes it easy to add authentication to a CLI while keeping higher standards of security. +* [Device Authorization Flow](#device-authorization-flow) +* [Client Credentials Grant Flow](#client-credentials-grant-flow) +* [Resource Owner Password Grant Flow](#resource-owner-password-grant-flow) (not recommended) -## How PKCE works +The first two options are for user-based authentication, whereas the third option is only when you're attempting to authenticate the CLI client itself, which is a very rare situation. -Traditionally, public applications (such as mobile apps, SPAs and CLIs) have used the [implicit flow](/api-auth/grant/implicit) to obtain a token. In this flow, there's no __application authentication__ because there's no easy way of storing a `client_secret`. +## Device Authorization Flow -The [PKCE flow](/api-auth/grant/authorization-code-pkce) (`pixy` for friends), increases security by adding a cryptographic challenge in the token exchange. This prevents rogue apps to intercept the response from Auth0, and get hold of the token. +With input-constrained devices that connect to the internet, rather than authenticate the user directly, the device asks the user to go to a link on their computer or smartphone and authorize the device. This avoids a poor user experience for devices that do not have an easy way to enter text. To do this, device apps use the Device Authorization Flow (drafted in [OAuth 2.0](https://tools.ietf.org/html/draft-ietf-oauth-device-flow-15)), in which they pass along their Client ID to initiate the authorization process and get a token. -## How to implement PKCE +The easiest way to implement the [Device Authorization Flow](/flows/concepts/device-auth) is to follow the steps in [Call API Using Device Authorization Flow](/flows/guides/device-auth/call-api-device-auth). -The steps to follow to implement this grant are the following: +## Client Credentials Grant Flow -1. __Create a Code Verifier__. This is a randomly generated value that will be used to generate the `code_challenge` (which will be sent in the authorization request). +Use the Client Credentials Grant (CCG) flow when users and downstream identity providers aren't involved and you want to authenticate based on distinct machines or devices. -2. __Create a Code Challenge__. A hashed (`SHA256`) and base64Url encoded value, generated using the `code_verifier`. +If your identity provider supports sending credentials, then you should use the [Client Credentials Flow](/flows/concepts/client-credentials). For details on how to implement this, refer to [Call API Using the Client Credentials Flow](/flows/guides/client-credentials/call-api-client-credentials). -3. __Initiate the Authorization Request__. The regular OAuth 2.0 authorization request, with the caveat that now it includes two parameters: the `code_challenge` and the `code_challenge_method` which should be `S256`. If the authorization is successful, then Auth0 will redirect the browser to the callback with a `code` query parameter: `${account.callback}/?code=123`. +## Resource Owner Password Grant Flow -::: warning - In order for the CLI to be able to receive the callback and retrieve the code, it should run on the web server. -::: +We do not recommend using the Resource Owner Password Grant (ROPG) flow for native applications. In the [RFC 8252 OAuth 2.0 for Native Apps](https://tools.ietf.org/html/rfc8252) from the Internet Engineering Task Force (IETF), it is recommended that “OAuth 2.0 authorization request from native apps should ONLY be made through external user-agents, primarily the user’s browser”. For details, see [RFC 8252 Embedded User-Agents](https://tools.ietf.org/html/rfc8252#section-8.12). -4. __Exchange the Authorization Code for a Token__. With the `code`, the program then uses the [/oauth/token endpoint](/api/authentication#authorization-code-pkce-) to obtain a token. In this second step, the CLI program adds a `verifier` parameter with the exact same random secret generated in step 1. Auth0 uses this to correlate and verify that the request originates from the same application. If successful the response is another JSON object, with an `id_token`, and `access_token`. Note that if the `verifier` doesn't match with what was sent in the [/authorize endpoint](/api/authentication#authorization-code-grant-pkce-), the request will fail. +Using Resource Owner Password Grant (ROPG) are less secure than the redirect-based options described above. ROPG is only for legacy. In the context of CLIs, it only makes sense for things like connection strings where you need to support legacy programs. ::: note - For implementation details and sample scripts, refer to [Execute an Authorization Code Grant Flow with PKCE](/api-auth/tutorials/authorization-code-grant-pkce). -::: +If you must use ROPG in your native app instead of Device Flow as we recommend, then you can use our [OIDC compliant ROPG endpoint](/api/authentication#resource-owner-password). +::: \ No newline at end of file diff --git a/articles/libraries/_includes/_change_get_profile.md b/articles/libraries/_includes/_change_get_profile.md index 41cdc0a986..96838117ae 100644 --- a/articles/libraries/_includes/_change_get_profile.md +++ b/articles/libraries/_includes/_change_get_profile.md @@ -1,5 +1,5 @@ ### Change calls to getProfile() -The deprecated `getProfile()` function was reimplemented in Lock 11. The previous implementation received an [ID Token](/tokens/id-token) as a parameter and returned the user profile. +The deprecated `getProfile()` function was reimplemented in Lock 11. The previous implementation received an [ID Token](/tokens/concepts/id-tokens) as a parameter and returned the user profile. -The new implementation requires an [Access Token](/tokens/access-token) parameter instead. +The new implementation requires an Access Token parameter instead. diff --git a/articles/libraries/_includes/_configure_custom_domain.md b/articles/libraries/_includes/_configure_custom_domain.md index 3e346bdc10..5a98890df2 100644 --- a/articles/libraries/_includes/_configure_custom_domain.md +++ b/articles/libraries/_includes/_configure_custom_domain.md @@ -10,16 +10,16 @@ var lock = new Auth0Lock('${account.clientId}', 'login.your-domain.com', options); ``` -4. Set the `configurationBaseUrl` option to `https://cdn.auth0.com`. +4. Set the `configurationBaseUrl` option to `https://cdn.us.auth0.com`. ``` var options = { - configurationBaseUrl: 'https://cdn.auth0.com' + configurationBaseUrl: 'https://cdn.us.auth0.com' }; ``` ::: note -The CDN URL varies by region. For regions outside of the US, use `https://cdn.{region}.auth0.com` (for example, use `eu` for Europe, `au` for Australia). +The CDN URL varies by region. Tenants created before 11 June 2020 should use `https://cdn.auth0.com` if the region is the United States, or add `eu` or `au` for Europe or Australia. If your tenant was created after 11 June 2020, use `https://cdn.us.auth0.com` if the region is the United States. ::: #### Management Application diff --git a/articles/libraries/_includes/_default_values.md b/articles/libraries/_includes/_default_values.md index ac6d09ca78..48b1b9eff4 100644 --- a/articles/libraries/_includes/_default_values.md +++ b/articles/libraries/_includes/_default_values.md @@ -1,6 +1,6 @@ ### Default values -Auth0.js v9 will default the value of the [scope](/scopes) parameter to `openid profile email`. +Auth0.js v9 will default the value of the scope parameter to `openid profile email`. If you are running your website from `http://localhost` or `http://127.0.0.1` and you do not specify the `openid profile email` scope when initializing auth0.js, calling the `getSSOData()` method will result in the following error in the browser console: diff --git a/articles/libraries/_includes/_default_values_lock.md b/articles/libraries/_includes/_default_values_lock.md index 8549aa5117..b66229d099 100644 --- a/articles/libraries/_includes/_default_values_lock.md +++ b/articles/libraries/_includes/_default_values_lock.md @@ -1,6 +1,6 @@ ### Default values -Lock 11 will default the [scope](/scopes) parameter to `'openid profile email'`. This is to make the **Last time you logged in with** window work correctly. +Lock 11 will default the scope parameter to `'openid profile email'`. This is to make the **Last time you logged in with** window work correctly. If you are running your website from `http://localhost` or `http://127.0.0.1` and you do not specify the `openid profile email` scope when initializing Lock, you may get the following error in the browser console: diff --git a/articles/libraries/_includes/_embedded_sso.md b/articles/libraries/_includes/_embedded_sso.md index 8a7bbf58d5..bd379358ae 100644 --- a/articles/libraries/_includes/_embedded_sso.md +++ b/articles/libraries/_includes/_embedded_sso.md @@ -1,10 +1,10 @@ -### SSO with embedded authentication +### Single Sign-On with embedded authentication -Apps with embedded login must meet two criteria in order to have SSO. +Apps with embedded login must meet two criteria in order to have Single Sign-on (SSO). -1. Both of the applications attempting SSO must be [first-party applications](/applications/application-types#first-party-application). SSO with third party applications will not work. +1. Both of the applications attempting SSO must be first-party applications. SSO with third-party applications will not work. 1. They need to make use of [custom domains](/custom-domains) and have both the applications which intend to have SSO as well as the Auth0 tenant on the same domain. Traditionally, Auth0 domains are in the format `foo.auth0.com`, but custom domains allow you to use the same domain for each of the applications in question as well as your Auth0 tenant, preventing the risk of CSRF attacks. ::: note -Our recommendation is to use [universal login](/hosted-pages/login) instead of setting up SSO in embedded login scenarios. Universal login is the most reliable and stable way to perform SSO, and is the only way to do so if you must use multiple domains for your applications, or use [third-party applications](/applications/application-types#third-party-application). +Our recommendation is to use Universal Login instead of setting up SSO in embedded login scenarios. Universal Login is the most reliable and stable way to perform SSO, and is the only way to do so if you must use multiple domains for your applications, or use [third-party applications](/applications/guides/enable-third-party-apps). ::: diff --git a/articles/libraries/_includes/_get_lock_latest_version.md b/articles/libraries/_includes/_get_lock_latest_version.md index 7c1cbac020..8f775a2240 100644 --- a/articles/libraries/_includes/_get_lock_latest_version.md +++ b/articles/libraries/_includes/_get_lock_latest_version.md @@ -1,6 +1,6 @@ ### Update Lock -Update the Lock library using npm or yarn. +Update the Lock library using npm or yarn. ```bash # installation with npm diff --git a/articles/libraries/_includes/_ip_ranges.md b/articles/libraries/_includes/_ip_ranges.md index 28d3422886..b3813c37ce 100644 --- a/articles/libraries/_includes/_ip_ranges.md +++ b/articles/libraries/_includes/_ip_ranges.md @@ -1,7 +1,7 @@ -### Single sign on using IP ranges +### Single sign-on using IP ranges In earlier versions of Lock, you could configure an IP range in an Active Directory/LDAP connection. You could then use that range to allow integrated Windows Authentication if the user's IP was within the range. When this was true, Lock would display a button that users could click and get redirected to the integrated authentication dialog. ![SSO With Lock 10 and Windows IP Ranges](/media/articles/libraries/lock/lock-11-windows-authentication.png) -This functionality has been removed from embedded login using Lock 11. There is no IP detection, and the user will need to type user and password in Lock. It is still available when using universal login. +This functionality has been removed from embedded login using Lock 11. There is no IP detection, and the user will need to type user and password in Lock. It is still available when using Universal Login. diff --git a/articles/libraries/_includes/_last_logged_in_window.md b/articles/libraries/_includes/_last_logged_in_window.md index 2b00879df0..696166ebfb 100644 --- a/articles/libraries/_includes/_last_logged_in_window.md +++ b/articles/libraries/_includes/_last_logged_in_window.md @@ -1,7 +1,9 @@ ### Last time you logged in with window with authorization code flow -Lock 11 will never show the **Last time you logged in with** window when using the [Authorization Code Flow](/api-auth/grant/authorization-code) (that is, when specifying `response_type='code'`). It will always prompt for credentials. +Lock 11 will never show the **Last time you logged in with** window when using the [Authorization Code Flow](/flows/concepts/auth-code) (that is, when specifying `response_type='code'`). It will always prompt for credentials. -The **Last time you logged in with** window will also never do a redirect, even when the `redirect` option is set to `true`. Lock11 still emits the `authenticated` event and you should subscribe to that event to [get the authentication result](/libraries/lock/v11#2-authenticating-and-getting-user-info). +### Last time you logged in with window and redirects + +The **Last time you logged in with** window will never do a redirect, even when the `redirect` option is set to `true`. Lock11 still emits the `authenticated` event and you should subscribe to that event to [get the authentication result](/libraries/lock/v11#2-authenticating-and-getting-user-info). If you want to avoid showing the Lock dialog when there's an existing session in the server, you can use Auth0.js's [checkSession()](/libraries/auth0js#using-checksession-to-acquire-new-tokens) function. diff --git a/articles/libraries/_includes/_legacy_flows.md b/articles/libraries/_includes/_legacy_flows.md index 00734a885b..b6793b4966 100644 --- a/articles/libraries/_includes/_legacy_flows.md +++ b/articles/libraries/_includes/_legacy_flows.md @@ -1,5 +1,5 @@ ### Migrating from legacy authentication flows -The OIDC conformant flows disallow certain practices that were common when developing applications with older versions of the library, like using [Refresh Tokens](tokens/refresh-token), using [id tokens](/tokens/id-token) to call APIs, and accessing non-standard claims in the user profile. +The OIDC conformant flows disallow certain practices that were common when developing applications with older versions of the library, like using Refresh Tokens, using [ID Tokens](/tokens/concepts/id-tokens) to call APIs, and [accessing non-standard claims in the user profile](/api-auth/tutorials/adoption/scope-custom-claims). Follow the steps in the [Migration from Legacy Authentication Flows](guides/migration-legacy-flows) to learn what changes you need to make in your application. diff --git a/articles/libraries/_includes/_oidc_conformant.md b/articles/libraries/_includes/_oidc_conformant.md index d600036909..ec12a82cf5 100644 --- a/articles/libraries/_includes/_oidc_conformant.md +++ b/articles/libraries/_includes/_oidc_conformant.md @@ -2,4 +2,4 @@ When the `oidcConformant` flag was set to true, Lock 10 used [Cross Origin Authentication](/cross-origin-authentication), and did not use the '/usernamepassword/login' and '/ssodata' endpoints. -Given Lock 11 always always uses Cross Origin Authentication and does not use the '/ssodata' endpoint, this flag is not longer needed. If specified, it will be ignored. +Given Lock 11 always uses Cross Origin Authentication and does not use the '/ssodata' endpoint, this flag is not longer needed. If specified, it will be ignored. diff --git a/articles/libraries/_includes/_review_get_ssodata.md b/articles/libraries/_includes/_review_get_ssodata.md index 5c9538812c..509974a67a 100644 --- a/articles/libraries/_includes/_review_get_ssodata.md +++ b/articles/libraries/_includes/_review_get_ssodata.md @@ -2,7 +2,7 @@ The deprecated `getSSOData()` function was reimplemented in Auth0.js v9 to simplify migration from older versions, but the behavior is not exactly the same. -The function will not work as expected when you use it in Web Applications that use the [Authorization Code Flow](/api-auth/grant/authorization-code) (such as when you specify `response_type='code'`). It will always return that there is not a current session. +The function will not work as expected when you use it in Web Applications that use the [Authorization Code Flow](/flows/concepts/auth-code) (such as when you specify `response_type='code'`). It will always return that there is not a current session. If you want to avoid showing the Lock dialog when there is an existing session in the server, you can use the [checkSession()](/libraries/auth0js#using-checksession-to-acquire-new-tokens) function in Auth0.js. @@ -21,6 +21,6 @@ If you are going to keep using `getSSOData()`, take into account the changes in | lastUsedClientId | The client id for the last active connection | The last application used when authenticating from the current browsers | | lastUsedUserId | The user id for the current session | The same | | lastUsedUsername | User's email or name | The same (requires `scope=’openid profile email’)` | -| lastUsedConnection | Last used connection and strategy. | Last connection used when authenticated from the current browser. It will be `null` if the user authenticated via [universal login](/hosted-pages/login). It will not return `strategy`, only `name` | +| lastUsedConnection | Last used connection and strategy. | Last connection used when authenticated from the current browser. It will be `null` if the user authenticated via Universal Login. It will not return `strategy`, only `name` | -In order for the function to work properly, you need to ask for `scope='openid profile email'` when you initialize Auth0.js. +For the function to work properly, you need to ask for `scope='openid profile email'` when you initialize Auth0.js. diff --git a/articles/libraries/_includes/_spa_js_faq.md b/articles/libraries/_includes/_spa_js_faq.md new file mode 100644 index 0000000000..0595e4e5fb --- /dev/null +++ b/articles/libraries/_includes/_spa_js_faq.md @@ -0,0 +1,5 @@ + + +::: note +If you encounter some problems or errors when using the new JavaScript SDK, please [check out the FAQ](https://github.com/auth0/auth0-spa-js/blob/master/FAQ.md) to see if your issue is covered there. +::: \ No newline at end of file diff --git a/articles/libraries/_includes/_verifying_migration.md b/articles/libraries/_includes/_verifying_migration.md index 5d72199ebc..a4edd88b3c 100644 --- a/articles/libraries/_includes/_verifying_migration.md +++ b/articles/libraries/_includes/_verifying_migration.md @@ -1,6 +1,6 @@ ### Verifying your migration -Once you have migrated your codebase, you should no longer see [deprecation notes in your logs](/errors/deprecation-errors). +Once you have migrated your codebase, you should no longer see [deprecation notes in your logs](/troubleshoot/guides/check-deprecation-errors). If you would like to be sure that your applications are no longer calling the legacy endpoints, you can go to the [Dashboard](${manage_url}/#/tenant/advanced) under **Tenant Settings > Advanced** then scroll down to **Migrations** and toggle off the Legacy Lock API switch. Turning off this switch will disable the deprecated Lock / Auth0.js endpoints for your tenant, preventing them from being used at all. diff --git a/articles/libraries/auth0-android/configuration.md b/articles/libraries/auth0-android/configuration.md index d3c5b085b2..08e87aef3f 100644 --- a/articles/libraries/auth0-android/configuration.md +++ b/articles/libraries/auth0-android/configuration.md @@ -2,6 +2,11 @@ section: libraries toc: true description: How to configure Auth0.Android to meet your application's needs +topics: + - libraries + - android +contentType: how-to +useCase: enable-mobile-auth --- # Auth0.Android Configuration Options @@ -12,7 +17,7 @@ Auth0.Android can be configured with a variety of options, listed below. The `withConnection` option allows you to specify a connection that you wish to authenticate with. ```java -WebAuthProvider.init(account) +WebAuthProvider.login(account) .withConnection("twitter") .start(this, authCallback); ``` @@ -24,17 +29,17 @@ Code grant is the default mode, and will always be used unless calling `useCodeG Before you can use `Code Grant` in Android, make sure to go to your [Dashboard](${manage_url}/#/applications) and check in the application's settings that `Application Type` is `Native`. ```java -WebAuthProvider.init(account) +WebAuthProvider.login(account) .useCodeGrant(true) .start(this, authCallback); ``` ## withScope -Using scopes can allow you to return specific claims for specific fields in your request. Adding parameters to `withScope` will allow you to add more scopes. You should read our [documentation on scopes](/scopes) for further details about them. +Using scopes can allow you to return specific claims for specific fields in your request. Adding parameters to `withScope` will allow you to add more scopes. You should read our [documentation on scopes](/scopes) for further details about them. ```java -WebAuthProvider.init(account) +WebAuthProvider.login(account) .withScope("openid email profile") .start(this, authCallback); ``` @@ -45,10 +50,10 @@ Note that the default scope used is `openid` ## withConnectionScope -There may be times when you need to authenticate with particular connection scopes, or permissions, from the Authentication Provider in question. Auth0 has [documentation on setting up connection scopes for external Authentication Providers](/tutorials/adding-scopes-for-an-external-idp). However, if you need specific access for a particular situation in your app you can do so by passing parameters to `withConnectionScope`. A full listing of available parameters can be found in that connection's settings in your [Dashboard](${manage_url}), or from the Authentication Providers's documentation. The scope requested here is added on top of the ones specified in the connection's settings in the Dashboard. +There may be times when you need to authenticate with particular connection scopes, or permissions, from the Authentication Provider in question. Auth0 has [documentation on setting up connection scopes for external Authentication Providers](/connections/adding-scopes-for-an-external-idp). However, if you need specific access for a particular situation in your app you can do so by passing parameters to `withConnectionScope`. A full listing of available parameters can be found in that connection's settings in your [Dashboard](${manage_url}), or from the Authentication Providers's documentation. The scope requested here is added on top of the ones specified in the connection's settings in the Dashboard. ```java -WebAuthProvider.init(account) +WebAuthProvider.login(account) .withConnectionScope("email", "profile", "calendar:read") .start(this, authCallback); ``` @@ -60,17 +65,17 @@ To send additional parameters on the authentication, use `withParameters`: ```java Map parameters = new HashMap<>(); //Add entries -WebAuthProvider.init(account) +WebAuthProvider.login(account) .withParameters(parameters) .start(this, authCallback); ``` ## withScheme -If you are not using Android "App Links" or you want to use a different scheme for the redirect URI, then use `withScheme`. Note that you'll need to update the `auth0Scheme` Manifest Placeholder in the `app/build.gradle` file and the whitelisted **Allowed Callback URLs** on the [Dashboard](${manage_url}) in the Application's settings to match the chosen scheme. +If you are not using Android "App Links" or you want to use a different scheme for the redirect URI, then use `withScheme`. Note that you'll need to update the `auth0Scheme` Manifest Placeholder in the `app/build.gradle` file and the whitelisted **Allowed Callback URLs** on the [Dashboard](${manage_url}) in the Application's settings to match the chosen scheme. ```java -WebAuthProvider.init(account) +WebAuthProvider.login(account) .withScheme("myapp") .start(this, authCallback); ``` @@ -81,10 +86,10 @@ Scheme must be lowercase! ## withAudience -To provide an audience, use `withAudience`. +To provide an audience, use `withAudience`. ```java -WebAuthProvider.init(account) +WebAuthProvider.login(account) .withScope("openid") .withAudience("https://${account.namespace}/userinfo") .start(this, authCallback); @@ -95,17 +100,17 @@ WebAuthProvider.init(account) By default a random [state](/protocols/oauth2/oauth-state) is always generated and sent. If you need to use a custom value instead, use `withState`: ```java -WebAuthProvider.init(account) +WebAuthProvider.login(account) .withState("my-custom-state") .start(this, authCallback); ``` ## withNonce -By default a random [nonce](/api-auth/tutorials/nonce) is generated and sent when the response type includes `id_token`. If you need to use a custom value instead, use `withNonce`: +By default a random nonce is generated and sent when the response type includes `id_token`. If you need to use a custom value instead, use `withNonce`: ```java -WebAuthProvider.init(account) +WebAuthProvider.login(account) .withNonce("my-custom-nonce") .start(this, authCallback); ``` diff --git a/articles/libraries/auth0-android/database-authentication.md b/articles/libraries/auth0-android/database-authentication.md index ffa37294e7..430ed70c91 100644 --- a/articles/libraries/auth0-android/database-authentication.md +++ b/articles/libraries/auth0-android/database-authentication.md @@ -2,18 +2,24 @@ section: libraries toc: true description: How to use Auth0.Android with database connections +topics: + - libraries + - android + - db-connections +contentType: how-to +useCase: enable-mobile-auth --- # Auth0.Android Database Authentication ::: panel-warning Database authentication on Native Platforms -Username/Email & Password authentication from native applications is disabled by default for new tenants as of 8 June 2017. Users are encouraged to use the [universal login](/hosted-pages/login) and perform Web Authentication instead. If you still want to proceed you'll need to enable the Password Grant Type on your dashboard first. See [Application Grant Types](/applications/application-grant-types) for more information. +Username/Email & Password authentication from native applications is disabled by default for new tenants as of 8 June 2017. Users are encouraged to use Universal Login and perform Web Authentication instead. If you still want to proceed you'll need to enable the Password Grant Type on your dashboard first. See [Application Grant Types](/applications/concepts/application-grant-types) for more information. ::: ## Log in with a database connection To log in with a database connection, call `login` with the user's **email**, **password**, and the **connection** you wish to authenticate with. The response will be a Credentials object. -Additionally, specifying the **audience** will yield an OIDC conformant response during authentication. +Additionally, specifying the **audience** will yield an OIDC-conformant response during authentication. ```java authentication @@ -33,7 +39,7 @@ authentication ``` ::: note -The default scope used is `openid`. +The default scope used is `openid`. ::: ## Sign up with database connection diff --git a/articles/libraries/auth0-android/index.md b/articles/libraries/auth0-android/index.md index 528d8a08dd..adfdcc3f4d 100644 --- a/articles/libraries/auth0-android/index.md +++ b/articles/libraries/auth0-android/index.md @@ -3,6 +3,13 @@ section: libraries toc: true description: How to install, initialize and use Auth0.Android url: /libraries/auth0-android +topics: + - libraries + - android +contentType: + - how-to + - index +useCase: enable-mobile-auth --- # Auth0.Android @@ -18,19 +25,7 @@ Android API version 15 or newer is required. ## Installation -Auth0.Android is available through [Gradle](https://gradle.org/). To install it, simply add the following line to your `build.gradle` file: - -```gradle -dependencies { - compile "com.auth0.android:auth0:1.+" -} -``` - -::: note -You can check for the latest version on the repository [Readme](https://github.com/auth0/auth0.android#installation), in [Maven](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22auth0%22%20g%3A%22com.auth0.android%22), or in [JCenter](https://bintray.com/auth0/android/auth0). -::: - -After adding your Gradle dependency, make sure to remember to sync your project with Gradle files. +<%= include('../../quickstart/native/android/_includes/_gradle.md') %> ## Permissions @@ -69,11 +64,9 @@ account.setOIDCConformant(true); //Use the account in the API applications ``` -Passwordless authentication **cannot be used** with this flag set to `true`. For more information, please see the [OIDC adoption guide](/api-auth/tutorials/adoption). - ## Authentication via Universal Login -First go to the [Dashboard](${manage_url}/#/applications) and go to your application's settings. Make sure you have in **Allowed Callback URLs** a URL with the following format: +First, go to the [Dashboard](${manage_url}/#/applications) and go to your application's settings. Make sure you have in **Allowed Callback URLs** a URL with the following format: ``` https://${account.namespace}/android/{YOUR_APP_PACKAGE_NAME}/callback @@ -148,17 +141,17 @@ Finally, don't forget to add the internet permission: In versions 1.8.0 or lower of Auth0.Android you had to define the **intent-filter** inside your activity to capture the authentication result in the `onNewIntent` method and then call `WebAuthProvider.resume()` with the received data. The intent-filter declaration and resume call are no longer required for versions greater than 1.8.0, as it's now done internally by the library for you. ::: -Now, let's authenticate a user by presenting the universal [login page](hosted-pages/login): +Now, let's authenticate a user by presenting the universal [login page](/universal-login): ```java -WebAuthProvider.init(account) +WebAuthProvider.login(account) .withAudience("https://${account.namespace}/userinfo") .start(this, authCallback); ``` The authentication result will be delivered to the callback. -To ensure an Open ID Connect compliant response you must either set an `audience` using [withAudience](/libraries/auth0-android/configuration#withAudience) or enable the **OIDC Conformant** switch in your Auth0 dashboard under **Dashboard > Settings > Advanced > OAuth**. You can read more about this in the documentation page on [how to use new flows](/api-auth/intro#how-to-use-the-new-flows). +To ensure a response that complies with OpenID Connect (OIDC), you must either set an `audience` using [withAudience](/libraries/auth0-android/configuration#withAudience) or enable the **OIDC Conformant** switch in your Auth0 dashboard under **Dashboard > Settings > Advanced > OAuth**. You can read more about this in the documentation page on [how to use new flows](/api-auth/intro#how-to-use-the-new-flows). ## Using the Authentication API @@ -170,7 +163,7 @@ AuthenticationAPIClient authentication = new AuthenticationAPIClient(account); ### Get user information -To get the information associated with a given user's `access_token`, you can call the `userInfo` endpoint, passing the token. +To get the information associated with a given user's Access Token, you can call the `userInfo` endpoint, passing the token. ```java authentication @@ -223,4 +216,4 @@ Take a look at the following resources to see how the Auth0.Android SDK can be c * [Auth0.Android Passwordless Authentication](/libraries/auth0-android/passwordless) * [Auth0.Android Refresh Tokens](/libraries/auth0-android/save-and-refresh-tokens) * [Auth0.Android User Management](/libraries/auth0-android/user-management) -::: \ No newline at end of file +::: diff --git a/articles/libraries/auth0-android/passwordless.md b/articles/libraries/auth0-android/passwordless.md index 56a5578db2..166610f555 100644 --- a/articles/libraries/auth0-android/passwordless.md +++ b/articles/libraries/auth0-android/passwordless.md @@ -2,16 +2,37 @@ section: libraries toc: true description: How to use Auth0.Android with passwordless connections +topics: + - libraries + - android + - passwordless +contentType: how-to +useCase: enable-mobile-auth --- # Auth0.Android Passwordless Authentication -<%= include('../../_includes/_native_passwordless_warning') %> +Passwordless can be done via email or via SMS, and either by sending the user a code, or sending them a link which contains a code. All of these methods of Passwordless authentication will require two steps - requesting the code, and then inputting the code for verification. -Passwordless can be done via email or via SMS, and either by sending the user a code, or sending them a link which contains a code. All of these methods of Passwordless authentication will require two steps - requesting the code, and then inputting the code for verification. +## Configure Auth0 and the Android SDK -Note that Passwordless authentication **cannot be used** with the [OIDC Conformant Mode](/api-auth/intro) enabled. +### Enable the Passwordless OTP Grant for the Application -## 1. Request the code +In order to be able to use the Passwordless API from a Native client, you first need to enable the Passwordless OTP grant for your application in **Dashboard > Applications > (YOUR APPLICATION) > Settings > Advanced Settings > Grant Types**. + +### Initialize the Android SDK + +Using the Passwordless API requires setting using the Auth0 Android SDK version 1.20 or higher, configured to work in OIDC conformant mode. This can be achieved by setting the `OIDCConformant` property to `true`: + +```java +Auth0 account = new Auth0("{YOUR_CLIENT_ID}", "{YOUR_DOMAIN}"); +//Configure the account in OIDC conformant mode +account.setOIDCConformant(true); +//Use the account in the API clients +``` + +## Implement Passwordless Authentication Steps + +## Request the code In this example, requesting the code is done by calling `passwordlessWithEmail` with the user's email, `PasswordlessType.CODE`, and the name of the connection as parameters. On success, you may wish to display a notice to the user that their code is on the way, and perhaps route them to the view where they will input that code. @@ -31,7 +52,9 @@ authentication }); ``` -## 2. Input the code +You can use the `passwordlessWithSms` method to send the code using SMS. + +## Input the code Once the user has a code, they can input it. Call the `loginWithEmail` method, and pass in the user's email, the code they received, and the name of the connection in question. Upon success, you will receive a Credentials object in the response. @@ -51,6 +74,8 @@ authentication }); ``` +You can use the `loginWithSms` method to send the code received by SMS and authenticate the user. + ::: note -The default scope used is `openid`. +The default scope used is `openid`. ::: diff --git a/articles/libraries/auth0-android/save-and-refresh-tokens.md b/articles/libraries/auth0-android/save-and-refresh-tokens.md index 8d6e5e5fe0..c70ab2403e 100644 --- a/articles/libraries/auth0-android/save-and-refresh-tokens.md +++ b/articles/libraries/auth0-android/save-and-refresh-tokens.md @@ -2,20 +2,22 @@ section: libraries description: Keeping your user logged in with Auth0.Android toc: true +topics: + - libraries + - android + - tokens +contentType: how-to +useCase: enable-mobile-auth --- # Auth0.Android Saving and Renewing Tokens -When an authentication is performed with the `offline_access` scope included, it will return a [Refresh Token](/refresh-token) that can be used to request a new user token, without forcing the user to perform authentication again. +When an authentication is performed with the `offline_access` scope included, it will return a Refresh Token that can be used to request a new user token, without forcing the user to perform authentication again. ## Credentials Manager [Auth0.Android](https://github.com/auth0/Auth0.Android) provides a utility class to streamline the process of storing and renewing credentials. You can access the `accessToken` or `idToken` properties from the [Credentials](https://github.com/auth0/Auth0.Android/blob/master/auth0/src/main/java/com/auth0/android/result/Credentials.java) instance. This is the preferred method to manage user credentials. -First, add the library dependency to your build.gradle file: - -```gradle -compile 'com.auth0.android:auth0:1.+' -``` +Credential Managers are included as part of the Auth0.Android SDK. If this is not part of your dependencies yet, make sure to [check the documentation](/libraries/auth0-android). Next, decide which class to use depending on your Android SDK target version. @@ -56,7 +58,7 @@ manager.clearCredentials(); ### Retrieving Credentials -Because the credentials may need to be refreshed against Auth0 Servers, this method is asynchronous. Pass a callback implementation where you'd like to receive the credentials. Credentials returned by this method upon success are always valid. +Because the credentials may need to be refreshed against Auth0 Servers, this method is asynchronous. Pass a callback implementation where you'd like to receive the credentials. Credentials returned by this method upon success are always valid. ```java manager.getCredentials(new BaseCallback() { @@ -100,7 +102,7 @@ The methods to obtain, save, check for existence and clearing the credentials ar ### Pre-Authenticate the User -This class provides optional functionality for additional authentication using the device's configured Lock Screen. If the Lock Screen Security is set to something different than PIN, Pattern, Password or Fingerprint, this feature won't be available. You need to call the method below to enable the authentication. Pass a valid `Activity` context, a request code, and 2 optional Strings to use as title and description for the Lock Screen. +This class provides optional functionality for additional authentication using the device's configured Lock Screen. If the Lock Screen Security is set to something different than PIN, Pattern, Password or Fingerprint, this feature won't be available. You need to call the method below to enable the authentication. Pass a valid `Activity` context, a request code, and 2 optional Strings to use as title and description for the Lock Screen. ```java private static final int RC_UNLOCK_AUTHENTICATION = 123; @@ -122,3 +124,12 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); } ``` + +### Handling usage exceptions + +In the event that something happened while trying to save or retrieve the Credentials, a `CredentialsManagerException` will be thrown. These are some of the failure scenarios you can expect: + +- The Credentials to be stored are invalid, e.g. some of the following fields are not defined: access_token, id_token or expires_at. +- The stored Credentials have expired but there is no refresh_token available to renew them automatically. +- Device's Lock Screen security settings have changed (e.g. the security PIN code was changed). Even when `hasCredentials` returns _true_, the encryption keys will be deemed invalid and until `saveCredentials` is called again it won't be possible to decrypt any previously existing content, since they keys used back then are not the same as the new ones. +- Device is not compatible with some of the cryptography algorithms required by the `SecureCredentialsManager` class. This is considered a _catastrophic event_ and is the only exception that will prevent you from using this implementation. This scenario happens when the OEM has modified the Android ROM of the device removing some of the algorithms officially included in every Android distribution. Nevertheless, you can check if this is the case in the exception instance itself by calling the `isDeviceIncompatible` method. By doing so you can decide the fallback implementation for storing the Credentials, such as using the regular `CredentialsManager` class. diff --git a/articles/libraries/auth0-android/user-management.md b/articles/libraries/auth0-android/user-management.md index 0010b6bde5..51c085825e 100644 --- a/articles/libraries/auth0-android/user-management.md +++ b/articles/libraries/auth0-android/user-management.md @@ -2,16 +2,22 @@ section: libraries toc: true description: How to use Auth0.Android to manage users +topics: + - libraries + - android + - users +contentType: how-to +useCase: enable-mobile-auth --- # Use Auth0.Android to Manage Users The Management API provides functionality that you can use to manage users of your application, including tasks such as the following. -* Link separate user accounts from different providers, tying them to a single profile (Read more about [Linking Accounts](/link-accounts) with Auth0) +* Link separate user accounts from different providers, tying them to a single profile (See [User Account Linking](/users/concepts/overview-user-account-linking) for details.) * Unlink user accounts, returning them to separate identities -* Update user [metadata](/metadata) +* Update [user metadata](/users/concepts/overview-user-metadata) -## Initializing the API Application +## Initialize the UsersAPIClient To get started, create a new `UsersAPIClient` instance by passing it the `account` and the token for the primary identity. In the case of linking users, this primary identity is the user profile that you want to "keep" the data for, and which you plan to link other identities to. @@ -20,9 +26,9 @@ Auth0 account = new Auth0("${account.clientId}", "${account.namespace}"); UsersAPIClient users = new UsersAPIClient(account, "token"); ``` -## Linking users +## Link users -Linking user accounts will allow a user to authenticate from any of their accounts and no matter which one they use, still pull up the same profile upon login. Auth0 treats all of these accounts as separate profiles by default, so if you wish a user's accounts to be linked, this is the way to go. +Linking user accounts will allow a user to authenticate from any of their accounts and no matter which one they use, still pull up the same profile upon login. Auth0 treats all of these accounts as separate profiles by default, so if you wish a user's accounts to refer to the same profile, you must perform account linking. The `link` method accepts two parameters, the primary user id and the secondary user token (the token obtained after login with this identity). The user id in question is the unique identifier for this user account. If the id is in the format `facebook|1234567890`, the id required is the portion after the delimiting pipe. @@ -42,7 +48,7 @@ users }); ``` -## Unlinking users +## Unlink users Unlinking users is a similar process to the linking of users. The `unlink` method takes three parameters, though: the primary user id, the secondary user id, and the secondary provider (of the secondary user). diff --git a/articles/libraries/auth0-php/authentication-api.md b/articles/libraries/auth0-php/authentication-api.md new file mode 100644 index 0000000000..570ccc6e83 --- /dev/null +++ b/articles/libraries/auth0-php/authentication-api.md @@ -0,0 +1,205 @@ +--- +section: libraries +toc: true +description: Using Auth0's Authentication API with your PHP applications. +topics: + - libraries + - php +contentType: + - how-to + - reference +useCase: + - add-login +--- +# PHP: Using the Authentication API + +The Auth0 PHP SDK provides a `Auth0\SDK\API\Authentication` class, which houses the methods you can use to access the [Authentication API](/api/authentication) directly. Please note that this interface is intended for more advanced applications and in general does provide a means of keeping track of user sessions. For most use cases, you'll want to work with the [Auth0 base class](/libraries/auth0-php/basic-use). + +In this article, you'll find examples of common authentication operations. + +## Prerequisites + +The documentation below assumes that you followed the steps in the [PHP getting started guide](/libraries/auth0-php), and continue off from the code provided there. + +## Authorization Code Flow + +An [Authorization Code grant](/api-auth/tutorials/authorization-code-grant) is the basic way to grant users access to your application. This flow is the same one used on the [Basic Use page](/libraries/auth0-php/basic-use#login). If you need more granular control over the login or callback process, this section walks through how to use the Authentication API directly. + +Users must authenticate with Auth0 to generate the authorization code. This is done by redirecting to the `/authorize` endpoint for your tenant domain. The following code would appear on a page that requires authentication: + +```php +// 👆 We're continuing from the "getting started" guide linked in "Prerequisites" above. Append this to the index.php file you created there. + +// Setup a PHP session, which we'll use as a custom session store for the authenticated user. +session_start(); + +// $user will be null if no session is available; otherwise it will contain user data. +$user = $_SESSION['user'] ?? null; + +// Has the user authenticated with us yet? +if ($user === null) { + // Generates cryptographically secure pseudo-random bytes to use as a CSRF mitigating value. + // Store this for retrieval after authentication. + $_SESSION['state'] = bin2hex(random_bytes(16)); + + // Generate the authorize URL, and redirect the user to it. + header('Location: ' . $auth0->authentication()->getLoginLink($_SESSION['state'])); + exit; +} + +echo '

    Sensitive data!

    '; +``` + +The process above does the following: + +1. We check if there is an authenticated user state stored in our custom session handler. Your application might handle user sessions differently. +2. If there is no session, then we need to log the user in by redirecting them to the Universal Login Page. +3. We set a state value with the login request and then verify that value when the code is returned on the callback URL. We're storing this in our PHP session under the 'state' key. +4. The `getLoginLink()` call builds the correct `/authorize` link with the correct response type (`code` in this case), redirect URI (wherein the application we will handle the response, explained below), and state (from above). +5. We then redirect to this URL and wait for the user to be redirected back to us. + +After authentication, the user is redirected back to our application at the callback URL, which is handled with the following: + +```php +// 👆 We're continuing from the "getting started" guide linked in "Prerequisites" above. Append this to the index.php file you created there. + +// Ensure we have our PHP session open so we can retrieve our stored state for comparison. +session_start(); + +// Extract `code` and `state` parameters from the request query, if present. +$code = filter_var($_GET['code'] ?? null, FILTER_UNSAFE_RAW, FILTER_NULL_ON_FAILURE); +$state = filter_var($_GET['state'] ?? null, FILTER_UNSAFE_RAW, FILTER_NULL_ON_FAILURE); + +// Check if a code is present in the request query. +if ($code === null) { + die('No authorization code found.'); +} + +// Check if a state is present, and compare it with the one we generated and stored before redirecting the user. +if ($state === null || $state !== $_SESSION['state']) { + die('Invalid state.'); +} + +// We have compared states, we should discard this stored value now. +unset($_SESSION['state']); + +// Attempt to get an access_token with the code returned and original redirect URI. (This returns a PSR-7 ResponseInterface.) +$response = $auth0->authentication()->codeExchange($code); + +// Does the status code of the response indicate failure? +if ($response->getStatusCode() !== 200) { + die("Code exchange failed."); +} + +// Decode the JSON response into a PHP array: +$response = json_decode(response->getBody()->__toString(), true, 512, JSON_THROW_ON_ERROR); + +// Create an array to store our session information in. +$session = [ + 'id_token' => $response['id_token'] ?? null, + 'access_token' => $response['access_token'] ?? null, + 'scope' => $response['scope'] ?? null, + 'refresh_token' => $response['refresh_token'] ?? null, + 'expires_in' => $response['expires_in'] ?? null, + 'user' => null +]; + +// We retrieved an ID token; let's process it! +if ($session['id_token'] !== null) { + // The Auth0 SDK includes a helpful token processing utility we'll leverage for this: + $token = new \Auth0\SDK\Token($auth0->configuration(), $session['id_token'], \Auth0\SDK\Token::TYPE_ID_TOKEN); + + // Verify the token, and validate it's claims. These will throw an \Auth0\SDK\Exception\InvalidTokenException if a check fails. + $token->verify(); + $token->validate(); + + $session['user'] => $token->toArray(); +} + +// Store our authenticated session state. +$_SESSION['user'] = $session; + +// Let's echo the user claims/identity as a demo of a successful authentication flow: +print_r($session['user']); +``` + +Walking through the process in detail: + +1. We look for a `code` parameter in a request query. If it's missing, we abort authentication. +2. We check to make sure we have a `state` value and make sure it matches the same one we generated. This is important to avoid CSRF attacks ([more information](/protocols/oauth2/mitigate-csrf-attacks).) +3. We attempt a code exchange with the `codeExchange()` call, making sure to pass in the `code` Auth0 gave our application when it returned the authenticating user back to us. +4. If this succeeds, we know the exchange was successful, and we have an ID Token and an Access Token among other potential values. +5. We validate the ID Token and use the claims for the user identity. +6. If this last step succeeds, we store the user and redirect back to our sensitive data. + +## Client Credentials Flow + +A [Client Credentials grant](/api-auth/tutorials/client-credentials) gives an application access to a specific API based on the scopes set in the Auth0 Dashboard. This is how applications can, for example, make calls to the Management API. Successful authentication will result in an Access Token being issued for the API requested. + +First, turn on the **Client Credentials** grant on then **Advanced settings > Grant Types** tab on the Application settings page. + +Next, authorize the Application for the API being used on the **Machine to Machine Applications** tab on the API's **Settings** page. Make sure all necessary scopes are selected (but no more) and **Update**. Switch back to the **Settings** tab and copy the **Identifier** value. This needs to be added to a `AUTH0_MANAGEMENT_AUDIENCE` key in your `.env` file. + +Request an Access Token for the API using the example below: + +```php +// 👆 We're continuing from the "getting started" guide linked in "Prerequisites" above. + +// Begin a client credentials exchange: +$response = $auth0->authentication()->clientCredentials([ + 'audience' => $env['AUTH0_MANAGEMENT_AUDIENCE'] +]); + +// Does the status code of the response indicate failure? +if ($response->getStatusCode() !== 200) { + die("Code exchange failed."); +} + +// Decode the JSON response into a PHP array: +$response = json_decode(response->getBody()->__toString(), true, 512, JSON_THROW_ON_ERROR); + +// Echo the response to the browser +print_r($response, true); +``` + +If the grant was successful, you should see something like the following: + +``` +Array +( + [access_token] => eyJ0eXAi...eyJpc3Mi...QoB2c24w + [scope] => read:users read:clients ... + [expires_in] => 86400 + [token_type] => Bearer +) +``` + +See the [Management API page](/libraries/auth0-php/management-api) for more information on how to use this Access Token. + +## Single Sign-on Logout + +While destroying the local session with a `session_destroy()` would be sufficient in deauthenticating a user from your application, you should close your end user's session with Auth0 as well. This ensures that the next time the user sees an Auth0 login form, they will be required to provide their credentials to log in. + +First, determine where the user should end up after the logout has completed. Save this in the Auth0 Application settings in the "Allowed Logout URLs" field. Also, add an `AUTH0_LOGOUT_RETURN_URL` key with this URL as the value in your `.env` file. + +Add the following to your application logout code: + +```php +// 👆 We're continuing from the "getting started" guide linked in "Prerequisites" above. + +// Deauthenticate the user's local session in your application. +session_destroy(); + +// Redirect to Auth0's logout URL to end their Auth0 session: +header("Location: " . $auth0->authentication()->getLogoutLink($env['AUTH0_LOGOUT_RETURN_URL']); +``` + +### Read more + +::: next-steps +* [PHP Getting Started](/libraries/auth0-php) +* [PHP Basic Use](/libraries/auth0-php/basic-use) +* [PHP Management API](/libraries/auth0-php/management-api) +* [PHP JWT Validation](/libraries/auth0-php/jwt-validation) +* [PHP Troubleshooting](/libraries/auth0-php/troubleshooting) +::: diff --git a/articles/libraries/auth0-php/basic-use.md b/articles/libraries/auth0-php/basic-use.md new file mode 100644 index 0000000000..758fd798ad --- /dev/null +++ b/articles/libraries/auth0-php/basic-use.md @@ -0,0 +1,110 @@ +--- +section: libraries +toc: true +description: Integrate a frictionless login and signup experience for your PHP applications. +topics: + - libraries + - php +contentType: + - how-to + - reference +useCase: + - add-login +--- +# PHP: Basic Usage + +The Auth0 PHP SDK bundles three core classes: `Auth0\SDK\Auth0`, `Auth0\SDK\API\Authentication` and `Auth0\SDK\API\Management`, each offering interfaces for different functionality across Auth0's APIs. If you're building a stateful web application that needs to keep track of users' sessions, the base `Auth0` class is what you'll be working with the most. It provides methods for handling common authentication and session handling tasks such as logging in and out, retrieving user credentials, checking of an available session, and callback handling. These tasks are explained below. + +## Prerequisites + +The documentation below assumes that you followed the steps in the [PHP getting started guide](/libraries/auth0-php), and continue off from the code provided there. + +## Logging In + +The default login process in the PHP SDK uses an [Authentication Code grant](/api-auth/tutorials/authorization-code-grant) combined with Auth0's Universal Login Page. In short, that process is: + +1. A user requesting access is redirected to the Universal Login Page. +2. The user authenticates using one of [many possible connections](https://auth0.com/docs/identityproviders): social (Google, Twitter, Facebook), database (email and password), passwordless (email, SMS), or enterprise (ActiveDirectory, ADFS, Office 365). +3. The user is redirected or posted back to your application's callback URL with `code` and `state` values if successful or an `error` and `error_description` if not. +4. If the authentication was successful, the `state` value is validated. +5. If the `state` is valid, the `code` value is exchanged with Auth0 for an ID Token and/or an Access Token. +6. The identity from the ID token can be used to create an account, to start an application-specific session, or to persist as the user session. + +Auth0-PHP handles most of these steps automatically for you. Your application will need to: + +1. Call `Auth0\SDK\Auth0::login()` when users need to login (for example: click a link, visit walled content, etc.) +2. Call `Auth0\SDK\Auth0::exchange()` when users are redirected to your callback URL. +3. Call `Auth0\SDK\Auth0::getCredentials()` when you need to check if a user is logged in and retrieve user information. + +A simple implementation of these steps looks like this: + +```php +// 👆 We're continuing from the "getting started" guide linked in "Prerequisites" above. Append this to the index.php file you created there. + +// getExchangeParameters() can be used on your callback URL to verify all the necessary parameters are present for post-authentication code exchange. +if ($auth0->getExchangeParameters()) { + // If they're present, we should perform the code exchange. + $auth0->exchange(); +} + +// Check if the user is logged in already +$session = $auth0->getCredentials(); + +if ($session === null) { + // User is not logged in! + // Redirect to the Universal Login Page for authentication. + header("Location: " . $auth0->login()); + exit; +} + +// 🎉 At this point we have an authenticated user session accessible from $session; your application logic can continue from here! +echo "Authenticated!"; +``` + +Finally, you'll need to add you're application's URL to your Auth0 Application's "Allowed Callback URLs" field on the settings page. After that, loading your scripted page should: + +1. Immediately redirect you to an Auth0 login page for your tenant. +2. After successfully logging in using any connection, redirect you back to your app. +3. Display a simple page showing 'Authenticated!'. + +## Profile + +Now that we have authenticated a user, we can work with their persisted session data to do things like display user profiles. + +```php +// 👆 We're continuing from code above. Append this to the index.php file. + +printf( + '

    Hi %s!

    +

    +

    Last update: %s

    +

    Contact: %s %s

    +

    Logout

    ', + isset($session->user['nickname']) ? strip_tags($session->user['nickname']) : '[unknown]', + isset($session->user['picture']) ? filter_var($session->user['picture'], FILTER_SANITIZE_URL) : 'https://gravatar.com/avatar/', + isset($session->user['updated_at']) ? date('j/m/Y', strtotime($session->user['updated_at'])) : '[unknown]', + isset($session->user['email']) ? filter_var($session->user['email'], FILTER_SANITIZE_EMAIL) : '[unknown]', + ! empty($session->user['email_verified']) ? '✓' : '✗' +); +``` + +## Logout + +In addition to logging in, we also want users to be able to log out. When users log out, they must invalidate their session for the application. For this SDK, that means destroying their persistent user and token data: + +```php +// Log out of the application. +header("Location: $auth0->logout()); +``` + +If you're using Single Sign-on (SSO) and also want to end their Auth0 session, see the [SSO Logout section here](/libraries/auth0-php/authentication-api#sso-logout). More information about logging out, in general, can be found [here](/logout). + +### Read more + +::: next-steps +* [PHP Getting Started](/libraries/auth0-php) +* [PHP Authentication API](/libraries/auth0-php/authentication-api) +* [PHP Management API](/libraries/auth0-php/management-api) +* [PHP JWT Validation](/libraries/auth0-php/jwt-validation) +* [PHP Troubleshooting](/libraries/auth0-php/troubleshooting) +::: diff --git a/articles/libraries/auth0-php/index.md b/articles/libraries/auth0-php/index.md new file mode 100644 index 0000000000..666ad55e32 --- /dev/null +++ b/articles/libraries/auth0-php/index.md @@ -0,0 +1,113 @@ +--- +section: libraries +toc: true +description: Integrate a frictionless login and signup experience for your PHP applications. +url: /libraries/auth0-php +topics: + - libraries + - php +contentType: + - how-to + - index + - reference +useCase: + - add-login +--- +# PHP: Getting Started + +The Auth0-PHP SDK can integrate into your PHP applications to provide a straightforward way to log your users in and to sign them up in your app. It provides support for social identity providers such as Facebook, Google, or Twitter, as well as enterprise providers such as Active Directory. The SDK provides convenient methods for accessing Auth0's Authentication and Management endpoints. + +The Auth0-PHP repository is open source and [hosted on GitHub](https://github.com/auth0/auth0-PHP). We appreciate all contributions, including bug reports, enhancement proposals, and pull requests. + +## Requirements + +- PHP 7.4+ (8.0+ recommended) +- [Composer](https://getcomposer.org/doc/00-intro.md) 2 + +## Installation + +Installing the Auth0 PHP SDK requires [Composer](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos), the standard dependency management utility for PHP. Composer allows you to declare the dependent libraries your project needs and installs them for you. Please ensure Composer is installed and accessible from your shell before continuing. + +Next, run the following shell command within your project directory to install the SDK: + +```sh +composer require auth0/auth0-php +``` + +This will create a `vendor` folder within your project and download all the dependencies needed to use the PHP SDK. This will also create a `vendor/autoload.php` file necessary for the SDK to work with your application, which we'll import later. + +## Getting Started + +To use the Auth0 Authentication and Management APIs, you'll need a free Auth0 account and an Application: + +1. Go to [auth0.com/signup](https://auth0.com/signup) and create an account. +2. From your dashboard, go to **Applications**, then **Create Application**. +3. Give your Application a name, select **Regular Web Application**, then **Create** +4. Click the **Settings** tab for the required credentials used below. More information about these settings is [here](/dashboard/reference/settings-application). + +### Configure the SDK + +You should use [environment variables](https://secure.php.net/manual/en/reserved.variables.environment.php) to store and load sensitive Auth0 credentials. This eliminates the need for hardcoding them into your application. Let's create an `.env` file within the root of our project directory to store our application's credentials: + +```sh +# The URL of our Auth0 Tenant Domain. +# If we're using a Custom Domain, be sure to set this to that value instead. +AUTH0_DOMAIN='https://${account.namespace}' + +# Our Auth0 application's Client ID. +AUTH0_CLIENT_ID='${account.clientId}' + +# Our Auth0 application's Client Secret. +AUTH0_CLIENT_SECRET='${account.clientSecret}' + +# A long secret value we'll use to encrypt session cookies. This can be generated using `openssl rand -hex 32` from our shell. +AUTH0_COOKIE_SECRET='SEE COMMENT ABOVE' + +# The base URL of our application. +AUTH0_BASE_URL='http://127.0.0.1:3000' +``` + +You should never commit this file to version control or share it in an unsecure manner. The contents should be handled with care and treated like a password. + +As PHP is unable to read our `.env` file natively, you'll need to install a PHP library to do so. For the purposes of this documentation we'll be using `vlucas/phpdotenv`, but any 'dotenv' library you prefer will work. From our project directory, run the following shell command to install the library: + +```sh +composer require vlucas/phpdotenv +``` + +### Initialize the SDK + +We're ready to configure and initialize an instance of the SDK within our new PHP application. Let's start by creating the PHP source file we'll be working with for this demonstration, `index.php`, and use the following snippet to get started: + +```php +load(); + +// Now instantiate the Auth0 class with our configuration: +$auth0 = new \Auth0\SDK\Auth0([ + 'domain' => $env['AUTH0_DOMAIN'], + 'clientId' => $env['AUTH0_CLIENT_ID'], + 'clientSecret' => $env['AUTH0_CLIENT_SECRET'], + 'cookieSecret' => $env['AUTH0_COOKIE_SECRET'] +]); +``` + +Congratulations, your application is now setup and ready to use with Auth0! You can now move on to building an example application using one of our PHP quickstarts. Choose the type of application you're looking to build to follow along with a quickstart suited for your needs: + +* [PHP Web Application](/quickstart/webapp/php/) +* [PHP Backend API](/quickstart/backend/php/) + +## Next Steps + +::: next-steps +* [PHP Basic Usage](/libraries/auth0-php/basic-use) +* [PHP Authentication API](/libraries/auth0-php/authentication-api) +* [PHP Management API](/libraries/auth0-php/management-api) +* [PHP JWT Validation](/libraries/auth0-php/jwt-validation) +* [PHP Troubleshooting](/libraries/auth0-php/troubleshooting) +::: diff --git a/articles/libraries/auth0-php/jwt-validation.md b/articles/libraries/auth0-php/jwt-validation.md new file mode 100644 index 0000000000..3c98d21c19 --- /dev/null +++ b/articles/libraries/auth0-php/jwt-validation.md @@ -0,0 +1,75 @@ +--- +section: libraries +toc: true +description: Validating JSON Web Tokens (JWTs) with your PHP applications. +topics: + - libraries + - php +contentType: + - how-to + - reference +--- +# PHP: Validating JWTs + +The Auth0 PHP SDK provides a `Auth0\SDK\Token` class used for processing JSON Web Tokens (JWT). It enables you to decode, validate and verify tokens for use by your application. More information on JWTs and how to build and decode them can be found [jwt.io](https://jwt.io/). + +The class can process both HS256 and RS256 tokens. Both types require the algorithm and valid audiences to be configured with the SDK before processing. HS256 tokens require the client secret to be configured. RS256 tokens require an authorized issuer, which is used to fetch a JWKs file during the decoding process. + +## Prerequisites + +The documentation below assumes that you followed the steps in the [PHP getting started guide](/libraries/auth0-php), and continue off from the code provided there. + +## Example Usage + +The following is an example of a small, URL-based JSON Web Token processor based on the SDK's `Token` class. + +```php +load(); + +$token = filter_var($_GET['token'] ?? null, FILTER_UNSAFE_RAW, FILTER_NULL_ON_FAILURE); +$algorithm = filter_var($_GET['algorithm'] ?? 'HS256', FILTER_UNSAFE_RAW, FILTER_NULL_ON_FAILURE); + +if ($token === null) { + die('No `token` request parameter.'); +} + +if (! in_array($algorithm, ['HS256', 'RS256'])) { + die('Invalid `algorithm` supplied.'); +} + +// The Auth0 SDK includes a helpful token processing utility we'll leverage for this: +$token = new \Auth0\SDK\Token([ + 'domain' => $env['AUTH0_DOMAIN'], + 'clientId' => $env['AUTH0_CLIENT_ID'], + 'clientSecret' => $env['AUTH0_CLIENT_SECRET'], + 'tokenAlgorithm' => $algorithm +], $token, \Auth0\SDK\Token::TYPE_ID_TOKEN); + +// Verify the token: (This will throw an \Auth0\SDK\Exception\InvalidTokenException if verification fails.) +$token->verify(); + +// Validate the token claims: (This will throw an \Auth0\SDK\Exception\InvalidTokenException if validation fails.) +$token->validate(); + +echo '
    ';
    +print_r($token->toArray(), true);
    +echo '
    '; +``` + +Both `verify()` and `validate()` offer a number of options arguments that can be used to customize their behavior, including validating nonce claims, restricting maximum time since a token's `auth_time`, `leeway` clock tolerance for time checks, and more. These methods are fully commented for review of these options either via the source code or your IDE of choice. + +### Read more + +::: next-steps +* [PHP Getting Started](/libraries/auth0-php) +* [PHP Basic Use](/libraries/auth0-php/basic-use) +* [PHP Authentication API](/libraries/auth0-php/authentication-api) +* [PHP Management API](/libraries/auth0-php/management-api) +* [PHP Troubleshooting](/libraries/auth0-php/troubleshooting) +::: diff --git a/articles/libraries/auth0-php/management-api.md b/articles/libraries/auth0-php/management-api.md new file mode 100644 index 0000000000..2fbae10fe9 --- /dev/null +++ b/articles/libraries/auth0-php/management-api.md @@ -0,0 +1,123 @@ +--- +section: libraries +toc: true +description: Using Auth0's Management API with your PHP applications. +topics: + - libraries + - php +contentType: + - how-to + - reference +--- +# PHP: Using the Management API + +The Auth0 PHP SDK provides a `Auth0\SDK\API\Management` class, which houses the methods you can use to access the [Management API](/api/management/v2) and perform operations on your Auth0 tenant. Using this interface, you can easily: + +- Search for and create users +- Create and update Applications +- Retrieve log entries +- Manage rules + +... and much more. See our [APi reference](/api/management/v2) for information on what's possible! + +## Authentication + +To use the Management API, you must authenticate one of two ways: + +- For temporary access or testing, you can [manually generate an API token](/api/management/v2/tokens#get-a-token-manually) and save it in your `.env` file. +- For extended access, you must create and execute and Client Credentials grant when access is required. This process is detailed on the [Authentication API page](/libraries/auth0-php/authentication-api#regular-web-app-login-flow). + +Regardless of the method, the token generated must have the scopes required for the operations your app wants to execute. Consult the [API documentation](/api/management/v2) for the scopes required for the specific endpoint you're trying to access. + +To grant the scopes needed: + +1. Go to [APIs](https://manage.auth0.com/#/apis) > Auth0 Management API > **Machine to Machine Applications** tab. +2. Find your Application and authorize it. +3. Click the arrow to expand the row and select the scopes required. + +Now you can authenticate one of the two ways above and use that token to perform operations: + +```php +// 👆 We're continuing from the "getting started" guide linked in "Prerequisites" above. Append this to the index.php file you created there. + +if (isset($env['AUTH0_MANAGEMENT_API_TOKEN'])) { + $auth0->configuration()->setManagementToken($env['AUTH0_MANAGEMENT_API_TOKEN']); +} + +// Create a configured instance of the `Auth0\SDK\API\Management` class, based on the configuration we setup the SDK ($auth0) using. +// If no AUTH0_MANAGEMENT_API_TOKEN is configured, this will automatically perform a client credentials exchange to generate one for you, so long as a client secret is configured. +$management = $auth0->management(); +``` + +The `Management` class stores access to endpoints as factory methods of its instances, for example `$management->users()` returns an instance of `Auth0\SDK\API\Management\Users` that you can use to interact with the /users Management API endpoints. + +### Example: Search Users + +This endpoint is documented [here](/api/management/v2#!/Users/get_users). + +```php +// 👆 We're continuing from the code above. Append this to your source code file. + +$response = $management->users()->getAll(['q' => 'josh']); + +// Does the status code of the response indicate failure? +if ($response->getStatusCode() !== 200) { + die("API request failed."); +} + +// Decode the JSON response into a PHP array: +$response = json_decode(response->getBody()->__toString(), true, 512, JSON_THROW_ON_ERROR); + +if (! empty($response)) { + echo '

    User Results

    '; + + foreach ($response as $result) { + printf( + '

    %s <%s> - %s

    ', + !empty($result['nickname']) ? $result['nickname'] : 'No nickname', + !empty($result['email']) ? $result['email'] : 'No email', + $result['user_id'] + ); + } +} +``` + +### Example: Get All Clients + +This endpoint is documented [here](/api/management/v2#!/Clients/get_clients). + +```php +// 👆 We're continuing from the code above. Append this to your source code file. + +$response = $management->clients()->getAll(['q' => 'josh']); + +// Does the status code of the response indicate failure? +if ($response->getStatusCode() !== 200) { + die("API request failed."); +} + +// Decode the JSON response into a PHP array: +$response = json_decode(response->getBody()->__toString(), true, 512, JSON_THROW_ON_ERROR); + +if (! empty($response)) { + echo '

    Get All Clients

    '; + + foreach ($response as $result) { + printf( + '

    %s - %s

    ', + $result['name'], + $result['client_id'] + ); + } +} +``` + +### Read more + +::: next-steps +* [PHP Introduction](/libraries/auth0-php) +* [PHP Basic Use](/libraries/auth0-php/basic-use) +* [PHP Authentication API](/libraries/auth0-php/authentication-api) +* [PHP JWT Validation](/libraries/auth0-php/jwt-validation) +* [PHP Troubleshooting](/libraries/auth0-php/troubleshooting) +::: diff --git a/articles/libraries/auth0-php/troubleshooting.md b/articles/libraries/auth0-php/troubleshooting.md new file mode 100644 index 0000000000..cbd531246b --- /dev/null +++ b/articles/libraries/auth0-php/troubleshooting.md @@ -0,0 +1,40 @@ +--- +section: libraries +toc: true +description: Troubleshooting commons issues with your PHP applications. +topics: + - libraries + - php +contentType: + - reference +--- +# PHP: Troubleshooting the SDK + +The following is a list of issues you might see when using the Auth0 PHP library and how you might troubleshoot these issues. + +### I'm getting an "Invalid State" exception when trying to log in. + +[State validation](https://auth0.com/docs/protocols/oauth2/oauth-state) was added in 5.1.0 for improved security. By default, this uses session storage and will happen automatically if you are using a combination of `Auth0::login()` and any method which calls `Auth0::exchange()` in your callback. + +If your users encounter this error: +- Ensure your application is not accidentally invoking `Auth0::login()` more than once, which could invalidate the state stored on the end user's device. +- The end user is using a modern browser on their device and not blocking cookies. + +### I am getting `curl error 60: SSL certificate problem: self-signed certificate in certificate chain` on Windows + +This is a common issue with the latest PHP versions under **Windows OS** (it is related to an incompatibility between Windows and OpenSSL CA's database). + +1. Download this CA database `https://curl.haxx.se/ca/cacert.pem` to `c:/cacert.pem`. +2. Edit your php.ini and add `openssl.cafile=c:/cacert.pem`. (It should point to the file you downloaded.) + +### My host does not allow using Composer + +The PHP SDK requires Composer for maintaining dependencies (external PHP libraries). If Composer is now allowed to be installed globally on your host, you can still install it locally to run on your user shell account. Instructions for this can be found on the Composer website: https://getcomposer.org/doc/00-intro.md#locally + +## Keep reading + +* [PHP Introduction](/libraries/auth0-php) +* [PHP Basic Use](/libraries/auth0-php/basic-use) +* [PHP Authentication API](/libraries/auth0-php/authentication-api) +* [PHP Management API](/libraries/auth0-php/management-api) +* [PHP JWT Validation](/libraries/auth0-php/jwt-validation) diff --git a/articles/libraries/auth0-react/index.md b/articles/libraries/auth0-react/index.md new file mode 100644 index 0000000000..c490c1e05e --- /dev/null +++ b/articles/libraries/auth0-react/index.md @@ -0,0 +1,232 @@ +--- +section: libraries +toc: true +title: Auth0 React SDK +description: Auth0 SDK for React Single Page Applications. +topics: + - libraries + - auth0-react +contentType: + - index +--- + + + +# Auth0 React SDK + + +The Auth0 React SDK is a JavaScript library for implementing authentication & authorization in React apps with Auth0. It provides a custom React hook and other Higher Order Components so you can secure React apps using best practices while writing less code. + +The Auth0 React SDK handles grant and protocol details, token expiration and renewal, as well as token storage and caching. Under the hood, it implements [Universal Login](/universal-login) and the [Authorization Code Grant Flow with PKCE](/api-auth/tutorials/authorization-code-grant-pkce). + +The library is [hosted on GitHub](https://github.com/auth0/auth0-react) where you can [read more about the API](https://auth0.github.io/auth0-react/). + +## Installation + +Using [npm](https://npmjs.org): + +```sh +npm install @auth0/auth0-react +``` + +Using [yarn](https://yarnpkg.com): + +```sh +yarn add @auth0/auth0-react +``` + +## Getting Started + +First, you'll need to wrap your application in a single `Auth0Provider` component. This will provide the React Context to components that are placed inside your application. + +```jsx +import React from 'react'; +import ReactDOM from 'react-dom'; +import { Auth0Provider } from '@auth0/auth0-react'; +import App from './App'; + +ReactDOM.render( + + + , + document.getElementById('app') +); +``` + +Use the `useAuth0` hook in your components to access the React Context's authentication state (`isLoading`, `isAuthenticated` and `user`) and authentication methods (`loginWithRedirect` and `logout`). + +### isLoading and error + +Wait for the SDK to initialise and handle any errors with the `isLoading` and `error` states. + +```jsx +import React from 'react'; +import { useAuth0 } from '@auth0/auth0-react'; + +function Wrapper({ children }) { + const { + isLoading, + error, + } = useAuth0(); + + if (isLoading) { + return
    Loading...
    ; + } + if (error) { + return
    Oops... {error.message}
    ; + } + return <>{children}; +} + +export default Wrapper; +``` + +### Login + +Use `loginWithRedirect` or `loginWithPopup` to log your users in. + +```jsx +import React from 'react'; +import { useAuth0 } from '@auth0/auth0-react'; + +function LoginButton() { + const { + isAuthenticated, + loginWithRedirect, + } = useAuth0(); + + return !isAuthenticated && ( + + ); +} + +export default LoginButton; +``` + +### Logout + +Use `logout` to log your users out. Make sure `returnTo` is specified in "Allowed Logout URLs" in your Auth0 Dashboard. + +```jsx +import React from 'react'; +import { useAuth0 } from '@auth0/auth0-react'; + +function LogoutButton() { + const { + isAuthenticated, + logout, + } = useAuth0(); + + return isAuthenticated && ( + + ); +} + +export default Logout; +``` + +### User + +Access user profile information with the `user` value. + +```jsx +import React from 'react'; +import { useAuth0 } from '@auth0/auth0-react'; + +function Profile() { + const { user } = useAuth0(); + + return
    Hello {user.name}
    ; +} + +export default Profile; +``` + +### Use with a class component + +Use the `withAuth0` Higher Order Component to add the `auth0` property to class components instead of using the hook. + +```jsx +import React, { Component } from 'react'; +import { withAuth0 } from '@auth0/auth0-react'; + +class Profile extends Component { + render() { + const { user } = this.props.auth0; + return
    Hello {user.name}
    ; + } +} + +export default withAuth0(Profile); +``` + +### Protect a route + +Protect a route component using the `withAuthenticationRequired` higher order component. Visits to this route when unauthenticated will redirect the user to the login page and back to this page after login. + +```jsx +import React from 'react'; +import { withAuthenticationRequired } from '@auth0/auth0-react'; + +const PrivateRoute = () => (
    Private
    ); + +export default withAuthenticationRequired(PrivateRoute, { + // Show a message while the user waits to be redirected to the login page. + onRedirecting: () => (
    Redirecting you to the login page...
    ) +}); +``` + +**Note** If you are using a custom router, you will need to supply the `Auth0Provider` with a custom `onRedirectCallback` method to perform the action that returns the user to the protected page. See examples for [react-router](https://github.com/auth0/auth0-react/blob/master/EXAMPLES.md#protecting-a-route-in-a-react-router-dom-v6-app), [Gatsby](https://github.com/auth0/auth0-react/blob/master/EXAMPLES.md#protecting-a-route-in-a-gatsby-app) and [Next.js](https://github.com/auth0/auth0-react/blob/master/EXAMPLES.md#protecting-a-route-in-a-nextjs-app-in-spa-mode). + +### Call an API + +To call a protected API with an Access Token, be sure to specify the `audience` and `scope` of your access token, either in `Auth0Provider` or `getAccessTokenSilently`. Then use it to call a protected API by passing it in the `Authorization` header of your request. + +```jsx +import React, { useEffect, useState } from 'react'; +import { useAuth0 } from '@auth0/auth0-react'; + +const Posts = () => { + const { getAccessTokenSilently } = useAuth0(); + const [posts, setPosts] = useState(null); + + useEffect(() => { + (async () => { + try { + const token = await getAccessTokenSilently({ + audience: 'https://api.example.com/', + scope: 'read:posts', + }); + const response = await fetch('https://api.example.com/posts', { + headers: { + Authorization: `Bearer <%= "${token}" %>`, + }, + }); + setPosts(await response.json()); + } catch (e) { + console.error(e); + } + })(); + }, [getAccessTokenSilently]); + + if (!posts) { + return
    Loading...
    ; + } + + return ( +
      + {posts.map((post, index) => { + return
    • {post}
    • ; + })} +
    + ); +}; + +export default Posts; +``` diff --git a/articles/libraries/auth0-spa-js/index.md b/articles/libraries/auth0-spa-js/index.md new file mode 100644 index 0000000000..0055131f0e --- /dev/null +++ b/articles/libraries/auth0-spa-js/index.md @@ -0,0 +1,340 @@ +--- +section: libraries +toc: true +title: Auth0 Single Page App SDK +description: Auth0 SDK for single page applications using Authorization Code Grant Flow with PKCE. +topics: + - libraries + - auth0-spa-js +contentType: + - index +--- + + + +# Auth0 Single Page App SDK + +The Auth0 Single Page App SDK is a new JavaScript library for implementing authentication & authorization in single page apps (SPA) with Auth0. It provides a high-level API and handles a lot of the details so you can secure SPAs using best practices while writing less code. + +The Auth0 SPA SDK handles grant and protocol details, token expiration and renewal, as well as token storage and cacheing. Under the hood, it implements [Universal Login](/universal-login) and the [Authorization Code Grant Flow with PKCE](/api-auth/tutorials/authorization-code-grant-pkce). + +The library is [hosted on GitHub](https://github.com/auth0/auth0-spa-js) and you can find the API documentation [here](https://auth0.github.io/auth0-spa-js/). + +If your SPA is based on React, check out the [Auth0 React SDK](/libraries/auth0-react). + +<%= include('../_includes/_spa_js_faq.md') %> + +## Installation + +You have a few options for using auth0-spa-js in your project: + +From the CDN: + +```html + +``` + +Using [npm](https://npmjs.org): + +```sh +npm install @auth0/auth0-spa-js +``` + +Using [yarn](https://yarnpkg.com): + +```sh +yarn add @auth0/auth0-spa-js +``` + +## Getting Started + +### Create the client + +First, you'll need to create a new instance of `Auth0Client` client object. Create the `Auth0Client` instance before rendering or initializing your application. You can do this using either the async/await method, or with promises. You should only create one instance of the client. + +```js +import createAuth0Client from '@auth0/auth0-spa-js'; + +// either with async/await +const auth0 = await createAuth0Client({ + domain: '${account.namespace}', + client_id: '${account.clientId}' +}); +``` + +```js +// or with promises +createAuth0Client({ + domain: '${account.namespace}', + client_id: '${account.clientId}' +}).then(auth0 => { + //... +}); +``` + +Using `createAuth0Client` does a couple of things automatically: + +* It creates an instance of `Auth0Client`. +* It calls `getTokenSilently` to refresh the user session. +* It suppresses all errors from `getTokenSilently`, except `login_required`. + +You can also create the client directly using the `Auth0Client` constructor. This can be useful if: + +* You wish to bypass the call to `getTokenSilently` on initialization. +* You wish to do custom error handling. +* You wish to initialize the SDK in a synchronous way. + +```js +import { Auth0Client } from '@auth0/auth0-spa-js'; + +const auth0 = new Auth0Client({ + domain: '${account.namespace}', + client_id: '${account.clientId}' +}); +``` + +### Login and get user info + +Next, create a button users can click to start logging in. + +```html + +``` + +Listen for click events on the button you created. When the event occurs, use the desired login method to authenticate the user (`loginWithRedirect()` in this example). After the user is authenticated, you can retrieve the user profile with the `getUser()` method. + +```js +// either with async/await +document.getElementById('login').addEventListener('click', async () => { + await auth0.loginWithRedirect({ + redirect_uri: 'http://localhost:3000/' + }); + //logged in. you can get the user profile like this: + const user = await auth0.getUser(); + console.log(user); +}); +``` + +```js +// or with promises +document.getElementById('login').addEventListener('click', () => { + auth0.loginWithRedirect({ + redirect_uri: 'http://localhost:3000/' + }).then(token => { + //logged in. you can get the user profile like this: + auth0.getUser().then(user => { + console.log(user); + }); + }); +}); +``` + +### Call an API + +To call your API, start by getting the user's Access Token. Then use the Access Token in your request. In this example the `getTokenSilently` method is used to retrieve the Access Token. + +```html + +``` + +```js +// either with async/await +document.getElementById('callApi').addEventListener('click', async () => { + const accessToken = await auth0.getTokenSilently(); + const result = await fetch('https://exampleco.com/api', { + method: 'GET', + headers: { + Authorization: 'Bearer ' + accessToken + } + }); + const data = await result.json(); + console.log(data); +}); +``` + +```js +// or with promises +document.getElementById('callApi').addEventListener('click', () => { + auth0 + .getTokenSilently() + .then(accessToken => + fetch('https://exampleco.com/api', { + method: 'GET', + headers: { + Authorization: 'Bearer ' + accessToken + } + }) + ) + .then(result => result.json()) + .then(data => { + console.log(data); + }); +}); +``` + +### Logout + +Add a button users can click to logout. + +```html + +``` + +```js +document.getElementById('logout').addEventListener('click', () => { + auth0.logout(); +}); +``` + +### Change storage options + +The Auth0 SPA SDK stores tokens in memory by default. However, this does not provide persistence across page refreshes and browser tabs. Instead, you can opt-in to store tokens in local storage by setting the `cacheLocation` property to `localstorage` when initializing the SDK. This can help to mitigate some of the effects of browser privacy technology that prevents access to the Auth0 session cookie by storing Access Tokens for longer. + +::: warning +Storing tokens in browser local storage provides persistence across page refreshes and browser tabs. However, if an attacker can achieve running JavaScript in the SPA using a cross-site scripting (XSS) attack, they can retrieve the tokens stored in local storage. A vulnerability leading to a successful XSS attack can be either in the SPA source code or in any third-party JavaScript code (such as bootstrap, jQuery, or Google Analytics) included in the SPA. + +Read more about [token storage](/tokens/concepts/token-storage#single-page-app-scenarios). +::: + +```js +const auth0 = await createAuth0Client({ + domain: '${account.namespace}', + client_id: '${account.clientId}', + cacheLocation: 'localstorage' +}); +``` + +### Use rotating Refresh Tokens + +The Auth0 SPA SDK can be configured to use [rotating Refresh Tokens](/tokens/concepts/refresh-token-rotation) to get new access tokens silently. These can be used to bypass browser privacy technology that prevents access to the Auth0 session cookie when authenticating silently, as well as providing [built-in reuse detection](/tokens/concepts/refresh-token-rotation#automatic-reuse-detection). + +Configure the SDK to do this by setting `useRefreshTokens` to `true` on initialization: + +```js +const auth0 = await createAuth0Client({ + domain: '${account.namespace}', + client_id: '${account.clientId}', + useRefreshTokens: true +}); + +// Request a new access token using a refresh token +const token = await auth0.getTokenSilently(); +``` + +Refresh Tokens will also need to be [configured for your tenant](/tokens/guides/configure-refresh-token-rotation) before they can be used in your SPA. + +Once configured, the SDK will request the `offline_access` scope during the authorization step. Furthermore, `getTokenSilently` will then call the `/oauth/token` endpoint directly to exchange refresh tokens for access tokens. + +:::note +The SDK will obey the storage configuration when storing refresh tokens. If the SDK has been configured using the default in-memory storage mechanism, refresh tokens will be lost when refreshing the page. +::: + +## Usage + +Below are examples of usage for various methods in the SDK. Note that jQuery is used in these examples. + +### Login with popup + +```js +$('#loginPopup').click(async () => { + await auth0.loginWithPopup(); +}); +``` + +### Login with redirect + +```js +$('#loginRedirect').click(async () => { + await auth0.loginWithRedirect({ + redirect_uri: 'http://localhost:3000/' + }); +}); +``` + +Redirect to the `/authorize` endpoint at Auth0, starting the [Universal Login](/universal-login) flow. + +### Login with redirect callback + +```js +$('#loginRedirectCallback').click(async () => { + await auth0.handleRedirectCallback(); +}); +``` + +### Get Access Token with no interaction + +Get a new Access Token silently using either a hidden iframe and `prompt=none`, or by using a rotating Refresh Token. Refresh Tokens are used when `useRefreshTokens` is set to `true` when configuring the SDK. + +If in-memory storage (the default) and refresh tokens are used, new tokens are retrieved using a web worker on supported browsers. + +```js +$('#getToken').click(async () => { + const token = await auth0.getTokenSilently(); +}); +``` + +The `getTokenSilently()` method requires you to have **Allow Skipping User Consent** enabled in your [API Settings in the Dashboard](${manage_url}/#/apis). Additionally, user consent [cannot be skipped on 'localhost'](/api-auth/user-consent#skipping-consent-for-first-party-applications). + +### Get Access Token with popup + +```js +$('#getTokenPopup').click(async () => { + const token = await auth0.getTokenWithPopup({ + audience: 'https://mydomain/api/', + scope: 'read:rules' + }); +}); +``` + +### Get Access Token for a different audience + +```js +$('#getToken_audience').click(async () => { + const differentAudienceOptions = { + audience: 'https://mydomain/another-api/', + scope: 'read:rules', + redirect_uri: 'http://localhost:3000/callback.html' + }; + const token = await auth0.getTokenSilently(differentAudienceOptions); +}); +``` + +### Get user + +```js +$('#getUser').click(async () => { + const user = await auth0.getUser(); +}); +``` + +### Get ID Token claims + +```js +$('#getIdTokenClaims').click(async () => { + const claims = await auth0.getIdTokenClaims(); + // if you need the raw id_token, you can access it + // using the __raw property + const id_token = claims.__raw; +}); +``` + +### Logout (default) + +```js +$('#logout').click(async () => { + auth0.logout({ + returnTo: 'http://localhost:3000/' + }); +}); +``` + +### Logout with no client ID + +```js +$('#logoutNoClientId').click(async () => { + auth0.logout({ + client_id: null, + returnTo: 'http://localhost:3000/' + }); +}); +``` diff --git a/articles/libraries/auth0-spa-js/migrate-from-auth0js.md b/articles/libraries/auth0-spa-js/migrate-from-auth0js.md new file mode 100644 index 0000000000..40ce0aa180 --- /dev/null +++ b/articles/libraries/auth0-spa-js/migrate-from-auth0js.md @@ -0,0 +1,244 @@ +--- +section: libraries +title: Migrate from Auth0.js to the Auth0 Single Page App SDK +description: How to migrate single page applications from Auth0.js to Auth0 Single Page App SDK +public: false +topics: + - libraries + - auth0-spa-js + - migrations +contentType: + - how-to +useCase: + - migrate +--- + +# Migrate from Auth0.js to the Auth0 Single Page App SDK + +In this article, you’ll see how to migrate your single page app (SPA) from [auth0.js](/libraries/auth0js) to [auth0-spa-js](/libraries/auth0-spa-js). Listed below are scenarios using auth0.js and the equivalent auth0-spa-js code. + +## Functionality that cannot be migrated + +Not all auth0.js functionality can be directly migrated to auth0-spa-js. Scenarios that cannot be directly migrated include: + +- embedded [login with username/password](https://auth0.github.io/auth0.js/global.html#login) as well as embedded [passwordless login](https://auth0.github.io/auth0.js/global.html#passwordlessLogin) +- user [signup](https://auth0.github.io/auth0.js/global.html#signup) +- [get a user profile from /userinfo endpoint](https://auth0.github.io/auth0.js/global.html#userInfo) +- [request an email to change the user's password](https://auth0.github.io/auth0.js/global.html#changePassword) +- [link users with the Management API](https://auth0.github.io/auth0.js/global.html#linkUser) +- [get user with the Management API](https://auth0.github.io/auth0.js/global.html#getUser) +- [update user attributes with the Management API](https://auth0.github.io/auth0.js/global.html#patchUserAttributes) +- [update user metadata with the Management API](https://auth0.github.io/auth0.js/global.html#patchUserMetadata) +- There are also some options that are configurable in Auth0.js that do not have a counterpart in the auth0-spa-js. An example of this is `responseType`. There is a reason that there is not a direct 1:1 mapping for each option. In this case, `responseType` is unnecessary, because the SDK is only for use in SPAs, and so one would not need to change the response type. + +## Authentication Parameters are not modified anymore + +Auth0.js converts custom parameters you set from `camelCase` to `snake_case` internally. For example, if you set `deviceType: 'offline'`, auth0.js actually sends `device_type: 'offline'` to the server. + +When using auth0-spa-js, custom parameters **are not converted** from `camelCase` to `snake_case`. It will relay whatever parameter you send to the authorization server. + +## Create the client + +### auth0.js + +* [WebAuth](https://auth0.github.io/auth0.js/WebAuth.html) + +```js +import { WebAuth } from 'auth0.js'; + +window.addEventListener('load', () => { + var auth0 = new WebAuth({ + domain: '${account.namespace}', + clientID: '${account.clientId}', + redirectUri: '${account.callback}' + }); +}); +``` + +### auth0-spa-js + +* [createAuth0Client()](https://auth0.github.io/auth0-spa-js/globals.html#createauth0client) +* [Auth0ClientOptions](https://auth0.github.io/auth0-spa-js/interfaces/auth0clientoptions.html) + +```js +import createAuth0Client from '@auth0/auth0-spa-js'; + +window.addEventListener('load', () => { + const auth0 = await createAuth0Client({ + domain: '${account.namespace}', + client_id: '${account.clientId}', + redirect_uri: '${account.callback}' + }); +}); +``` + +## Redirect to the Universal Login Page + +### auth0.js + +* [authorize()](https://auth0.github.io/auth0.js/global.html#authorize) + +```js +document.getElementById('login').addEventListener('click', () => { + auth0.authorize(); +}); +``` + +### auth0-spa-js + +* [Auth0Client.loginWithRedirect()](https://auth0.github.io/auth0-spa-js/classes/auth0client.html#loginwithredirect) +* [RedirectLoginOptions](https://auth0.github.io/auth0-spa-js/interfaces/redirectloginoptions.html) + +```js +document.getElementById('login').addEventListener('click', async () => { + await auth0.loginWithRedirect(); +}); +``` + +## Parse the hash after the redirect + +### auth0.js + +* [parseHash()](https://auth0.github.io/auth0.js/global.html#parseHash) + +```js +window.addEventListener('load', () => { + auth0.parseHash({ hash: window.location.hash }, function(err, authResult) { + if (err) { + return console.log(err); + } + console.log(authResult); + }); +}); +``` + +### auth0-spa-js + +* [Auth0Client.handleRedirectCallback()](https://auth0.github.io/auth0-spa-js/classes/auth0client.html#handleredirectcallback) + +```js +window.addEventListener('load', async () => { + await auth0.handleRedirectCallback(); +}); +``` + +## Get the user information + +### auth0.js + +The `userInfo()` function makes a call to the [/userinfo endpoint](https://auth0.com/docs/api/authentication#user-profile) and returns the user profile. + +* [userInfo()](https://auth0.github.io/auth0.js/global.html#userInfo) + +```js +window.addEventListener('load', () => { + auth0.client.userInfo(accessToken, function(err, user) { + console.log(user) + }); +}); +``` + +### auth0-spa-js + +Unlike auth0.js, the Auth0 SPA SDK does not call to the [/userinfo endpoint](https://auth0.com/docs/api/authentication#user-profile) for the user profile. Instead `Auth0Client.getUser()` returns user information from the decoded `id_token`. + +* [Auth0Client.getUser()](https://auth0.github.io/auth0-spa-js/classes/auth0client.html#getuser) +* [GetUserOptions](https://auth0.github.io/auth0-spa-js/interfaces/getuseroptions.html) + +```js +window.addEventListener('load', async () => { + const user = await auth0.getUser(); + console.log(user); +}); +``` + +## Open the Universal Login Page in a popup + +### auth0.js + +```js +document.getElementById('login').addEventListener('click', () => { + auth0.popup.authorize(); +}); +``` + +### auth0-spa-js + +* [Auth0Client.loginWithPopup()](https://auth0.github.io/auth0-spa-js/classes/auth0client.html#loginwithpopup) +* [PopupLoginOptions](https://auth0.github.io/auth0-spa-js/interfaces/popuploginoptions.html) + +```js +document.getElementById('login').addEventListener('click', async () => { + await auth0.loginWithPopup(); +}); +``` + +## Refresh tokens + +### auth0.js + +* [checkSession()](https://auth0.github.io/auth0.js/global.html#checkSession) + +```js +document.getElementById('login').addEventListener('click', () => { + auth0.checkSession({}, function(err, authResult) { + // Authentication tokens or error + }); +}); +``` + +### auth0-spa-js + +The Auth0 SPA SDK handles Access Token refresh for you. Every time you call `getTokenSilently`, you'll either get a valid Access Token or an error if there's no session at Auth0. + +* [Auth0Client.getTokenSilently()](https://auth0.github.io/auth0-spa-js/classes/auth0client.html#gettokensilently) + +```js +document.getElementById('login').addEventListener('click', async () => { + await auth0.getTokenSilently(); +}); +``` + +## Get a token for a different audience or with more scopes + +### auth0.js + +* [checkSession()](https://auth0.github.io/auth0.js/global.html#checkSession) + +```js +document.getElementById('login').addEventListener('click', () => { + auth0.checkSession({ + audience: 'https://mydomain/another-api/', + scope: 'read:messages' + }, function(err, authResult) { + // Authentication tokens or error + }); +}); +``` + +### auth0-spa-js + +The Auth0 SPA SDK handles Access Token refresh for you. Every time you call `getTokenSilently`, you'll either get a valid Access Token or an error if there's no session at Auth0. + +* [Auth0Client.getTokenSilently()](https://auth0.github.io/auth0-spa-js/classes/auth0client.html#gettokensilently) +* [GetTokenSilentlyOptions](https://auth0.github.io/auth0-spa-js/interfaces/gettokensilentlyoptions.html) + +```js +document.getElementById('login').addEventListener('click', async () => { + await auth0.getTokenSilently({ + audience: 'https://mydomain/another-api/', + scope: 'read:messages' + }); +}); +``` + +Use [getTokenWithPopup](https://auth0.github.io/auth0-spa-js/classes/auth0client.html#gettokenwithpopup) to open a popup and allow the user to consent to the new API: + +```js +document.getElementById('login').addEventListener('click', async () => { + await auth0.getTokenWithPopup({ + audience: 'https://mydomain/another-api/', + scope: 'read:messages' + }); +}); +``` diff --git a/articles/libraries/auth0-swift/database-authentication.md b/articles/libraries/auth0-swift/database-authentication.md index 2b86867c73..039f9467b1 100644 --- a/articles/libraries/auth0-swift/database-authentication.md +++ b/articles/libraries/auth0-swift/database-authentication.md @@ -1,10 +1,21 @@ --- section: libraries toc: true -description: Using Database Connections with Auth0.Swift +description: Using database connections with Auth0.Swift +topics: + - libraries + - swift + - db-connections +contentType: how-to +useCase: enable-mobile-auth --- + # Using Database Connections with Auth0.Swift +::: panel-warning Database authentication on Native Platforms +Username/Email & Password authentication from native applications is disabled by default for new tenants as of 8 June 2017. Users are encouraged to use Universal Login and perform Web Authentication instead. If you still want to proceed you'll need to enable the Password Grant Type on your dashboard first. See [Application Grant Types](/applications/concepts/application-grant-types) for more information. +::: + The Authentication API provides methods to authenticate and sign up database users. ## Signing up with a database connection @@ -19,12 +30,11 @@ Auth0 password: "secret-password", connection: "Username-Password-Authentication", userMetadata: ["first_name": "First", - "last_name": "Last"] - ) + "last_name": "Last"]) .start { result in switch result { case .success(let user): - print("User Signed up: \(user)") + print("User: \(user)") case .failure(let error): print("Failed with \(error)") } @@ -46,7 +56,7 @@ Auth0 .start { result in switch result { case .success(let credentials): - print("Obtained credentials: \(credentials)") + print("Credentials: \(credentials)") case .failure(let error): print("Failed with \(error)") } diff --git a/articles/libraries/auth0-swift/index.md b/articles/libraries/auth0-swift/index.md index 523332759e..bc88fd539e 100644 --- a/articles/libraries/auth0-swift/index.md +++ b/articles/libraries/auth0-swift/index.md @@ -3,7 +3,15 @@ section: libraries toc: true description: How to install, initialize and use Auth0.Swift url: /libraries/auth0-swift +topics: + - libraries + - swift +contentType: + - how-to + - index +useCase: enable-mobile-auth --- + # Auth0.swift Auth0.swift is a client-side library for Auth0. @@ -14,15 +22,29 @@ Check out the [Auth0.swift repository](https://github.com/auth0/Auth0.swift) on ## Requirements -- iOS 9 or later -- Xcode 8 -- Swift 3.0 +- iOS 9+ / macOS 10.11+ / tvOS 9.0+ / watchOS 2.0+ +- Xcode 11.4+ / 12.x +- Swift 4.x / 5.x ## Installation +### Cocoapods + +If you are using [Cocoapods](https://cocoapods.org), add this line to your `Podfile`: + +```ruby +pod 'Auth0', '~> 1.0' +``` + +Then run `pod install`. + +::: note +For more information on Cocoapods, check [their official documentation](https://guides.cocoapods.org/using/getting-started.html). +::: + ### Carthage -If you are using Carthage, add the following lines to your `Cartfile`: +If you are using [Carthage](https://github.com/Carthage/Carthage), add the following line to your `Cartfile`: ```ruby github "auth0/Auth0.swift" ~> 1.0 @@ -31,22 +53,25 @@ github "auth0/Auth0.swift" ~> 1.0 Then run `carthage bootstrap`. ::: note -For more information about Carthage usage, check [the official documentation](https://github.com/Carthage/Carthage#if-youre-building-for-ios-tvos-or-watchos). +For more information about Carthage usage, check [their official documentation](https://github.com/Carthage/Carthage#if-youre-building-for-ios-tvos-or-watchos). ::: -### Cocoapods +### SPM -If you are using [Cocoapods](https://cocoapods.org/), add these lines to your `Podfile`: +If you are using the Swift Package Manager, open the following menu item in Xcode: -```ruby -use_frameworks! -pod 'Auth0', '~> 1.0' +**File > Swift Packages > Add Package Dependency...** + +In the **Choose Package Repository** prompt add this url: + +```text +https://github.com/auth0/Auth0.swift.git ``` -Then, run `pod install`. +Then press **Next** and complete the remaining steps. ::: note -For further reference on Cocoapods, check [the official documentation](http://guides.cocoapods.org/using/getting-started.html). +For further reference on SPM, check [its official documentation](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app). ::: ## Adding Auth0 Credentials @@ -66,9 +91,9 @@ You will need to add an `Auth0.plist` file, containing your Auth0 client id and ``` -### Web-based Auth (iOS Only) +### Web-based Auth (iOS / macOS 10.15+) -First go to [Auth0 Dashboard](${manage_url}/#/applications) and go to application's settings. Make sure you have in **Allowed Callback URLs** a URL with the following format: +First go to [Auth0 Dashboard](${manage_url}/#/applications) and go to application's settings. Make sure you have in **Allowed Callback URLs** a URL with the following format: ```text {YOUR_BUNDLE_IDENTIFIER}://${account.namespace}/ios/{YOUR_BUNDLE_IDENTIFIER}/callback @@ -100,20 +125,30 @@ If your `Info.plist` is not shown in this format, you can **Right Click** on `In Auth0.swift will only handle URLs with your Auth0 domain as host, for example `com.auth0.MyApp://samples.auth0.com/ios/com.auth0.MyApp/callback` ::: -Allow Auth0 to handle authentication callbacks. In your `AppDelegate.swift` add the following: +Allow Auth0 to handle authentication callbacks. In your `AppDelegate.swift`, add the following: + +##### iOS + +```swift +func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any]) -> Bool { + return Auth0.resumeAuth(url) +} +``` + +##### macOS ```swift -func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool { - return Auth0.resumeAuth(url, options: options) +func application(_ application: NSApplication, open urls: [URL]) { + Auth0.resumeAuth(urls) } ``` -#### Authenticate with universal login +#### Authenticate with Universal Login -The first step in adding authentication to your iOS application is to provide a way for your users to log in. The fastest, most secure, and most feature-rich way to do this with Auth0 is to use [universal login](/hosted-pages/login). +The first step in adding authentication to your application is to provide a way for your users to log in. The fastest, most secure, and most feature-rich way to do this with Auth0 is to use Universal Login. ::: note -To ensure an [OpenID Connect compliant response](/api-auth/intro), you must either request an `audience` or enable the **OIDC Conformant** switch in your [Auth0 dashboard](${manage_url}), under **Application > Settings > Show Advanced Settings > OAuth**. For more information, refer to [How to use the new flows](/api-auth/intro#how-to-use-the-new-flows). +For more information on the two types of login flows, please refer to [Browser-Based vs. Native Login Flows on Mobile Devices](/design/browser-based-vs-native-experience-on-mobile) ::: ```swift @@ -121,17 +156,21 @@ Auth0 .webAuth() .audience("https://${account.namespace}/userinfo") .start { result in - switch result { + switch result { // Auth0.Result case .success(let credentials): - print("credentials: \(credentials)") + print("Credentials: \(credentials)") case .failure(let error): print(error) } } ``` +::: warning +If you're using **Swift 5+**, `Auth0.Result` may shadow Swift's `Result` type. To prevent that, replace it with `Swift.Result` whenever you want to refer to Swift's built-in type. This will be fixed in the next major version of Auth0.swift. +::: + ::: note -If you need help between the two types of login flows, refer to [Browser-Based vs. Native Login Flows on Mobile Devices](/tutorials/browser-based-vs-native-experience-on-mobile) +To ensure a response that complies with OpenID Connect (OIDC), you must either request an `audience` or enable the **OIDC Conformant** switch in your [Auth0 dashboard](${manage_url}), under **Application > Settings > Show Advanced Settings > OAuth**. For more information, refer to [How to use the new flows](/api-auth/tutorials/adoption#how-to-use-the-new-flows). ::: #### Authenticate with a specific Auth0 connection @@ -146,7 +185,7 @@ Auth0 .start { result in switch result { case .success(let credentials): - print("credentials: \(credentials)") + print("Credentials: \(credentials)") case .failure(let error): print(error) } @@ -155,7 +194,7 @@ Auth0 #### Authenticate using a specific scope -Using scopes can allow you to return specific claims for specfic fields in your request. Adding parameters to `scope` will allow you to add more scopes. The default scope is `openid`, and you should read our [documentation on scopes](/scopes) for further details about them. +Using scopes can allow you to return specific claims for specific fields in your request. Adding parameters to `scope` will allow you to add more scopes. The default scope is `openid`, and you should read our [documentation on scopes](/scopes/current) for further details about them. ```swift Auth0 @@ -166,7 +205,7 @@ Auth0 .start { result in switch result { case .success(let credentials): - print("credentials: \(credentials)") + print("Credentials: \(credentials)") case .failure(let error): print(error) } @@ -175,7 +214,7 @@ Auth0 ### Getting user information -In order to retrieve a user's profile, you call the `userInfo` method and pass it the user's `accessToken`. Although the call returns a [UserInfo](https://github.com/auth0/Auth0.swift/blob/master/Auth0/UserInfo.swift) instance, this is a basic OIDC conformant profile and the only guaranteed claim is the `sub` which contains the user's id, but depending on the requested scope the claims returned may vary. You can also use the `sub` value to call the [Management API](#Management-API) and return a full user profile. +In order to retrieve a user's profile, you call the `userInfo` method and pass it the user's `accessToken`. Although the call returns a [UserInfo](https://github.com/auth0/Auth0.swift/blob/master/Auth0/UserInfo.swift) instance, this is a basic OIDC conformant profile and the only guaranteed claim is the `sub`, which contains the user's ID. Depending on the requested scope, the claims returned may vary. You can also use the `sub` value to call the [Management API](https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id) and return a full user profile. ```swift Auth0 @@ -193,12 +232,12 @@ Auth0 ## Next Steps -Take a look at the following resources to see how the Auth0.Swift SDK can be customized for your needs: +Take a look at the following resources to see how the Auth0.swift SDK can be customized for your needs: ::: next-steps * [Auth0.Swift Database Authentication](/libraries/auth0-swift/database-authentication) * [Auth0.Swift Passwordless Authentication](/libraries/auth0-swift/passwordless) * [Auth0.Swift Refresh Tokens](/libraries/auth0-swift/save-and-refresh-jwt-tokens) * [Auth0.Swift User Management](/libraries/auth0-swift/user-management) -* [Auth0.Swift TouchID Authentication](/libraries/auth0-swift/touchid-authentication) -::: \ No newline at end of file +* [Auth0.Swift Touch ID / Face ID Authentication](/libraries/auth0-swift/touchid-authentication) +::: diff --git a/articles/libraries/auth0-swift/passwordless.md b/articles/libraries/auth0-swift/passwordless.md index f79eb83bdc..664f8e8d7f 100644 --- a/articles/libraries/auth0-swift/passwordless.md +++ b/articles/libraries/auth0-swift/passwordless.md @@ -1,13 +1,20 @@ --- section: libraries toc: true -description: Using Auth0.Swift in Passwordless mode +description: Using Auth0.Swift in passwordless mode +topics: + - libraries + - swift + - passwordless +contentType: how-to +useCase: enable-mobile-auth --- + # Passwordless Authentication with Auth0.Swift -<%= include('../../_includes/_native_passwordless_warning') %> +Passwordless authentication allows users to login using only an email address or phone number, reducing the friction that occurs when a user must remember a password. Passwordless authentication can be done via email or via SMS, and either by sending the user a code, or sending them a link which contains a code. -Passwordless authentication allows users to login using only an email address or phone number, reducing the friction that occurs when a user must remember a password. Passwordless authentication can be done via email or via SMS, and either by sending the user a code, or sending them a link which contains a code. +To use Passwordless Authentication you need Auth0.Swift version `1.20.0` or greater. ## How Passwordless works @@ -25,7 +32,7 @@ In this example, requesting the code is done by calling `startPasswordless` with ```swift Auth0 .authentication() - .startPasswordless(email: "support@auth0.com", connection: "email") + .startPasswordless(email: "support@auth0.com") .start { result in switch result { case .success: @@ -44,14 +51,34 @@ Once the user has a code, they can input it. Call the `login` method, and pass i Auth0 .authentication() .login( - usernameOrEmail: "support@auth0.com", - password: "123456", - realm: "Username-Password-Authentication" - ) + email: "support@auth0.com", + code: "123456", + audience: "https://myapi.com/api", + scope: "openid email") + .start { result in + switch result { + case .success(let credentials): + print("Access Token: \(credentials.accessToken)") + case .failure(let error): + print(error) + } + } +``` + +If you used SMS, the call would be like: + +```swift +Auth0 + .authentication() + .login( + phoneNumber: "+4591131761367", + code: "123456", + audience: "https://myapi.com/api", + scope: "openid email") .start { result in switch result { case .success(let credentials): - print("access_token: \(credentials.accessToken)") + print("Access Token: \(credentials.accessToken)") case .failure(let error): print(error) } @@ -79,4 +106,4 @@ or | `email` | required | (String) Either `email` or `phoneNumber` is required (not both), depending on which will be used. | | `phoneNumber` | required | (String) Either `email` or `phoneNumber` is required (not both), depending on which will be used. | | `type` | optional | (String) The type of Passwordless transaction to use, either `.Code` or `.iOSLink`. Defaults to `.Code`. | -| `connection` | optional | (String) The name of the connection to use for the Passwordless authentication. Defaults to `sms`. | +| `connection` | optional | (String) The name of the connection to use for the Passwordless authentication. Defaults to `sms` for the SMS overload or to `email` for the email overload | diff --git a/articles/libraries/auth0-swift/save-and-refresh-jwt-tokens.md b/articles/libraries/auth0-swift/save-and-refresh-jwt-tokens.md index acc67867b9..c633a9c650 100644 --- a/articles/libraries/auth0-swift/save-and-refresh-jwt-tokens.md +++ b/articles/libraries/auth0-swift/save-and-refresh-jwt-tokens.md @@ -1,35 +1,41 @@ --- section: libraries description: Keeping your user logged in with Auth0.swift +topics: + - libraries + - swift + - tokens +contentType: how-to +useCase: enable-mobile-auth --- # Auth0.swift Saving and Renewing Tokens -When an authentication is performed with the `offline_access` scope included, it will return a [Refresh Token](/refresh-token) that can be used to request a new user token, without asking for credentials again. +When an authentication is performed with the `offline_access` scope included, it will return a Refresh Token that can be used to request a new token without asking for credentials again. ## Credentials Manager [Auth0.swift](https://github.com/auth0/Auth0.swift) provides a utility class to streamline the process of storing and renewing credentials. You can access the `accessToken` or `idToken` properties from the [Credentials](https://github.com/auth0/Auth0.swift/blob/master/Auth0/Credentials.swift) instance. This is the preferred method to manage user credentials. -First, import the `Auth0` module: +First import the `Auth0` module: ```swift import Auth0 ``` -Next, present the Login: +Next present the Universal Login page: -```swift +```swift let credentialsManager = CredentialsManager(authentication: Auth0.authentication()) Auth0 .webAuth() .scope("openid profile offline_access") .audience("https://${account.namespace}/userinfo") - .start { - switch $0 { + .start { result in + switch result { case .failure(let error): - // Handle the error + // Handle error case .success(let credentials): // Pass the credentials over to the Credentials Manager credentialsManager.store(credentials: credentials) @@ -37,13 +43,17 @@ Auth0 } ``` +::: warning +The Keychain items do not get deleted after your app is uninstalled. We recommend to always clear all of your app's Keychain items on first launch. +::: + ### Credentials Check -It can be useful to perform a quick sanity check that you have valid credentials stored in the manager. If not the user can then be directed to authenticate. +It can be useful to perform a quick sanity check to ensure that you have valid credentials stored in the manager. If not, the user can then be directed to authenticate. ```swift guard credentialsManager.hasValid() else { - // Present Login Page + // Present login screen } ``` @@ -54,21 +64,21 @@ You can retrieve the user's credentials as follows: ```swift credentialsManager.credentials { error, credentials in guard error == nil, let credentials = credentials else { - // Handle Error, Present Login Page + // Handle error, present login page } - // Valid credentials, you can access the token properties such as `idToken`, `accessToken`. + // Valid credentials; you can access token properties such as `idToken`, `accessToken`. } ``` -::: note -Renewing a user's credentials works exactly the same way, if the token has expired. The Credentials Manager will automatically renew the credentials, then store the renewed credentials to the Keychain and finally return them in the closure. +::: note +Renewing a user's credentials works exactly the same way if the token has expired. The Credentials Manager will automatically renew the credentials, store the renewed credentials to the Keychain, then return them in the closure. ::: ## Alternative Method - SimpleKeychain -If you are familiar with Lock v1, you may already be using the [SimpleKeychain](https://github.com/auth0/SimpleKeychain) SDK to handle iOS Keychain read/write access. This section is for developers who would prefer to keep using the SimpleKeychain and not upgrade to the preferred Credentials Manager. +If you are familiar with Lock v1, you may already be using the [SimpleKeychain](https://github.com/auth0/SimpleKeychain) SDK to handle iOS Keychain read/write access. This section is for developers who would prefer to keep using the SimpleKeychain and not upgrade to the preferred Credentials Manager. -First thing you need to do is store the tokens you need, in this case you will store the `access_token` and `refresh_token` in the Keychain after a successful authentication. +The first thing you will do is store the tokens you need. In this case, you will store the `access_token` and `refresh_token` in the Keychain after a successful authentication. ```swift let keychain = A0SimpleKeychain(service: "Auth0") @@ -77,15 +87,19 @@ Auth0 .webAuth() .scope("openid profile offline_access") .audience("https://${account.namespace}/userinfo") - .start { - switch $0 { + .start { result in + switch result { case .failure(let error): - // Handle the error + // Handle error case .success(let credentials): - guard let accessToken = credentials.accessToken, let refreshToken = credentials.refreshToken else { // Handle Error } - keychain.setString(accessToken, forKey: "access_token") - keychain.setString(refreshToken, forKey: "refresh_token") - // You might want to route to a user profile screen at this point + guard let accessToken = credentials.accessToken, + let refreshToken = credentials.refreshToken else { + // Handle error + return + } + keychain.setString(accessToken, forKey: "access_token") + keychain.setString(refreshToken, forKey: "refresh_token") + // You might want to route to a user profile screen at this point } } ``` @@ -103,12 +117,19 @@ Auth0 .start { result in switch(result) { case .success(let credentials): - // Store the new Access Token + // If you have Refresh Token Rotation enabled, you get a new Refresh Token + // Otherwise you only get a new Access Token + guard let accessToken = credentials.accessToken, + let refreshToken = credentials.refreshToken else { + // Handle error + return + } + // Store the new tokens keychain.setString(accessToken, forKey: "access_token") - // You do not get a new refresh_token, you can still use the one you originally had + keychain.setString(refreshToken, forKey: "refresh_token") case .failure(let error): keychain.clearAll() - // Handle Error + // Handle error } } ``` diff --git a/articles/libraries/auth0-swift/touchid-authentication.md b/articles/libraries/auth0-swift/touchid-authentication.md index 6f47432214..e86bcad058 100644 --- a/articles/libraries/auth0-swift/touchid-authentication.md +++ b/articles/libraries/auth0-swift/touchid-authentication.md @@ -1,12 +1,20 @@ --- section: libraries -description: How to implement Touch ID authentication with Auth0.swift. +description: How to implement Touch ID / Face ID authentication with Auth0.swift. +topics: + - libraries + - swift + - touch-id + - face-id +contentType: how-to +useCase: enable-mobile-auth --- -# Auth0.swift Touch ID Authentication -Here's the scenario: After user authentication, you want to store the user's credentials and use them as long as they are valid. Once they expire, you would want to renew them using the `refreshToken` in order to avoid presenting the login page again. Rather than doing this automatically you require the user to validate with their fingerprint. +# Auth0.swift Touch ID / Face ID Authentication -You will be using the [Credentials Manager](https://github.com/auth0/Auth0.swift/blob/master/Auth0/CredentialsManager.swift) utility in [Auth0.swift](https://github.com/auth0/Auth0.swift/) to streamline the management of user credentials and perform the Touch ID authentication. +Here's the scenario: After user authentication, you want to store the user's credentials and use them as long as they are valid. Once they expire, you would want to renew them using the `refreshToken` in order to avoid presenting the login page again. Rather than doing this automatically, you require the user to validate with their fingerprint or face. + +You will be using the [Credentials Manager](https://github.com/auth0/Auth0.swift/blob/master/Auth0/CredentialsManager.swift) utility in [Auth0.swift](https://github.com/auth0/Auth0.swift/) to streamline the management of user credentials and perform biometric authentication. ## Getting Started @@ -18,27 +26,37 @@ import Auth0 ### Credentials Manager -Setup the Credentials Manager and enable Touch ID authentication, you can pass the title to show in the Touch ID prompt: +Before retrieving credentials, you can also engage the biometric authentication (Face ID or Touch ID) supported by your iOS device. + +Begin by setting up the Credentials Manager. Then enable biometrics. You can also pass in a title to show in the prompt. ```swift -let credentialsManager = CredentialsManager(authentication: Auth0.authentication()) -credentialsManager.enableTouchAuth(withTitle: "Touch to Authenticate") +var credentialsManager = CredentialsManager(authentication: Auth0.authentication()) +credentialsManager.enableBiometrics(withTitle: "Touch ID / Face ID Login") +``` + +We strongly recommend that you add the [NSFaceIDUsageDescription](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW75) setting to your project's `Info.plist` to display a reason for using Face ID. In some cases, if you do not provide a description string and the user attempts Face ID authentication, the user's attempt may fail. + +```xml +... +NSFaceIDUsageDescription +Reason why we use Face ID here +... ``` ### Login -Present the login page and pass the credentials upon successful authentication to the Credentials Manager. +Present the Universal Login page and, upon successful authentication, pass the credentials to the Credentials Manager. ```swift Auth0 .webAuth() .scope("openid profile offline_access") .audience("https://${account.namespace}/userinfo") - .start { - switch $0 { + .start { result in + switch result { case .failure(let error): - // Handle the error - print("Error: \(error)") + // Handle error case .success(let credentials): // Store credentials securely with the Credentials Manager credentialsManager.store(credentials: credentials) @@ -48,15 +66,15 @@ Auth0 ### Renew User Credentials -When you need to renew the user's credentials you can call the `credentials` method from the Credentials Manager to take care of this. The user will be promoted for Touch ID. +When you need to renew the user's credentials, you can call the `credentials` method from the Credentials Manager. ```swift credentialsManager.credentials { error, credentials in guard error == nil, let credentials = credentials else { - // Handle Error - // Fallback to Login Screen + // Handle error + // Fallback to login screen } - // Continue routing the user as authentication was a success + // Continue routing the user as authentication was successful } ``` @@ -64,4 +82,4 @@ There is no need manually store the new credentials as this is handled by the Cr ## Next Steps -You can download a sample project and follow the tutorial in our [Touch ID Authentication](/quickstart/native/ios-swift/08-touch-id-authentication) quickstart. +You can download a sample project and follow the instructions in the iOS quickstart section on [Touch ID / Face ID in iOS](/quickstart/native/ios-swift/08-touch-id-authentication). diff --git a/articles/libraries/auth0-swift/user-management.md b/articles/libraries/auth0-swift/user-management.md index edcd6a9ef3..c2ad08deab 100644 --- a/articles/libraries/auth0-swift/user-management.md +++ b/articles/libraries/auth0-swift/user-management.md @@ -2,44 +2,51 @@ section: libraries toc: true description: User Management with Auth0.Swift +topics: + - libraries + - swift + - users +contentType: how-to +useCase: enable-mobile-auth --- + # User Management with Auth0.Swift -The Management API provides functionality that allows you to link and unlink separate user accounts from different providers, tying them to a single profile (Read more about [Linking Accounts](/link-accounts) with Auth0). It also allows you to update user metadata. +The Management API provides [User Account Linking](/users/concepts/overview-user-account-linking), which allows you to link and unlink separate user accounts from different providers, tying them to a single profile. It also allows you to update user metadata and other profile information. -## Linking users +## Link users -Linking user accounts will allow a user to authenticate from any of their accounts and no matter which one they use, still pull up the same profile upon login. Auth0 treats all of these accounts as separate profiles by default, so if you wish a user's accounts to be linked, this is the way to go. +Linking user accounts will allow a user to authenticate from any of their accounts and, no matter which one they use, still pull up the same profile upon login. Auth0 treats all of these accounts as separate profiles by default, so if you wish for a user's accounts to be linked, this is the way to go. -The `link` method accepts two parameters, the primary user id and the secondary user token (the token obtained after login with this identity). The user id in question is the unique identifier for this user account. If the id is in the format `facebook|1234567890`, the id required is the portion after the delimiting pipe. +The `link` method accepts two parameters: the primary profile's user ID and the secondary profile's Access Token (the token obtained after login with this identity). The user ID in question is the unique identifier for this user account. If the ID is in the format `facebook|1234567890`, the ID required is the portion after the delimiting pipe (in this case, `1234567890`). ```swift Auth0 - .users(token: "user token") + .users(token: "user-scoped access token") .link(userId, withOtherUserToken: "another user token") .start { result in switch result { case .success(let userInfo): - print("user: \(userInfo)") + print("User: \(userInfo)") case .failure(let error): print(error) } } ``` -## Unlinking users +## Unlink users -Unlinking users is a similar provess to the linking of users. The `unlink` method takes three parameters, though: the secondary user id, and the secondary provider (the provider of the secondary user), and the primary user id. +Unlinking users is a similar process to linking users. The `unlink` method takes three parameters: the secondary profile's user ID, the secondary profile's provider (the connection's identity provider), and the primary profile's user ID. The parameters read, essentially: "Unlink this **secondary user** (with this **provider**) from this **primary user**". ```swift Auth0 - .users(token: "user token") + .users(token: "user-scoped access token") .unlink(identityId: identifier, provider: provider, fromUserId:userId) .start { result in switch result { case .success(let userInfo): - print("user: \(userInfo)") + print("User: \(userInfo)") case .failure(let error): print(error) } @@ -47,19 +54,19 @@ Auth0 ``` ::: note -Note that when accounts are linked, the secondary account's metadata is not merged with the primary account's metadata. Similarly, when unlinking two accounts, the secondary account does not retain the primary account's metadata when it becomes separate again. +Note that when accounts are linked, the metadata from the secondary account's profile is not merged with the metadata from the primary account's profile. Similarly, when unlinking accounts, the secondary account's profile does not retain metadata from the primary account's profile. ::: -## Retrieving user metadata +## Retrieve user metadata ```swift Auth0 - .users(token: idToken) + .users(token: "user-scoped access token") .get(userId, fields: ["user_metadata"], include: true) .start { result in switch result { case .success(let userInfo): - print("user: \(userInfo)") + print("User: \(userInfo)") case .failure(let error): print(error) } @@ -68,16 +75,16 @@ Auth0 ## Update user metadata -When updating user metadata, you will create a `userMetadata` object, and then call the `patch` method, passing it the user id and the `userMetadata` object. The values in this object will overwrite existing values with the same key, or add new ones for those that don't yet exist in the user metadata. +When updating user metadata, you will create a `userMetadata` object and then call the `patch` method, passing it the user ID and the `userMetadata` object. The values in this object will overwrite existing values with the same key, or add new ones for those that don't yet exist in the user metadata. ```swift Auth0 - .users(token: "user token") + .users(token: "user-scoped access token") .patch("user identifier", userMetadata: ["first_name": "John", "last_name": "Doe"]) .start { result in switch result { case .success(let userInfo): - print("user: \(userInfo)") + print("User: \(userInfo)") case .failure(let error): print(error) } diff --git a/articles/libraries/auth0js/index.yml b/articles/libraries/auth0js/index.yml index 82ff282c42..44a74ecb88 100644 --- a/articles/libraries/auth0js/index.yml +++ b/articles/libraries/auth0js/index.yml @@ -2,10 +2,6 @@ versioning: baseUrl: libraries/auth0js current: v9 versions: - - v7 - - v8 - v9 defaultArticles: - v7: index - v8: index v9: index diff --git a/articles/libraries/auth0js/v7/index.md b/articles/libraries/auth0js/v7/index.md deleted file mode 100644 index 2e760f8327..0000000000 --- a/articles/libraries/auth0js/v7/index.md +++ /dev/null @@ -1,779 +0,0 @@ ---- -section: libraries -toc: true -description: How to install, initialize and use auth0.js v7 ---- - -# Auth0.js v7 Reference - -<%= include('../../../_includes/_version_warning_auth0js') %> - -Auth0.js is a client-side library for [Auth0](http://auth0.com), for use in your web apps. It allows you to trigger the authentication process and parse the [JSON Web Token](http://openid.net/specs/draft-jones-json-web-token-07.html) (JWT) with just the Auth0 `clientID`. Once you have the JWT, you can use it to authenticate requests to your HTTP API and validate the JWT in your server-side logic with the `clientSecret`. - -::: note -Check out the [Auth0.js repository](https://github.com/auth0/auth0.js/tree/v7) on GitHub. -::: - -## Ready-to-Go Example - -The [example directory](https://github.com/auth0/auth0.js/tree/master/example) of the auth0.js library is a ready-to-go app that can help you to quickly and easily try out auth0.js. In order to run it, follow these quick steps: -1. If you don't have [node](http://nodejs.org/) installed, do that now -1. Download dependencies by running `npm install` from the root of this project -1. Finally, execute `npm run example` from the root of this project, and then browse to your app running on the node server, presumably at `http://localhost:3000`. - - - -It's that easy! - -## Usage - -Now, let's get started integrating auth0.js into your project. We'll cover [methods of installation](#installation-options), [how to initialize auth0.js](#initialize), [signup](#signup), [login](#login), [Passwordless](#passwordless-authentication), [accessing user profiles](#user-profile), and more! - -### Installation Options - -You have a few options for using auth0.js in your project. Pick one of the below depending on your needs: - -Install via [npm](https://npmjs.org): - -```sh -npm install auth0-js -``` - -Install via [bower](http://bower.io): - -```sh -bower install auth0.js -``` - -Include via our CDN: - -```html - -``` - -If you are using [browserify](http://browserify.org/), you will want to install with `npm i auth0-js --production --save`. - -### Initialize - -::: note -The following examples use jQuery, but auth0.js is not tied to jQuery and any library can be used with it. -::: - -Construct a new instance of the Auth0 application as follows: - -```html - - -``` -### Signup - -Here is an example of the `signup` method and some sample code for the form. - -```html -

    Signup Database Connection

    - - - - -``` - -### Login - -This method can be referenced as `signin` or as `login` indifferently. It triggers the login on any of your active identity providers. The following are several examples of calling the `login` method with particular parameters; use the one that makes the most sense for your needs. - -```js - //trigger login with google - $('.login-google').click(function () { - auth0.login({ - connection: 'google-oauth2' - }); - }); - - //trigger login with github - $('.login-github').click(function () { - auth0.login({ - connection: 'github' - }); - }); - - //trigger login with an enterprise connection - $('.login-microsoft').click(function () { - auth0.login({ - connection: 'contoso.com' - }); - }); - - //trigger login with a db connection - $('.login-dbconn').click(function () { - auth0.login({ - connection: 'db-conn', - username: $('.username').val(), - password: $('.password').val(), - }); - }); - - //trigger login with a db connection and avoid the redirect - $('.login-dbconn').click(function () { - auth0.login({ - connection: 'db-conn', - username: $('.username').val(), - password: $('.password').val(), - }, - function (err, result) { - // store in cookies - }); - }); - - //trigger login popup with google - $('.login-google-popup').click(function (e) { - e.preventDefault(); - auth0.login({ - connection: 'google-oauth2', - popup: true, - popupOptions: { - width: 450, - height: 800 - } - }, function(err, result) { - if (err) { - alert("something went wrong: " + err.message); - return; - } - alert('Hello!'); - }); - }); -``` - -You can also request scopes that are not were not configured for the connection. - -```js - //trigger login requesting additional scopes with google - $('.login-google').click(function () { - auth0.login({ - connection: 'google-oauth2', - connection_scope: ['https://www.googleapis.com/auth/orkut', 'https://picasaweb.google.com/data/'] - }); - }); - - // alternatively a comma separated list also works - $('.login-google').click(function () { - auth0.login({ - connection: 'google-oauth2', - connection_scope: 'https://www.googleapis.com/auth/orkut,https://picasaweb.google.com/data/' - }); - }); -``` - -Trigger the login with offline mode support to get the `refresh_token` - -```js -$('.login-dbconn').click(function () { - auth0.login({ - connection: 'db-conn', - username: $('.username').val(), - password: $('.password').val(), - scope: 'openid offline_access' - }, - function (err, result) { - // store in cookies - // result.refreshToken is sent because offline_access is set as a scope - }); - }); -``` - -### Logout - -After a user logs in, a JSON Web Token (JWT) is returned and this token can be saved in a cookie or in browser storage for later use. In addition to this, an SSO cookie gets set in the user's browser (unless specifying `sso: false`). - -If you would like to log the user out from their current browser session in your app, provide a method for removing their JWT from the browser. - -```js - $('.logout-dbconn').click(function() { - // local storage example - localStorage.removeItem('id_token'); - }); -``` - -If you would like to invalidate the user's Auth0 SSO session, use the `logout` method from `auth0.js`. - -```js - $('.logout-dbconn').click(function() { - auth0.logout(); - }); -``` - -This method will redirect the user to an Auth0-hosted page that says "OK". You may pass a `returnTo` value to specify where the user should be redirected to after logout. - -```js - $('.logout-dbconn').click(function() { - auth0.logout({ returnTo: 'http://localhost:3000' }, { version: 'v2' }); - }); -``` - -You must whitelist the **Logout URL** for your app at either the account level or the app level. To whitelist a logout URL for your entire account, provide it in your [advanced settings](${manage_url}/#/account/advanced). To whitelist for the application only, provide the logout URL in your [application settings](${manage_url}/#/clients). - -If you whitelist the logout URL at the application level, pass the `client_id` for your app in the query object. - -```js - $('.logout-dbconn').click(function() { - auth0.logout({ returnTo: 'http://localhost:3000', client_id: AUTH0_CLIENT_ID }, { version: 'v2' }); - }); -``` - -For more information about logout, see the [documentation](https://auth0.com/docs/logout). - -### Passwordless Authentication - -Passwordless authentication allows users to log in by receiving a one-time password via email or text message. - -#### With Email - -One option for Passwordless authentication is using email. Once you have configured a passwordless `email` connection, you can request a link or a code to be sent via email that will allow the receiver to sign in to your application. - -##### Link - -```js -$('.request-email-link').click(function (ev) { - ev.preventDefault(); - - auth0.requestMagicLink({ - email: $('.email-input').val() - }, function (err) { - if (err) { - alert(err.error_description); - return; - } - // the request was successful and you should receive - // an email with the link at the specified address - }); -}); -``` - -##### Code - -```js -$('.request-email-code').click(function (ev) { - ev.preventDefault(); - - auth0.requestEmailCode({ - email: $('.email-input').val() - }, function (err) { - if (err) { - alert(err.error_description); - return; - } - // the request was successful and you should receive - // an email with the code at the specified address - }); -}); -``` - -Once you receive the code you can call `verifyEmailCode` to authenticate the user using an `email` and a `code`. - -```js -auth0.verifyEmailCode({ - email: $('.email-input').val(), - code: $('.email-code-input').val() -}, function (err, result) { - if (err) { - alert("something went wrong: " + err.error_description); - return; - } - alert('Hello'); -}); -``` - -If you provide a `callbackURL` parameter when constructing the Auth0 instance, a redirect will be performed and the callback will only be invoked in the case of an error (notice it takes a single argument). - -```js -auth0.verifyEmailCode({ - email: $('.email-input').val(), - code: $('.email-code-input').val() -}, function (err) { - if (err) { - alert("something went wrong: " + err.error_description); - return; - } -}); -``` - -#### With SMS - -You can also do Passwordless authentication via SMS. First you must activate and configure your passwordless [Twilio](https://twilio.com) connection in our [dashboard](${manage_url}/#/connections/passwordless). - -After that you can request a passcode to be sent via SMS to a phone number. Ensure the phone number has the proper [full-length format](https://www.twilio.com/help/faq/phone-numbers/how-do-i-format-phone-numbers-to-work-internationally). - - -```js -$('.request-sms-code').click(function (ev) { - ev.preventDefault(); - - auth0.requestSMSCode({ - phoneNumber: $('.phone-input').val() - }, function (err) { - if (err) { - alert(err.error_description); - return; - } - // the request was successful and you should receive - // a SMS with the code at the specified phone number - }); -}); -``` - -Once you receive the code you can call `verifySMSCode` to authenticate the user using an `phoneNumber` and a `code`. - -```js -auth0.verifySMSCode({ - phoneNumber: $('.phone-input').val(), - code: $('.sms-code-input').val() -}, function (err, result) { - if (err) { - alert("something went wrong: " + err.error_description); - return; - } - alert("Hello"); -}); -``` - -If you provide a `callbackURL` parameter when constructing the Auth0 instance, a redirect will be performed and the callback will only be invoked in the case of an error (notice it takes a single argument). - -```js -auth0.verifySMSCode({ - phoneNumber: $('.phone-input').val(), - code: $('.sms-code-input').val() -}, function (err) { - if (err) { - alert("something went wrong: " + err.error_description); - return; - } -}); -``` - -### User Profile - -The `getProfile` method allows you to obtain the user information after a successful login. - -```js -auth0.getProfile(idToken, function (err, profile) { - if(err) { - // handle error - return; - } - - alert('hello ' + profile.name); -}); -``` - -How do you acquire the `idToken` depends on the mode you are using to log in. See below for examples for [redirect](#single-page-apps) and [popup](#popup-mode) modes. - -### Processing the Callback - -How does control return back to your app after a login has been attempted? This all depends on which login "mode" you choose to use (**Redirect** or **Popup**) and in some cases, which type of connection you're using. - -#### Redirect Mode - -The default mode of the `login` method is Redirect Mode. Here two separate "redirect" actions will occur when `login` is called. First, the browser will navigate to a separate login page to collect the user's credentials. Once the user successfully logs in, the browser will redirect the user *back* to your application via the `callbackURL`. - -For example, let's say you've initialized your Auth0 application as shown in the [Initialize](#initialize) section above. Then the following call to `login` using your `google-oauth2` social connection would result in a redirect to a Google login page and then a redirect back to `http://my-app.com/callback` if successful: - -```js -auth0.login({ - connection: 'google-oauth2' -}); -``` - -##### Single Page Apps - -If you're building a SPA (Single Page Application) and using Redirect Mode, then your `callbackURL` should send the user back to the same page. And because the `responseType` initialization option was set to `'token'`, Auth0 will also append a hash to that URL that will contain an `access_token` and `id_token` (the JWT). After control returns to your app, the full user profile can be retrieved via the `parseHash` and `getProfile` methods: - -```js -$(function () { - var result = auth0.parseHash(window.location.hash); - - //use result.idToken to call your rest api - - if (result && result.idToken) { - // optionally fetch user profile - auth0.getProfile(result.idToken, function (err, profile) { - alert('hello ' + profile.name); - }); - - // If offline_access was a requested scope - // You can grab the result.refresh_token here - - } else if (result && result.error) { - alert('error: ' + result.error); - } -}); -``` - -If the `scope` option used with the `login` method did not contain `openid profile`, then the profile will only contain `user_id`. In that case just parse the hash to obtain the user ID: - -```js -$(function () { - var result = auth0.parseHash(window.location.hash); - if (result && result.profile) { - alert('your user_id is: ' + result.profile.sub); - //use result.id_token to call your rest api - } - }); -}); -``` - -If there is no hash, `result` will be null. If the hash contains the JWT, the `profile` field will be populated. - -##### Regular Web Apps - -If you're building a regular web application (HTML pages rendered on the server), then `callbackURL` should point to a server-side endpoint that will process the successful login, primarily to set some sort of session cookie. In this scenario you should make sure the `responseType` option is `'code'` (or just not specified) when the Auth0 application is created: - -```js -var auth0 = new Auth0({ - domain: 'mine.auth0.com', - clientID: 'dsa7d77dsa7d7', - callbackURL: 'http://my-app.com/callback' - // responseType not set (defaults to 'code') -}); -``` - -On successful login, Auth0 will redirect to your `callbackURL` with an appended authorization `code` query parameter. Unlike the SPA scenario, this `code` value should get processed completely server-side. - -::: panel Authorization Code Grant -Server-side processing of the `code` looks something like this: Using whichever [Auth0 server-side SDK](/quickstart/webapp) necessary, the endpoint on the server should exchange the `code` for an `access_token` and `id_token` and optionally a full user profile. It should then set some kind of local session cookie, which is what enables a user to be "logged in" to the website and usually contains data from the user profile. It should finally redirect the user back to a meaningful page. -::: - -#### Popup Mode - -Besides Redirect Mode, the `login` method also supports Popup Mode, which you enable by passing `popup: true` in the `options` argument. In this mode the browser will *not* be redirected to a separate login page. Instead Auth0 will display a popup window where the user enters their credentials. The advantage of this approach is that the original page (and all of its state) remains intact, which can be important, especially for certain Single Page Apps. - -::: panel-warning Popup mode issues -While Popup Mode does have the advantage of preserving page state, it has some issues. Often times users have popup blockers that prevent the login page from even displaying. There are also known issues with mobile browsers. For example, in recent versions of Chrome on iOS, the login popup does not get closed properly after login (see an example [here](https://github.com/auth0/lock/issues/71)). For these reasons, we encourage developers to favor Redirect Mode over Popup Mode, even with Single Page Apps. -::: - -In Popup Mode you also have no need to be redirected back to the application, since, once the user has logged in, the popup is simply closed. Instead Auth0 uses the `login` method's `callback` argument to return control to your client-side application, for both failed and successful logins. Along with the `err` argument, `callback` should also receive a `result` argument with the following properties: `idTokenPayload, idToken, accessToken, state` (and optionally `refreshToken` if the `offline_access` scope has been requested): - -```js -auth0.login({ - popup: true, - connection: 'google-oauth2' -}, -function(err, result) { - if (err) { - // Handle the error! - return; - } - - // Success! - - // optionally fetch user profile - auth0.getProfile(result.idToken, function (err, profile) { - alert('hello ' + profile.name); - }); -}); -``` - -#### Database and Active Directory/LDAP connections - -The behavior of Redirect and Popup Modes differs if you're using a [Database](/connections/database/mysql) or [Active Directory/LDAP](/connections/enterprise/active-directory) connection. Those differences depend on two factors: whether SSO ([Single Sign-On](/sso/single-sign-on)) is enabled and whether or not credentials are being directly passed to the `login` method. - -##### SSO enabled - -By default SSO is enabled (equivalent to passing the `sso: true` option to the `login` method). This means that after a successful login, Auth0 will set a special cookie that [can be used](#sso) to automatically log a user onto additional websites that are registered as Auth0 apps. When using either the Database or Active Directory/LDAP connections with SSO enabled, you can still choose to go with Redirect or Popup Mode. - -As with other connection types, Redirect Mode will happen by default. The browser will navigate to a login page that will prompt the user for their credentials and then, when login is complete, redirect back to the `callbackURL`. However, one of the unique options you have with Database and Active Directory/LDAP connections is that the redirect to the login page can be bypassed if the `username` and `password` options are passed to the `login` method. These values are typically collected via a *custom login form* in your app: - -```js -auth0.login({ - connection: 'db-conn', - username: $('.username').val(), - password: $('.password').val(), -}, -function (err) { - // this only gets called if there was a login error -}); -``` - -If the login is successful, the browser will then be redirected to `callbackURL`. And as shown above, a `callback` argument should also be provided to the `login` method that handles any authentication errors (without redirecting). - -Furthermore, sometimes you don't want a redirect to occur at all after a login. This is often the case with Single Page Apps where a redirect will result in loss of important page state. To handle all login results client-side, simply provide additional parameters to the `callback` argument JavaScript function: - -```js -auth0.login({ - connection: 'db-conn', - username: $('.username').val(), - password: $('.password').val(), -}, -function(err, result) { - if (err) { - // Handle the error! - return; - } - - // Success! -}); -``` - -::: note -This `callback` approach is similar to what you'd do in the [Popup Mode](#popup-mode) scenario described earlier, except no popups (or redirects) occur since credentials are provided to the `login` method and success and failure is handled in the `callback` argument. -::: - -You can still do Popup Mode with SSO enabled with a Database or Active Directory/LDAP connection if you want to (but please see the **WARNING** in the [Popup Mode](#popup-mode) section above). This is similar to the Redirect Mode scenario where you don't have a custom login form, but want to use a popup window to collect the user's credentials, and also want control to return to the client-side code (vs. redirecting to `callbackURL`). This behavior would occur if you simply specified the `popup: true` option: - -```js -auth0.login({ - connection: 'db-conn', - popup: true -}, -function(err, result) { - if (err) { - // Handle the error! - return; - } - - // Success! -}); -``` - -##### SSO disabled - -If you explicitly don't want SSO enabled in your application, you can pass the `sso: false` option to the `login` method. The result is that when a login occurs, Auth0 performs a CORS POST request (or in IE8 or 9 a JSONP request) against a special "resource owner" endpoint (`/ro`), which allows users to authenticate by sending their username and password. Also, no SSO cookie is set. - -There are a couple important constraints at play when SSO is disabled: - -* Because the `/ro` endpoint requires credentials, the `username` and `password` options must be passed to the `login` method -* It's not possible to use Popup Mode when SSO is disabled, even if you pass `popup: true` - -This leaves you with a call to the `login` method that looks something like this: - -```js -auth0.login({ - connection: 'db-conn', - sso: false, - username: $('.username').val(), - password: $('.password').val() -}, -function(err) { - // this only gets called if there was a login error -}); -``` - -If the login succeeds, Auth0 will redirect to your `callbackURL`, and if it fails, control will be given to the `callback`. - -And if you don't want that redirect to occur (for example, you have a Single Page App), you can use a `callback` argument that takes the additional parameters (like what's shown in [Popup Mode](#popup-mode)), and control will go to your callback function with a failed or successful login. - -### Response configuration - -By default, after a successful login, the browser is redirected back to the `callbackURL` with an authorization `code` included in the `query` string. This `code` is then used by a server to obtain an Access Token. The Access Token can be obtained directly if you provide the `responseType: 'token'` option. In this case the Access Token will be included in the fragment (or hash) part of the `callbackURL`. Finally, you can specify `responseType: 'id_token'` if you just need an `id_token`. - -```js -var auth0 = new Auth0({ - domain: 'mine.auth0.com', - clientID: 'dsa7d77dsa7d7', - callbackURL: 'http://my-app.com/callback', - responseType: 'token' // also 'id_token' and 'code' (default) -}); -``` - -Besides being included in the URL, the code or the tokens can be encoded in HTML form and transmitted via an HTTP POST request to the `callbackUrl`. The `responseMode: 'form_post'` option needs to be used to activate this flow. - -```js -var auth0 = new Auth0({ - domain: 'mine.auth0.com', - clientID: 'dsa7d77dsa7d7', - callbackURL: 'http://my-app.com/callback', - responseMode: 'form_post', - responseType: 'token' // also 'id_token' and 'code' (default) -}); -``` - -Both `responseType` and `responseMode` options were added in version `7.2.0`. In previous versions, a subset of the functionality of these options was available through `callbackOnLocationHash`. `responseType: 'code'` is equivalent to `callbackOnLocationHash: false` and `responseType: 'token'` is equivalent to `callbackOnLocationHash: true`. The `callbackOnLocationHash` option is still available for compatibility reasons, but it has been deprecated and will be removed in version `8.0.0`. Also note that is not possible to use `callbackOnLocationHash` and `responseType` at the same time. - -```js -// The next two snippets are equivalent, and a code will be included in the -// callbackURL after a successful login -var auth0 = new Auth0({ - // ... - responseType: 'code' -}); - -var auth0 = new Auth0({ - // ... - callbackOnLocationHash: false -}); - -// The next two snippets are equivalent, and a token will be included in the -// callbackURL after a successful login -var auth0 = new Auth0({ - // ... - responseType: 'token' -}); - -var auth0 = new Auth0({ - // ... - callbackOnLocationHash: true -}); -``` - -### Change Password (database connections): - -```js - $('.change_password').click(function () { - auth0.changePassword({ - connection: 'db-conn', - email: 'foo@bar.com' - }, function (err, resp) { - if(err){ - console.log(err.message); - }else{ - console.log(resp); - } - - }); - }); -``` - -This request will always return a 200, even if the user doesn't exist. -The user will receive an email with a link to reset their password. - -### Delegation Token Request - -A delegation token is a new token for a different service or app/API. - -If you just want to get a new token for an addon that you've activated, you can do the following: - -```js -var options = { - id_token: "your ID Token", // The id_token you have now - api: 'firebase', // This defaults to the first active addon if any or you can specify this - "scope": "openid profile" // default: openid -}; - -auth0.getDelegationToken(options, function (err, delegationResult) { - // Call your API using delegationResult.id_token -}); -``` - -If you want to get the token for another API or App: - -```js -var options = { - id_token: "your ID Token", // The id_token you have now - api: 'auth0' // This is default when calling another app that doesn't have an addon - targetClientId: 'The other application id' -}; - -auth0.getDelegationToken(options, function (err, delegationResult) { - // Call your API using delegationResult.id_token -}); -``` - -### Refresh Token - -If you want to refresh your existing (not expired) token, you can just do the following: - -```js -auth0.renewIdToken(current_id_token, function (err, delegationResult) { - // Get here the new delegationResult.id_token -}); -``` - -If you want to refresh your existing (expired) token, if you have the refresh_token, you can call the following: - -```js -auth0.refreshToken(refresh_token, function (err, delegationResult) { - // Get here the new delegationResult.id_token -}); -``` - -### Validate User - -You can validate a user of a specific connection using username and password: - -```js -auth0.validateUser({ - connection: 'db-conn', - username: 'foo@bar.com', - password: 'blabla' -}, function (err, valid) { }); -``` - -### SSO - -Method `getSSOData` fetches Single Sign-On information: - -```js - auth0.getSSOData(function (err, ssoData) { - if (err) return console.log(err.message); - expect(ssoData.sso).to.exist; - }); -``` - -The returned `ssoData` object will contain the following fields, for example: - -```js -{ - sso: true, - sessionClients: [ - "jGMow0KO3WDJELW8XIxolqb1XIitjkYL" - ], - lastUsedClientID: "jGMow0KO3WDJELW8XIxolqb1XIitjkYL", - lastUsedUsername: "alice@example.com", - lastUsedConnection: { - name: "Username-Password-Authentication", - strategy: "auth0" - } -} -``` - -Load Active Directory data if available (Kerberos): - -```js - auth0.getSSOData(true, fn); -``` - -When Kerberos is available you can automatically trigger Windows Authentication. As a result the user will immediately be authenticated without taking any action. - -```js - auth0.getSSOData(true, function (err, ssoData) { - if (!err && ssoData && ssoData.connection) { - auth0.login({ connection: ssoData.connection }); - } - }); -``` - - - -[npm-image]: https://img.shields.io/npm/v/auth0-js.svg?style=flat-square -[npm-url]: https://npmjs.org/package/auth0-js -[travis-image]: https://travis-ci.org/auth0/auth0.js.svg?branch=master -[travis-url]: https://travis-ci.org/auth0/auth0.js -[coveralls-image]: https://img.shields.io/coveralls/auth0/auth0.js.svg?style=flat-square -[coveralls-url]: https://coveralls.io/r/auth0/auth0.js?branch=master -[david-image]: http://img.shields.io/david/auth0/auth0.js.svg?style=flat-square -[david-url]: https://david-dm.org/auth0/auth0.js -[license-image]: http://img.shields.io/npm/l/auth0-js.svg?style=flat-square -[license-url]: #license -[downloads-image]: http://img.shields.io/npm/dm/auth0-js.svg?style=flat-square -[downloads-url]: https://npmjs.org/package/auth0-js diff --git a/articles/libraries/auth0js/v8/index.md b/articles/libraries/auth0js/v8/index.md deleted file mode 100644 index f4e66a876b..0000000000 --- a/articles/libraries/auth0js/v8/index.md +++ /dev/null @@ -1,557 +0,0 @@ ---- -section: libraries -toc: true -description: How to install, initialize and use auth0.js v8 ---- -# Auth0.js v8 Reference - -<%= include('../../../_includes/_version_warning_auth0js') %> - -Auth0.js is a client-side library for Auth0. Using auth0.js in your web apps makes it easier to do authentication and authorization with Auth0 in your web apps. - -::: note -Check out the [Auth0.js repository](https://github.com/auth0/auth0.js/tree/v8) on GitHub. -::: - -## Ready-to-go example - -The [example directory](https://github.com/auth0/auth0.js/tree/master/example) of the auth0.js library is a ready-to-go app that can help you to quickly and easily try out auth0.js. In order to run it, follow these quick steps: - -1. If you don't have [node](http://nodejs.org/) installed, do that now -1. Download dependencies by running `npm install` from the root of this project -1. Finally, execute `npm start` from the root of this project, and then browse to your app running on the node server, presumably at `http://localhost:3000/example`. - -## Setup and initialization - -Now, let's get started integrating auth0.js into your project. We'll cover [methods of installation](#installation-options), [how to initialize auth0.js](#initialization), [signup](#sign-up), [login](#login), [logout](#logout), and more! - -### Installation options - -You have a few options for using auth0.js in your project. Pick one of the below depending on your needs: - -Install via [npm](https://npmjs.org): - -```sh -npm install auth0-js -``` - -Install via [bower](http://bower.io): - -```sh -bower install auth0.js -``` - -```html - -``` - -Include via our CDN: - -```html - -``` - -::: note -For production use, the latest patch release (for example, 8.0.0) is recommended, rather than the latest minor release indicated above. -::: - -If you are using a bundler, you will want to install with `npm i auth0-js --production --save`. - -### Initialization - -Initialize a new instance of the Auth0 application as follows: - -```html - -``` - -#### Available parameters - -There are two required parameters that must be passed in the `options` object when instantiating `webAuth`, and more that are optional. - -| **Parameter** | **Required** | **Description** | -| --- | --- | --- | -| `domain` | required | (String) Your Auth0 account domain (ex. myaccount.auth0.com) | -| `clientID` | required | (String) Your Auth0 client ID | -| `redirectUri` | optional | (String) The default `redirectUri` used. Defaults to an empty string (none). | -| `scope` | optional | (String) The default scope(s) used by the application. Using scopes can allow you to return specific claims for specific fields in your request. You should read our [documentation on scopes](/scopes) for further details. | -| `audience` | optional | (String) The default audience to be used for requesting API access. | -| `responseType` | optional | (String) The default `responseType` used. It can be any space separated list of the values `code`, `token`, `id_token`. It defaults to `'token'`, unless a `redirectUri` is provided, then it defaults to `'code'`. | -| `responseMode` | optional | (String) This option is omitted by default. Can be set to `'form_post'` in order to send the token or code to the `'redirectUri'` via POST. Supported values are `query`, `fragment` and `form_post`. The `query` value is only supported when `responseType` is `code`. | -| `_disableDeprecationWarnings` | optional | (Boolean) Disables the deprecation warnings, defaults to `false`. | - -## Login - -You can choose a method for login based on the type of auth you need in your application. - -### webAuth.authorize() - -The `authorize()` method can be used for logging in users via [universal login](/hosted-pages/login), or via social connections, as exhibited in the examples below. This method invokes the [/authorize endpoint](/api/authentication?javascript#social) of the Authentication API, and can take a variety of parameters via the `options` object. - -| **Parameter** | **Required** | **Description** | -| --- | --- | --- | -| `audience` | optional | (String) The default audience to be used for requesting API access. | -| `scope` | optional | (String) The scopes which you want to request authorization for. These must be separated by a space. You can request any of the standard OIDC scopes about users, such as `profile` and `email`, custom claims that must [conform to a namespaced format](/api-auth/tutorials/adoption/scope-custom-claims), or any scopes supported by the target API (for example, `read:contacts`). Include `offline_access` to get a Refresh Token. | -| `responseType` | optional | (String) It can be any space separated list of the values `code`, `token`, `id_token`. It defaults to `'token'`, unless a `redirectUri` is provided, then it defaults to `'code'`. | -| `clientID` | optional | (String) Your Auth0 client ID. | -| `redirectUri` | optional | (String) The URL to which Auth0 will redirect the browser after authorization has been granted for the user. | -| `leeway` | optional | (Integer) A value in seconds; leeway to allow for clock skew with regard to JWT expiration times. | - -::: note -Because of clock skew issues, you may occasionally encounter the error `The token was issued in the future`. The `leeway` parameter can be used to allow a few seconds of leeway to JWT expiration times, to prevent that from occuring. -::: - -For hosted login, one must call the `authorize()` method. - -```js -webAuth.authorize({ - //Any additional options can go here -}); -``` - -For social logins, the `connection` parameter will need to be specified: - -```js -webAuth.authorize({ - connection: 'twitter' -}); -``` - -### webAuth.popup.authorize() - -For popup authentication the `popup.authorize` method can be used. - -Hosted login with popup: - -```js -webAuth.popup.authorize({ - //Any additional options can go here -}, function(err, authResult) { - //do something -}); -``` - -And for social login with popup using `authorize`: - -```js -webAuth.popup.authorize({ - connection: 'twitter' -}, function(err, authResult) { - //do something -}); -``` - -### webAuth.redirect.loginWithCredentials() - -To login using redirect with credentials to enterprise connections, the `redirect.loginWithCredentials` method is used. - -```js -webAuth.redirect.loginWithCredentials({ - connection: 'Username-Password-Authentication', - username: 'testuser', - password: 'testpass', - scope: 'openid' -}, function(err, authResult) { - // Auth tokens in the result or an error -}); -``` - -The use of `webauth.redirect.loginWithCredentials` is not recommended when using Auth0.js in your apps; it is recommended that you use `webauth.login` instead. - -However, using `webauth.redirect.loginWithCredentials` **is** the correct choice for use in the universal login page, and is the only way to have SSO cookies set for your users who login using universal login. - -### webAuth.popup.loginWithCredentials() - -To login using popup mode with credentials to enterprise connections, the `popup.loginWithCredentials` method is used. - -```js -webAuth.popup.loginWithCredentials({ - connection: 'Username-Password-Authentication', - username: 'testuser', - password: 'testpass', - scope: 'openid' -}, function(err, authResult) { - // Auth tokens in the result or an error -}); -``` - -### webAuth.login() - -The `login` method allows for [cross-origin auth](/cross-origin-authentication) using database connections, using `/co/authenticate`. - -| **Parameter** | **Required** | **Description** | -| --- | --- | --- | -| `username` | optional | (String) The username to present for authentication. **Either** `username` or `email` must be present. | -| `email` | optional | (String) The email to present for authentication. **Either** `username` or `email` must be present.| -| `password` | required | (String) The password to present for authentication. | -| `realm` | required | (String) The name of the database connection against which to authenticate. See [realm documentation](/api-auth/tutorials/password-grant#realm-support) for more information | - -```js -webAuth.login({ - realm: 'tests', - username: 'testuser', - password: 'testpass', -}); -``` - -### buildAuthorizeUrl(options) - -The `buildAuthorizeUrl` method can be used to build the `/authorize` URL, in order to initialize a new transaction. Use this method if you want to implement browser based authentication. - -```js -// Calculate URL to redirect to -var url = webAuth.client.buildAuthorizeUrl({ - clientID: '${account.clientId}', - responseType: 'token id_token', - redirectUri: '${account.callback}', - state: 'YOUR_STATE' -}); - -// Redirect to url -// ... -``` - -::: note -The `state` parameter is an opaque value that Auth0 will send back to you. This method helps prevent CSRF attacks, and it needs to be specified if you redirect to the URL yourself instead of calling `webAuth.authorize()`. The [OAuth state documentation](/protocols/oauth2/oauth-state) describes how to do use it correctly. -::: - -## Passwordless login - -Passwordless authentication allows users to log in by receiving a one-time password via email or text message. The process will require you to start the Passwordless process, generating and dispatching a code to the user, (or a code within a link), followed by accepting their credentials via the verification method. That could happen in the form of a login screen which asks for their (email or phone number) and the code you just sent them. It could also be implemented in the form of a Passwordless link instead of a code sent to the user. They would simply click the link in their email or text and it would hit your endpoint and verify this data automatically using the same verification method (just without manual entry of a code by the user). - -In order to use Passwordless, you will want to initialize Auth0.js with a `redirectUri` and to set the `responseType: 'token'`. - -```js -var webAuth = new auth0.WebAuth({ - clientID: '${account.clientId}', - domain: '${account.namespace}', - redirectUri: 'http://example.com', - responseType: 'token id_token' -}); -``` - -### Start passwordless - -The first step in Passwordless authentication with Auth0.js is the `passwordlessStart` method, which has several parameters which can be passed within its `options` object: - -| **Parameter** | **Required** | **Description** | -| --- | --- | --- | -| `connection` | required | (String) Specifies how to send the code/link to the user. Value must be either `email` or `sms`. | -| `send` | required | (String) Value must be either `code` or `link`. If `null`, a link will be sent. | -| `phoneNumber` | optional | (String) The user's phone number for delivery of a code or link via SMS. | -| `email` | optional | (String) The user's email for delivery of a code or link via email. | - -Note that exactly _one_ of the optional `phoneNumber` and `email` parameters must be sent in order to start the Passwordless transaction. - -```js -webAuth.passwordlessStart({ - connection: 'email', - send: 'code', - email: 'foo@bar.com' - }, function (err,res) { - // handle errors or continue - } -); -``` - -### Passwordless login - -If sending a code, you will then need to prompt the user to enter that code. You will process the code, and authenticate the user, with the `passwordlessLogin` method, which has several parameters which can be sent in its `options` object: - -| **Parameter** | **Required** | **Description** | -| --- | --- | --- | -| `connection` | required | (String) Specifies how to send the code/link to the user. Value must be either `email` or `sms` and the same as the value passed to `passwordlessStart`. | -| `verificationCode` | required | (String) The code sent to the user, either as a code or embedded in a link. | -| `phoneNumber` | optional | (String) The user's phone number to which the code or link was delivered via SMS. | -| `email` | optional | (String) The user's email to which the code or link was delivered via email. | - -As with `passwordlessStart`, exactly _one_ of the optional `phoneNumber` and `email` parameters must be sent in order to complete the passwordless login. - -::: note -In order to use `passwordlessLogin`, the options `redirectUri` and `responseType: 'token'` must be specified when first initializing WebAuth. -::: - -```js -webAuth.passwordlessLogin({ - connection: 'email', - email: 'foo@bar.com', - verificationCode: '389945' - }, function (err,res) { - // handle errors or continue - } -); -``` - -## Extract the authResult and get user info - -After authentication occurs, you can use the `parseHash` method to parse a URL hash fragment when the user is redirected back to your application in order to extract the result of an Auth0 authentication response. You may choose to handle this in a callback page that will then redirect to your main application, or in-page, as the situation dictates. - -The `parseHash` method takes an `options` object that contains the following parameters: - -| **Parameter** | **Required** | **Description** | -| --- | --- | --- | -| `state` | optional | (String) An opaque value the application adds to the initial request that Auth0 includes when redirecting back to the application. This value must be used by the application to prevent CSRF attacks. | -| `nonce` | optional | (String) Used to verify the `id_token` -| `hash` | optional | (String) The URL hash (if not provided, `window.location.hash` will be used by default) | - -::: note -This method requires that your tokens are signed with RS256 rather than HS256. For more information about this, check the [Auth0.js v8 Migration Guide](/libraries/auth0js/migration-guide#the-parsehash-method). -::: - -The contents of the authResult object returned by `parseHash` depend upon which authentication parameters were used. It can include: - -| **Item** | **Description** | -| --- | --- | -| `accessToken` | An Access Token for the API, specified by the `audience` | -| `expiresIn` | A string containing the expiration time (in seconds) of the `accessToken` | -| `idToken` | An ID Token JWT containing user profile information | - -```js -webAuth.parseHash({ hash: window.location.hash }, function(err, authResult) { - if (err) { - return console.log(err); - } - - webAuth.client.userInfo(authResult.accessToken, function(err, user) { - // Now you have the user's information - }); -}); -``` - -As shown above, the `client.userInfo` method can be called passing the returned `accessToken`. It will make a request to the `/userinfo` endpoint and return the `user` object, which contains the user's information, formatted similarly to the below example. - -```json -{ - "email_verified": "false", - "email": "test@example.com", - "clientID": "AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHH", - "updated_at": "2017-02-07T20:50:33.563Z", - "name": "tester9@example.com", - "picture": "https://gravatar.com/avatar/example.png", - "user_id": "auth0|123456789012345678901234", - "nickname": "tester9", - "identities": [ - { - "user_id": "123456789012345678901234", - "provider": "auth0", - "connection": "Username-Password-Authentication", - "isSocial": "false" - } - ], - "created_at": "2017-01-20T20:06:05.008Z", - "sub": "auth0|123456789012345678901234" -} -``` - -You can now do something else with this information as your application needs, such as acquire the user's entire set of profile information with the Management API, as described below. - -## Using nonces - -By default (and if `responseType` contains `id_token`), `auth0.js` will generate a random `nonce` when you call `webAuth.authorize`, store it in local storage, and pull it out in `webAuth.parseHash`. The default behavior should work in most cases, but some use cases may require a developer to control the `nonce`. -If you want to use a developer generated `nonce`, then you must provide it as an option to both `webAuth.authorize` and `webAuth.parseHash`. - -```js -webAuth.authorize({nonce: '1234', responseType: 'token id_token'}); -webAuth.parseHash({nonce: '1234'}, callback); -``` - -If you're calling `webAuth.checkSession` instead of `webAuth.authorize`, then you only have to specify your custom `nonce` as an option to `checkSession`: - -```js -webAuth.checkSession({ - audience: 'https://example.com/api/v2', - scope: 'openid read:something write:otherthing', - responseType: 'token id_token', - nonce: '1234' -}, function (err, authResult) { - ... -}); -``` - -The `webAuth.checkSession` method will automatically verify that the returned `id_token`'s `nonce` claim is the same as the option. - -## Logout - -To log out a user, use the `logout` method. This method accepts an options object, which can include the following parameters. - -| **Parameter** | **Required** | **Description** | -| --- | --- | --- | -| `returnTo` | optional | (String) URL to redirect the user to after the logout. | -| `clientID` | optional | (String) Your Auth0 client ID | -| `federated` | optional | (Querystring parameter) Add this querystring parameter to the logout URL, to log the user out of their identity provider, as well: `https://${account.namespace}/v2/logout?federated`. | - -::: panel returnTo parameter -Note that if the `clientID` parameter is included, the `returnTo` URL that is provided must be listed in the Application's **Allowed Logout URLs** in the [Auth0 dashboard](${manage_url}). However, if the `clientID` parameter _is not_ included, the `returnTo` URL must be listed in the **Allowed Logout URLs** at the *account level* in the [Auth0 dashboard](${manage_url}). -::: - -```js -webAuth.logout({ - returnTo: 'some url here', - clientID: 'some client ID here' -}); -``` - -## Signup - -To sign up a user, use the `signup` method. This method accepts an options object, which can include the following parameters. - -| **Parameter** | **Required** | **Description** | -| --- | --- | --- | -| `email` | required | (String) User's email address | -| `password` | required | (String) User's desired password | -| `connection` | required | (String) The database connection name on your application upon which to attempt user account creation | - -Signups should be for database connections. Here is an example of the `signup` method and some sample code for a form. - -```html -

    Signup Database Connection

    - - - - -``` - -## Using checkSession to acquire new tokens - -The `checkSession` method allows you to acquire a new token from Auth0 for a user who has a current session in Auth0 server for your domain. The method accepts any valid OAuth2 parameters that would normally be sent to `authorize`. - -```js -webAuth.checkSession({ - audience: 'https://example.com/api/v2', - scope: 'read:something write:otherthing' -}, function (err, authResult) { - // err if automatic parseHash fails - ... -}); -``` - -The actual redirect to `/authorize` happens inside an iframe, so it will not reload your application or redirect away from it. - -Remember to add the URL where the authorization request originates from, to the **Allowed Web Origins** list of your Auth0 application in the [Dashboard](${manage_url}) under your application's **Settings**. - -::: warning -If the connection is a social connection and you are using Auth0 dev keys, the `checkSession` call will always return `login_required`. -::: - -## Password reset requests - -If attempting to set up a password reset functionality, you'll use the `changePassword` method and pass in an "options" object, with a "connection" parameter and an "email" parameter. - -```js - $('.change_password').click(function () { - webAuth.changePassword({ - connection: 'db-conn', - email: 'foo@bar.com' - }, function (err, resp) { - if(err){ - console.log(err.message); - }else{ - console.log(resp); - } - }); - }); -``` - -The user will then receive an email which will contain a link that they can follow to reset their password. - -## Cross-Origin authentication - -Using auth0.js within your application (rather than using [universal login](/hosted-pages/login)) requires cross-origin authentication. Make sure you read the [cross-origin authentication documentation](/cross-origin-authentication) to understand how to properly configure your application to make it work. - -## User management - -The Management API provides functionality that allows you to link and unlink separate user accounts from different providers, tying them to a single profile (Read more about [Linking Accounts](/link-accounts) with Auth0). It also allows you to update user metadata. - -To get started, you first need to obtain a an Access Token that can be used to call the Management API. You can do it by specifying the `https://${account.namespace}/api/v2/˜` audience when initializing Auth0.js, in which case you will get the Access Token as part of the authentication flow. - -```js -var webAuth = new auth0.WebAuth({ - clientID: '${account.clientId}', - domain: '${account.namespace}', - redirectUri: 'http://example.com', - audience: `https://${account.namespace}/api/v2/˜`, - scope: 'read:current_user', - responseType: 'token id_token' -}); -``` - -You can also do so by using `checkSession()`: - -``` -webAuth.checkSession( - { - audience: `https://${account.namespace}/api/v2/˜`, - scope: 'read:current_user' - }, function(err, result) { - // use result.accessToken - } -); -``` - -You must specify the specific scopes you need. You can ask for the following scopes: - -* `read:current_user` -* `update:current_user_identities` -* `create:current_user_metadata` -* `update:current_user_metadata` -* `delete:current_user_metadata` -* `create:current_user_device_credentials` -* `delete:current_user_device_credentials` - -Once you have the Access Token, you can create a new `auth0.Management` instance by passing it the account's Auth0 domain, and the Access Token. - -```js -var auth0Manage = new auth0.Management({ - domain: '${account.namespace}', - token: 'ACCESS_TOKEN' -}); -``` - -### Getting the user profile - -In order to get the user profile data, use the `getUser()` method, with the `userId` and a callback as parameters. The method returns the user profile. Note that the `userID` required here will be the same one fetched from the `client.userInfo` method. - -```js -auth0Manage.getUser(userId, cb); -``` - -### Updating the user profile - -When updating user metadata, you will need to first create a `userMetadata` object, and then call the `patchUserMetadata` method, passing it the user id and the `userMetadata` object you created. The values in this object will overwrite existing values with the same key, or add new ones for those that don't yet exist in the user metadata. Visit the [User Metadata](/metadata) documentation for more details on user metadata. - -```js -auth0Manage.patchUserMetadata(userId, userMetadata, cb); -``` - -### Linking users - -Linking user accounts will allow a user to authenticate from any of their accounts and no matter which one they use, still pull up the same profile upon login. Auth0 treats all of these accounts as separate profiles by default, so if you wish a user's accounts to be linked, this is the way to go. - -The `linkUser` method accepts two parameters, the primary `userId` and the secondary user's `id_token` (the token obtained after login with this identity). The user id in question is the unique identifier for this user account. If the id is in the format `facebook|1234567890`, the id required is the portion after the delimiting pipe. Visit the [Linking Accounts](/link-accounts) documentation for more details on linking accounts. - -```js -auth0Manage.linkUser(userId, secondaryUserToken, cb); -``` - -After linking the accounts, the second account will no longer exist as a separate entry in the user database, and will only be accessible as part of the primary one. - -::: note -Note that when accounts are linked, the secondary account's metadata is **not** merged with the primary account's metadata, and if they are ever unlinked, the secondary account will likewise not retain the primary account's metadata when it becomes separate again. -::: diff --git a/articles/libraries/auth0js/v8/migration-guide.md b/articles/libraries/auth0js/v8/migration-guide.md deleted file mode 100644 index 61331a035c..0000000000 --- a/articles/libraries/auth0js/v8/migration-guide.md +++ /dev/null @@ -1,216 +0,0 @@ ---- -section: libraries -title: Auth0.js v7 to v8 Migration Guide -description: How to migrate from auth0.js v7 to auth0.js v8 -toc: true ---- -# Auth0.js v7 to v8 Migration Guide - -The following instructions assume you are migrating from **auth0.js v7** to **auth0.js v8**. - -The goal of this migration guide is to provide you with all of the information you would need to update Auth0.js in your application. Of course, your first step is to include the latest version of auth0.js. Beyond that, take a careful look at each of the areas on this page. You will need to change your implementation of auth0.js to reflect the new changes. - -Take a look below for more information about changes and additions to Auth0.js in version 8! - -## Reasons to Migrate - -The first question to answer before getting into the changes is why to migrate your app to the new version at all. Here are a few quick points that address that: - -* With version 8 of the Auth0.js SDK, you can use [our latest and most secure authentication pipeline](/api-auth/intro), compliant with the OpenID Connect specification. For more information, refer to the below section [Use of API Auth and Metadata](#use-of-api-auth-and-metadata). -* Auth0.js v8 was rewritten from scratch, improving its cohesion and performance and coming with more tests to be utilized. -* Long term support - As is often the case with new iterations of projects, v8 will be supported for significantly longer than v7. - -### Use of API Auth and Metadata - -There are often situations where your APIs will need to authorize limited access to users, servers, or servers on behalf of users. Managing these types of authorization flows and access to your APIs is much easier with Auth0. If you need to use these [API Auth](/api-auth) features, we recommend that you upgrade to [auth0.js v8](/libraries/auth0js/v8). - -Alternatively, you could also simply request the metadata in a different way, for example with a rule to add custom claims to either the returned `id_token` or `access_token` as described in the [custom claims](/scopes/current#custom-claims) section of the scopes documentation. - -::: note -You can find detailed information about supported methods in the [Auth0.js v8](/libraries/auth0js) documentation, and generated documentation on all methods [here](http://auth0.github.io/auth0.js/global.html) for further reading. -::: - -## Initialization of auth0.js - -Initialization of auth0.js in your application will now use `auth0.WebAuth` instead of `Auth0` - -```html - - -``` - -## Login - -The `login` method of version 7 was divided into several different methods in version 8, based on the type of auth you need, rather than the old `login` method. - -### webAuth.authorize() - -The `authorize` method can be used for logging in users via [universal login](/hosted-pages/login), or via social connections, as exhibited below. - -For hosted login, one must call the authorize endpoint - -```js -webAuth.authorize({ - //Any additional options can go here -}); -``` - -For social logins, the connection will need to be specified - -```js -webAuth.authorize({ - connection: 'twitter' -}); -``` - -### webAuth.popup.authorize() - -For popup authentication, the `popup.authorize` method can be used. - -Hosted login with popup - -```js -webAuth.popup.authorize({ - //Any additional options can go here -}); -``` - -And social login with popup - -```js -webAuth.popup.authorize({ - connection: 'twitter' -}); -``` - -### webAuth.redirect.loginWithCredentials() - -To login with credentials to enterprise connections, the `redirect.loginWithCredentials` method is used. - -With redirect - -```js -webAuth.redirect.loginWithCredentials({ - connection: 'Username-Password-Authentication', - username: 'testuser', - password: 'testpass', - scope: 'openid' -}); -``` - -### webAuth.popup.loginWithCredentials() - -Or, popup authentication can be performed with `popup.loginWithCredentials`. - -```js -webAuth.popup.loginWithCredentials({ - connection: 'Username-Password-Authentication', - username: 'testuser', - password: 'testpass', - scope: 'openid' -}); -``` - -### webAuth.client.login() - -The `client.login` method allows for non redirect auth using custom database connections, using /oauth/token. - -```js -webAuth.client.login({ - realm: 'tests', - username: 'testuser', - password: 'testpass', - scope: 'openid profile', - audience: 'urn:test' -}); -``` - -### Passwordless Login - -Passwordless authentication is no longer available using the v7 methods. Now, passwordless is a simpler process, begun by calling `passwordlessStart` and completed by calling `passwordlessLogin`. See the v8 [documentation on Passwordless Authentication](/libraries/auth0js#passwordless-login) for more details! - -```js -webAuth.passwordlessStart({ - connection: 'Username-Password-Authentication', - send: 'code', // code or link - email: 'foo@bar.com' // either send an email param or a phoneNumber param - }, function (err,res) { - // handle errors or continue - } -); -``` - -```js -webAuth.passwordlessLogin({ - connection: 'Username-Password-Authentication', - email: 'foo@bar.com', - verificationCode: '389945' - }, function (err,res) { - // handle errors or continue - } -); -``` - -## Id Token Validation - -When the `id_token` signature method is HS256, auth0.js cannot validate the token, as it does not have the secret key. To populate the `idTokenPayload` property in the `parseHash` callback, it will call the [/userinfo](/api/authentication#get-user-info) endpoint to retrieve user information. - -If the `id_token` is signed with RS256, auth0.js will validate the token, decode it, and populate the `idTokenPayload` with the decoded data. - -:::note -We recommend that you use RS256 for signing tokens in Single Page Applications. -::: - -### Switching from HS256 to RS256 - -::: panel-warning Before Changing the Signing Algorithm -Please note that altering the signing algorithm for your application will immediately change the way your user's tokens are signed. This means that if you have already implemented JWT verification for your application somewhere, your tokens will not be verifiable until you update the logic to account for the new signing algorithm. -::: - -To switch from HS256 to RS256 for a specific application, follow these instructions: - -1. Go to [Dashboard > Applications](${manage_url}/#/applications) -1. Select your application -1. Go to _Settings_ -1. Click on __Show Advanced Settings__ -1. Click on the _OAuth_ tab in Advanced Settings -1. Change the __JsonWebToken Signature Algorithm__ to `RS256` - -Remember that if the token is being validated anywhere else, changes might be needed there as well in order to comply. - -## Refreshing Tokens - -When a token is nearing expiration, or is expired, you may wish to simply renew the token rather than requiring a new transaction. - -In [auth0.js v7](/libraries/auth0js/v7#refresh-token), the `renewIdToken()` and `refreshToken()` methods were used to Refresh Tokens. In [auth0.js v8](/libraries/auth0js#using-checksession-to-acquire-new-tokens), refreshing tokens is done via the `checkSession()` method. If a user is already authenticated, `checkSession()` can be used to acquire a new token for that user. - -## Delegation - -Delegation is now done via the `delegation` method, which takes an `options` object containing the following potential parameters: - -* __client_id__ (required): a string; the Auth0 application identifier -* __grant_type__ (required): a string; must be `urn:ietf:params:oauth:grant-type:jwt-bearer` -* __id_token__ (required): a string; either a valid id_token or a valid refresh_token is required -* __refresh_token__: a string; either a valid refresh_token or a valid id_token is required -* __target__: a string; the target application id of the delegation -* __scope__: a string; either `'openid'` or `'openid profile email'` -* __api_type__: a string; the api to be called - -```js -webAuth.client.delegation({ - client_id: '${account.clientId}', - grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer', - id_token: 'valid idToken here', - target: 'target client id here', - scope: 'openid' -}); -``` - -## User Management - -Linking accounts and gathering info has also changed. You can now instantiate a Management application object and call the `getUser`, `patchUserMetadata`, and `linkUser` methods on it to get a user's profile, update their metadata, or link two user accounts together. For more information, read about [user management](/libraries/auth0js#user-management) in the auth0.js documentation. diff --git a/articles/libraries/auth0js/v9/index.md b/articles/libraries/auth0js/v9/index.md index 74276efc4c..4366c9d400 100644 --- a/articles/libraries/auth0js/v9/index.md +++ b/articles/libraries/auth0js/v9/index.md @@ -1,15 +1,24 @@ --- section: libraries toc: true -title: Auth0.js v9 Reference +title: auth0.js v9 Reference description: How to install, initialize and use auth0.js v9 +topics: + - libraries + - auth0js +contentType: + - index + - how-to +useCase: add-login --- -# Auth0.js v9 Reference +# auth0.js v9 Reference -Auth0.js is a client-side library for Auth0. It is recommended for use in single page apps, and auth0.js in your SPA makes it easier to do authentication and authorization with Auth0. +auth0.js is a client-side library for Auth0. It is recommended for use in single-page apps, preferably in conjunction with [Universal Login](/universal-login), which should be used whenever possible. Using auth0.js in your SPA makes it easier to do authentication and authorization with Auth0. The full API documentation for the library is [here](https://auth0.github.io/auth0.js/index.html). +<%= include('../../../_includes/_embedded_login_warning') %> + ## Ready-to-go example The [example directory](https://github.com/auth0/auth0.js/tree/master/example) of the auth0.js library is a ready-to-go app that can help you to quickly and easily try out auth0.js. In order to run it, follow these quick steps: @@ -66,24 +75,24 @@ There are two required parameters that must be passed in the `options` object wh | --- | --- | --- | | `domain` | required | (String) Your Auth0 account domain (ex. myaccount.auth0.com) | | `clientID` | required | (String) Your Auth0 client ID | -| `redirectUri` | optional | (String) The default `redirectUri` used. Defaults to an empty string (none). | -| `scope` | optional | (String) The default scope(s) used by the application. Using scopes can allow you to return specific claims for specific fields in your request. You should read our [documentation on scopes](/scopes) for further details. | +| `redirectUri` | optional* | (String) The default `redirectUri` used. Defaults to an empty string (none). **If you do not provide a global `redirectUri` value here, you will need to provide a redirectUri value for *each* method you use.** | +| `scope` | optional | (String) The default scope(s) used by the application. Using scopes can allow you to return specific claims for specific fields in your request. You should read our [documentation on scopes](/scopes) for further details. | | `audience` | optional | (String) The default audience to be used for requesting API access. | -| `responseType` | optional | (String) The default `responseType` used. It can be any space separated list of the values `code`, `token`, `id_token`. It defaults to `'token'`, unless a `redirectUri` is provided, then it defaults to `'code'`. | +| `responseType` | optional* | (String) The default `responseType` used. It can be any space separated list of the values `code`, `token`, `id_token`. It defaults to `'token'`, unless a `redirectUri` is provided, then it defaults to `'code'`. **If you do not provide a global `responseType` value, you will need to provide a `responseType` value for *each* method you use.** | | `responseMode` | optional | (String) This option is omitted by default. Can be set to `'form_post'` in order to send the token or code to the `'redirectUri'` via POST. Supported values are `query`, `fragment` and `form_post`. | -| `leeway` | optional | (Integer) A value in seconds; leeway to allow for clock skew with regard to JWT expiration times. | +| `leeway` | optional | (Integer) A value in seconds; leeway to allow for clock skew with regard to ID Token expiration times. | | `_disableDeprecationWarnings` | optional | (Boolean) Disables the deprecation warnings, defaults to `false`. | ::: note -Because of clock skew issues, you may occasionally encounter the error `The token was issued in the future`. The `leeway` parameter can be used to allow a few seconds of leeway to JWT expiration times, to prevent that from occuring. +Because of clock skew issues, you may occasionally encounter the error `The token was issued in the future`. The `leeway` parameter can be used to allow a few seconds of leeway to ID Token expiration times, to prevent that from occurring. ::: ##### Scope -The default `scope` value in Auth0.js v9 is `openid profile email`. +The default `scope` value in auth0.js v9 is `openid profile email`. -::: panel Running Auth0.js Locally -If you don't specify at least the above scope when initializing Auth0.js, and you are running your website from `http://localhost` or `http://127.0.0.1`, calling the `getSSOData()` method will result in the following error in the browser console: +::: panel Running auth0.js Locally +If you don't specify at least the above scope when initializing auth0.js, and you are running your website from `http://localhost` or `http://127.0.0.1`, calling the `getSSOData()` method will result in the following error in the browser console: `Consent required. When using getSSOData, the user has to be authenticated with the following scope: openid profile email` @@ -96,17 +105,18 @@ You can choose a method for login based on the type of auth you need in your app ### webAuth.authorize() -The `authorize()` method can be used for logging in users via [universal login](/hosted-pages/login), or via social connections, as exhibited in the examples below. This method invokes the [/authorize endpoint](/api/authentication?javascript#social) of the Authentication API, and can take a variety of parameters via the `options` object. +The `authorize()` method can be used for logging in users via Universal Login, or via social connections, as exhibited in the examples below. This method invokes the [/authorize endpoint](/api/authentication?javascript#social) of the Authentication API, and can take a variety of parameters via the `options` object. | **Parameter** | **Required** | **Description** | | --- | --- | --- | | `audience` | optional | (String) The default audience to be used for requesting API access. | | `connection` | optional | (String) Specifies the connection to use rather than presenting all connections available to the application. | -| `scope` | optional | (String) The scopes which you want to request authorization for. These must be separated by a space. You can request any of the standard OIDC scopes about users, such as `profile` and `email`, custom claims that must [conform to a namespaced format](/api-auth/tutorials/adoption/scope-custom-claims), or any scopes supported by the target API (for example, `read:contacts`). Include `offline_access` to get a Refresh Token. | +| `scope` | optional | (String) The scopes which you want to request authorization for. These must be separated by a space. You can request any of the standard OIDC scopes about users, such as `profile` and `email`, custom claims that must [conform to a namespaced format](/tokens/guides/create-namespaced-custom-claims), or any scopes supported by the target API (for example, `read:contacts`). Include `offline_access` to get a Refresh Token. | | `responseType` | optional | (String) It can be any space separated list of the values `code`, `token`, `id_token`. It defaults to `'token'`, unless a `redirectUri` is provided, then it defaults to `'code'`. | | `clientID` | optional | (String) Your Auth0 client ID. | | `redirectUri` | optional | (String) The URL to which Auth0 will redirect the browser after authorization has been granted for the user. | -| `state` | optional | (String) An arbitrary value that should be maintained across redirects. It is useful to mitigate CSRF attacks and for any contextual information (for example, a return URL) that you might need after the authentication process is finished. For more information, see the [state parameter documentation](/protocols/oauth2/oauth-state). | +| `state` | optional | (String) An arbitrary value that should be maintained across redirects. It is useful to mitigate CSRF attacks and for any contextual information (for example, a return URL) that you might need after the authentication process is finished. For more information, see [State Parameter](/protocols/oauth2/oauth-state). auth0.js, when used in single-page applications, handles the state generation and validation automatically if not specified. | +| `prompt` | optional | (String) A value of `login` will force the login page to show regardless of current session. A value of `none` will attempt to bypass the login prompts if a session already exists (see the [silent authentication](/sso/current/single-page-apps#silent-authentication) documentation for more details). | For hosted login, one must call the `authorize()` method. @@ -132,9 +142,10 @@ Hosted login with popup: ```js webAuth.popup.authorize({ + redirectUri: 'https://YOUR_APP/popup_response_handler.html' //Any additional options can go here }, function(err, authResult) { - //do something + //do something }); ``` @@ -142,15 +153,41 @@ And for social login with popup using `authorize`: ```js webAuth.popup.authorize({ + redirectUri: 'https://YOUR_APP/popup_response_handler.html', connection: 'twitter' }, function(err, authResult) { - //do something + //do something }); ``` +#### Handling popup authentication results + +When using popup authentication, you'll have to provide a `redirectUri` where the destination page communicates the authorization results back to the callback by using the `webAuth.popup.callback` method. A simple implementation would be something like this: + +```HTML + + + + + + + +``` + +An ideal handler would contain just this minimal functionality (i.e. avoid reloading the whole application just to handle the response). +You will need to add the `redirectUri` to the application's **Allowed Callback URLs** list in the application configuration page on the Dashboard. + ### webAuth.login() -The `login` method allows for [cross-origin authentication](/cross-origin-authentication) using database connections, using `/co/authenticate`. +<%= include('../../../_includes/_embedded_login_warning') %> + +The `login` method allows for [cross-origin authentication](/cross-origin-authentication) for database connections, using `/co/authenticate`. | **Parameter** | **Required** | **Description** | | --- | --- | --- | @@ -190,16 +227,16 @@ var url = webAuth.client.buildAuthorizeUrl({ ``` ::: note -The `state` parameter is an opaque value that Auth0 will send back to you. This method helps prevent CSRF attacks, and it needs to be specified if you redirect to the URL yourself instead of calling `webAuth.authorize()`. The [OAuth state documentation](/protocols/oauth2/oauth-state) describes how to do use it correctly. +The `state` parameter is an opaque value that Auth0 will send back to you. This method helps prevent CSRF attacks, and it needs to be specified if you redirect to the URL yourself instead of calling `webAuth.authorize()`. For more information, see [State Parameter](/protocols/oauth2/oauth-state). ::: <%= include('../../_includes/_embedded_sso') %> ## Passwordless login -Passwordless authentication allows users to log in by receiving a one-time password via email or text message. The process will require you to start the Passwordless process, generating and dispatching a code to the user, (or a code within a link), followed by accepting their credentials via the verification method. That could happen in the form of a login screen which asks for their (email or phone number) and the code you just sent them. It could also be implemented in the form of a Passwordless link instead of a code sent to the user. They would simply click the link in their email or text and it would hit your endpoint and verify this data automatically using the same verification method (just without manual entry of a code by the user). +Passwordless authentication allows users to log in by receiving a one-time password via email or text message. The process will require you to start the Passwordless process, generating and dispatching a code to the user, (or a code within a link), followed by accepting their credentials via the verification method. That could happen in the form of a login screen which asks for their (email or phone number) and the code you just sent them. It could also be implemented in the form of a Passwordless link instead of a code sent to the user. They would simply click the link in their email or text and it would hit your endpoint and verify this data automatically using the same verification method (just without manual entry of a code by the user). -In order to use Passwordless, you will want to initialize Auth0.js with a `redirectUri` and to set the `responseType: 'token'`. +In order to use Passwordless, you will want to initialize auth0.js with a `redirectUri` and to set the `responseType: 'token'`. ```js var webAuth = new auth0.WebAuth({ @@ -212,7 +249,7 @@ var webAuth = new auth0.WebAuth({ ### Start passwordless -The first step in Passwordless authentication with Auth0.js is the `passwordlessStart` method, which has several parameters which can be passed within its `options` object: +The first step in Passwordless authentication with auth0.js is the `passwordlessStart` method, which has several parameters which can be passed within its `options` object: | **Parameter** | **Required** | **Description** | | --- | --- | --- | @@ -234,7 +271,7 @@ webAuth.passwordlessStart({ ); ``` -### Verify passwordless +### Passwordless Login If sending a code, you will then need to prompt the user to enter that code. You will process the code, and authenticate the user, with the `passwordlessLogin` method, which has several parameters which can be sent in its `options` object: @@ -248,7 +285,7 @@ If sending a code, you will then need to prompt the user to enter that code. You As with `passwordlessStart`, exactly _one_ of the optional `phoneNumber` and `email` parameters must be sent in order to verify the Passwordless transaction. ::: note -In order to use `passwordlessLogin`, the options `redirectUri` and `responseType: 'token'` must be specified when first initializing WebAuth. +In order to use `passwordlessLogin`, the options `redirectUri` and `responseType` must be specified when first initializing WebAuth. ::: ```js @@ -271,14 +308,14 @@ The `parseHash` method takes an `options` object that contains the following par | **Parameter** | **Required** | **Description** | | --- | --- | --- | | `state` | optional | (String) An opaque value the application adds to the initial request that Auth0 includes when redirecting back to the application. This value is used by auth0.js to prevent CSRF attacks. | -| `nonce` | optional | (String) Used to verify the `id_token` +| `nonce` | optional | (String) Used to verify the ID Token | `hash` | optional | (String) The URL hash (if not provided, `window.location.hash` will be used by default) | The contents of the authResult object returned by `parseHash` depend upon which authentication parameters were used. It can include: | **Item** | **Description** | | --- | --- | -| `accessToken` | An Access Token for the API, specified by the `audience` | +| `accessToken` | An Access Token for the API, specified by the `audience` | | `expiresIn` | A string containing the expiration time (in seconds) of the `accessToken` | | `idToken` | An ID Token JWT containing user profile information | @@ -330,7 +367,7 @@ webAuth.checkSession({ }); ``` -The `webAuth.checkSession` method will automatically verify that the returned `id_token`'s `nonce` claim is the same as the option. +The `webAuth.checkSession` method will automatically verify that the returned ID Token's `nonce` claim is the same as the option. <%= include('../../../_includes/_co_authenticate_errors', { library : 'Auth0.js v9'}) %> @@ -363,8 +400,9 @@ To sign up a user, use the `signup` method. This method accepts an options objec | --- | --- | --- | | `email` | required | (String) User's email address | | `password` | required | (String) User's desired password | +| `username` | required\* | (String) User's desired username.
    \*Required if you use a database connection and you have enabled **Requires Username** | | `connection` | required | (String) The database connection name on your application upon which to attempt user account creation | -| `user_metadata` | optional | (JSON object) Additional attributes used for user information. Will be stored in [user_metadata](/metadata) | +| `user_metadata` | optional | (JSON object) Additional attributes used for user information. Will be stored in [user_metadata](/users/concepts/overview-user-metadata) | Signups should be for database connections. Here is an example of the `signup` method and some sample code for a form. @@ -391,9 +429,9 @@ Signups should be for database connections. Here is an example of the `signup` m ## Using checkSession to acquire new tokens -The `checkSession` method allows you to acquire a new token from Auth0 for a user who is already authenticated against Auth0 for your domain. The method accepts any valid OAuth2 parameters that would normally be sent to `authorize`. If you omit them, it will use the ones provided when initializing Auth0. +The `checkSession` method allows you to acquire a new token from Auth0 for a user who is already authenticated against Auth0 for your domain. The method accepts any valid OAuth2 parameters that would normally be sent to `authorize`. If you omit them, it will use the ones provided when initializing Auth0. -The call to `checkSession` can use get a new token for the API that was specified as the audience when `webAuth` was initialized: +The call to `checkSession` can be used to get a new token for the API that was specified as the audience when `webAuth` was initialized: ```js webAuth.checkSession({}, function (err, authResult) { @@ -402,6 +440,8 @@ webAuth.checkSession({}, function (err, authResult) { }); ``` +See [Extract the AuthResult and Get User Info](#extract-the-authresult-and-get-user-info) for the format of `authResult`. + Or, the token can be acquired for a different API than the one used when initializing `webAuth` by specifying an `audience` and `scope`: ```js @@ -421,12 +461,18 @@ Note that `checkSession()` triggers any [rules](/rules) you may have set up, so The actual redirect to `/authorize` happens inside an iframe, so it will not reload your application or redirect away from it. +However, the browser **must** have third-party cookies enabled. Otherwise, **checkSession()** is unable to access the current user's session (making it impossible to obtain a new token without displaying anything to the user). The same will happen if users have [Safari's ITP enabled](/api-auth/token-renewal-in-safari). + Remember to add the URL where the authorization request originates from, to the **Allowed Web Origins** list of your Auth0 application in the [Dashboard](${manage_url}) under your application's **Settings**. ::: warning If the connection is a social connection and you are using Auth0 dev keys, the `checkSession` call will always return `login_required`. ::: +### Polling with checkSession() + +<%= include('../../../_includes/_checksession_polling') %> + ## Password reset requests If attempting to set up a password reset functionality, you'll use the `changePassword` method and pass in an "options" object, with a "connection" parameter and an "email" parameter. @@ -450,9 +496,9 @@ The user will then receive an email which will contain a link that they can foll ## User management -The Management API provides functionality that allows you to link and unlink separate user accounts from different providers, tying them to a single profile (Read more about [Linking Accounts](/link-accounts) with Auth0). It also allows you to update user metadata. +The Management API provides functionality that allows you to link and unlink separate user accounts from different providers, tying them to a single profile (See [User Account Linking](/users/concepts/overview-user-account-linking) for details.) It also allows you to update user metadata. -To get started, you first need to obtain a an Access Token that can be used to call the Management API. You can do it by specifying the `https://${account.namespace}/api/v2/˜` audience when initializing Auth0.js, in which case you will get the Access Token as part of the authentication flow. +To get started, you first need to obtain a an Access Token that can be used to call the Management API. You can do it by specifying the `https://${account.namespace}/api/v2/` audience when initializing auth0.js, in which case you will get the Access Token as part of the authentication flow. ::: note If you use [custom domains](/custom-domains), you will need to instantiate a new copy of `webAuth` using your Auth0 domain rather than your custom one, for use with the Management API calls, as it only works with Auth0 domains. @@ -463,7 +509,7 @@ var webAuth = new auth0.WebAuth({ clientID: '${account.clientId}', domain: '${account.namespace}', redirectUri: 'http://example.com', - audience: `https://${account.namespace}/api/v2/˜`, + audience: `https://${account.namespace}/api/v2/`, scope: 'read:current_user', responseType: 'token id_token' }); @@ -474,9 +520,9 @@ You can also do so by using `checkSession()`: ``` webAuth.checkSession( { - audience: `https://${account.namespace}/api/v2/˜`, + audience: `https://${account.namespace}/api/v2/`, scope: 'read:current_user' - }, function(err, result) { + }, function(err, result) { // use result.accessToken } ); @@ -511,7 +557,7 @@ auth0Manage.getUser(userId, cb); ### Updating the user profile -When updating user metadata, you will need to first create a `userMetadata` object, and then call the `patchUserMetadata` method, passing it the user id and the `userMetadata` object you created. The values in this object will overwrite existing values with the same key, or add new ones for those that don't yet exist in the user metadata. Visit the [User Metadata](/metadata) documentation for more details on user metadata. +When updating user metadata, you will need to first create a `userMetadata` object, and then call the `patchUserMetadata` method, passing it the user id and the `userMetadata` object you created. The values in this object will overwrite existing values with the same key, or add new ones for those that don't yet exist in the user metadata. See the [Metadata](/users/concepts/overview-user-metadata) documentation for more details on user metadata. ```js auth0Manage.patchUserMetadata(userId, userMetadata, cb); @@ -521,7 +567,7 @@ auth0Manage.patchUserMetadata(userId, userMetadata, cb); Linking user accounts will allow a user to authenticate from any of their accounts and no matter which one they use, still pull up the same profile upon login. Auth0 treats all of these accounts as separate profiles by default, so if you wish a user's accounts to be linked, this is the way to go. -The `linkUser` method accepts two parameters, the primary `userId` and the secondary user's `id_token` (the token obtained after login with this identity). The user id in question is the unique identifier for this user account. If the id is in the format `facebook|1234567890`, the id required is the portion after the delimiting pipe. Visit the [Linking Accounts](/link-accounts) documentation for more details on linking accounts. +The `linkUser` method accepts two parameters, the primary `userId` and the secondary user's ID Token (the token obtained after login with this identity). The user ID in question is the unique identifier for the primary user account. The ID should be passed with the provider prefix, e.g., `auth0|1234567890` or `facebook|1234567890`, when using this method. See [User Account Linking](/users/concepts/overview-user-account-linking) for details. ```js auth0Manage.linkUser(userId, secondaryUserToken, cb); diff --git a/articles/libraries/auth0js/v9/migration-angular.md b/articles/libraries/auth0js/v9/migration-angular.md index 20bcf3fff7..ee64ca6012 100644 --- a/articles/libraries/auth0js/v9/migration-angular.md +++ b/articles/libraries/auth0js/v9/migration-angular.md @@ -2,6 +2,17 @@ section: libraries title: Migrating Angular applications to Auth0.js v9 description: How to migrate Angular applications to Auth0.js v9 +public: false +topics: + - libraries + - auth0js + - migrations + - angular +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating Angular 2+ Applications to Auth0.js v9 diff --git a/articles/libraries/auth0js/v9/migration-angularjs-v6.md b/articles/libraries/auth0js/v9/migration-angularjs-v6.md index 36afc7f865..b87b3568e6 100644 --- a/articles/libraries/auth0js/v9/migration-angularjs-v6.md +++ b/articles/libraries/auth0js/v9/migration-angularjs-v6.md @@ -2,7 +2,18 @@ section: libraries title: Migrating Angular 1.x Applications From auth0.js v6 to v9 description: How to migrate Angular 1.x Applications From auth0.js v6 to v9 +public: false toc: true +topics: + - libraries + - auth0js + - migrations + - angular +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating Angular 1.x applications from Auth0.js v6 to v9 diff --git a/articles/libraries/auth0js/v9/migration-angularjs-v7.md b/articles/libraries/auth0js/v9/migration-angularjs-v7.md index 769c55a61c..6020f63d6c 100644 --- a/articles/libraries/auth0js/v9/migration-angularjs-v7.md +++ b/articles/libraries/auth0js/v9/migration-angularjs-v7.md @@ -2,7 +2,18 @@ section: libraries title: Migrating Angular 1.x Applications From auth0.js v7 to v9 description: How to migrate Angular 1.x Applications From auth0.js v7 to v9 +public: false toc: true +topics: + - libraries + - auth0js + - migrations + - angular +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating Angular 1.x applications from Auth0.js v7 to v9 diff --git a/articles/libraries/auth0js/v9/migration-angularjs-v8.md b/articles/libraries/auth0js/v9/migration-angularjs-v8.md index a229a40820..edea9b70ee 100644 --- a/articles/libraries/auth0js/v9/migration-angularjs-v8.md +++ b/articles/libraries/auth0js/v9/migration-angularjs-v8.md @@ -2,7 +2,18 @@ section: libraries title: Migrating Angular 1.x Applications From auth0.js v8 to v9 description: How to migrate Angular 1.x Applications From auth0.js v8 to v9 +public: false toc: true +topics: + - libraries + - auth0js + - migrations + - angular +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating Angular 1.x applications from Auth0.js v8 to v9 diff --git a/articles/libraries/auth0js/v9/migration-guide.md b/articles/libraries/auth0js/v9/migration-guide.md index 0781834347..51c3f7a950 100644 --- a/articles/libraries/auth0js/v9/migration-guide.md +++ b/articles/libraries/auth0js/v9/migration-guide.md @@ -2,7 +2,17 @@ section: libraries title: Migrating to Auth0.js v9 description: How to migrate to Auth0.js v9 +public: false toc: true +topics: + - libraries + - auth0js + - migrations +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating to Auth0.js v9 @@ -10,18 +20,14 @@ toc: true ## Should I migrate to v9? -Everyone should migrate to v9. All previous versions are deprecated, and will be removed from service July 16, 2018. For applications that use Auth0.js within an Auth0 login page, this migration is recommended; for applications with Auth0.js embedded within them, this migration is mandatory. - -::: note -Previously, deprecated Auth0.js versions were planned to be removed from service on April 1, 2018. However, the Removal of Service date has been extended to **July 16, 2018** due to a [mitigation of the risks posed by deprecated versions](/cross-origin-authentication/fingerprinting). Customers are still encouraged to migrate applications to the latest version **as soon as possible** in order to ensure that applications continue to function properly. -::: +Everyone should migrate to v9. All previous versions are deprecated, and the deprecated endpoints used by them were removed from service on August 6, 2018. For applications that use Auth0.js within an Auth0 login page, this migration is recommended; for applications with Auth0.js embedded within them, this migration is mandatory. ## Migration Instructions -The documents below describe all the changes that you should be aware of when migrating from different versions of auth0.js to v9. Make sure you go through the relevant guide(s) before upgrading. +The documents below describe all the changes that you should be aware of when migrating from different versions of Auth0.js to v9. Make sure you go through the relevant guide(s) before upgrading. * [Migrating from Auth0.js v8](/libraries/auth0js/v9/migration-v8-v9) - * [Recommendations for migrating from Auth0.js v8 when SSO is required](/guides/login/migration-sso) + * [Recommendations for migrating from Auth0.js v8 when Single Sign-on (SSO) is required](/guides/login/migration-sso) * [Migrating from Auth0.js v7](/libraries/auth0js/v9/migration-v7-v9) * [Migrating from Auth0.js v6](/libraries/auth0js/v9/migration-v6-v9) * [Migrating from Auth0.js v8 in Angular 1.x Applications](/libraries/auth0js/v9/migration-angularjs-v8) @@ -30,9 +36,9 @@ The documents below describe all the changes that you should be aware of when mi * [Migrating from Auth0.js v8 in Angular 2.x Applications](/libraries/auth0js/v9/migration-angular) * [Migrating from Auth0.js v8 in React.js Applications](/libraries/auth0js/v9/migration-react) -:::note If you have any questions or concerns, you can discuss them in the [Auth0 Community](https://community.auth0.com/), submit them using the [Support Center](${env.DOMAIN_URL_SUPPORT}), or directly through your account representative, if applicable. -::: + +<%= include('../../../_includes/_embedded_login_warning') %> ## Troubleshooting @@ -44,4 +50,6 @@ You have already migrated to Auth0.js 9 but you still see this error in your log Legacy Lock API: This feature is being deprecated. Please refer to our documentation to learn how to migrate your application. ``` -These deprecation notices most likely originate from a user visiting the [Universal Login page](/hosted-pages/login) directly without initiating the authentication flow from your app. This can happen if a user bookmarks the login page directly. If this happens after **July 16, 2018** the user will not be able to log in. +These deprecation notices most likely originate from a user visiting the Universal Login [page](/universal-login) directly without initiating the authentication flow from your app. This can happen if a user bookmarks the login page directly. After August 6, 2018, these users will not be able to log in. + +See [Check Deprecation Errors](/troubleshoot/guides/check-deprecation-errors) for more information on deprecation-related errors. diff --git a/articles/libraries/auth0js/v9/migration-react.md b/articles/libraries/auth0js/v9/migration-react.md index 480b82c679..633c543fbb 100644 --- a/articles/libraries/auth0js/v9/migration-react.md +++ b/articles/libraries/auth0js/v9/migration-react.md @@ -2,6 +2,17 @@ section: libraries title: Migrating React Applications to Auth0.js v9 description: How to migrate React applications to Auth0.js v9 +public: false +topics: + - libraries + - auth0js + - migrations + - react +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating React Applications to Auth0.js v9 diff --git a/articles/libraries/auth0js/v9/migration-v6-v9.md b/articles/libraries/auth0js/v9/migration-v6-v9.md index f742bc1215..99375af3f5 100644 --- a/articles/libraries/auth0js/v9/migration-v6-v9.md +++ b/articles/libraries/auth0js/v9/migration-v6-v9.md @@ -2,7 +2,17 @@ section: libraries title: Migrating from Auth0.js v6 to v9 description: How to migrate from Auth0.js v6 to v9 +public: false toc: true +topics: + - libraries + - auth0js + - migrations +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating from Auth0.js v6 to v9 diff --git a/articles/libraries/auth0js/v9/migration-v7-v9.md b/articles/libraries/auth0js/v9/migration-v7-v9.md index 5471f91592..7a1c5bb666 100644 --- a/articles/libraries/auth0js/v9/migration-v7-v9.md +++ b/articles/libraries/auth0js/v9/migration-v7-v9.md @@ -2,7 +2,17 @@ section: libraries title: Migrating from Auth0.js v7 to v9 description: How to migrate from Auth0.js v7 to v9 +public: false toc: true +topics: + - libraries + - auth0js + - migrations +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating from Auth0.js v7 to v9 @@ -25,7 +35,7 @@ var auth0 = new Auth0({ responseType: 'token' }); -// With universal login +// With Universal Login auth0.login({}); // With a social or enterprise connection @@ -50,7 +60,7 @@ var webAuth = new auth0.WebAuth({ responseType: 'token id_token' }); -// with universal login +// with Universal Login webAuth.authorize({}); // with a social or enterprise connection @@ -77,7 +87,7 @@ var auth0 = new Auth0({ responseType: 'token' }); -// With universal login +// With Universal Login auth0.login({ popup: true }); @@ -106,7 +116,7 @@ var webAuth = new auth0.WebAuth({ responseType: 'token' }); -// with universal login +// with Universal Login webAuth.popup.authorize({}); // with a social or enterprise connection diff --git a/articles/libraries/auth0js/v9/migration-v8-v9.md b/articles/libraries/auth0js/v9/migration-v8-v9.md index 7bc448a3b2..2a40de08b2 100644 --- a/articles/libraries/auth0js/v9/migration-v8-v9.md +++ b/articles/libraries/auth0js/v9/migration-v8-v9.md @@ -2,7 +2,17 @@ section: libraries title: Migrating to from Auth0.js v8 to v9 description: How to migrate from Auth0.js v8 to v9 +public: false toc: true +topics: + - libraries + - auth0js + - migrations +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating from Auth0.js v8 to v9 diff --git a/articles/libraries/custom-signup.md b/articles/libraries/custom-signup.md index 5b04f26bc4..fe0c3841bf 100644 --- a/articles/libraries/custom-signup.md +++ b/articles/libraries/custom-signup.md @@ -1,14 +1,26 @@ --- section: libraries -description: How to customize the user sign-up form with additional fields using Lock or the Auth0 API. +description: How to customize the user signup form with additional fields using Lock or the Auth0 API. toc: true +topics: + - libraries + - lock + - custom-signups +contentType: + - how-to + - concept +useCase: + - add-login + - enable-mobile-auth --- # Custom Signup -In some cases, you may want to customize the user sign up form with more fields other than email and password. +You can customize the user signup form with more fields in addition to email and password when using Lock or the Auth0 API. + +There are many factors to consider before you choose [Lock vs. Custom UI](/libraries/when-to-use-lock). For example, using Lock, you can redirect to another page to capture data or use progressive profiling. When using the Auth0 API, you can capture custom fields and store them in a database. There are certain limitations to the customization that should be considered when choosing the method that best suits your purpose. Some typical customizations include adding a username and verifying password strength. :::panel Universal Login -Auth0 offers a [universal login](/hosted-pages/login) option that you can use instead of designing your own custom sign up page. If you want to offer sign up and log in options, and you only need to customize the application name, logo and background color, then universal login via an Auth0 login page might be an easier option to implement. +Auth0 offers a Universal Login option that you can use instead of designing your own custom signup page. If you want to offer signup and login options, and you only need to customize the application name, logo and background color, then Universal Login via an Auth0 login page might be an easier option to implement. ::: ## Using Lock @@ -21,17 +33,15 @@ Lock's `additionalSignUpFields` option will only work with database signups. For ### Redirect to another page -One way to use social provider signups with Lock and collect custom fields is to use [redirect rules](/rules/redirect) to redirect the user to another page where you ask for extra information, and then redirect back to finish the authentication transaction. +One way to use social provider signups with Lock and collect custom fields is to use [redirect rules](/rules/guides/redirect) to redirect the user to another page where you ask for extra information, and then redirect back to finish the authentication transaction. ### Progressive profiling -Another way to collect custom field data when signing users up with social providers is via progressive profiling. Progressive profiling is a way by which you can slowly build up user profiles over time. You collect the bare minimum details upon signup, but when a user later interacts with your app, you collect a small amount of data (perhaps one question) each time until their profile is complete. This allows for collecting the desired information, but with less friction at signup, since the goal of using a social IDP for signup is, at least in part, making it more effortless and streamlined for the user. - -For further reference, here is our [documentation on progressive profiling](/user-profile/progressive-profiling) as well as an Auth0 [blog post on progressive profiling](https://auth0.com/blog/progressive-profiling/). +Another way to collect custom field data when signing users up with social providers is via [progressive profiling](/users/concepts/overview-progressive-profiling) whereby you can slowly build up user profile data over time. You collect the bare minimum details upon signup, but when a user later interacts with your app, you collect a small amount of data (perhaps one question) each time until their profile is complete. This allows you to collect the desired information but with less friction, since the goal of using a social IDP for signup is making it more effortless and streamlined for the user. ## Using the API -### 1. Create a Sign Up form to capture custom fields +### Create a signup form to capture custom fields ```html
    @@ -55,15 +65,22 @@ For further reference, here is our [documentation on progressive profiling](/use
    ``` -The `name` and `color` are custom fields. +The `name` is a user profile attribute and `color` is a custom field. ::: note There is currently no way to validate user-supplied custom fields when signing up. Validation must be done from an Auth0 [Rule](/rules) at login, or with custom, **server-side** logic in your application. ::: -### 2. Send the Form Data +### Send the form data -Send a POST request to the [/dbconnections/signup](/api/authentication/reference#signup) endpoint in Auth0. You will need to send your `ClientId`, the `email` and `password` of the user being signed up, and the custom fields as part of `user_metadata`. +Send a POST request to the [/dbconnections/signup](/api/authentication/reference#signup) endpoint in Auth0. + +You will need to send: +- Your application's `client_id` +- The `email` and `password` of the user being signed up +- The name of the database `connection` to store your user's data +- Any user profile attribute you want to update for the user, which can include `given_name`, `family_name`, `name`, `nickname`, and `picture`. +- Any custom fields as part of `user_metadata` ```har { @@ -75,7 +92,7 @@ Send a POST request to the [/dbconnections/signup](/api/authentication/reference }], "postData": { "mimeType": "application/json", - "text": "{\"client_id\": \"${account.clientId}\",\"email\": \"$('#signup-email').val()\",\"password\": \"$('#signup-password').val()\",\"user_metadata\": {\"name\": \"john\",\"color\": \"red\"}}" + "text": "{\"client_id\": \"${account.clientId}\",\"email\": \"$('#signup-email').val()\",\"password\": \"$('#signup-password').val()\",\"connection\": \"YOUR_CONNECTION_NAME\",\"name\": \"$('#name').val()\",\"user_metadata\": {\"color\": \"red\"}}" } } ``` @@ -92,7 +109,7 @@ When your users sign up, the custom fields are sent as part of `user_metadata`. ## Redirect mode -After a successful login, Auth0 will redirect the user to your configured callback URL with a JWT (`id_token`) in the query string. +After a successful login, Auth0 will redirect the user to your configured callback URL with a JWT (`id_token`) in the query string. ::: note To learn more about the differences between popup and redirect modes, please refer to [this document](/libraries/lock/v10/popup-mode). @@ -109,20 +126,58 @@ window.auth0 = new Auth0({ Your server will then need to call APIv2 to add the necessary custom fields to the user's profile. -## Add Username to Sign Up form +## Add username to the signup form + +One common signup customization is to add a username to the signup. -One common signup customization is to add a `username` to the signup. +To enable this feature, turn on the **Requires Username** setting on the [Connections > Database](${manage_url}/#/connections/database/) section of the dashboard under the **Settings** tab for the connection you wish to edit. -To enable this feature, turn on the `Requires Username` setting on the [Connections > Database](${manage_url}/#/connections/database/) section of the dashboard under the **Settings** tab for the connection you wish to edit. +Capture the `username` field in your custom form, and add the `username` to your request body. -Once this has been set, when a user is created manually in the Auth0 dashboard, the screen where users enter their information will prompt them for both an email and a username. +```html +
    +
    + Sign up +

    + +

    +

    + +

    +

    + +

    + +
    +
    +``` -Similarly, the Lock widget in sign up mode will prompt for a username, email and password. +```js +var settings = { + "async": true, + "crossDomain": true, + "url": "https://${account.namespace}/dbconnections/signup", + "method": "POST", + "headers": { + "content-type": "application/x-www-form-urlencoded" + }, + "data": { + "client_id": "${account.clientId}", + "email": $('#signup-email').val(), + "password": $('#signup-password').val(), + "connection": "YOUR_CONNECTION_NAME", + "username": $('#username').val() + } +} -Then users can log in with Username and Password. +$.ajax(settings).done(function (response) { + console.log(response); +}); +``` -## Optional: Verifying password strength +## Optional: Verify password strength Password policies for database connections can be configured in the dashboard. For more information, see: [Password Strength in Auth0 Database Connections](/connections/database/password-strength). -If required for implementation of custom signup forms, the configured password policies, along with other connection information, can be retrieved from the the [Management v2 API](/api/management/v2#!/Connections/get_connections_by_id). The result can be parsed client-side, and will contain information about the current password policy (or policies) configured in the dashboard for that connection. +If required for implementation of custom signup forms, the configured password policies, along with other connection information, can be retrieved from the [Management v2 API](/api/management/v2#!/Connections/get_connections_by_id). The result can be parsed client-side, and will contain information about the current password policy (or policies) configured in the dashboard for that connection. diff --git a/articles/libraries/error-messages.md b/articles/libraries/error-messages.md index 3169930aa7..a6c1e29606 100644 --- a/articles/libraries/error-messages.md +++ b/articles/libraries/error-messages.md @@ -1,10 +1,20 @@ --- section: libraries -description: Common errors that you might get when you authenticate users using Auth0 libraries +description: Describes common sign up and login errors that you might see when you authenticate users using Auth0 libraries. +topics: + - libraries + - lock + - auth0js + - error-messages +contentType: + - reference +useCase: + - add-login + - enable-mobile-auth --- -# Common Authentication Errors +# Common Auth0 Library Authentication Errors -The actions or input data of your users, during the sign up or the log in processes, might trigger errors. This article lists the most common errors that you might get, if you use any of the Auth0 libraries for authentication. +The actions or input data of your users, during the sign up or the log in processes, might trigger errors. Here is a list of the most common errors that you might get if you use any of the Auth0 libraries for authentication. ## Sign up @@ -12,13 +22,14 @@ In the case of a failed signup, the most common errors are: | **Error** | **Description** | |-|-| -| **user_exists** | The user you are attempting to sign up has already signed up | -| **username_exists** | The username you are attempting to sign up with is already in use | -| **unauthorized** | If you cannot sign up for this application. May have to do with the violation of a specific rule | | **invalid_password** | If the password used doesn't comply with the password policy for the connection | +| **invalid_signup** | The user your are attempting to sign up is invalid | | **password_dictionary_error** | The chosen password is too common | | **password_no_user_info_error** | The chosen password is based on user information | | **password_strength_error** | The chosen [password is too weak](/connections/database/password-strength) | +| **unauthorized** | If you cannot sign up for this application. May have to do with the violation of a specific rule | +| **user_exists** | The user you are attempting to sign up has already signed up | +| **username_exists** | The username you are attempting to sign up with is already in use | ## Log in @@ -26,13 +37,13 @@ In the case of a failed login, the most common errors are: | **Error** | **Description** | |-|-| -| **unauthorized** | The user you are attempting to sign in with is blocked | -| **too_many_attempts** | The account is blocked due to too many attempts to sign in | +| **access_denied** | When using web-based authentication, the resource server denies access per OAuth2 specifications | +| **invalid_user_password** | The username and/or password used for authentication are invalid | +| **mfa_invalid_code** | The multi-factor authentication (MFA) code provided by the user is invalid/expired | +| **mfa_registration_required** | The administrator has required [multi-factor authentication](/mfa), but the user has not enrolled | +| **mfa_required** | The user must provide the [multi-factor authentication](/mfa) code to authenticate | | **password_leaked** | If the password has been leaked and a different one needs to be used | -| **mfa_required** | The user must provide the [multifactor authentication](/multifactor-authentication) code to authenticate | -| **mfa_registration_required** | The administrator has required [multifactor authentication](/multifactor-authentication), but the user has not enrolled | -| **mfa_invalid_code** | The [multifactor authentication](/multifactor-authentication) code provided by the user is invalid/expired | -| **PasswordStrengthError** | The password provided does not match the connection's [strength requirements](/connections/database/password-strength) | | **PasswordHistoryError** | The password provided for sign up/update has already been used (reported when [password history](/connections/database/password-options#password-history) feature is enabled) | -| **invalid_user_password** | The username and/or password used for authentication are invalid | -| **access_denied** | When using web-based authentication, the resource server denies access per OAuth2 specifications | +| **PasswordStrengthError** | The password provided does not match the connection's [strength requirements](/connections/database/password-strength) | +| **too_many_attempts** | The account is blocked due to too many attempts to sign in | +| **unauthorized** | The user you are attempting to sign in with is blocked | \ No newline at end of file diff --git a/articles/libraries/index.md b/articles/libraries/index.md index 45b6e2478d..cb41e46b6c 100644 --- a/articles/libraries/index.md +++ b/articles/libraries/index.md @@ -2,41 +2,28 @@ section: libraries classes: topic-page title: Auth0 Libraries -description: Overview of the Auth0 Libraries and SDKs +description: Auth0 Libraries and SDKs overview +topics: + - libraries + - lock + - auth0js +contentType: + - index + - concept ---

    Auth0 Libraries

    -

    - There are several widgets and SDKs available for developers to provide a frictionless, simple experience when using Auth0. Take a look below to find documentation on the tools that you need to get started! +

    + Auth0 offers widgets and SDKs to provide a simple and frictionless experience for you when using Auth0. Take a look at the options listed to find documentation and links to repositories for the tools you need to get started.

    -<%= include('../_includes/_lock_auth0js_deprecations_notice') %> - -## How Should You Implement Auth0? - -When adding Auth0 to your web apps, the best solution is to use Auth0's [universal login](/hosted-pages/login). Using universal login is a simple process, and prevents the pitfalls of [cross-origin authentication](/cross-origin-authentication). The login page uses by default the Lock Widget to authenticate users, but there is also a template for Lock Passwordless and a template for a custom UI built with the Auth0.js SDK available. - -You can customize the page in the [Hosted Pages Editor](${manage_url}/#/login_page). - -If universal login does not meet your requirements, however, Auth0 has a variety of options which can be embedded in your applications to assist with authentication. - -* [Lock](#lock) is a drop-in authentication widget that provides a standard set of behaviors and a customizable user interface. -* [Auth0 SDKs](#auth0-sdks) are client-side libraries that do not come with a user interface. These allow for expanded customization of the behavior and appearance of the login process. -* The [Authentication API](/api/authentication) can be used to integrate applications with Auth0 without using any of the Auth0 libraries. - -The best option to choose will depend on the needs of your app. Check out [When to Use Lock](/libraries/when-to-use-lock) for more information to help you decide between using Lock or an SDK. +<%= include('../_includes/_embedded_login_warning') %> ## Lock -The Lock widget is a simple way to integrate Auth0 into existing projects and provide the frictionless login and signup experience that you want for your app. Lock gives your users a customizable UI with which to authenticate in your app. - -The Lock widget for each platform has detailed reference documentation. - -### Lock Reference Documentation - -### Lock Support Table - -Below are the GitHub links and support status for the various Lock widgets. +### Lock repositories and support status <%= include('../_includes/_libraries_support_lock') %> - -## Auth0 SDKs - -Auth0 SDKs include no UI. Instead, you would use one of these SDKs alongside your custom UI. - -### SDK Reference Documentation - -The most commonly used SDKs have reference documentation. +## SDKs -### SDK Support Table - -Below are listed all of the SDKs that are available for Auth0, with GitHub links and their support status. +### SDK repositories and support status <%= include('../_includes/_libraries_support_sdks') %> - -### Framework/Platform Integration SDK Support Table +### Platform integration repositories and support status <%= include('../_includes/_libraries_support_frameworks') %> - ::: note -Auth0 reserves the right to downgrade support for an SDK to Community-Supported at any time. +Auth0 reserves the right to downgrade an SDK from **Supported** to **Community-Supported** at any time. ::: diff --git a/articles/libraries/lock-android/_includes/_lock-version.md b/articles/libraries/lock-android/_includes/_lock-version.md index db1a84107b..4c92f0862e 100644 --- a/articles/libraries/lock-android/_includes/_lock-version.md +++ b/articles/libraries/lock-android/_includes/_lock-version.md @@ -1,3 +1,3 @@ ::: version-warning -This document covers an outdated version of Lock for Android. We recommend you to [upgrade to v2](/libraries/lock-android/v2/migration-guide) +This document covers an outdated version of Lock for Android. We recommend you to upgrade to v2. ::: \ No newline at end of file diff --git a/articles/libraries/lock-android/v1/configuration.md b/articles/libraries/lock-android/v1/configuration.md index 7d1b245649..918f0e31ed 100644 --- a/articles/libraries/lock-android/v1/configuration.md +++ b/articles/libraries/lock-android/v1/configuration.md @@ -2,6 +2,16 @@ toc: true title: Lock for Android v1 Configuration description: Configuration options and methods for Lock for Android v1 +public: false +topics: + - libraries + - lock + - android +contentType: + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Configuration @@ -193,7 +203,7 @@ After a successful sign up of a user, sign him/her in too. public Builder authenticationParameters(Map parameters); ``` -Extra parameters sent to Auth0 Auth API during authentication. By default it has `scope` defined as `openid offline_access` and a device name stored in `device` parameter key. For more information check out our [documentation on sending authentication parameters](/libraries/lock-android/v1/sending-authentication-parameters) +Extra parameters sent to Auth0 Auth API during authentication. By default it has `scope` defined as `openid offline_access` and a device name stored in `device` parameter key. For more information check out our [documentation on sending authentication parameters](/libraries/lock-android/v1/sending-authentication-parameters) ```java public Builder useEmail(boolean useEmail); diff --git a/articles/libraries/lock-android/v1/delegation-api.md b/articles/libraries/lock-android/v1/delegation-api.md index 9ca1c0ea9a..f868a9de45 100644 --- a/articles/libraries/lock-android/v1/delegation-api.md +++ b/articles/libraries/lock-android/v1/delegation-api.md @@ -2,11 +2,24 @@ toc: true title: Lock for Android v1 Delegation description: Integrate with third-party apps with the delegation API. +public: false +topics: + - libraries + - lock + - delegation + - android +contentType: + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Delegation API <%= include('../_includes/_lock-version') %> +<%= include('../../../_includes/_deprecate-delegation') %> + After a successful authentication, you can request credentials to access third party apps like Firebase or AWS that are configured in your Auth0 App's Add-On section. In order to do that you need to make a request to our [Delegation API](/auth-api#!#post--delegation) using a valid JWT. Here's an example @@ -15,7 +28,7 @@ Here's an example Lock lock = LockContext.getLock(this); AuthenticationAPIClient client = lock.getAuthenticationAPIClient(); String apiType = "firebase"; -String token = .... //Your Auth0 id_token of the logged in User +String token = .... //Your Auth0 ID Token of the logged in User Map parameters = ParameterBuilder.newEmptyBuilder() .set("id_token", token) .set("api_type", apiType) diff --git a/articles/libraries/lock-android/v1/index.md b/articles/libraries/lock-android/v1/index.md index cfa92699ca..9c2bdbf318 100644 --- a/articles/libraries/lock-android/v1/index.md +++ b/articles/libraries/lock-android/v1/index.md @@ -3,7 +3,18 @@ section: libraries toc: true title: Lock for Android v1 description: A widget that provides a frictionless login and signup experience for your native Android apps. +public: false mobileimg: media/articles/libraries/lock-android.png +topics: + - libraries + - lock + - android +contentType: + - index + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Getting Started diff --git a/articles/libraries/lock-android/v1/internationalization.md b/articles/libraries/lock-android/v1/internationalization.md index aa711f2b94..141c75ae56 100644 --- a/articles/libraries/lock-android/v1/internationalization.md +++ b/articles/libraries/lock-android/v1/internationalization.md @@ -2,6 +2,17 @@ section: libraries title: Lock Android v1 Internationalization description: Internationalization support in Lock for Android +public: false +topics: + - libraries + - lock + - i18n + - android +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Internationalization diff --git a/articles/libraries/lock-android/v1/native-social-authentication.md b/articles/libraries/lock-android/v1/native-social-authentication.md index fc38397fbc..295964224c 100644 --- a/articles/libraries/lock-android/v1/native-social-authentication.md +++ b/articles/libraries/lock-android/v1/native-social-authentication.md @@ -1,6 +1,18 @@ --- title: Lock Android v1 Native Social Authentication description: How to implement native social authentication with Lock Android +public: false +topics: + - libraries + - lock + - native + - social-connections + - android +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Native Social Authentication diff --git a/articles/libraries/lock-android/v1/passwordless-magic-link.md b/articles/libraries/lock-android/v1/passwordless-magic-link.md index 78b80274d7..a318f4fb5f 100644 --- a/articles/libraries/lock-android/v1/passwordless-magic-link.md +++ b/articles/libraries/lock-android/v1/passwordless-magic-link.md @@ -1,18 +1,31 @@ --- title: Lock Android v1 Passwordless with Magic Link description: Passwordless with Magic Link with Lock Android +public: false +topics: + - libraries + - lock + - android + - passwordless + - magic-link +contentType: + - how-to + - concept +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Passwordless Magic link <%= include('../_includes/_lock-version') %> ::: warning -Passwordless on native platforms is disabled by default for new tenants as of 8 June 2017. If you would like this feature enabled, please contact support to discuss your use case. See [Application Grant Types](/applications/application-grant-types) for more information. Alternatively, you can use Lock Passwordless with Auth0's [universal login](/hosted-pages/login). +Passwordless on native platforms is disabled by default for new tenants as of 8 June 2017. If you would like this feature enabled, please contact support to discuss your use case. See [Application Grant Types](/applications/concepts/application-grant-types) for more information. Alternatively, you can use Lock Passwordless with Auth0's Universal Login. ::: ## Passwordless Authentication with Magic Link -In order to avoid asking the user to input the one-time password sent for passwordless authentication in Android apps, we introduced the ability to send a link that the user can tap to login without any code input involved. +In order to avoid asking the user to input the one-time password sent for passwordless authentication in Android apps, we introduced the ability to send a link that the user can tap to login without any code input involved. These links include the same code that would be used in the traditional passwordless flow, but with the correct configuration they will be handled automatically by the Android system and our application will log in the users effortlessly by relying on **Android App Links**. @@ -25,7 +38,7 @@ This feature works as long as the user has not already chosen a default app to h You could find more information about App Links in the [Android docs](http://developer.android.com/training/app-links/index.html). ::: note -The links will work in all versions of Android, but the dialog asking the user whether to use the browser or the app to open the link will be displayed (whether the verification passed or not) in versions of Andrdoi prior to 6.0, at least until the user chooses to always open the links with the app. +The links will work in all versions of Android, but the dialog asking the user whether to use the browser or the app to open the link will be displayed (whether the verification passed or not) in versions of Android prior to 6.0, at least until the user chooses to always open the links with the app. ::: In this article we'll show how Auth0 helps you set up your app to use app links to log in. @@ -39,7 +52,7 @@ Auth0 will generate the [Digital Asset Links](https://developers.google.com/digi We'll have to configure/add some field to our Auth0 application. The fields we need to configure are: - **app\_package\_name**: This is the package name, as declared in the app's manifest. An example would be *com.example.android.myapp* -- **sha256\_cert\_fingerprints**: This is an array of the SHA256 fingerprints of our android app’s signing certificates. This is an arbitrary lenght array, it can include all the fingerprints we want, so for example we could add both our release and debug fingerprints. +- **sha256\_cert\_fingerprints**: This is an array of the SHA256 fingerprints of our android app’s signing certificates. This is an arbitrary length array, it can include all the fingerprints we want, so for example we could add both our release and debug fingerprints. #### Getting your signing certificates fingerprint @@ -155,9 +168,9 @@ Also notice that in case we'll only use one passwordless method (SMS or Email) y ### Usage -As you should already know, `LockPasswordlessActivity` authenticates users by sending them an Email or SMS, in this case we'll send them a link instead of a code. The only difference w.r.t. the regular passwordless is that we now explicitly indicate that we will use magic/app links. This is accomplished using the appropiate mode. +As you should already know, `LockPasswordlessActivity` authenticates users by sending them an Email or SMS, in this case we'll send them a link instead of a code. The only difference w.r.t. the regular passwordless is that we now explicitly indicate that we will use magic/app links. This is accomplished using the appropriate mode. -If we would like to send app links by **Email**, just start `LockPasswordlessActivity` especifying the passwordless mode `MODE_EMAIL_MAGIC_LINK`: +If we would like to send app links by **Email**, just start `LockPasswordlessActivity` specifying the passwordless mode `MODE_EMAIL_MAGIC_LINK`: ```java LockPasswordlessActivity.showFrom(MyActivity.this, diff --git a/articles/libraries/lock-android/v1/passwordless.md b/articles/libraries/lock-android/v1/passwordless.md index 9625d3f3bc..473c2ee94a 100644 --- a/articles/libraries/lock-android/v1/passwordless.md +++ b/articles/libraries/lock-android/v1/passwordless.md @@ -2,12 +2,25 @@ section: libraries title: Lock Android v1 Passwordless description: Guide on implementing Passwordless authentication with Lock for Android +public: false +topics: + - libraries + - lock + - android + - passwordless + - tokens +contentType: + - how-to + - concept +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Passwordless <%= include('../_includes/_lock-version') %> -Lock Passwordless authenticates users by sending them an Email or SMS with a one-time password that the user must enter and confirm to be able to log in, similar to how WhatsApp authenticates you. This article will explain how to send a **CODE** using the `Lock.Android` library. +Lock Passwordless authenticates users by sending them an Email or SMS with a one-time password that the user must enter and confirm to be able to log in, similar to how WhatsApp authenticates you. This article will explain how to send a **CODE** using the `Lock.Android` library. ::: note You can achieve a similar result by sending a **LINK** that the user can click to finish the passwordless authentication automatically, but a few more configuration steps are involved. You can check that article [here](/libraries/lock-android/v1/passwordless-magic-link). diff --git a/articles/libraries/lock-android/v1/refresh-jwt-tokens.md b/articles/libraries/lock-android/v1/refresh-jwt-tokens.md index b1e2f06655..6460b9756c 100644 --- a/articles/libraries/lock-android/v1/refresh-jwt-tokens.md +++ b/articles/libraries/lock-android/v1/refresh-jwt-tokens.md @@ -1,18 +1,33 @@ --- title: Lock Android v1 Refreshing JWT Tokens description: Keeping your user logged in +public: false +topics: + - libraries + - lock + - android + - passwordless + - tokens +contentType: + - how-to + - concept +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Refreshing JWT Tokens <%= include('../_includes/_lock-version') %> -When an authentication is performed with the `offline_access` scope included, it will return a [Refresh Token](/refresh-token) that can be used to request a new JWT token and avoid asking the user their credentials again. +<%= include('../../../_includes/_uses-delegation') %> + +When an authentication is performed with the `offline_access` scope included, it will return a Refresh Token that can be used to request a new JWT token and avoid asking the user for their credentials again. ::: note Lock.Android will include the `offline_scope` scope by default. ::: -Before we start, we have to retreive `id_token` or `refresh_token` from the token when a the user logs in. +Before we start, we have to retrieve the ID Token or Refresh Token from the token when the user logs in. ```java private BroadcastReceiver authenticationReceiver = new BroadcastReceiver() { @@ -21,17 +36,17 @@ private BroadcastReceiver authenticationReceiver = new BroadcastReceiver() { Token token = intent.getParcelableExtra(Lock.AUTHENTICATION_ACTION_TOKEN_PARAMETER); String idToken = token.getIdToken(); String refreshToken = token.getRefreshToken(); - // Store id_token or refresh_token in a secure storage + // Store ID Token or Refresh Token in secure storage } }; ``` -Then, we need to store `id_token` or `refresh_token` in a secure storage after the user is authenticated by Auth0. And finally, you can request a new `id_token` using either of them by calling to Auth0`s **delegation** endpoint. +Then, we need to store the ID Token or Refresh Token in secure storage after the user is authenticated by Auth0. And finally, we can request a new ID Token using either of them by calling Auth0`s **delegation** endpoint. -## Using a non-expired id_token +## Using a non-expired ID Token ```java -String idToken = // Retrieve id_token from the secure storage +String idToken = // Retrieve ID Token from secure storage Lock lock = LockContext.getLock(this); AuthenticationAPIClient client = lock.getAuthenticationAPIClient(); client.delegationWithIdToken(idToken).start(new RefreshIdTokenCallback() { @@ -47,10 +62,10 @@ client.delegationWithIdToken(idToken).start(new RefreshIdTokenCallback() { }); ``` -## Using refresh_token +## Using Refresh Token ```java -String refreshToken = // Retrieve refresh_token from the secure storage +String refreshToken = // Retrieve Refresh Token from secure storage Lock lock = LockContext.getLock(this); AuthenticationAPIClient client = lock.getAuthenticationAPIClient(); client.delegationWithRefreshToken(refreshToken).start(new RefreshIdTokenCallback() { @@ -64,4 +79,4 @@ client.delegationWithRefreshToken(refreshToken).start(new RefreshIdTokenCallback //FAILURE } }); -``` \ No newline at end of file +``` diff --git a/articles/libraries/lock-android/v1/sending-authentication-parameters.md b/articles/libraries/lock-android/v1/sending-authentication-parameters.md index fece19d8fb..9ebaa1ad4e 100644 --- a/articles/libraries/lock-android/v1/sending-authentication-parameters.md +++ b/articles/libraries/lock-android/v1/sending-authentication-parameters.md @@ -1,12 +1,23 @@ --- title: Lock Android v1 Sending Authentication Parameters description: Sending Authentication parameters with Lock Android +public: false +topics: + - libraries + - lock + - android +contentType: + - how-to + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Sending Authentication Parameters <%= include('../_includes/_lock-version') %> -You can specify additional authentication parameters, before starting `LockActivity` or when calling any API method using `APIClient`, by using `ParameterBuilder` object to build the parameter dictionary. By default `ParameterBuilder` has the parameter `scope` with `openid offline_access` and `device` with the name obtained from +You can specify additional authentication parameters, before starting `LockActivity` or when calling any API method using `APIClient`, by using `ParameterBuilder` object to build the parameter dictionary. By default `ParameterBuilder` has the parameter `scope` with `openid offline_access` and `device` with the name obtained from ```java android.os.Build.MODEL @@ -26,11 +37,11 @@ The following parameters are supported: * `protocol` * `device` * `connection_scopes` -* `nonce` +* `nonce` * `offline_mode` * `state`. -There are other extra parameters that will depend on the provider. For example, Google allows you to get back a `refresh_token` only if you explicitly ask for `access_type=offline`. +There are other extra parameters that will depend on the provider. For example, Google allows you to get back a Refresh Token only if you explicitly ask for `access_type=offline`. We support sending arbitrary parameters like this: @@ -48,11 +59,11 @@ Map parameters = builder There are different values supported for scope: -* `'openid'`: It will return, not only the `access_token`, but also an `id_token` which is a Json Web Token (JWT). The JWT will only contain the user id (sub claim). You can use constant `ParameterBuilder.SCOPE_OPENID`. +* `'openid'`: It will return, not only the Access Token, but also an ID Token which is a JSON Web Token (JWT). The JWT will only contain the user id (sub claim). You can use constant `ParameterBuilder.SCOPE_OPENID`. * `'openid profile'`: (not recommended): will return all the user attributes in the token. This can cause problems when sending or receiving tokens in URLs (such as when using response_type=token) and will likely create an unnecessarily large token (especially with Azure AD which returns a fairly long JWT). Keep in mind that JWTs are sent on every API request, so it is desirable to keep them as small as possible. -* `'openid {attr1} {attr2} {attrN}'`: If you want only specific user's attributes to be part of the `id_token` (For example: `scope: 'openid name email picture'`). +* `'openid {attr1} {attr2} {attrN}'`: If you want only specific user's attributes to be part of the ID Token (for example: `scope: 'openid name email picture'`). -Also when need to keep the `id_token` alive, you can request a refresh_token adding to the scope the value `offline_access` (Or use the constant `ParameterBuilder.SCOPE_OFFLINE_ACCESS`). +Also when you need to keep the ID Token alive, you can request a Refresh Token adding to the scope the value `offline_access` (Or use the constant `ParameterBuilder.SCOPE_OFFLINE_ACCESS`). By default in Lock for Android, the scope is set to `openid offline_access`. diff --git a/articles/libraries/lock-android/v1/use-your-own-ui.md b/articles/libraries/lock-android/v1/use-your-own-ui.md index 2e54486c2c..5ab6f8899c 100644 --- a/articles/libraries/lock-android/v1/use-your-own-ui.md +++ b/articles/libraries/lock-android/v1/use-your-own-ui.md @@ -1,13 +1,26 @@ --- title: Lock Android v1 Customize Your UI description: Customize the UI of Lock in your App +public: false +topics: + - libraries + - lock + - android + - lock-ui +contentType: + - how-to + - concept + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Customize Your UI <%= include('../_includes/_lock-version') %> :::note -We are going to use the library [EventBus](https://github.com/greenrobot/EventBus) in order to post authentication related events like **authentication done** and **uthentication failed** +We are going to use the library [EventBus](https://github.com/greenrobot/EventBus) in order to post authentication related events like **authentication done** and **Authentication failed** ::: Add the following dependencies to your project: diff --git a/articles/libraries/lock-android/v2/configuration.md b/articles/libraries/lock-android/v2/configuration.md index cc3efd8043..0a6bc8c3f2 100644 --- a/articles/libraries/lock-android/v2/configuration.md +++ b/articles/libraries/lock-android/v2/configuration.md @@ -2,10 +2,20 @@ section: libraries title: Lock for Android v2 Configuration description: Altering the appearance and behavior of Lock for Android +topics: + - libraries + - lock + - android +contentType: + - how-to + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Configuration -These are options that can be used to configure Lock for Android to your project's needs. **Note that if you are a user of Lock v1 who is now migrating to Lock v2**, you'll want to take note first of those [options that have been renamed or whose behavior have changed](/libraries/lock-android/migration-guide), and then look over the new list below, which contains quite a few options new to v2. +These are options that can be used to configure Lock for Android to your project's needs. **Note that if you are a user of Lock v1 who is now migrating to Lock v2**, you'll want to take note first of those [options that have been renamed or whose behavior have changed](/libraries/lock-android/migration-guide), and then look over the new list below, which contains quite a few options new to v2. Configurations options are added to the Lock Builder using the following format: @@ -27,7 +37,7 @@ Configurations options are added to the Lock Builder using the following format: ## Authentication options -- **withAuthenticationParameters(Map)**: Defines extra authentication parameters to be sent on each log in and sign up call. The default `scope` used on authentication calls is `openid`. If you want to specify a different one, use `withAuthenticationParameters` and add a different value for the `scope` key. +- **withAuthenticationParameters(Map)**: Defines extra authentication parameters to be sent on each log in and sign up call. The default `scope` used on authentication calls is `openid`. If you want to specify a different one, use `withAuthenticationParameters` and add a different value for the `scope` key. - **withScope(String)**: Changes the scope requested when performing an authentication request. ## Database options @@ -40,7 +50,7 @@ Configurations options are added to the Lock Builder using the following format: - **allowForgotPassword(boolean)**: Shows the Forgot Password form if a Database connection is configured and it's allowed from the Dashboard. Defaults to `true`. - **allowShowPassword(boolean)**: Shows a button to toggle the input visibility of a Password field. Defaults to `true`. - **setDefaultDatabaseConnection(String)**: Defines which will be the default Database connection. This is useful if your application has many Database connections configured. -- **withSignUpFields(List)**: Shows a second screen with extra fields for the user to complete after the username/email and password were completed in the sign up screen. Values submitted this way will be attached to the user profile in `user_metadata`. See [this file](/libraries/lock-android/custom-fields) for more information. +- **withSignUpFields(List)**: Shows a second screen with extra fields for the user to complete after the username/email and password were completed in the sign up screen. Values submitted this way can be stored in the user profile using either a root attribute or the `user_metadata` attribute. For more info, see [Lock Android: Custom Fields at Signup](/libraries/lock-android/custom-fields). - **setPrivacyURL(String)**: Allows to customize the Privacy Policy URL. Defaults to `https://auth0.com/privacy`. - **setTermsURL(String)**: Allows to customize the Terms of Service URL. Defaults to `https://auth0.com/terms`. - **setSupportURL(String)**: Allows to set a Support URL that will be displayed in case that a non-recoverable error raises on Lock. @@ -52,12 +62,11 @@ Configurations options are added to the Lock Builder using the following format: - **withAuthStyle(String, int)**: Customize the look and feel of a given connection (name) with a specific style. See [this document on custom oauth connections](/libraries/lock-android/v2/custom-theming#custom-oauth-connection-buttons) for more information. - **withAuthHandlers(AuthHandler...)**: Customize the authentication process by passing an array of AuthHandlers. See [this document on custom authentication parameters](/libraries/lock-android/custom-authentication-providers) for more information. -- **withAuthButtonSize(int)**: Allows to customize the Style of the Auth buttons. Possible values are `SMALL` and `BIG`. If this is not specified, it will default to `SMALL` when using **ClassicLock** with at least 2 Enterprise or Database connections, or when using **PasswordlessLock** with a Passwordless connection and less than 3 Social connections. On the rest of the cases, it will use `BIG`. - **withConnectionScope(String, String...)**: Allows to specify additional scopes for a given Connection name, which will be request along with the ones defined in the connection settings in the [Auth0 Dashboard](${manage_url}). The scopes are not validated in any way and need to be recognized by the given authentication provider. For a list, check in the [Auth0 Dashboard](${manage_url}) under the settings for the connection in question. -- **withScheme(String)**: Allows to change the scheme of the `redirect_uri` sent on the authorize call. By default, the scheme is `https`. When changing this setting, the intent-filter on the `AndroidManifest.xml` file and the Allowed Callbacks URLs on the application dashboard must be updated too. +- **withScheme(String)**: Allows to change the scheme of the `redirect_uri` sent on the authorize call. By default, the scheme is `https`. When changing this setting, the intent-filter on the `AndroidManifest.xml` file and the Allowed Callbacks URLs on the application dashboard must be updated too. ## Passwordless options -- **useCode()**: Send a code instead of a link via email/SMS for Passwordless authentication. +- **useCode()**: Send a code instead of a link via email/SMS for Passwordless authentication. - **useLink()**: Send a link instead of a code via email/SMS for Passwordless authentication. - **rememberLastLogin(boolean)**: Whether the email or phone used in the last successful authentication will be saved to auto-login the next time a Passwordless authentication is requested. diff --git a/articles/libraries/lock-android/v2/custom-authentication-providers.md b/articles/libraries/lock-android/v2/custom-authentication-providers.md index a605d6e322..44e93d8d40 100644 --- a/articles/libraries/lock-android/v2/custom-authentication-providers.md +++ b/articles/libraries/lock-android/v2/custom-authentication-providers.md @@ -2,6 +2,16 @@ section: libraries title: Lock Android v2 Custom Authentication Providers description: Implementing custom authentication providers +topics: + - libraries + - lock + - android +contentType: + - how-to + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Custom Authentication Providers diff --git a/articles/libraries/lock-android/v2/custom-fields.md b/articles/libraries/lock-android/v2/custom-fields.md index 1a9742ec82..f68d7cf54b 100644 --- a/articles/libraries/lock-android/v2/custom-fields.md +++ b/articles/libraries/lock-android/v2/custom-fields.md @@ -2,6 +2,16 @@ section: libraries title: Lock Android v2 Custom Fields at Signup description: Adding additional fields to signups with Lock for Android +topics: + - libraries + - lock + - android +contentType: + - how-to + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Custom Fields at Signup @@ -16,6 +26,8 @@ Create a new `CustomField` object passing all these 4 mandatory parameters. 1. Key: The `String` that identifies this value in the result JSON. It shouldn't be repeated! Repeated field keys will result in the second field getting removed from the list. 1. Hint: The `@StringRes` of the text to show as hint in the field. +In addition, you can specify where the field is going to be stored on the user's profile. See the [Storage](#storage) section below for details. + ```java List customFields = new ArrayList<>(); @@ -36,7 +48,7 @@ Lock lock = Lock.newBuilder(auth0, callback) .build(this); ``` -Thats it! If you have enabled users Sign Up in the Application's Dashboard, after they complete the basic fields (email/username, password) and hit Submit, they will be prompted to fill the remaining fields. +That's it! If you have enabled users Sign Up in the Application's Dashboard, after they complete the basic fields (email/username, password) and hit Submit, they will be prompted to fill the remaining fields. ::: note The user must fill all of the custom fields before being able to complete signup. @@ -52,3 +64,21 @@ Each custom field can only have one `FieldType` associated. * TYPE_NUMBER * TYPE_PHONE_NUMBER * TYPE_EMAIL + +## Storage + +Each custom field can only have one `Storage` associated. You can choose to store it right at the root level in a root attribute or inside the `user_metadata` attribute. To specify the storage location, use the five-parameter constructor and pass the `Storage` parameter of your choice (see below). By default, fields will be stored inside the `user_metadata` attribute. + +Available choices: + +* PROFILE_ROOT +* USER_METADATA (default) + +```java +CustomField fieldName = new CustomField(R.drawable.ic_field_person, FieldType.TYPE_TEXT_NAME, "firstName", R.string.hint_first_name, Storage.PROFILE_ROOT); +``` + +::: note +For the fields to be saved at the root level of the user's profile, their keys must match the ones listed in the [endpoint documentation](/api/authentication#signup). +::: + diff --git a/articles/libraries/lock-android/v2/custom-theming.md b/articles/libraries/lock-android/v2/custom-theming.md index 48a3faff4c..9ed6a02d3f 100644 --- a/articles/libraries/lock-android/v2/custom-theming.md +++ b/articles/libraries/lock-android/v2/custom-theming.md @@ -2,6 +2,16 @@ section: libraries title: Lock Android v2 Custom Theming description: Customizing the Lock for Android UI +topics: + - libraries + - lock + - android +contentType: + - how-to + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Custom Theming diff --git a/articles/libraries/lock-android/v2/delegation-api.md b/articles/libraries/lock-android/v2/delegation-api.md index c120fb3533..98291b7eb8 100644 --- a/articles/libraries/lock-android/v2/delegation-api.md +++ b/articles/libraries/lock-android/v2/delegation-api.md @@ -2,9 +2,21 @@ section: libraries title: Lock for Android v2 Delegation API description: Integrate with third-party apps with the delegation API. +topics: + - libraries + - lock + - android +contentType: + - how-to + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Delegation API +<%= include('../../../_includes/_deprecate-delegation') %> + After a successful authentication, you can request credentials to access third party apps like Firebase or AWS that are configured in your Auth0 App's Add-On section. In order to do that you need to make a request to our [Delegation API](/api/authentication/reference#delegation) using a valid JWT. Here's an example @@ -14,7 +26,7 @@ Auth0 auth0 = new Auth0("${account.clientId}", "${account.namespace}"); auth0.setOIDCConformant(true); AuthenticationAPIClient client = new AuthenticationAPIClient(auth0); String apiType = "firebase"; -String token = //Your Auth0 id_token of the logged in User +String token = //Your Auth0 ID Token of the logged in User client.delegationWithIdToken(token, apiType) .start(new BaseCallback, AuthenticationException>() { @Override diff --git a/articles/libraries/lock-android/v2/index.md b/articles/libraries/lock-android/v2/index.md index 6ed265766e..1eb9d180a9 100644 --- a/articles/libraries/lock-android/v2/index.md +++ b/articles/libraries/lock-android/v2/index.md @@ -4,14 +4,25 @@ toc: true title: Lock for Android v2 description: A widget that provides a frictionless login and signup experience for your native Android apps. mobileimg: media/articles/libraries/lock-android.png +topics: + - libraries + - lock + - android +contentType: + - index + - how-to + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Getting Started ::: warning -Username/Email & Password authentication from native applications is disabled by default for new tenants as of 8 June 2017. Users are encouraged to use [universal login](/hosted-pages/login) and perform Web Authentication instead. If you still want to proceed you'll need to enable the Password Grant Type on your dashboard first. See [Application Grant Types](/applications/application-grant-types) for more information. +Auth0 encourages the use of [web authentication via Universal Login](/guides/login/universal-vs-embedded) rather than native username/password authentication whenever possible. ::: -Lock for Android can integrate into your native Android apps to provide a beautiful way to log your users in and to sign them up in your app. It provides support for social identity providers such as Facebook, Google, or Twitter, as well as enterprise providers such as Active Directory. +Lock for Android can integrate into your native Android apps to provide a beautiful way to log your users in and to sign them up in your app. It provides support for social identity providers such as Facebook, Google, or Twitter, as well as enterprise providers such as Active Directory. Get started using Lock for Android below, or if you're looking for a specific document beyond basic setup of Lock, try the listing of [next steps](#next-steps) for working with Lock for Android. @@ -43,7 +54,7 @@ You need to fill in a few settings in your [Auth0 Dashboard](${manage_url}) befo ### Callback URL -Head over to your Auth0 Dashboard and go to the application's settings. Add the following URL to the application's "Allowed Callback URLs" +Head over to your Auth0 Dashboard and go to the application's settings. Add the following URL to the application's "Allowed Callback URLs" ```text https://${account.namespace}/android/{YOUR_APP_PACKAGE_NAME}/callback @@ -63,7 +74,7 @@ For a release keystore, replace the file, alias, store password and key password ## Implementing Lock (Social, Database, Enterprise) -The following instructions discuss implementing Lock for Android. If you specifically are looking to implement Passwordless Lock for Android, read the [Passwordless Authentication with Lock for Android](/libraries/lock-android/v2/passwordless) page. +The following instructions discuss implementing Lock for Android. If you specifically are looking to implement Passwordless Lock for Android, read the [Passwordless Authentication with Lock for Android](/libraries/lock-android/v2/passwordless) page. ### Configuring the SDK @@ -104,7 +115,7 @@ Add the `LockActivity`. android:label="@string/app_name" android:launchMode="singleTask" android:screenOrientation="portrait" - android:theme="@style/MyLock.Theme"/> + android:theme="@style/Lock.Theme"/> ``` ::: note @@ -119,7 +130,7 @@ In case you are using an older version of Lock the **intent-filter** must be add android:label="@string/app_name" android:launchMode="singleTask" android:screenOrientation="portrait" - android:theme="@style/MyLock.Theme"> + android:theme="@style/Lock.Theme"> @@ -182,14 +193,14 @@ private LockCallback callback = new AuthenticationCallback() { ``` ::: note -The results of the AuthenticationCallback are in a `credentials` object. This object contains the tokens that you will require for authentication related operations in your app; see the [Tokens documentation](/tokens) for more specifics. +The results of the AuthenticationCallback are in a `credentials` object. This object contains the tokens that you will require for authentication related operations in your app; see [Tokens](/tokens) for more specifics. ::: ### Lock.Builder To create a new `Lock` instance and configure it, use the `Lock.Builder` class. Call the static method `Lock.newBuilder(Auth0, LockCallback)`, passing the account details and the callback implementation, and start configuring the Options as you need. After you're done, build the Lock instance and use it to start the `LockActivity`. -To ensure an Open ID Connect compliant responses you must either request an `audience` or enable the **OIDC Conformant** switch in your Auth0 dashboard under `Application / Settings / Advanced OAuth`. You can read more about this [here](/api-auth/intro#how-to-use-the-new-flows). +To ensure a response that complies with OpenID Connect (OIDC), you must either request an `audience` or enable the **OIDC Conformant** switch in your Auth0 dashboard under `Application / Settings / Advanced OAuth`. You can read more about this [here](/api-auth/intro#how-to-use-the-new-flows). This is an example of what your `Activity` should look: @@ -269,7 +280,7 @@ As this library depends on `Auth0.Android`, you should keep the files up to date ## Lock configuration -For a full list of Lock's configuration options, check out the [Lock for Android Configuration Reference](/libraries/lock-android/v2/configuration). Also, for users of v1 migrating to v2, read the [Migration Guide](/libraries/lock-android/v2/migration-guide) to see what options have changed. +For a full list of Lock's configuration options, check out the [Lock for Android Configuration Reference](/libraries/lock-android/v2/configuration). ## Error messages diff --git a/articles/libraries/lock-android/v2/internationalization.md b/articles/libraries/lock-android/v2/internationalization.md index 4190556ad2..f2dc13d979 100644 --- a/articles/libraries/lock-android/v2/internationalization.md +++ b/articles/libraries/lock-android/v2/internationalization.md @@ -2,6 +2,16 @@ section: libraries title: Lock Android v2 Internationalization description: Internationalization support in Lock for Android +topics: + - libraries + - lock + - android + - i18n +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Internationalization diff --git a/articles/libraries/lock-android/v2/keystore.md b/articles/libraries/lock-android/v2/keystore.md index fcf3a7ff90..7b31c26d29 100644 --- a/articles/libraries/lock-android/v2/keystore.md +++ b/articles/libraries/lock-android/v2/keystore.md @@ -2,6 +2,16 @@ section: libraries title: Android Development Keystores and Key Hashes description: Instructions on acquiring development keystores/key hashes during Android app development. +topics: + - libraries + - lock + - android +contentType: + - how-to + - concept +useCase: + - add-login + - enable-mobile-auth --- # Android Development Keystores and Key Hashes @@ -47,8 +57,8 @@ Certificate fingerprints: ## Using your key hashes -Once you have your key hashes output, copy the resulting SHA256 value and go to your application's settings in the [Auth0 Dashboard](${manage_url}/#/applications). Click "Show Advanced Settings", and in the "Mobile Settings" tab, under "Android", fill the "App Package Name" with your application's package name, and the "Key Hashes" field with the SHA256 value you copied. Don't forget to save the changes. +Once you have your key hashes output, copy the resulting SHA256 value and go to your application's settings in the [Auth0 Dashboard](${manage_url}/#/applications). Click "Show Advanced Settings", and in the "Device Settings" tab, under "Android", fill the "App Package Name" with your application's package name, and the "Key Hashes" field with the SHA256 value you copied. Don't forget to save the changes. ::: warning -If you don't add the Callback URL to the application settings nor the Key Hashes to the application's mobile settings, the Auth0 server won't return the call result to your application. +If you don't add the Callback URL to the application settings nor the Key Hashes to the application's device settings, the Auth0 server won't return the call result to your application. ::: diff --git a/articles/libraries/lock-android/v2/migration-guide.md b/articles/libraries/lock-android/v2/migration-guide.md index 59baa4170e..7fcc499bb9 100644 --- a/articles/libraries/lock-android/v2/migration-guide.md +++ b/articles/libraries/lock-android/v2/migration-guide.md @@ -2,19 +2,32 @@ section: libraries title: Lock Android v2 Migration Guide description: A reference for changed option names and behaviors in Lock for Android v2 +public: false +topics: + - libraries + - lock + - android + - migrations +contentType: + - how-to + - reference +useCase: + - add-login + - enable-mobile-auth + - migrate --- # Lock Android: Migration Guide ## Application Class and Initializing Lock -In v1 of Lock for Android, you were asked to create a custom `Application` class and initialize the `Lock.Context` there. **Now this is no longer needed**. In v2, to create a new `Lock` instance and configure it, you will just use the `Lock.Builder` class. The configurable options in v2 have been expanded, allowing more configuration while making the implementation and customization process easier than in v1. +In v1 of Lock for Android, you were asked to create a custom `Application` class and initialize the `Lock.Context` there. **Now this is no longer needed**. In v2, to create a new `Lock` instance and configure it, you will just use the `Lock.Builder` class. The configurable options in v2 have been expanded, allowing more configuration while making the implementation and customization process easier than in v1. ## Obtaining the User's Profile -In v1, when an authentication was successful, you could obtain the UserProfile from the received Intent. As of v2, the only received value is a `Credentials` object. You can get the `access_token` and request the information associated to that user, by making a request to Auth0. +In v1, when an authentication was successful, you could obtain the UserProfile from the received Intent. As of v2, the only received value is a `Credentials` object. You can get the Access Token and request the information associated to that user, by making a request to Auth0. 1. Create a new `AuthenticationAPIClient` instance by passing an instance of the `Auth0` object. It can be the same instance used to launch Lock in the first place. -1. Call the `userInfo` method on the API application passing the previously obtained `access_token`. +1. Call the `userInfo` method on the API application passing the previously obtained Access Token. 1. A `UserProfile` instance is returned ```java @@ -49,6 +62,6 @@ As in the previous version, Lock for Android v2 can be configured with extra opt * `disableResetAction`: Renamed to `allowForgotPassword`. Shows a link to the Forgot Password form if a Database connection is configured and it's allowed from the Dashboard. Defaults to `true`. * `defaultUserPasswordConnection`: Renamed to `setDefaultDatabaseConnection`. Defines which will be the default Database connection. This is useful if your application has many Database connections configured. * `setConnections`: Renamed to `allowedConnections`. Filters the allowed connections from the list configured in the Dashboard. If this value is empty, all the connections defined in the dashboard will be available. This is also the default behavior. -* `setAuthenticationParameters`: Renamed to `withAuthenticationParameters`. Defines extra authentication parameters to be sent on sign up and log in/sign in. The default `scope` used on authentication calls is `openid`. This is changed from v1, which also included the `offline_access` scope. +* `setAuthenticationParameters`: Renamed to `withAuthenticationParameters`. Defines extra authentication parameters to be sent on sign up and log in/sign in. The default `scope` used on authentication calls is `openid`. This is changed from v1, which also included the `offline_access` scope. Lock for Android v2 also features a bunch of new options. Check the [configuration options page](/libraries/lock-android/configuration) for a complete list of them. diff --git a/articles/libraries/lock-android/v2/native-social-authentication.md b/articles/libraries/lock-android/v2/native-social-authentication.md index fc9e52eab1..94576b4705 100644 --- a/articles/libraries/lock-android/v2/native-social-authentication.md +++ b/articles/libraries/lock-android/v2/native-social-authentication.md @@ -2,6 +2,17 @@ section: libraries title: Lock Android v2 Native Social Authentication description: Lock for Android - Native Social Authentication +topics: + - libraries + - lock + - android + - native + - social-connections +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Native Social Authentication @@ -12,7 +23,7 @@ We recommend using browser-based flows, as explained in [Authentication via Auth ## Native Provider - Google -You can use Google AuthProvider to log in with or without **Lock**. Make sure to follow the instructions in the [setup](#setup) section. +You can use Google AuthProvider to log in with or without **Lock**. Make sure to follow the instructions in the [setup](#setup) section. [Lock-Google.Android](https://github.com/auth0/Lock-Google.Android) requires Android API 15 or later & Google Play Services 10.+ @@ -36,7 +47,7 @@ You can check for the latest version on the repository [Readme](https://github.c 1. Go to the [Google Developers Console](https://console.developers.google.com/) and create a new Project. 2. Complete the [OAuth Consent Screen](https://console.developers.google.com/apis/credentials/consent) by at least providing a valid Email Address and Name. 3. On the left side you have the navigation drawer, click [Credentials](https://console.developers.google.com/apis/credentials). -4. Create a new credential by clicking the [Create Credentials](https://console.developers.google.com/apis/credentials/oauthclient) button and choosing **OAuth client ID**. Next, choose **Web Application** and give it a name like "Auth0 Server Google-OAuth". Complete the **Authorized redirect URIs** by filling the field with your callback URL, which should look like `https://${account.namespace}/login/callback`. Make sure to press ENTER before leaving the field and then click the Create button. Take note of the `CLIENT ID` and `CLIENT SECRET` values as we're going to use them later. +4. Create a new credential by clicking the [Create Credentials](https://console.developers.google.com/apis/credentials/oauthclient) button and choosing **OAuth client ID**. Next, choose **Web Application** and give it a name like "Auth0 Server Google-OAuth". Complete the **Authorized redirect URIs** by filling the field with your callback URL, which should look like `https://${account.namespace}/login/callback`. Make sure to press ENTER before leaving the field and then click the Create button. Take note of the `CLIENT ID` and `CLIENT SECRET` values as we're going to use them later. 5. Create a new credential by clicking the [Create Credentials](https://console.developers.google.com/apis/credentials/oauthclient) button and choosing **OAuth client ID**. Next, choose **Android** and give it a name like "Auth0 Android Google-OAuth". Obtain the **SHA-1** of the certificate you're using to sign your application and complete the first field with it. If you need help obtaining the SHA-1 check [this](#certificate-fingerprints) section. Finally, complete the last field with your android application **Package Name** and then click the Create button. Take note of the `CLIENT ID` value as we're going to use it later. #### Auth0 Dashboard @@ -48,7 +59,7 @@ You can check for the latest version on the repository [Readme](https://github.c 5. Complete the "Allowed Mobile Client IDs" field with the `CLIENT ID` obtained in the step 5 of the **Google Developers Console** section above. 6. Click the Save button. 7. Go to the Auth0 Dashboard and click [Applications](${manage_url}/#/applications). If you haven't created yet one, do that first and get into your application configuration page. -8. At the bottom of the page, click the "Show Advanced Settings" link and go to the "Mobile Settings" tab. +8. At the bottom of the page, click the "Show Advanced Settings" link and go to the "Device Settings" tab. 9. In the Android section, complete the **Package Name** with your application's package name. Finally, complete the **Key Hashes** field with the SHA-256 of the certificate you're using to sign your application. If you need help obtaining the SHA-256 check [this](#certificate-fingerprints) section. Click the "Save Changes" button. #### Android application @@ -149,7 +160,7 @@ provider.setParameters(parameters); #### Requesting a custom Google scope -By default, the scope `Scopes.PLUS_LOGIN` is requested. You can customize the Scopes by calling `setScopes` with the list of Scopes. Each Google API (Auth, Drive, Plus..) specify it's own list of Google Scopes. +By default, the scope `Scopes.PLUS_LOGIN` is requested. You can customize the Scopes by calling `setScopes` with the list of Scopes. Each Google API (Auth, Drive, Plus..) specify its own list of Google Scopes. ```java provider.setScopes(Arrays.asList(new Scope(Scopes.PLUS_ME), new Scope(Scopes.PLUS_LOGIN))); @@ -225,7 +236,7 @@ _You can check for the latest version on the repository [Readme](https://github. 3. Add the **SHA-1** Base64 encoded Key Hashes of the certificates you're using to sign your application and click the Next button. If you need help obtaining the SHA-1 check [this](#certificate-fingerprints) section. 4. Finally, scroll to the top of the page and click the Skip Quickstart button to go to your Facebook app's page. 5. On the top of the page, you will find the `APP ID` and `APP SECRET` values. Save them as you're going to need them later. -6. On the left side you have the navigation drawer. Click Settings and then Basic. Turn ON the **Single Sign On** switch and click the Save button. +6. On the left side you have the navigation drawer. Click Settings and then Basic. Turn ON the **Single Sign-On** switch and click the Save button. 7. Click Settings and then Advanced. Turn ON the **Native or desktop app?** switch. #### Auth0 dashboard @@ -236,7 +247,7 @@ _You can check for the latest version on the repository [Readme](https://github. 4. Complete the "App Secret" field with the `APP SECRET` value obtained in the step 5 of the **Facebook Developers Console** section above. 5. Click the Save button. 6. Go to the Auth0 Dashboard and click [Applications](${manage_url}/#/applications). If you haven't created yet one, do that first and get into your application configuration page. -7. At the bottom of the page, click the "Show Advanced Settings" link and go to the "Mobile Settings" tab. +7. At the bottom of the page, click the "Show Advanced Settings" link and go to the "Device Settings" tab. 8. In the Android section, complete the **Package Name** with your application's package name. Finally, complete the **Key Hashes** field with the SHA-256 of the certificate you're using to sign your application. If you need help obtaining the SHA-256 check [this](#certificate-fingerprints) section. Click the "Save Changes" button. #### Android application diff --git a/articles/libraries/lock-android/v2/passwordless-magic-link.md b/articles/libraries/lock-android/v2/passwordless-magic-link.md index eeb50778a1..b2479a7542 100644 --- a/articles/libraries/lock-android/v2/passwordless-magic-link.md +++ b/articles/libraries/lock-android/v2/passwordless-magic-link.md @@ -2,12 +2,21 @@ section: libraries title: Lock Android v2 Passwordless with Magic Link description: Passwordless with Magic Link with Lock Android +topics: + - libraries + - lock + - android + - passwordless + - magic-link +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Passwordless with Magic Link -<%= include('../../../_includes/_native_passwordless_warning') %> - -In order to avoid asking the user to input the one-time password sent for passwordless authentication in Android apps, we introduced the ability to send a link that the user can tap to login without any manual input involved. +In order to avoid asking the user to input the one-time password sent for passwordless authentication in Android apps, we introduced the ability to send a link that the user can tap to login without any manual input involved. These links include the same code that would be used in the traditional passwordless flow, but with the correct configuration they will be handled automatically by the Android system and delivered to our application. @@ -18,47 +27,27 @@ Go to your [application settings](${manage_url}/#/applications/${account.clientI - **App Package Name**: This is the package name, as declared in the app's manifest. It's also available in the `app/build.gradle` file as the `applicationId` attribute. An example would be `com.example.android.myapp` - **Key Hashes**: This is an array of the SHA256 fingerprints of our android app’s signing certificates. This is an arbitrary length array, it can include all the fingerprints we want, so for example we could add both our release and debug fingerprints. An example would be `DE:1A:5B:75:27:AA:48:D5:A6:72:2F:76:43:95:9B:79:C6:86:1A:5B:75:27:AA:48:D5:A6:73:FE`. -After you set the values make sure to click the "Save Changes" button. Next we'll have to configure either the SMS or Email connection. - +After you set the values make sure to click the "Save Changes" button. Next we'll have to configure either the Email connection. ### Getting your Signing Certificates Fingerprint You can use the following command to generate the fingerprint via the Java keytool: ```bash -$ keytool -list -v -keystore my-release-key.keystore +keytool -list -v -keystore my-release-key.keystore ``` or to obtain the default debug key: ```bash -$ keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android +keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android ``` The value required by the dashboard is the one listed as **SHA256**. - -### Using SMS Connection - -In case we'll use a passwordless connection via SMS, we'll need to update the SMS message template from the [dashboard](${manage_url}/#/connections/passwordless). - -All you need to do is choose **Liquid** as the SMS Syntax and make sure the message contains the following: - -```liquid -{% if send == 'link_ios' or send == 'link_android' %} -Your verification link is: {{ link }} -{% else %} -Your verification code is: {{ code }} -{% endif %} -``` - -::: note -We assume that you have the SMS connection correctly configured, including the Twilio account. If you haven't, please do so. -::: - ### Using Email Connection -Otherwise, if we'll use a passwordless connection via Email, we'll need to make sure the template is **HTML + Liquid** and that the email body contains *somewhere* a conditional like this: +To use a passwordless connection via Email, we'll need to make sure the template is **HTML + Liquid** and that the email body contains *somewhere* a conditional like this: ```liquid {% if send == 'link' or send == 'link_ios' or send == 'link_android' %} @@ -92,17 +81,6 @@ In the `AndroidManifest.xml` file add the intent-filters inside the `Passwordles android:scheme="https" /> - - - - - - /sms" - android:scheme="https" /> - - ``` @@ -110,7 +88,7 @@ Make sure the Activity's `launchMode` is declared as `singleTask` or the result ## Usage -Lock Passwordless authenticates users by sending them an Email or SMS with a one-time password, which in this case will be a **LINK** instead of a CODE. We'll indicate this by calling the `useLink()` method. +Lock Passwordless authenticates users by sending them an Email with a one-time password, which in this case will be a **LINK** instead of a CODE. We'll indicate this by calling the `useLink()` method. ```java public class MyActivity extends AppCompatActivity { @@ -161,11 +139,7 @@ Finally, just start `PasswordlessLock` from inside your activity and perform the startActivity(lock.newIntent(this)); ``` -Depending on which passwordless connections are enabled, Lock will send the LINK in an Email or SMS. The 'email' connection is selected first if available. - - -After requesting the magic link from Auth0, via SMS or Email, the next screen will indicate that in order to log in, the user should tap it. We also offer a backup option to enter the code manually, just in case the links don't work. - +After requesting the magic link from Auth0, the next screen will indicate that in order to log in, the user should tap it. We also offer a backup option to enter the code manually, just in case the links don't work. ## Optional: Use Android App Links @@ -173,7 +147,7 @@ With App Links, in Android 6.0 (API level 23) and higher, Android allows an app Automatic handling of links requires the cooperation of our app and website (our Auth0 Authentication Server). The app must declare the association with the website and request that the system verify it. The website must, in turn, provide that verification by publishing a [Digital Asset Links](https://developers.google.com/digital-asset-links/) file. This feature works as long as the user has not already chosen a default app to handle that URI pattern in the Android settings. -Auth0 will generate the [Digital Asset Links](https://developers.google.com/digital-asset-links/) file automatically for you after you've configured the **App Package Name** and **Key Hash** as shown before. If you've followed all the steps on this article, the only change you need to do is add an attribute to the **Intent-Filter** declaration in order to ask the OS to verify the link at install time. Go to the `AndroidManifest.xml` file where you have declared the Intent-Filter and add the `android:autoVerify="true"` attribute indicating use of an SMS connection: +Auth0 will generate the [Digital Asset Links](https://developers.google.com/digital-asset-links/) file automatically for you after you've configured the **App Package Name** and **Key Hash** as shown before. If you've followed all the steps on this article, the only change you need to do is add an attribute to the **Intent-Filter** declaration in order to ask the OS to verify the link at install time. Go to the `AndroidManifest.xml` file where you have declared the Intent-Filter and add the `android:autoVerify="true"` attribute indicating use of an email connection: ```xml @@ -183,7 +157,7 @@ Auth0 will generate the [Digital Asset Links](https://developers.google.com/digi /sms" + android:pathPrefix="/android/<%= "${applicationId}" %>/email" android:scheme="https" /> ``` diff --git a/articles/libraries/lock-android/v2/passwordless.md b/articles/libraries/lock-android/v2/passwordless.md index 9dbd4c3211..c5bbd7d967 100644 --- a/articles/libraries/lock-android/v2/passwordless.md +++ b/articles/libraries/lock-android/v2/passwordless.md @@ -2,12 +2,20 @@ section: libraries title: Lock Android v2 Passwordless description: Guide on implementing Passwordless authentication with Lock for Android +topics: + - libraries + - lock + - android + - passwordless +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Passwordless -<%= include('../../../_includes/_native_passwordless_warning') %> - -Lock Passwordless authenticates users by sending them an Email or SMS with a one-time password that the user must enter and confirm to be able to log in, similar to how WhatsApp authenticates you. This article will explain how to send a **CODE** using the `Lock.Android` library. +Lock Passwordless authenticates users by sending them an Email or SMS with a one-time password that the user must enter and confirm to be able to log in, similar to how WhatsApp authenticates you. This article will explain how to send a **CODE** using the `Lock.Android` library. ::: note You can achieve a similar result by sending a **LINK** that the user can click to finish the passwordless authentication automatically, but a few more configuration steps are involved. You can check that article [here](/libraries/lock-android/v2/passwordless-magic-link). @@ -15,11 +23,11 @@ You can achieve a similar result by sending a **LINK** that the user can click t In order to be able to authenticate the user, your application must have the Email/SMS connection enabled and configured in your [Auth0 Dashboard](${manage_url}/#/connections/passwordless). -Note that Passwordless Lock *cannot be used* with the [OIDC Conformant Mode](/libraries/lock-android/index#oidc-conformant-mode) set to `true`. For more information, please see the [OIDC adoption guide](api-auth/tutorials/adoption). +To use Passwordless Authentication with Lock, you need to use Lock Android v2.17 or greater, and it needs to be configured with [OIDC Conformant Mode](/libraries/lock-android#oidc-conformant-mode) set to `true`. ## Implementing CODE Passwordless -In your `app/build.gradle` file add the [Manifest Placeholders](https://developer.android.com/studio/build/manifest-build-variables.html) for the Auth0 Domain and the Auth0 Scheme properties which are going to be used internally by the library to register an intent-filter that captures the callback URI. +In your `app/build.gradle` file add the [Manifest Placeholders](https://developer.android.com/studio/build/manifest-build-variables.html) for the Auth0 Domain and the Auth0 Scheme properties which are going to be used internally by the library to register an intent-filter that captures the callback URI. ```groovy apply plugin: 'com.android.application' @@ -125,6 +133,8 @@ public class MainActivity extends Activity { super.onCreate(savedInstanceState); // Your own Activity code Auth0 auth0 = new Auth0("${account.clientId}", "${account.namespace}"); + auth0.setOIDCConformant(true); + lock = PasswordlessLock.newBuilder(auth0, callback) .useCode() .build(this); diff --git a/articles/libraries/lock-android/v2/refresh-jwt-tokens.md b/articles/libraries/lock-android/v2/refresh-jwt-tokens.md index 5d7f66fdec..3f039ce2c3 100644 --- a/articles/libraries/lock-android/v2/refresh-jwt-tokens.md +++ b/articles/libraries/lock-android/v2/refresh-jwt-tokens.md @@ -2,17 +2,29 @@ section: libraries title: Lock Android v2 Refreshing JWTs description: Keeping your user logged in +topics: + - libraries + - lock + - android + - tokens +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock Android: Refreshing JWT Tokens -When an authentication is performed with the `offline_access` scope included, the returned Credentials will contain a [refresh_token](/refresh-token) and a `id_token`. Both tokens can be used to request a new `access_token` and avoid asking the user their credentials again. +<%= include('../../../_includes/_uses-delegation') %> + +When an authentication is performed with the `offline_access` scope included, the returned Credentials will contain a Refresh Token and an ID Token. Both tokens can be used to request a new Access Token and avoid asking the user their credentials again. We need to store the tokens in a secure storage after a successful authentication. Keep in mind that Refresh Tokens **never expire**. To request a new token you'll need to use `auth0.android`'s `AuthenticationAPIClient`. Don't forget to request the same scope used in the first login call. -## Using refresh_token +## Using Refresh Token ```java -String refreshToken = // Retrieve refresh_token from the secure storage +String refreshToken = // Retrieve Refresh Token from secure storage Auth0 account = new Auth0("${account.clientId}", "${account.namespace}"); auth0.setOIDCConformant(true); @@ -33,10 +45,10 @@ client.renewAuth(refreshToken) }); ``` -## Using a non-expired id_token +## Using a non-expired ID Token ```java -String idToken = // Retrieve id_token from the secure storage +String idToken = // Retrieve ID Token from the secure storage Auth0 account = new Auth0("${account.clientId}", "${account.namespace}"); auth0.setOIDCConformant(true); diff --git a/articles/libraries/lock-ios/_includes/_dependencies.md b/articles/libraries/lock-ios/_includes/_dependencies.md index d4e1eb5057..f0b8babdc6 100644 --- a/articles/libraries/lock-ios/_includes/_dependencies.md +++ b/articles/libraries/lock-ios/_includes/_dependencies.md @@ -1,12 +1,25 @@ ## Install +### Cocoapods + +If you are using [Cocoapods](https://cocoapods.org), add this line to your `Podfile`: + +```ruby +pod 'Lock', '~> 2.0' +``` + +Then run `pod install`. + +::: note +For more information on Cocoapods, check [their official documentation](https://guides.cocoapods.org/using/getting-started.html). +::: + ### Carthage -If you are using Carthage, add the following lines to your `Cartfile`: +If you are using [Carthage](https://github.com/Carthage/Carthage), add the following line to your `Cartfile`: ```ruby github "auth0/Lock.swift" ~> 2.0 -github "auth0/Auth0.swift" ~> 1.0 ``` Then run `carthage bootstrap`. @@ -15,18 +28,20 @@ Then run `carthage bootstrap`. For more information about Carthage usage, check [their official documentation](https://github.com/Carthage/Carthage#if-youre-building-for-ios-tvos-or-watchos). ::: -### Cocoapods +### SPM -If you are using [Cocoapods](https://cocoapods.org/), add these lines to your `Podfile`: +If you are using the Swift Package Manager, open the following menu item in Xcode: -```ruby -use_frameworks! -pod 'Lock', '~> 2.0' -pod 'Auth0', '~> 1.0' +**File > Swift Packages > Add Package Dependency...** + +In the **Choose Package Repository** prompt add this url: + +```text +https://github.com/auth0/Lock.swift.git ``` -Then, run `pod install`. +Then press **Next** and complete the remaining steps. ::: note -For further reference on Cocoapods, check [their official documentation](http://guides.cocoapods.org/using/getting-started.html). +For further reference on SPM, check [its official documentation](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app). ::: diff --git a/articles/libraries/lock-ios/_includes/_lock-version-1.md b/articles/libraries/lock-ios/_includes/_lock-version-1.md index c10a575955..fb21b112e4 100644 --- a/articles/libraries/lock-ios/_includes/_lock-version-1.md +++ b/articles/libraries/lock-ios/_includes/_lock-version-1.md @@ -1,3 +1,3 @@ ::: version-warning -This document covers an outdated version of Lock for iOS. We recommend you to [upgrade to v2](/libraries/lock-ios/v2/migration) +This document covers an outdated version of Lock for iOS. We recommend that you upgrade to v2. ::: diff --git a/articles/libraries/lock-ios/_includes/_lock-version.md b/articles/libraries/lock-ios/_includes/_lock-version.md index 62e81ed198..2596ef64e6 100644 --- a/articles/libraries/lock-ios/_includes/_lock-version.md +++ b/articles/libraries/lock-ios/_includes/_lock-version.md @@ -1,3 +1,3 @@ ::: note -This document uses the latest version of Lock for iOS - version 2. We recommend using this version, but if you are already using version 1, you can access it using the dropdown at the top of this document. If you are interested in upgrading to this version, take a look at the Lock v1 to Lock v2 migration guide. +This document uses the latest version of Lock for iOS - version 2. We recommend using this version, but if you are already using version 1, you can access it using the dropdown at the top of this document. ::: diff --git a/articles/libraries/lock-ios/v1/customization.md b/articles/libraries/lock-ios/v1/customization.md index af14ee8457..ed76e46250 100644 --- a/articles/libraries/lock-ios/v1/customization.md +++ b/articles/libraries/lock-ios/v1/customization.md @@ -2,13 +2,24 @@ section: libraries title: Customization description: Learn how to customize the look and feel of Lock +public: false +topics: + - libraries + - lock + - ios +contentType: + - how-to + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock iOS: Customization <%= include('../_includes/_lock-version-1') %> -Lock UI can be customized by creating your own `A0Theme` and overriding the default one before displaying `A0LockViewController`: +Lock UI can be customized by creating your own `A0Theme` and overriding the default one before displaying `A0LockViewController`: ```objc A0Theme *myAwesomeTheme = [[A0Theme alloc] init]; diff --git a/articles/libraries/lock-ios/v1/delegation-api.md b/articles/libraries/lock-ios/v1/delegation-api.md index b53bde914b..81be9f0cf1 100644 --- a/articles/libraries/lock-ios/v1/delegation-api.md +++ b/articles/libraries/lock-ios/v1/delegation-api.md @@ -2,19 +2,33 @@ section: libraries title: Delegation API description: Integrate with third-party apps with the delegation API. +public: false +topics: + - libraries + - lock + - ios + - delegation +contentType: + - how-to + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock iOS: Delegation API <%= include('../_includes/_lock-version-1') %> +<%= include('../../../_includes/_deprecate-delegation') %> + After a successful authentication, you can request credentials to access third party apps like Firebase or AWS that are configured in your Auth0 App's Add-On section. In order to do that you need to make a request to our [Delegation API](/api/authentication/reference#delegation) using a valid JWT. Here's an example ```objc A0Lock *lock = [A0Lock sharedLock]; -NSString *token = ...; // Auth0's id_token obtained on login +NSString *token = ...; // Auth0's ID Token obtained on login A0AuthParameters *parameters = [A0AuthParameters newWithDictionary:@{ @"id_token": token, A0ParameterAPIType: @"firebase", @@ -28,7 +42,7 @@ A0AuthParameters *parameters = [A0AuthParameters newWithDictionary:@{ ```swift let client = A0Lock.shared().apiClient() -let token = // Auth0's id_token obtained on login +let token = // Auth0's ID Token obtained on login let parameters = A0AuthParameters.new(with: [ "id_token": token, A0ParameterAPIType: "firebase" diff --git a/articles/libraries/lock-ios/v1/index.md b/articles/libraries/lock-ios/v1/index.md index 46da92b982..57b47e6a6c 100644 --- a/articles/libraries/lock-ios/v1/index.md +++ b/articles/libraries/lock-ios/v1/index.md @@ -6,22 +6,33 @@ title: Lock v1 for iOS and macOS snippets: dependencies: native-platforms/ios-objc/dependencies description: A widget that provides a frictionless login and signup experience for your native iOS and macOS apps. +public: false +topics: + - libraries + - lock + - ios +contentType: + - index + - how-to + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock v1 for iOS and macOS <%= include('../_includes/_lock-version-1') %> -Auth0 is an authentication broker that supports social identity providers as well as enterprise identity providers such as Active Directory, LDAP, Google Apps and Salesforce. +Auth0 is an authentication broker that supports social identity providers as well as enterprise identity providers such as Active Directory, LDAP, G Suite and Salesforce. ## Key features * **Integrates** your iOS app with **Auth0** (OS X coming soon). * Provides a elegant **native UI** to log in your users. * Provides support for **Social Providers** (Facebook, Twitter, and so on), **Enterprise Providers** (AD, LDAP, and so on) and **Username & Password** authentication. -* Provides the ability to do **SSO** with 2 or more mobile apps, similar to Facebook and Messenger apps. +* Provides the ability to do **Single Sign-on (SSO)** with 2 or more mobile apps, similar to Facebook and Messenger apps. * [1Password](https://agilebits.com/onepassword) integration using the **iOS 8** [Extension](https://github.com/AgileBits/onepassword-app-extension). -* Passwordless authentication using **Touch ID** and **SMS**. ::: note Check out the [Lock.swift repository](https://github.com/auth0/Lock.swift/tree/v1) on GitHub. @@ -109,21 +120,22 @@ Then call this method: lock.applicationLaunched(options: launchOptions) ``` -Lastly, you will need to handle the already registered custom scheme in your `AppDelegate`. To do so, override the `-application:openURL:sourceApplication:annotation:` method and add the following line: +Lastly, you will need to handle the already registered custom scheme in your `AppDelegate`. To do so, override the `-application:openURL:options:` method and add the following line: **Objective C**: ```objc -- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { - return [self.lock handleURL:url sourceApplication:sourceApplication]; +- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url + options:(NSDictionary *)options { + return [self.lock handleURL:url sourceApplication:app]; } ``` **Swift**: ```swift -func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { - return self.lock.handle(url, sourceApplication: sourceApplication) +func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { + return self.lock.handle(url, sourceApplication: app) } ``` @@ -135,7 +147,7 @@ This call is required to be able to return to your application when authenticati `A0LockViewController` will handle email/password, enterprise, and social provider authentication based on the connections enabled on your application in the [Auth0 Dashboard](${manage_url}/#/connections/social). -First, instantiate `A0LockViewController` and register the authentication callback that will receive the authenticated user's credentials. Then present it as a modal view controller: +First, instantiate `A0LockViewController` and register the authentication callback that will receive the authenticated user's credentials. Then present it as a modal view controller: #### Objective C @@ -271,7 +283,7 @@ Your `viewController` should also implement the `A0LockEventDelegate` methods: - (void)userAuthenticatedWithToken:(A0Token *)token profile:(A0UserProfile *)profile; - Calls `onAuthenticationBlock` of `A0LockViewController` with token and profile ``` -After implementating your `viewController`, you will need to return it in a `customSignUp` block of `A0LockViewController`. The default value for this block is `nil`. +After implementing your `viewController`, you will need to return it in a `customSignUp` block of `A0LockViewController`. The default value for this block is `nil`. **Objective-C**: diff --git a/articles/libraries/lock-ios/v1/lock-ios-api.md b/articles/libraries/lock-ios/v1/lock-ios-api.md index b7c8f3b7d5..660eb5dbe3 100644 --- a/articles/libraries/lock-ios/v1/lock-ios-api.md +++ b/articles/libraries/lock-ios/v1/lock-ios-api.md @@ -2,6 +2,17 @@ section: libraries title: Lock Objective-C API description: Description of the Lock Objective-C API +public: false +topics: + - libraries + - lock + - ios + - objective-c +contentType: + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock Objective-C API @@ -64,7 +75,7 @@ A0APIClient *client = [lock apiClient]; - (A0UserAPIClient *)newUserAPIClientWithIdToken:(NSString *)idToken; ``` -Returns a new instance of the API client for Auth0 API with the credentials of a authenticated user obtained from the **id_token** +Returns a new instance of the API client for Auth0 API with the credentials of a authenticated user obtained from the **ID Token** ```objc A0UserAPIClient *client = [lock newUserAPIClientWithIdToken:@"AN ID TOKEN"]; @@ -202,7 +213,7 @@ controller.loginAfterSignup = NO; @property (assign, nonatomic) A0AuthParameters *authenticationParameters; ``` -List of optional parameters that will be used for every authentication request with Auth0 API. By default it only has 'openid' and 'offline_access' scope values. For more information check out our [Wiki](/libraries/lock-ios/sending-authentication-parameters) +List of optional parameters that will be used for every authentication request with Auth0 API. By default it only has 'openid' and 'offline_access' scope values. For more information check out our [Wiki](/libraries/lock-ios/sending-authentication-parameters) ```objc controller.authenticationParameters.scopes = @[A0ScopeOfflineAccess, A0ScopeProfile]; diff --git a/articles/libraries/lock-ios/v1/logging.md b/articles/libraries/lock-ios/v1/logging.md index a64938781a..f33ff75ea7 100644 --- a/articles/libraries/lock-ios/v1/logging.md +++ b/articles/libraries/lock-ios/v1/logging.md @@ -2,13 +2,23 @@ section: libraries title: Logging description: Learn how to debug Lock by enabling logging. +public: false +topics: + - libraries + - lock + - ios +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock iOS: Logging <%= include('../_includes/_lock-version-1') %> -__Lock__ logs several pieces of useful debugging information using [CocoaLumberjack](https://github.com/CocoaLumberjack/CocoaLumberjack). +Lock logs several pieces of useful debugging information using [CocoaLumberjack](https://github.com/CocoaLumberjack/CocoaLumberjack). ::: note diff --git a/articles/libraries/lock-ios/v1/native-social-authentication.md b/articles/libraries/lock-ios/v1/native-social-authentication.md index a26f03d9a4..56a08f5617 100644 --- a/articles/libraries/lock-ios/v1/native-social-authentication.md +++ b/articles/libraries/lock-ios/v1/native-social-authentication.md @@ -2,6 +2,18 @@ section: libraries title: Native Social Authentication description: How to enable native login for some the supported social social connections. +public: false +topics: + - libraries + - lock + - ios + - native + - social-connections +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock iOS: Native Social Authentication @@ -9,7 +21,7 @@ description: How to enable native login for some the supported social social con <%= include('../_includes/_lock-version-1') %> ::: warning -This feature relies on a deprecated grant type. Applications created after June 8th 2017 won't be able to use this feature. +This feature relies on a deprecated grant type. Applications created after June 8th 2017 won't be able to use this feature. We recommend using browser-based flows, as explained in [Web-based auth](/libraries/auth0-swift#web-based-auth-ios-only-). ::: @@ -32,7 +44,7 @@ Before following these steps, please check our [documentation](/libraries/lock-i ### Facebook -Lock uses Facebook iOS SDK to obtain user's Access Token so you'll need to configure it using your Facebook App info: +Lock uses Facebook iOS SDK to obtain user's Access Token so you'll need to configure it using your Facebook App info: First, add the following entries to the `Info.plist`: * _FacebookAppID_: `YOUR_FACEBOOK_APP_ID` @@ -54,7 +66,7 @@ A0FacebookAuthenticator *facebook = [A0FacebookAuthenticator newAuthenticationWi ### Twitter -Twitter authentication is done using [Reverse Auth](https://dev.twitter.com/docs/ios/using-reverse-auth) in order to obtain a valid access_token that can be sent to Auth0 Server and validate the user. By default we use iOS Twitter Integration but we support OAuth Web Flow (with Safari) as a fallback mechanism in case a user has no accounts configured in his/her Apple Device. +Twitter authentication is done using [Reverse Auth](https://dev.twitter.com/docs/ios/using-reverse-auth) in order to obtain a valid Access Token that can be sent to Auth0 Server and validate the user. By default we use iOS Twitter Integration but we support OAuth Web Flow (with Safari) as a fallback mechanism in case a user has no accounts configured in his/her Apple Device. To support Twitter authentication you need to register `A0TwitterAuthenticator` with your instance of `A0Lock`: @@ -72,7 +84,7 @@ We need your twitter app's key & secret in order to sign the reverse auth reques Google authentication uses [Google Sign-In](https://developers.google.com/identity/sign-in/ios/) iOS library, so you'll need to register your iOS application in [Google Developer Console](https://console.developers.google.com/project) and get your clientId. -We recommend follwing [this wizard](https://developers.google.com/mobile/add?platform=ios) instead and download the file `GoogleServices-Info.plist` that is generated at the end. +We recommend following [this wizard](https://developers.google.com/mobile/add?platform=ios) instead and download the file `GoogleServices-Info.plist` that is generated at the end. Then add that file to your application's target and the last step is to register two custom URL for your application. diff --git a/articles/libraries/lock-ios/v1/password-reset-ios.md b/articles/libraries/lock-ios/v1/password-reset-ios.md index 04d18a3c47..9d7462f62f 100644 --- a/articles/libraries/lock-ios/v1/password-reset-ios.md +++ b/articles/libraries/lock-ios/v1/password-reset-ios.md @@ -2,6 +2,17 @@ section: libraries title: Password Reset description: All you need to know about password reset with Lock for iOS. +public: false +topics: + - libraries + - lock + - ios + - passwords +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock iOS: Password Reset @@ -9,7 +20,7 @@ description: All you need to know about password reset with Lock for iOS. You can allow the user to reset their password for any database connections. -If you use Lock UI, you can hide or show a **Reset password** button by setting the `disableResetPassword` property, which will default to `false`. +If you use Lock UI, you can hide or show a **Reset password** button by setting the `disableResetPassword` property, which will default to `false`. If you implement a custom UI, you need to send a password reset email to the user using `A0APIClient`. diff --git a/articles/libraries/lock-ios/v1/passwordless.md b/articles/libraries/lock-ios/v1/passwordless.md index 808536489a..6296f23b3c 100644 --- a/articles/libraries/lock-ios/v1/passwordless.md +++ b/articles/libraries/lock-ios/v1/passwordless.md @@ -2,6 +2,17 @@ section: libraries title: Passwordless in Lock iOS v1 description: How to implement Passwordless authentication in Lock v1 +public: false +topics: + - libraries + - lock + - ios + - passwordless +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Passwordless in Lock iOS v1 @@ -13,9 +24,9 @@ description: How to implement Passwordless authentication in Lock v1 `A0SMSLockViewController` authenticates without using a password with SMS. In order to be able to authenticate the user, your application must have the SMS connection enabled and configured in your [dashboard](${manage_url}/#/connections/passwordless). -First instantiate `A0SMSLockViewController` and register the authentication callback that will receive the authenticated user's credentials. +First instantiate `A0SMSLockViewController` and register the authentication callback that will receive the authenticated user's credentials. -The next step is register a block to return an API Token used to register the phone number and send the login code with SMS. This token can be generated in [Auth0 API v2 page](/api/v2), just select the scope `create:users` and copy the generated API Token. +The next step is register a block to return an API Token used to register the phone number and send the login code with SMS. This token can be generated in [Auth0 API v2 page](/api/v2), just select the scope `create:users` and copy the generated API Token. Finally present it to the user: ```objc @@ -50,7 +61,7 @@ And you'll see SMS login screen ## Passwordless with Touch ID -Lock provides passwordless authentication with Touch ID for your Auth0 DB connection. To start authenticating your users with Touch ID please follow those steps: +Lock provides passwordless authentication with Touch ID for your Auth0 DB connection. To start authenticating your users with Touch ID please follow those steps: 1. Add `TouchID` subspec module of **Lock** to your `Podfile` ```ruby diff --git a/articles/libraries/lock-ios/v1/save-and-refresh-jwt-tokens.md b/articles/libraries/lock-ios/v1/save-and-refresh-jwt-tokens.md index b2a33f96cc..69be180f58 100644 --- a/articles/libraries/lock-ios/v1/save-and-refresh-jwt-tokens.md +++ b/articles/libraries/lock-ios/v1/save-and-refresh-jwt-tokens.md @@ -2,20 +2,33 @@ section: libraries title: Saving and Refreshing JWT Tokens description: Keeping your user logged in +public: false +topics: + - libraries + - lock + - ios + - tokens +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock iOS: Saving and Refreshing JWT Tokens <%= include('../_includes/_lock-version-1') %> -When an authentication is performed with the `offline_access` scope included, it will return a [Refresh Token](/refresh-token) that can be used to request a new JWT token and avoid asking the user his/her +<%= include('../../../_includes/_uses-delegation') %> + +When an authentication is performed with the `offline_access` scope included, it will return a Refresh Token that can be used to request a new JWT token and avoid asking the user his/her credentials again. ::: note We are using [SimpleKeychain](https://github.com/auth0/SimpleKeychain) to handle iOS Keychain access. ::: -First thing we need to do is store the `id_token` and `refresh_token` in the iOS Keychain after a successful authentication. +First thing we need to do is store the ID Token and Refresh Token in the iOS Keychain after a successful authentication. ```objc A0LockViewController *controller = ...; @@ -43,9 +56,9 @@ controller.onAuthenticationBlock = { (profile, token) in // Other stuff. Don't forget to dismiss lock } ``` -Once you have those stored, you can at any point request a new `id_token` using either of by calling to Auth0`s **delegation** endpoint. +Once you have those stored, you can at any point request a new ID Token using either of by calling to Auth0`s **delegation** endpoint. -## Using a non-expired id_token +## Using a non-expired ID Token ```objc A0Lock *lock = [A0Lock sharedLock]; @@ -54,10 +67,10 @@ NSString* token = [keychain stringForKey:@"id_token"]; A0APIClient *client = [lock apiClient]; [client fetchNewIdTokenWithIdToken:token parameters:nil success:^(A0Token *token) { [keychain setString:token.idToken forKey:@"id_token"]; - //Just got a new id_token! + //Just got a new ID Token! } failure:^(NSError *error) { [keychain clearAll]; //Cleaning stored values since they are no longer valid - //id_token is no longer valid. + //ID Token is no longer valid. //You should ask the user to login again!. }]; ``` @@ -70,16 +83,16 @@ if let token = keychain.stringForKey("id_token") { parameters: nil, success: { token in keychain.setString(token.idToken, forKey: "id_token") - //Just got a new id_token! + //Just got a new ID Token! }, failure: { error in keychain.clearAll() //Cleaning stored values since they are no longer valid - //id_token is no longer valid. + //ID Token is no longer valid. //You should ask the user to login again!. }) } ``` -## Using refresh_token +## Using Refresh Token ```objc A0Lock *lock = [A0Lock sharedLock]; @@ -88,10 +101,10 @@ NSString* refreshToken = [keychain stringForKey:@"refresh_token"]; A0APIClient *client = [lock apiClient]; [client fetchNewIdTokenWithRefreshToken:refreshToken parameters:nil success:^(A0Token *token) { [keychain setString:token.idToken forKey:@"id_token"]; - //Just got a new id_token! + //Just got a new ID Token! } failure:^(NSError *error) { [keychain clearAll]; //Cleaning stored values since they are no longer valid - //refresh_token is no longer valid. + //Refresh Token is no longer valid. //You should ask the user to login again!. }]; ``` @@ -104,10 +117,10 @@ if let token = keychain.stringForKey("refresh_token") { parameters: nil, success: { token in keychain.setString(token.idToken, forKey: "id_token") - //Just got a new id_token! + //Just got a new ID Token! }, failure: { error in keychain.clearAll() //Cleaning stored values since they are no longer valid - //refresh_token is no longer valid. + //Refresh Token is no longer valid. //You should ask the user to login again!. }) } diff --git a/articles/libraries/lock-ios/v1/sending-authentication-parameters.md b/articles/libraries/lock-ios/v1/sending-authentication-parameters.md index b9f51ddd0e..325e52750d 100644 --- a/articles/libraries/lock-ios/v1/sending-authentication-parameters.md +++ b/articles/libraries/lock-ios/v1/sending-authentication-parameters.md @@ -2,13 +2,23 @@ section: libraries title: Sending Authentication Parameters description: How to send authentication parameters, and what parameters are supported when using Lock iOS. +public: false +topics: + - libraries + - lock + - ios +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock iOS: Sending Authentication Parameters <%= include('../_includes/_lock-version-1') %> -You can send parameters, before displaying `A0AuthenticationViewController` or when calling any API method using `A0APIClient`, by adding them to a `A0AuthParameters` object. By default `A0AuthParameters` has the parameter `scope` with `openid offline_access` and `device` with the name obtained from calling +You can send parameters, before displaying `A0AuthenticationViewController` or when calling any API method using `A0APIClient`, by adding them to a `A0AuthParameters` object. By default `A0AuthParameters` has the parameter `scope` with `openid offline_access` and `device` with the name obtained from calling ```objc [[UIDevice currentDevice] name]; ``` @@ -24,7 +34,7 @@ The following parameters are supported: * `protocol` * `device` * `connection_scopes` -* `nonce` +* `nonce` * `offline_mode` * `state`. @@ -43,11 +53,11 @@ A0AuthParameters *parameters = [A0AuthParameters newDefaultParams]; There are different values supported for scope: -* `'openid'`: It will return, not only the `access_token`, but also an `id_token` which is a Json Web Token (JWT). The JWT will only contain the user id (sub claim). You can use objc constant `A0ScopeOpenId`. +* `'openid'`: It will return, not only the Access Token, but also an ID Token, which is a JSON Web Token (JWT). The JWT will only contain the user id (sub claim). You can use objc constant `A0ScopeOpenId`. * `'openid profile'`:(not recommended): will return all the user attributes in the token. This can cause problems when sending or receiving tokens in URLs (for example, when using response_type=token) and will likely create an unnecessarily large token(especially with Azure AD which returns a fairly long JWT). Keep in mind that JWTs are sent on every API request, so it is desirable to keep them as small as possible. You can use objc constant `A0ScopeProfile`. -* `'openid {attr1} {attr2} {attrN}'`: If you want only specific user's attributes to be part of the `id_token` (For example: `scope: 'openid name email picture'`). +* `'openid {attr1} {attr2} {attrN}'`: If you want only specific user's attributes to be part of the ID Token (for example: `scope: 'openid name email picture'`). -Also when need to keep the `id_token` alive, you can request a refresh_token adding to the scope the value `offline_access` (Or use the constant `A0ScopeOfflineAccess`). +Also, when you need to keep the ID Token alive, you can request a Refresh Token adding to the scope the value `offline_access` (Or use the constant `A0ScopeOfflineAccess`). By default in Auth0.iOS, the scope is set to `openid offline_access`. diff --git a/articles/libraries/lock-ios/v1/swift.md b/articles/libraries/lock-ios/v1/swift.md index 961d6775f0..de468cce8c 100644 --- a/articles/libraries/lock-ios/v1/swift.md +++ b/articles/libraries/lock-ios/v1/swift.md @@ -2,13 +2,24 @@ section: libraries title: Using Lock with Swift description: How to use Swift with Lock iOS. +public: false +topics: + - libraries + - lock + - ios + - swift +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock iOS: Using Swift <%= include('../_includes/_lock-version-1') %> -**Lock** was written in Objective-C but it can be used from a pure Swift project or a Hybrid project (Swift & Objective-C). +**Lock** was written in Objective-C but it can be used from a pure Swift project or a Hybrid project (Swift & Objective-C). ## Create Objective-C Bridging Header In order to use **Lock** classes in any Swift file, you need to add a Objective-C Bridging Header to your project. The easiest way is to create a dummy Objective-C file in your Swift project (or Swift file in a Objective-C project), this will make Xcode prompt to create the bridging header, just press _"YES"_. After that you can delete the dummy file from your project and open the bridging header file which is called `-Bridging-Header.h`. diff --git a/articles/libraries/lock-ios/v1/use-your-own-ui.md b/articles/libraries/lock-ios/v1/use-your-own-ui.md index 9209033813..e7cd769663 100644 --- a/articles/libraries/lock-ios/v1/use-your-own-ui.md +++ b/articles/libraries/lock-ios/v1/use-your-own-ui.md @@ -2,6 +2,17 @@ section: libraries title: Build your own UI description: Customize the UI of Lock in your App +public: false +topics: + - libraries + - lock + - ios + - custom-ui +contentType: + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock iOS: Build your own UI @@ -86,15 +97,15 @@ After that, you may want to save the user's token to be able to use them later, 2. Also add the following lines to your `AppDelegate` too ```objc - - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { - A0Lock *lock = ... //Get your Lock instance - return [lock handleURL:url sourceApplication:sourceApplication]; +- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { + A0Lock *lock = ... // Get your Lock instance + return [lock handleURL:url sourceApplication:app]; } ``` ```swift - func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { + func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { let lock = ... // Get your Lock instance - return lock.handle(url, sourceApplication: sourceApplication) + return lock.handle(url, sourceApplication: app) } ``` diff --git a/articles/libraries/lock-ios/v2/configuration.md b/articles/libraries/lock-ios/v2/configuration.md index ad915e9f20..20831500fb 100644 --- a/articles/libraries/lock-ios/v2/configuration.md +++ b/articles/libraries/lock-ios/v2/configuration.md @@ -4,6 +4,16 @@ toc: true url: /libraries/lock-ios/v2/configuration title: Lock for iOS v2 Configuration Options description: Behavior configuration options available with Lock v2 for iOS +topics: + - libraries + - lock + - ios +contentType: + - reference + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock v2 for iOS - Configuration Options @@ -39,7 +49,7 @@ Allows Lock to be dismissed by the user. By default this is `false`. ### scope -Scope used for authentication. By default is `openid`. It will return not only the **access\_token**, but also an **id_token** which is a [JSON Web Token (JWT)](https://jwt.io/) containing user information. See the documentation on [Scopes](/scopes) for more information about authentication scopes. +Scope used for authentication. By default is `openid`. It will return not only the **Access Token**, but also an **ID Token** which is a JSON Web Token (JWT) containing user information. See the documentation on [Scopes](/scopes) for more information about authentication scopes. ```swift .withOptions { @@ -49,7 +59,7 @@ Scope used for authentication. By default is `openid`. It will return not only t #### Refresh Tokens -Specifying the `offline_access` scope in your Lock options will allow a [Refresh Token](/tokens/refresh-token) to be returned along with the access\_token and the id\_token. Refresh Tokens can be saved and used to acquire a new Access Token when the old one expires. For more information about using Refresh Tokens for Auth0 authentication, take a look at the reference documentation for the [Auth0.Swift SDK](/libraries/auth0-swift), which you would use to implement Refresh Tokens, or at the [Swift QuickStart Guide](/quickstart/native/ios-swift/03-user-sessions), which provides a comprehensive example of use of Auth0 in Swift development, including the management of Refresh Tokens. +Specifying the `offline_access` scope in your Lock options will allow a [Refresh Token](/tokens/concepts/refresh-tokens) to be returned along with the access\_token and the id\_token. Refresh Tokens can be saved and used to acquire a new Access Token when the old one expires. For more information about using Refresh Tokens for Auth0 authentication, take a look at the reference documentation for the [Auth0.Swift SDK](/libraries/auth0-swift), which you would use to implement Refresh Tokens, or at the [Swift Quickstart Guide](/quickstart/native/ios-swift/03-user-sessions), which provides a comprehensive example of use of Auth0 in Swift development, including the management of Refresh Tokens. ### termsOfService @@ -62,7 +72,49 @@ By default Lock will use Auth0's [Terms of Service](https://auth0.com/terms) and } ``` -## Database Options +### Show Terms of Service + +Database connections display the Terms of Service dialog. Default is `true`. Note that the Terms of Service will always be shown if the `mustAcceptTerms` flag is enabled. + +```swift +.withOptions { + $0.showTerms = true +} +``` + +### Require users to accept the Terms of Service + +Database connection require explicit acceptance of the Terms of Service. + +```swift +.withOptions { + $0.mustAcceptTerms = true +} +``` + +## Web Authentication Options + +### leeway + +Clock skew used for ID token validation. It expands the time window in which the ID token will still be considered valid, to account for the difference between server time and client time. By default is **60000 milliseconds** (60 seconds). + +```swift +.withOptions { + $0.leeway = 30000 // 30 seconds +} +``` + +### maxAge + +Allowable elapsed time (in milliseconds) since the user last authenticated. Used for ID token validation. If set, the ID token will contain an `auth_time` claim with the authentication timestamp. Defaults to `nil`. + +```swift +.withOptions { + $0.maxAge = 86400000 // 1 day +} +``` + +## Database options ### allow @@ -80,7 +132,7 @@ The first screen to present to the user. The default is `.Login`, other options ```swift .withOptions { - $0.initialScreen = .Login + $0.initialScreen = .login } ``` @@ -96,7 +148,7 @@ Specify the type of identifier the login will require. The default is either: ` #### Custom Signup Fields -When signing up the default information requirements are the user's *email* and *password*. You can expand your data capture requirements as needed. Capturing additional signup fields here will store them in the `user_metadata`, which you can read more about in the [Metadata Documentation](/metadata). Note that you must specify the icon to use with your custom text field. +When signing up the default information requirements are the user's *email* and *password*. You can expand your data capture requirements as needed. Capturing additional signup fields here will store them in the `user_metadata`, which you can read more about in [Metadata](/users/concepts/overview-user-metadata). Note that you must specify the icon to use with your custom text field. ```swift .withOptions { diff --git a/articles/libraries/lock-ios/v2/custom-fields.md b/articles/libraries/lock-ios/v2/custom-fields.md index 80fcbd88d2..3ce74320cf 100644 --- a/articles/libraries/lock-ios/v2/custom-fields.md +++ b/articles/libraries/lock-ios/v2/custom-fields.md @@ -2,15 +2,25 @@ section: libraries title: Custom Fields at Signup description: Adding additional fields to signups with Lock v2 for iOS +topics: + - libraries + - lock + - ios +contentType: + - how-to + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock v2 for iOS - Custom Fields at Signup -**Lock v2 for iOS** allows you to specify additional fields that the user must complete before creating a new account. The extra fields will be shown on a second screen after the user completes the basic fields (email, username, password). +**Lock v2 for iOS** allows you to specify additional fields that the user must complete before creating a new account. The extra fields will be shown after the basic fields (email, username, password). ## Adding custom fields -When signing up the default information requirements are the user's *email* and *password*. You can expand your data capture requirements as needed. Capturing additional signup fields here will store them in the `user_metadata`, which you can read more about in the [Metadata Documentation](/metadata). +When signing up the default information requirements are the user's *email* and *password*. You can expand your data capture requirements as needed. Capturing additional signup fields here will store them in the `user_metadata`, which you can read more about in [Metadata](/users/concepts/overview-user-metadata). ```swift .withOptions { @@ -25,7 +35,7 @@ When signing up the default information requirements are the user's *email* and You must specify the icon to use with your custom text field. ::: -Thats it! If you have enabled users Sign Up in the Application's Dashboard, after they complete the basic fields (email/username, password) and hit Submit, they will be prompted to fill the remaining fields. +That's it! If you have enabled users Sign Up in the Application's Dashboard, after they complete the basic fields (email/username, password) and hit Submit, they will be prompted to fill the remaining fields. ::: note Note that the user must fill all of the custom fields before being able to complete signup. diff --git a/articles/libraries/lock-ios/v2/customization.md b/articles/libraries/lock-ios/v2/customization.md index e7f4ce4d56..438a224801 100644 --- a/articles/libraries/lock-ios/v2/customization.md +++ b/articles/libraries/lock-ios/v2/customization.md @@ -4,11 +4,20 @@ toc: true url: /libraries/lock-ios/v2/customization title: Lock for iOS v2 Style Customization Options description: Styling and customization options for the style of Lock v2 for iOS +topics: + - libraries + - lock + - ios +contentType: + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock v2 for iOS - Style Customization Options -There are numerous options to configure Lock's style and appearance listed below. In addition, there are also quite a few options available to alter Lock's behavior and functionality in the [Behavior Configuration Options](/libraries/lock-ios/v2/configuration) page. +There are numerous options to configure Lock's style and appearance listed below. In addition, there are also quite a few options available to alter Lock's behavior and functionality in the [Behavior Configuration Options](/libraries/lock-ios/v2/configuration) page. ## Customizing Lock's appearance @@ -267,7 +276,7 @@ The Lock Controller Status Bar style. ### UISearchBarStyle -The Lock Passwordless Search Bar style. +The Lock Passwordless Search Bar style. ```swift .withStyle { diff --git a/articles/libraries/lock-ios/v2/index.md b/articles/libraries/lock-ios/v2/index.md index 9c766f9eb6..ccde6a136d 100644 --- a/articles/libraries/lock-ios/v2/index.md +++ b/articles/libraries/lock-ios/v2/index.md @@ -4,10 +4,25 @@ toc: true title: Lock v2 for iOS description: A widget that provides a frictionless login and signup experience for your native iOS apps. mobileimg: media/articles/libraries/lock-ios.png +topics: + - libraries + - lock + - ios +contentType: + - reference + - index + - how-to +useCase: + - add-login + - enable-mobile-auth --- # Lock v2 for iOS -This reference guide will show you how to implement the Lock user interface, and give you the details on configuring and customizing Lock in order to use it as the UI for your authentication needs. However, if you'd like to learn how to do more with Auth0 and Swift, such as how to save, call and refresh Access Tokens, get user profile info, and more, check out the [Auth0.Swift SDK](/libraries/auth0-swift). Or, take a look at the [Swift QuickStart](/quickstart/native/ios-swift) to walk through complete examples and see options, both for using Lock as the interface, and for using a custom interface. +::: warning +Auth0 encourages the use of [web authentication via Universal Login](/guides/login/universal-vs-embedded) rather than native username/password authentication whenever possible. +::: + +This reference guide will show you how to implement the Lock user interface, and give you the details on configuring and customizing Lock in order to use it as the UI for your authentication needs. However, if you'd like to learn how to do more with Auth0 and Swift, such as how to save, call and refresh Access Tokens, get user profile info, and more, check out the [Auth0.swift SDK](/libraries/auth0-swift). Or, take a look at the [Swift Quickstart](/quickstart/native/ios-swift) to walk through complete examples and see options, both for using Lock as the interface, and for using a custom interface. ::: note Check out the [Lock.swift repository](https://github.com/auth0/Lock.swift) on GitHub. @@ -15,9 +30,9 @@ Check out the [Lock.swift repository](https://github.com/auth0/Lock.swift) on Gi ## Requirements -- iOS 9 or later -- Xcode 8 -- Swift 3.0 +- iOS 9+ +- Xcode 10+ +- Swift 4+ <%= include('../_includes/_dependencies') %> @@ -28,7 +43,7 @@ Check out the [Lock.swift repository](https://github.com/auth0/Lock.swift) on Gi Lock needs to be notified when the application is asked to open a URL. You can do this in the `AppDelegate` file. ```swift -func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool { +func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { return Lock.resumeAuth(url, options: options) } ``` @@ -123,7 +138,7 @@ Adding a database connection: ```swift .withConnections { - connections.database(name: "Username-Password-Authentication", requiresUsername: true) + $0.database(name: "Username-Password-Authentication", requiresUsername: true) } ``` @@ -131,8 +146,8 @@ Adding multiple social connections: ```swift .withConnections { - connections.social(name: "facebook", style: .Facebook) - connections.social(name: "google-oauth2", style: .Google) + $0.social(name: "facebook", style: .Facebook) + $0.social(name: "google-oauth2", style: .Google) } ``` diff --git a/articles/libraries/lock-ios/v2/internationalization.md b/articles/libraries/lock-ios/v2/internationalization.md index 6fd81ea34b..cda2d77a2b 100644 --- a/articles/libraries/lock-ios/v2/internationalization.md +++ b/articles/libraries/lock-ios/v2/internationalization.md @@ -2,6 +2,17 @@ section: libraries title: Internationalization in Lock v2 for iOS description: Internationalization support in Lock v2 for iOS +topics: + - libraries + - lock + - ios + - i18n +contentType: + - how-to + - reference +useCase: + - add-login + - enable-mobile-auth --- # Internationalization @@ -45,7 +56,7 @@ Add the new language and ensure that **Lock.strings** is selected ![xcode add language](/media/articles/libraries/lock-ios/xcode_add_language_step_2.png) -You will notice under **Lock.strings** a new file has been created for your specified language, based upon the the **Reference Language** selection. +You will notice under **Lock.strings** a new file has been created for your specified language, based upon the **Reference Language** selection. Now you are ready to translate to your desired language. diff --git a/articles/libraries/lock-ios/v2/logging.md b/articles/libraries/lock-ios/v2/logging.md index 8e37ff681d..821a5dae26 100644 --- a/articles/libraries/lock-ios/v2/logging.md +++ b/articles/libraries/lock-ios/v2/logging.md @@ -2,10 +2,20 @@ section: libraries title: Logging in Lock for iOS v2 description: Logging in Lock for iOS v2 +topics: + - libraries + - lock + - ios + - logs +contentType: + - reference +useCase: + - add-login + - enable-mobile-auth --- # Logging in Lock for iOS v2 -Lock provides options to easily turn on and off logging capabilities, as well as adjust other logging related settings. +Lock provides options to easily turn on and off logging capabilities, as well as adjust other logging related settings. ## logLevel diff --git a/articles/libraries/lock-ios/v2/migration.md b/articles/libraries/lock-ios/v2/migration.md index b2e215d329..274c9bd896 100644 --- a/articles/libraries/lock-ios/v2/migration.md +++ b/articles/libraries/lock-ios/v2/migration.md @@ -4,10 +4,23 @@ toc: true url: /libraries/lock-ios/v2/migration title: Migrating from v1 to v2 of Lock for iOS description: A migration guide to assist with migration from Lock v1 (Swift) to Lock v2 (Swift). +public: false +topics: + - libraries + - lock + - ios + - migrations +contentType: + - reference + - how-to +useCase: + - add-login + - enable-mobile-auth + - migrate --- # Migrating from Lock iOS v1 to v2 -Lock 2.0 is the latest major release of Lock iOS-OSX. This guide is provided in order to ease the transition of existing applications using Lock 1.x to the latest APIs. +Lock 2.0 is the latest major release of Lock iOS-OSX. This guide is provided in order to ease the transition of existing applications using Lock 1.x to the latest APIs. ## Requirements @@ -19,7 +32,7 @@ Lock 2.0 is the latest major release of Lock iOS-OSX. This guide is provided in Lock v2 cannot be used from Objective-C, since its public API relies on Swift features and that makes them unavailable in ObjC codebases. -If you are willing to have some Swift code in your existing application you can follow this [guide](https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html) on how to mix Objective-C and Swift and then use Lock v2 from the Swift files. +If you are willing to have some Swift code in your existing application, you can follow this [guide](https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html) on how to mix Objective-C and Swift and then use Lock v2 from the Swift files. If that's not an option, we recommend sticking with Lock v1 or using [Auth0.swift](/libraries/auth0-swift) to build your own interface for user logins and signups. @@ -58,22 +71,22 @@ In Lock v2, this is no longer required. In Lock v1 you'd add the following: ```swift -func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool { - return A0Lock.shared().handle(url, sourceApplication: sourceApplication) +func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { + return A0Lock.shared().handle(url, sourceApplication: app) } ``` In Lock v2 you need to instead use the following: ```swift -func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool { +func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { return Lock.resumeAuth(url, options: options) } ``` #### Application is asked to continue a User Activity -If you are using Lock passwordless and have specified the `.magicLink` option to send the user a universal link then you will need to add the following to your `AppDelegate.swift`: +If you are using Lock passwordless and have specified the `.magicLink` option to send the user a universal link then you will need to add the following to your `AppDelegate.swift`: ```swift func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool { @@ -131,13 +144,13 @@ Lock .present(from: self) ``` -So, in the `onAuth` callback, you'd only recieve the credentials of the user when the authentication is successful. +So, in the `onAuth` callback, you'd only receive the credentials of the user when the authentication is successful. ::: note -In constrast with Lock v1, in v2, Lock will dismiss itself so there is no need to call `dismissViewController(animated:, completion:)` in any of the callbacks. +In contrast with Lock v1, in v2, Lock will dismiss itself so there is no need to call `dismissViewController(animated:, completion:)` in any of the callbacks. ::: -In the case you need to know about the errors or signup there are the corresponding `onError` and `onSignUp` callbacks that can be employed. +In the case you need to know about the errors or signup, there are the corresponding `onError` and `onSignUp` callbacks that can be employed. ```swift Lock @@ -210,7 +223,7 @@ Lock #### Configuration options -If you needed to tweak Lock behaviour using it's options in v1, you would use the following format: +If you needed to tweak Lock behaviour using its options in v1, you would use the following format: ```swift let controller = A0Lock.shared().newLockViewController() @@ -272,6 +285,8 @@ Auth0 ### Delegation -Delegation is not available through Lock. It can be implemented via a legacy method in [Auth0.Swift](/libraries/auth0-swift) for tenants which existed prior to June 2017, but delegation is deprecated and not recommended for most use cases. See the [migrations notice](/migrations#api-authorization-with-third-party-vendor-apis) for more details. +<%= include('../../../_includes/_deprecate-delegation') %> + +Delegation is not available through Lock. It can be implemented via a legacy method in [Auth0.Swift](/libraries/auth0-swift) for tenants which existed prior to June 2017. <%= include('../_includes/_roadmap') %> diff --git a/articles/libraries/lock-ios/v2/passwordless.md b/articles/libraries/lock-ios/v2/passwordless.md index 7c9c648002..5f9478eca3 100644 --- a/articles/libraries/lock-ios/v2/passwordless.md +++ b/articles/libraries/lock-ios/v2/passwordless.md @@ -2,18 +2,31 @@ section: libraries title: Lock Passwordless for iOS description: Using Passwordless authentication with Lock for iOS v2 +topics: + - libraries + - lock + - ios + - passwordless +contentType: + - reference +useCase: + - add-login + - enable-mobile-auth --- # Lock Passwordless for iOS -<%= include('../../../_includes/_native_passwordless_warning') %> +Lock Passwordless handles passwordless authentication using email and sms connections. -Lock Passwordless handles passwordless authentication using email and sms connections. +To use Passwordless Authentication you need Lock.Swift version 2.14.0 or greater. To show Lock, add the following snippet in your `UIViewController`. ```swift Lock .passwordless() + .withOptions { + $0.oidcConformant = true + } // withConnections, withOptions, withStyle, and so on. .onAuth { credentials in // Save the Credentials object @@ -24,11 +37,10 @@ Lock **Notes:** - Passwordless can only be used with a single connection and will prioritize the use of email connections over SMS. -- The `audience` option is not available in Passwordless. ### Passwordless Method -When using Lock Passwordless the default `passwordlessMethod` is `.code` which sends the user a one time passcode to login. If you want to use [Universal Links](/applications/enable-universal-links) you can add the following: +When using Lock Passwordless the default `passwordlessMethod` is `.code` which sends the user a one time passcode to login. If you want to use [Universal Links](/dashboard/guides/applications/enable-universal-links) you can add the following: ```swift .withOptions { @@ -44,4 +56,4 @@ If you are using Lock Passwordless and have specified the `.magicLink` option to func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool { return Lock.continueAuth(using: userActivity) } -``` \ No newline at end of file +``` diff --git a/articles/libraries/lock/index.yml b/articles/libraries/lock/index.yml index 68f1909501..a120986e44 100644 --- a/articles/libraries/lock/index.yml +++ b/articles/libraries/lock/index.yml @@ -2,10 +2,6 @@ versioning: baseUrl: libraries/lock current: v11 versions: - - v9 - - v10 - v11 defaultArticles: - v9: index - v10: index v11: index diff --git a/articles/libraries/lock/v10/api.md b/articles/libraries/lock/v10/api.md deleted file mode 100644 index 8be8ae0baf..0000000000 --- a/articles/libraries/lock/v10/api.md +++ /dev/null @@ -1,248 +0,0 @@ ---- -section: libraries -toc: true -description: Details on the Lock V10 API. ---- -# Lock: API Reference - -<%= include('../../../_includes/_version_warning_lock') %> - -Lock has many methods, features, and configurable options. This reference is designed to direct you to the ones that you need, and discuss how to use them. Click below to go straight the method you're looking for, or just browse! If you're looking for information about events emitted by Lock, they're listed under the [on()](#on-event-callback-) method section! - -- [new Auth0Lock](#auth0lock) - Instantiating Lock -- [getUserInfo()](#getuserinfo-) - Obtaining the profile of a logged in user -- [show()](#show-) - Showing the Lock widget -- [on()](#on-) - Listening for events -- [resumeAuth()](#resumeauth-) - Use to complete authentication flow when `autoParseHash` is false -- [logout()](#logout-) - Log out the user - -## Auth0Lock - -```js -new Auth0Lock(clientID, domain, options) -``` - -Initializes a new instance of `Auth0Lock` configured with your application's `clientID` and your account's `domain` from your [Auth0](${manage_url}/) management dashboard. The third and optional parameter is an `options` object used to configure Lock for your application's needs. You can find this information at your [application settings](${manage_url}/#/applications). - -- **clientId {String}**: Required parameter. Your application's _clientId_ in Auth0. -- **domain {String}**: Required parameter. Your Auth0 _domain_. Usually _your-account.auth0.com_. -- **options {Object}**: Optional parameter. Allows for the configuration of Lock's appearance and behavior. See [the configuration options page](/libraries/lock/v10/customization) for details. - -**Example:** - -```js -var clientId = '${account.clientId}'; -var domain = '${account.namespace}'; -// Instantiate Lock - without custom options -var lock = new Auth0Lock(clientId, domain); - -// Listen for the authenticated event and get profile -lock.on("authenticated", function(authResult) { - lock.getUserInfo(authResult.accessToken, function(error, profile) { - if (error) { - // Handle error - return; - } - - // Save token and profile locally - localStorage.setItem("accessToken", authResult.accessToken); - localStorage.setItem("profile", JSON.stringify(profile)); - - // Update DOM - }); -}); -``` - -## getUserInfo() - -```js -getUserInfo(accessToken, callback) -``` - -Once the user has logged in and you are in possesion of a token, you can use that token to obtain the user's profile with `getUserInfo`. This method replaces the deprecated `getProfile()`. - -- **accessToken {String}**: User token. -- **callback {Function}**: Will be invoked after the user profile been retrieved. - -**Example:** - -```js -lock.getUserInfo(accessToken, function(error, profile) { - if (!error) { - alert("hello " + profile.name); - } -}); -``` - -## show() - -```js -show(options) -``` - -The `show` method displays the widget. Beginning with Lock version 10.2.0, the `show` method can now accept an `options` object as a parameter. Note that this parameter is meant to be used as a way to _override_ your Lock's `options` for this particular displaying of the widget - options should be _set_ when instantiating Lock, and _overridden_, only if needed for your specific use case, here. - -The following subset of `options` to be overridden from the values they were given (or their defaults) when Lock was instantiated: - -- [allowedConnections](/libraries/lock/v10/customization#allowedconnections-array-) -- [auth.params](/libraries/lock/v10/customization#params-object-) -- [allowLogin](/libraries/lock/v10/customization#allowlogin-boolean-) -- [allowSignUp](/libraries/lock/v10/customization#allowsignup-boolean-) -- [allowForgotPassword](/libraries/lock/v10/customization#allowforgotpassword-boolean-) -- [initialScreen](/libraries/lock/v10/customization#initialscreen-string-) -- [rememberLastLogin](/libraries/lock/v10/customization#rememberlastlogin-boolean-) - -For more detail on the entire list of configurable options that can be chosen when instantiating Lock, as opposed to the limited subset above that can be overridden in the `show` method, please see the [user configurable options page](/libraries/lock/v10/customization). - -Options override examples: - -```js -// Show the Lock widget, without overriding any options -lock.show(); -``` - -```js -// Show the Lock widget, overriding some options -lock.show({ - allowedConnections: ["twitter", "facebook"], - allowSignUp: false -}); -``` - -::: panel When to set your configuration options -Options should be set when first instantiating Lock `var lock = new Auth0Lock(clientId, domain, options);`. Options should only be passed to `show` in order to override your previously set options while displaying the widget at this particular time and place. - -Previous users of Lock 9 should note that this is a different behavior from `options` in Lock 9, where all options were set as parameters of `show` and not at instantiation. -::: - -There is an additional option that can be set in the `show` method called `flashMessage`. - -### flashMessage - -This object is _only_ available as an option for the `show` method, not for use in the normal `options` object when instantiating Lock. The `flashMessage` object shows an error or success flash message when Lock is shown. It has the following parameters: - -- **type** {String}: The message type, it should be either `error` or `success`. -- **text** {String}: The text to show. - -An example of usage: - -```js -lock.show({ - flashMessage:{ - type: 'success', - text: 'Amazing Success!!' - } -}); -``` - -![Lock - Flash Message](/media/articles/libraries/lock/v10/flashMessage.png) - -A practical application of the `flashMessage` option is to handle authorization errors. The `flashMessage` can be populated with error description text. - -```js -lock.on('authorization_error', function(error) { - lock.show({ - flashMessage: { - type: 'error', - text: error.error_description - } - }); -}); -``` - -So, if `tester@example.com` were now to try to sign in, being a user who is blocked, the user will be shown Lock again, and receive the following error message: - -![Lock - Flash Message](/media/articles/libraries/lock/v10/flashmessage2.png) - -Rather than simply failing to login, and Lock closing. - -## hide() - -```js -hide() -``` - -The `hide` method closes the widget if it is currently open. The widget closes itself under most circumstances, so this method would primarily be invoked in specific use cases only. For instance, one might wish to listen for the `unrecoverable_error` event and then `hide` the Lock and redirect to their own custom error page. Another example is users who are implementing [popup mode](/libraries/lock/v10/popup-mode), and might need to manually `hide` the widget after the `authenticated` event fires. - -Example usage to hide (close) the Lock widget in popup mode: - -```js -// Listen for authenticated event and hide Lock -lock.on("authenticated", function() { - lock.hide(); - - // Whatever else you'd like to do on authenticated event - -}); -``` - -## on() - -```js -on(event, callback) -``` - -Lock will emit events during its lifecycle. The `on` method can be used to listen for particular events and react to them. - -- `show`: emitted when Lock is shown. Has no arguments. -- `hide`: emitted when Lock is hidden. Has no arguments. -- `unrecoverable_error`: emitted when there is an unrecoverable error, for instance when no connection is available. Has the error as the only argument. -- `authenticated`: emitted after a successful authentication. Has the authentication result as the only argument. The authentication result contains the token which can be used to get the user's profile or stored to log them in on subsequent checks. -- `authorization_error`: emitted when authorization fails. Has error as the only argument. -- `hash_parsed`: every time a new Auth0Lock object is initialized in redirect mode (the default), it will attempt to parse the hash part of the url looking for the result of a login attempt. This is a low level event for advanced use cases and `authenticated` and `authorization_error` should be preferred when possible. After that this event will be emitted with `null` if it couldn't find anything in the hash. It will be emitted with the same argument as the `authenticated` event after a successful login or with the same argument as `authorization_error` if something went wrong. This event won't be emitted in [popup mode](/libraries/lock/v10/authentication-modes) because there is no need to parse the url's hash part. -- `forgot_password ready`: emitted when the "Forgot password" screen is shown. (Only in Version >`10.18`) -- `forgot_password submit`: emitted when the user clicks on the submit button of the "Forgot password" screen. (Only in Version >`10.14`) -- `signin submit`: emitted when the user clicks on the submit button of the "Login" screen. (Only in Version >`10.18`) -- `signup submit`: emitted when the user clicks on the submit button of the "Sign Up" screen. (Only in Version >`10.18`) -- `federated login`: emitted when the user clicks on a social connection button. Has the connection name and the strategy as arguments. (Only in Version >`10.18`) - -### The authenticated event - -The `authenticated` event listener has a single argument, an `authResult` object. This object contains the following properties: `accessToken`, `idToken`, `state`, `refreshToken` and `idTokenPayload`. - -An example use of the `authenticated` event: - -```js -// Listen for authenticated event; pass the result to a function as authResult -lock.on("authenticated", function(authResult) { - // Call getUserInfo using the token from authResult - lock.getUserInfo(authResult.accessToken, function(error, profile) { - if (error) { - // Handle error - return; - } - // Store the token from authResult for later use - localStorage.setItem('accessToken', authResult.accessToken); - // Display user information - show_profile_info(profile); - }); -}); -``` - -## resumeAuth() - -If you set the [auth.autoParseHash](/libraries/lock/v10/customization#autoparsehash-boolean-) option to `false`, you'll need to call this method to complete the authentication flow. This method is useful when you're using a client-side router that uses a `#` to handle urls (angular2 with `useHash`, or react-router with `hashHistory`). - -- **hash** {String}: The hash fragment received from the redirect. -- **callback** {Function}: Will be invoked after the parse is done. Has an error (if any) as the first argument and the authentication result as the second one. If there is no hash available, both arguments will be `null`. - -```js -lock.resumeAuth(hash, function(error, authResult) { - if (error) { - alert("Could not parse hash"); - } - console.log(authResult.accessToken); -}); -``` - -## logout() - -Logs out the user. - -- **options** {Object}: This is optional and follows the same rules as [auth0.js logout](/libraries/auth0js#logout) - -```js -lock.logout({ - returnTo: 'https://myapp.com/bye-bye' -}); -``` diff --git a/articles/libraries/lock/v10/auth0js.md b/articles/libraries/lock/v10/auth0js.md deleted file mode 100644 index d87d4b8407..0000000000 --- a/articles/libraries/lock/v10/auth0js.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -section: libraries -description: How to use Lock v10 with auth0.js ---- -# Using Lock With auth0.js - -<%= include('../../../_includes/_version_warning_lock') %> - - -By nature, Lock and the Auth0.js SDK are different things. Lock provides a UI that is customizable (to an extent) with behavior that is customizable (to an extent). It is an easily deployed, easily used interface for Auth0 authentication in custom applications. - -For simple uses, Lock is all that is necessary. However, while using Lock, if more customization is required in an application than Lock allows, functionality from the Auth0.js SDK can be used alongside Lock to meet those needs. An example might be using Lock to handle signups and logins, while using auth0.js to [manage users](/libraries/auth0js#user-management) (read and update user metadata, link user accounts together, and similar tasks). - -### Including auth0.js - -If you are using the Auth0 CDN, you can also include the auth0.js script in the same manner: - -```html - - -``` - -If you installed Lock from npm, you should include `auth0-js` in your project dependencies and import it to pin the particular `auth0-js` version you're using. Before instantiating the `Auth0` object, you will need to require `auth0-js`: - -```js -var auth0 = require('auth0-js'); -``` - -Then, to use `auth0.js`, simply instantiate a new object: - -```js - var webAuth = new auth0.WebAuth({ - domain: '${account.namespace}', - clientID: '${account.clientId}' -}); -``` - -If you need further detail about usage, check out the [Auth0.js Reference](/libraries/auth0js). diff --git a/articles/libraries/lock/v10/authentication-modes.md b/articles/libraries/lock/v10/authentication-modes.md deleted file mode 100644 index 8e446cfdb0..0000000000 --- a/articles/libraries/lock/v10/authentication-modes.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -section: libraries -description: Details about Authentication Modes with Lock V10. -toc: true ---- -# Lock: Authentication Modes - -<%= include('../../../_includes/_version_warning_lock') %> - -Lock can function in two different modes. The default mode is **redirect mode**. In this mode, your user is redirected to be authenticated, and then is returned to the application. In the second mode, **popup mode**, a popup window allows the user to authenticate with the identity provider without leaving the application. - -## Redirect Mode - -![Lock - Redirect](/media/articles/libraries/lock/v10/gif/redirect.gif) - -When you click the IdP button (For example, Facebook) with redirect mode, you are redirected to Facebook momentarily. Redirect mode is the default with Lock 10, and is the recommended mode for almost all use cases. Once you successfully login (to Facebook, in this example), Facebook will redirect you back to your app (through Auth0). The majority of examples or samples in the reference documentation employ redirect mode. - -![Lock - Social Redirect](/media/articles/libraries/lock/v10/gif/social-redirect.gif) - -## Popup Mode - -![Lock - Redirect](/media/articles/libraries/lock/v10/gif/social-popup.gif) - -If after you click on the IdP button (Facebook for example), a popup (new tab or window) is opened, it means you are using popup mode. In that popup, you'll see that Facebook page is displayed. Once you successfully login to Facebook, the popup will be closed and your web app will recognize that the user has been authenticated. The web app has **never been redirected to any other page**. - -::: warning -There is a known bug that prevents popup mode from functioning properly in Android or Firefox on iOS, and in Internet Explorer under certain circumstances. As such we recommend only using redirect mode (or if popup mode is absolutely required, detecting these special cases in which popup mode will fail and selectively enabling redirect mode). -::: - -Implementing Lock with Popup Mode is again a simple change of the `redirect` option from its default. - -```js -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - { - auth: { - redirect: false - } - } -); -``` - -## Database connections and popup mode - -![Lock - Popup](/media/articles/libraries/lock/v10/gif/popup.gif) - -Some Auth0 features such as [MFA](/multifactor-authentication) and [SSO](/sso/single-sign-on) between multiple applications depend on users being redirected to Auth0 to set a cookie on `'${account.namespace}'`. - -When using popup mode, a popup window will be displayed in order to set this cookie and display MFA prompts if necessary; this popup window will be blank if users are not prompted for MFA, which might not be a desirable UX. The reason for this is that cross-origin requests sent from your application to Auth0 are not be able to set cookies. - -If you do not want to display a popup window and do not need MFA or SSO between multiple applications, you can set `sso: false` when using Lock or auth0.js. - -For example: - -```js -var options = { - auth: { - sso: false - } -} -``` diff --git a/articles/libraries/lock/v10/configuration.md b/articles/libraries/lock/v10/configuration.md deleted file mode 100644 index 37645264cf..0000000000 --- a/articles/libraries/lock/v10/configuration.md +++ /dev/null @@ -1,910 +0,0 @@ ---- -section: libraries -toc: true -description: Lock 10 has many configurable options that allow you to change the behavior, appearance, and connectivity of the Lock widget - this resource provides the details on those options for you! ---- -# Lock: Configuration Options - -<%= include('../../../_includes/_version_warning_lock') %> - -The **Auth0Lock** can be configured through the `options` parameter sent to the constructor. These options can alter the way that the Lock widget behaves, how it deals with connections, additional signup fields that you require for your project, the language and text values, colors, and images on the widget, and many more. Take a look at the index below if you know what you are looking for, or browse the options for more details. - -```js -var lock = new Auth0Lock('clientID', 'account.auth0.com', options); -``` - -## Index of Configurable Options - -### Display - -| Option | Description | -| --- | --- | -| [allowAutocomplete](#allowautocomplete-boolean-) | Whether or not to allow autocomplete in the widget | -| [allowedConnections](#allowedconnections-array-) | limit the application connections shown in Lock to a particular set | -| [allowShowPassword](#allowshowpassword-boolean-) | Whether to allow the user to show password as typing | -| [autoclose](#autoclose-boolean-) | Whether or not Lock auto closes after a login | -| [autofocus](#autofocus-boolean-) | Whether or not focus is set on first input field | -| [avatar](#avatar-object-) | Obtain avatar from a non gravatar source | -| [closable](#closable-boolean-) | Whether or not Lock is closable | -| [container](#container-string-) | Embed Lock in a container | -| [language](#language-string-) | Change the language of Lock | -| [languageDictionary](#languagedictionary-object-) | Change text in particular sections of Lock | -| [popupOptions](#popupoptions-object-) | Customize the location of the popup | -| [rememberLastLogin](#rememberlastlogin-boolean-) | Whether to remember the last login option chosen | - -### Theming - -| Option | Description | -| --- | --- | -| [theme](#theme-object-) | The theme object contains the below theming options | -| [authButtons](#authbuttons-object-) | Customize the appearance of specific connection buttons | -| [labeledSubmitButton](#labeledsubmitbutton-boolean-) | whether or not the submit button has text | -| [logo](#logo-string-) | What logo should be used | -| [primaryColor](#primarycolor-string-) | Color of the primary button on the widget | - -### Social - -| Option | Description | -| --- | --- | -| [socialButtonStyle](#socialbuttonstyle-string-) | Force small or large social connection buttons | - -### Authentication - -| Option | Description | -| --- | --- | -| [auth](#auth-object-) | The auth object contains the below auth options | -| [audience](#audience-string-) | The API which will be consuming your `access_token` | -| [autoParseHash](#autoparsehash-boolean-) | Whether or not to automatically parse hash and continue | -| [connectionScopes](#connectionscopes-object-) | Specify connection scopes | -| [params](#params-object-) | Option to send parameters at login | -| [redirect](#redirect-boolean-) | Whether or not to use redirect mode | -| [redirectUrl](#redirecturl-string-) | The URL to redirect to after auth | -| [responseMode](#responsemode-string-) | Option to send response as POST | -| [responseType](#responsetype-string-) | Response as a code or token | -| [sso](#sso-boolean-) | Whether or not to enable Single Sign On behavior in Lock | - -### Database - -| Option | Description | -| --- | --- | -| [additionalSignUpFields](#additionalsignupfields-array-) | Additional fields collected at signup | -| [allowLogin](#allowlogin-boolean-) | Whether or not to allow login on widget | -| [allowForgotPassword](#allowforgotpassword-boolean-) | Whether or not to allow forgot password on widget | -| [allowSignUp](#allowsignup-boolean-) | Whether or not to allow signup on widget | -| [defaultDatabaseConnection](#defaultdatabaseconnection-string-) | Default shown DB connection | -| [initialScreen](#initialscreen-string-) | Which screen to show when the widget is opened | -| [loginAfterSignUp](#loginaftersignup-boolean-) | After signup, whether or not to auto login | -| [forgotPasswordLink](#forgotpasswordlink-string-) | Link to a custom forgot password page | -| [mustAcceptTerms](#mustacceptterms-boolean-) | Whether or not terms must be accepted (checkbox) | -| [prefill](#prefill-object-) | Prefill values for email/username fields | -| [signUpLink](#signuplink-string-) | Set a custom url to fire when clicking "sign up" | -| [usernameStyle](#usernamestyle-string-) | Toggle "username", "password" or "username and password" | - -### Enterprise - -| Option | Description | -| --- | --- | -| [defaultEnterpriseConnection](#defaultenterpriseconnection-string-) | Specifies a connection if more than one present | - -### Other - -| Option | Description | -| --- | --- | -| [oidcConformant](#oidcconformant-boolean-) | Whether or not to use OIDC Conformant mode | -| [clientBaseUrl](#clientbaseurl-string-) | Override your application's base URL | -| [languageBaseUrl](#languagebaseurl-string-) | Override your language file base URL | -| [hashCleanup](#hashcleanup-boolean-) | Override the default removal of the hash from the URL | -| [leeway](#leeway-integer-) | Add leeway for clock skew to JWT expiration times | - ---- - -## Display Options - -### allowAutocomplete {Boolean} - -Determines whether or not the email or username inputs will allow autocomplete (``). Defaults to `false`. - -```js -var options = { - allowAutocomplete: true -}; -``` - -### allowedConnections {Array} - -Array of connections that will be used for the `signin|signup|reset` actions. Defaults to all enabled connections. - -```js -// The following will only display -// username and password sign in form -var options = { - allowedConnections: ['Username-Password-Authentication'] -}; - -// ... social connections only -var options = { - allowedConnections: ['twitter', 'facebook', 'linkedin'] -}; - -// ... enterprise connections only -var options = { - allowedConnections: ['qraftlabs.com'] -}; -``` - -Examples of `allowedConnections`: - -![Lock - Allowed Connections](/media/articles/libraries/lock/v10/customization/lock-allowedconnections-database.png) - -![Lock - Allowed Connections](/media/articles/libraries/lock/v10/customization/lock-allowedconnections-social.png) - -### allowShowPassword {Boolean} - -This option determines whether or not to add a checkbox to the UI which, when selected, will allow the user to show their password when typing it. The option defaults to `false`. - -```js -var options = { - allowShowPassword: true -}; -``` - -Lock with `allowShowPassword` set to `true` and toggled to show the password: - -![Lock - Avatar](/media/articles/libraries/lock/v10/customization/lock-allowshowpassword.png) - -### autoclose {Boolean} - -Determines whether or not the Lock will be closed automatically after a successful sign in. Defaults to false. - -::: note -If the Lock is not `closable` it won't be closed, even if this option is set to true. -::: - -```js -var options = { - autoclose: true -}; -``` - -### autofocus {Boolean} - -If true, the focus is set to the first field on the widget. Defaults to `false` when being rendered on a mobile device, or if a `container` option is provided; defaults to `true` in all other cases. - -```js -var options = { - autofocus: false -}; -``` - -### avatar {Object} - -By default, Gravatar is used to fetch the user avatar and display name, but you can obtain them from anywhere with the `avatar` option. - -```js -var options = { - avatar: { - url: function(email, cb) { - // Obtain the avatar url for the email input by the user, Lock - // will preload the image before displaying it. - // Note that in case of an error you call cb with the error in - // the first arg instead of `null`. - var url = obtainAvatarUrl(email); - cb(null, url); - }, - displayName: function(email, cb) { - // Obtain the display name for the email input by the user. - // Note that in case of an error you call cb with the error in - // the first arg instead of `null`. - var displayName = obtainDisplayName(email); - cb(null, displayName); - } - } -}; -``` - -Or, if you want to display no avatar at all, simply pass in `null`. - -```js -var options = { - avatar: null -}; -``` - -Default behavior with Gravatar: - -![Lock - Avatar](/media/articles/libraries/lock/v10/customization/lock-avatar.png) - -### closable {Boolean} - -Determines whether or not the Lock can be closed. When a `container` option is provided its value is always `false`, otherwise it defaults to `true`. - -```js -var options = { - closable: false -}; -``` - -![Lock - Closable](/media/articles/libraries/lock/v10/customization/lock-closable.png) - -### container {String} - -The `id` of the html element where the widget will be shown. - -::: note -This makes the widget appear inline within your `div` instead of in a modal pop-out window. -::: - -```html -
    - - -``` - -![Lock - Container](/media/articles/libraries/lock/v10/customization/lock-container.png) - -### language {String} - -Specifies the language of the widget. Defaults to "en". See the [internationalization directory](https://github.com/auth0/lock/blob/master/src/i18n/) for a current list of provided languages. - -```js -// select a supported language -var options = { - language: 'es' -}; -``` - -![Lock - Language](/media/articles/libraries/lock/v10/customization/lock-language.png) - -### languageDictionary {Object} - -Allows customization of every piece of text displayed in the Lock. Defaults to {}. See English language [Language Dictionary Specification](https://github.com/auth0/lock/blob/master/src/i18n/en.js) for the full list of `languageDictionary` values able to be altered with this object. - -```js -var options = { - languageDictionary: { - emailInputPlaceholder: "something@youremail.com", - title: "Log me in" - }, -}; -``` - -![Lock - Language Dictionary](/media/articles/libraries/lock/v10/customization/lock-languagedictionary.png) - -Additionally, check out the [Customizing Error Messages](/libraries/lock/v10/customizing-error-messages) page or the [Internationalization](/libraries/lock/v10/i18n) page for more information about the use of the `languageDictionary` option. - -### popupOptions {Object} - -Allows the customization the location of the popup in the screen. Any position and size feature allowed by window.open is accepted. Defaults to {}. - -Options for the `window.open` [position and size][windowopen-link] features. This only applies if `redirect` is set to `false`. - -```js -var options = { - redirect: false, - popupOptions: { width: 300, height: 400, left: 200, top: 300 } -}; -``` - -### rememberLastLogin {Boolean} - -Determines whether or not to show a screen that allows you to quickly log in with the account you used the last time. Defaults to true. -Request for SSO data and enable **Last time you signed in with[...]** message. Defaults to `true`. - -```js -var options = { - rememberLastLogin: false -}; -``` - -## Theming Options - -### theme {Object} - -Theme options are grouped in the `theme` property of the `options` object. - -#### authButtons {Object} - -Allows the customization of buttons in Lock. Each custom connection whose button you desire to customize should be listed by name, each with their own set of parameters. The customizable parameters are listed below: - -- **displayName** {String}: The name to show instead of the connection name when building the button title, such as `LOGIN WITH MYCONNECTION` for login). -- **primaryColor** {String}: The button's background color. Defaults to `#eb5424`. -- **foregroundColor** {String}: The button's text color. Defaults to `#FFFFFF`. -- **icon** {String}: The URL of the icon for this connection. For example: `http://site.com/logo.png`. - -```js -var options = { - theme: { - authButtons: { - "testConnection": { - displayName: "Test Conn", - primaryColor: "#b7b7b7", - foregroundColor: "#000000", - icon: "http://example.com/icon.png" - }, - "testConnection2": { - primaryColor: "#000000", - foregroundColor: "#ffffff", - } - } - } -}; -``` - -#### labeledSubmitButton {Boolean} - -This option indicates whether or not the submit button should have a label, and defaults to `true`. When set to `false`, an icon will be shown instead. - -```js -var options = { - theme: { - labeledSubmitButton: false - } -}; -``` - -![Lock - Labeled Submit Button](/media/articles/libraries/lock/v10/customization/lock-theme-labeledsubmitbutton.png) - -If the label is set to true, which is the default, the label's text can be customized through the [languageDictionary](#languagedictionary-object-) option. - -#### logo {String} - -The value for `logo` is a URL for an image that will be placed in the Lock's header, and defaults to Auth0's logo. It has a recommended max height of `58px` for a better user experience. - -```js -var options = { - theme: { - logo: 'https://example.com/logo.png' - } -}; -``` - -![Lock - Theme - Logo](/media/articles/libraries/lock/v10/customization/lock-theme-logo.png) - -#### primaryColor {String} - -The `primaryColor` property defines the primary color of the Lock; all colors used in the widget will be calculated from it. This option is useful when providing a custom `logo`, to ensure all colors go well together with the `logo`'s color palette. Defaults to `#ea5323`. - -```js -var options = { - theme: { - logo: 'https://example.com/logo.png', - primaryColor: '#31324F' - } -}; -``` - -![Lock - Theme - Primary Color](/media/articles/libraries/lock/v10/customization/lock-theme-primarycolor.png) - -## Social Options - -### socialButtonStyle {String} - -Determines the size of the buttons for the social providers. Possible values are `big` and `small`. The default style depends on the connections that are available: - -- If only social connections are available, it will default to `big` when there are 5 connections at most, and default to `small` otherwise. -- If connections from types other than social are also available, it will default to `big` when there are 3 social connections at most, and default to `small` otherwise. - -First example, with three social connections, and other connections (in this case, a username-password connection) - with forced small buttons. - -```js -var options = { - socialButtonStyle: 'small' -}; -``` - -![Lock - Social Button Style](/media/articles/libraries/lock/v10/customization/lock-socialbuttonstyle-small.png) - -Second example, with `socialButtonStyle` remaining at default behavior - three social connections, with no other connections enabled for this application in the dashboard. - -```js -var options = {}; -``` - -![Lock - Social Button Style](/media/articles/libraries/lock/v10/customization/lock-socialbuttonstyle-default-social.png) - -Third example, with `socialButtonStyle` remaining at default behavior - the app has three social connections, with other connections turned on in the dashboard (in this case, a username-password connection). - -```js -var options = {}; -``` - -![Lock - Social Button Style](/media/articles/libraries/lock/v10/customization/lock-socialbuttonstyle-default.png) - -Fourth example, with three social connections, and no other connections enabled in the dasbboard, but with forced small buttons. - -```js -var options = { - socialButtonStyle: 'small' -}; -``` - -![Lock - Social Button Style](/media/articles/libraries/lock/v10/customization/lock-socialbuttonstyle-small-social.png) - -## Authentication Options - -### auth {Object} - -Authentication options are grouped in the auth property of the options object. - -```js -var options = { - auth: { - params: {param1: "value1"}, - redirect: true, - redirectUrl: "some url", - responseType: "token", - sso: true - } -}; -``` - -### audience {String} - -The `audience` option indicates the API which will be consuming the `access_token` that is received after authentication. - -```js -var options = { - auth: { - audience: 'https://${account.namespace}/userinfo', - } -} -``` - -#### autoParseHash {Boolean} - -When `autoParseHash` is set to `true`, Lock will parse the `window.location.hash` string when instantiated. If set to `false`, you'll have to manually resume authentication using the [resumeAuth](/libraries/lock/v10/api#resumeauth-) method. - -```js -var options = { - auth: { - autoParseHash: false - } -}; -``` - -#### connectionScopes {Object} - -This option allows you to set scopes to be sent to the oauth2/social connection for authentication. - -```js -var options = { - auth: { - connectionScopes: { - 'facebook': ['scope1', 'scope2'] - } - } -}; -``` - -A listing of particular scopes for your social connections can be acquired from the provider in question. For example, [Facebook for Developers](https://developers.facebook.com/docs/facebook-login/permissions/) reference has a listing of separate permissions that can be requested for your connection. - -#### params {Object} - -You can send parameters when starting a login by adding them to the options object. The example below adds a `state` parameter with a value equal to `foo` and also adds a `scope` parameter (which includes the scope, and then the requested attributes). [Read here][authparams-link] to learn more about what `authParams` can be set. - -```js -var options = { - auth: { - params: { - state: 'foo', - scope: 'openid email user_metadata app_metadata picture' - } - } -}; -``` - -::: note -For more details about supported parameters check the [Authentication Parameters][authparams-link] documentation page. -::: - -#### redirect {Boolean} - -Defaults to true. When set to true, redirect mode will be used. If set to false, [popup mode](/libraries/lock/v10/popup-mode) is chosen. - -::: warning -There is a known bug that prevents popup mode from functioning properly in Android or Firefox on iOS, and in Internet Explorer under certain circumstances. As such we recommend either only using redirect mode or detecting these special cases and selectively enabling redirect mode. For more info refer to this [Auth0 Community thread](https://community.auth0.com/questions/9768/popup-login-window-is-not-closed-after-authenticat). -::: - -```js -var options = { - auth: { - redirect: false - } -}; -``` - -#### redirectUrl {String} - -The URL Auth0 will redirect back to after authentication. Defaults to the empty string "" (no redirect URL). - -```js -var options = { - auth: { - redirectUrl: 'http://testurl.com' - } -}; -``` - -::: note -When the `redirectUrl` is provided (set to non blank value) the `responseType` option will be defaulted to `code` if not manually set. -::: - -#### responseMode {String} - -Should be set to `"form_post"` if you want the code or the token to be transmitted via an HTTP POST request to the `redirectUrl`, instead of being included in its query or fragment parts. - -Otherwise, this option should be omitted, and is omitted by default. - -```js -var options = { - auth: { - responseMode: 'form_post' - } -}; -``` - -#### responseType {String} - -The value of `responseType` should be set to "token" for Single Page Applications, and "code" otherwise. Defaults to "code" when redirectUrl is provided, and to "token" otherwise. - -```js -var options = { - auth: { - responseType: 'token' - } -}; -``` - -#### sso {Boolean} - -Tells Lock to use or not the Single Sign On session created by Auth0 so it can prompt the user to login with the last logged in user. The Auth0 session is not tied to this value since it depends on the application's or tenant' settings. - -::: warning -Failing to set this to true will result in multifactor authentication not working correctly. -::: - -```js -var options = { - auth: { - sso: true - } -}; -``` - -## Database Options - -### additionalSignUpFields {Array} - -Extra input fields can be added to the sign up screen with the `additionalSignUpFields` option. Each option added in this manner will then be added to that user's `user_metadata`. See the [user metadata documentation](/metadata) for more information. Every input must have a `name` and a `placeholder`, and an `icon` URL can also be provided. Also, the initial value can be provided with the `prefill` option, which can be a string with the value or a function that obtains it. Other options depend on the type of the field, which is defined via the type option and defaults to "text". - -::: panel Intended for use with database signup only -`additionalSignupFields` are intended for use with database signups only. If you have social sign ups too, you can ask for the additional information after the users sign up (see this [page about custom signup](/libraries/lock/v10/custom-signup#using-lock) for more details). You can use the `databaseAlternativeSignupInstructions` i18n key to display these instructions. -::: - -The new fields are rendered below the regular sign up input fields in the order they are provided. - -#### Text Fields - -Text fields are the default type of additional signup field. Note that a `validator` function can also be provided. - -```js -var options = { - additionalSignUpFields: [{ - name: "address", - placeholder: "enter your address", - // The following properties are optional - icon: "https://example.com/assests/address_icon.png", - prefill: "street 123", - validator: function(address) { - return { - valid: address.length >= 10, - hint: "Must have 10 or more chars" // optional - }; - } - }, - { - name: "full_name", - placeholder: "Enter your full name" - }] -} -``` - -![Lock - Additional Signup Fields](/media/articles/libraries/lock/v10/customization/lock-additionalsignupfields.png) - -#### Select Field - -The signup field `type: "select"` will allow you to use select elements for the user to choose a value from. - -```js -var options = { - additionalSignUpFields: [{ - type: "select", - name: "location", - placeholder: "choose your location", - options: [ - {value: "us", label: "United States"}, - {value: "fr", label: "France"}, - {value: "ar", label: "Argentina"} - ], - // The following properties are optional - icon: "https://example.com/assests/location_icon.png", - prefill: "us" - }] -} -``` - -The `options` array items for `select` fields must adhere to the following format: -`{label: “non empty string”, value: “non empty string”}`, and at least one option must be defined. - -The `options` and `prefill` values can be provided through a function: - -```js -var options = { - additionalSignUpFields: [{ - type: "select", - name: "location", - placeholder: "choose your location", - options: function(cb) { - // obtain options, in case of error you call cb with the error in the - // first arg instead of null - cb(null, options); - }, - icon: "https://example.com/assests/location_icon.png", - prefill: function(cb) { - // obtain prefill, in case of error you call cb with the error in the - // first arg instead of null - cb(null, prefill); - } - }] -} -``` - -#### Checkbox Field - -The third type of custom signup field is the `type: "checkbox"`. The `prefill` value can determine the default state of the checkbox (`true` or `false`), and it is required. - -```js -var options = { - additionalSignUpFields: [{ - type: "checkbox", - name: "newsletter", - prefill: "true", - placeholder: "I hereby agree that I want to receive marketing emails from your company" - }] -} -``` - -::: note -Some use cases may be able to use `additionalSignupFields` data for email templates, such as an option for language preferences, the value of which could then be used to set the language of templated email communications. -::: - -### allowLogin {Boolean} - -When set to `false` the widget won't display the login screen. This is useful if you want to use the widget just for signups (the login and signup tabs in the signup screen will be hidden) or to reset passwords (the back button in the forgot password screen will be hidden). In such cases you may also need to specify the `initialScreen`, `allowForgotPassword` and `allowSignUp` options. It defaults to `true`. - -```js -// -var options = { - allowLogin: false -}; -``` - -![Lock - Allow Login](/media/articles/libraries/lock/v10/customization/lock-allowlogin.png) - -### allowForgotPassword {Boolean} - -When set to false, `allowForgotPassword` hides the "Don't remember your password?" link in the Login screen, making the Forgot Password screen unreachable. Defaults to true. - -::: note -Keep in mind that if you are using a database connection with a custom database which doesn't have a change password script the Forgot Password screen won't be available. -::: - -```js -// -var options = { - allowForgotPassword: false -}; -``` - -![Lock - Allow Forgot Password](/media/articles/libraries/lock/v10/customization/lock-allowforgotpassword.png) - -### allowSignUp {Boolean} - -When set to `false`, hides the login and sign up tabs in the login screen, making the sign up screen unreachable. Defaults to `true`. Keep in mind that if the database connection has sign ups disabled or you are using a custom database which doesn't have a create script, then the sign up screen won't be available. - -Also bear in mind that this option **only** controls client-side appearance, and does not completely stop new sign ups from determined anonymous visitors. If you are looking to fully prevent new users from signing up, you must use the **Disable Sign Ups** option in the dashboard, in the connection settings. - -```js -var options = { - allowSignUp: false -}; -``` - -![Lock - Social Button Style](/media/articles/libraries/lock/v10/customization/lock-allowsignup.png) - -### defaultDatabaseConnection {String} - -Specifies the database connection that will be used when there is more than one available. - -```js -var options = { - defaultDatabaseConnection: 'test-database' -}; -``` - -### initialScreen {String} - -The name of the screen that will be shown when the widget is opened. Valid values are `login`, `signUp`, and `forgotPassword`. If this option is left unspecified, the widget will default to the first screen that is available from that list. - -```js -var options = { - initialScreen: 'forgotPassword' -}; -``` - -### loginAfterSignUp {Boolean} - -Determines whether or not the user will be automatically signed in after a successful sign up. Defaults to `true`. - -```js -var option = { - loginAfterSignUp: false -}; -``` - -### forgotPasswordLink {String} - -Set the URL for a page that allows the user to reset their password. When set to a non-empty string, the user will be sent to the provided URL when clicking the "Don't remember your password?" link in the login screen. - -```js -var options = { - forgotPasswordLink: 'https://yoursite.com/reset-password' -}; -``` - -### mustAcceptTerms {Boolean} - -When set to `true` displays a checkbox input alongside the terms and conditions that must be checked before signing up. The terms and conditions can be specified via the `languageDictionary` option. This option will only take effect for users signing up with database connections. Defaults to `false`. - -```js -var options = { - mustAcceptTerms: true -}; -``` - -### prefill {Object} - -Allows to set the initial value for the email and/or username inputs. When omitted, no initial value will be provided. - -```js -var options = { - prefill: { - email: "someone@auth0.com", - username: "someone" - } -}; -``` - -### signUpLink {String} - -Set the URL to be requested when clicking on the Signup button. - -::: panel Side effects -When set to a non empty string, this option forces `allowSignUp` to `true`. -::: - -```js -var options = { - signUpLink: 'https://yoursite.com/signup' -}; -``` - -### usernameStyle {String} - -Determines what will be used to identify the user for a Database connection that has the `requires_username` flag set (if it is not set, `usernameStyle` option will be ignored). Possible values are `"username"` and `"email"`. By default both `username` and `email` are allowed; setting this option will limit logins to use one or the other. - -```js -var options = { - // Limits logins to usernames only, not emails - usernameStyle: 'username' -}; -``` - -## Enterprise Options - -### defaultEnterpriseConnection {String} - -Specifies the enterprise connection which allows to login using a username and a password that will be used when there is more than one available or there is a database connection. If a `defaultDatabaseConnection` is provided the database connection will be used and this option will be ignored. - -```js -var options = { - defaultEnterpriseConnection: 'test-database' -}; -``` - -### defaultADUsernameFromEmailPrefix {Boolean} - -Resolve the AD placeholder username from the email's prefix. Defaults to `true`. - -```js -var options = { - defaultADUsernameFromEmailPrefix: false -}; -``` - -## Other Options - -### oidcConformant {Boolean} - -Lock should be used in OIDC Conformant mode when embedding it directly in your application. When this mode is enabled, it will force Lock to use Auth0's current authentication pipeline and will prevent it from reaching legacy endpoints. This mode is **not** required when implementing [universal login](/hosted-pages/login). - -To enable OIDC conformant mode, pass a flag in the options object. - -```js -var options = { - oidcConformant: true -} -``` - -Using OIDC Conformant mode in Lock necessitates a cross-origin authentication flow which makes use of third party cookies to process the authentication transaction securely. - -For more information, please see the [OIDC adoption guide](/api-auth/tutorials/adoption) and the [cross-origin authentication documentation](/cross-origin-authentication). - -::: note -Although this flag was present in previous versions, official support was added only in version 10.22.0. -::: - -### clientBaseUrl {String} - -This option can provide a URL to override the application settings base URL. By default, it uses Auth0's CDN URL when the domain has the format `*.auth0.com`. For example, if your URL is `contoso.eu.auth0.com`, then by default, the `clientBaseUrl` is `cdn.eu.auth0.com`. If the `clientBaseUrl` option is set instead, it uses the provided domain. This would only be necessary if your specific use case dictates that your application not use the default behavior. - -```js -var options = { - clientBaseUrl: "http://www.example.com" -}; -``` - -### languageBaseUrl {String} - -Overrides the language source url for Auth0's provided translations. By default, this option uses Auth0's CDN URL `https://cdn.auth0.com` since this is where all of the provided translations are stored. By providing another value, you can use another source for the language translations if needed. - -```js -var options = { - languageBaseUrl: "http://www.example.com" -}; -``` - -### hashCleanup {Boolean} - -When the `hashCleanup` option is enabled, it will remove the hash part of the callback url after the user authentication. It defaults to true. - -```js -var options = { - hashCleanup: false -}; -``` - -### leeway {Integer} - -The `leeway` option can be set to an integer - a value in seconds - which can be used to account for clock skew in JWT expirations. Typically the value is no more than a minute or two at maximum. - -```js -var options = { - leeway: 30 -}; -``` - - - -[authparams-link]: /libraries/lock/v10/sending-authentication-parameters -[windowopen-link]: https://developer.mozilla.org/en-US/docs/Web/API/Window.open#Position_and_size_features diff --git a/articles/libraries/lock/v10/customizing-error-messages.md b/articles/libraries/lock/v10/customizing-error-messages.md deleted file mode 100644 index 2609f827e4..0000000000 --- a/articles/libraries/lock/v10/customizing-error-messages.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -section: libraries -description: Customizing error messages with Lock 10 ---- -# Lock: Customizing Error Messages - -<%= include('../../../_includes/_version_warning_lock') %> - -You can customize the error messages that will be displayed in certain situations by providing a [languageDictionary option](/libraries/lock/v10/customization#languagedictionary-object-). A full listing of available `languageDictionary` fields to customize can be found in the GitHub repository's [English Dictionary file for Lock 10](https://github.com/auth0/lock/blob/master/src/i18n/en.js). Below is an example of some customized error messages: - -```js -// Examples of customized error messages in the languageDictionary option -var options = { - languageDictionary: { - error: { - login: { - "lock.invalid_email_password": "Custom message about invalid credentials", - "lock.network": "Custom message indicating a network error and suggesting the user check connection", - "lock.unauthorized": "Custom message about a failure of permissions", - "too_many_attempts": "Custom message indicating the user has failed to login too many times." - }, - signUp: { - "invalid_password": "Custom message indicating a password was invalid", - "user_exists": "Custom message indicating that a user already exists" - } - } - } -}; - -// Initiating our Auth0Lock -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - options -); -``` - -These errors will be shown on the widget header. diff --git a/articles/libraries/lock/v10/i18n.md b/articles/libraries/lock/v10/i18n.md deleted file mode 100644 index 99e935485e..0000000000 --- a/articles/libraries/lock/v10/i18n.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -section: libraries -description: Lock 10 supports multiple languages, and allows for the addition of other custom language files, as well as for customizing the values of specific pieces of text that are displayed in the Lock widget. ---- -# Lock: Internationalization - -<%= include('../../../_includes/_version_warning_lock') %> - -You can change the language of Lock by using the `language` configuration option. This will pull the corresponding language file from the `i18n` directory in Lock. Take a look at that [i18n directory](https://github.com/auth0/lock/blob/master/src/i18n/) for a current list of provided languages. - -In order to use the below examples, you'll need to first include Lock in your page: - -```html - - -``` - -Then, you will need to define your `options` object, and instantiate Lock. - -```js -// Select a supported language -var options = { - language: 'es' -}; - -// Initiating our Auth0Lock -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - options -); -``` - -The `language` option needs to be a string matching the name of the corresponding file in the `i18n` directory [within Lock](https://github.com/auth0/lock/tree/master/src/i18n). You can look at existing language files to provide an example format to copy for any new languages you wish to add yourself. If and when supported languages are added to Lock, they will be added to the `i18n` directory with new releases. - -::: panel Missing translation values -Translation data for Lock comes from language files which have key-value pairs representing various translations. For some languages, certain values may be missing, in which case you will see a warning: `language does not have property `. We encourage you to submit a [pull request](https://github.com/auth0/lock/tree/master/src/i18n) to add these missing values. Alternatively, you may define the missing values in your Lock `options` (see below). -::: - -You can also customize your own specific dictionary items using the `languageDictionary`option. This is especially useful if you want to keep the language using one of the supported languages, but change the specific wording of a few items, such as re-wording the `title` or making various other labels read different messages, but leaving the remaining text on the widget intact. - -```js -// Customize some languageDictionary attributes -var options = { - languageDictionary: { - emailInputPlaceholder: "something@youremail.com", - title: "Log me in" - }, -}; - -// Initiating our Auth0Lock -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - options -); -``` - -Furthermore, the `languageBaseUrl` option, which takes a string value (a URL), overrides the language source url for Auth0's provided translations. By default it uses to Auth0's CDN URL `https://cdn.auth0.com` because that is where the provided language translations are stored. By providing another value, you can use your own source for the language translations as needed for your applications. - -::: note -For an example of available `languageDictionary` property names, and of how to structure a `language` file, see the [English dictionary file for Lock 10](https://github.com/auth0/lock/blob/master/src/i18n/en.js). And for more information on how to configure Lock, check out the [api reference](/libraries/lock/v10/api) or the full reference of [configuration options](/libraries/lock/v10/customization) that are available. -::: diff --git a/articles/libraries/lock/v10/index.md b/articles/libraries/lock/v10/index.md deleted file mode 100644 index 239bdb936e..0000000000 --- a/articles/libraries/lock/v10/index.md +++ /dev/null @@ -1,158 +0,0 @@ ---- -section: libraries -toc: true -title: Lock 10 for Web -description: A widget that provides a frictionless login and signup experience for your web apps. -img: media/articles/libraries/lock-web.png ---- -# Lock 10 for Web - -<%= include('../../../_includes/_version_warning_lock') %> - -Lock is an embeddable login form, [configurable to your needs][lock-configuration] and ready for use on web apps. It enables you to easily add social identity providers to Lock, allowing your users to login seamlessly using any provider they want. - -::: note -Check out the [Lock repository](https://github.com/auth0/lock) on GitHub. -::: - -## Lock 10 Installation - -You can install Lock 10 via several methods. Select any of the following installation sources that best suit your environment and application. - -### Installation Sources - -Install via [npm](https://npmjs.org): - -```sh -npm install auth0-lock -``` - -Install via [bower](http://bower.io): - -```sh -bower install auth0-lock -``` - -Include via our CDN (with the latest minor and patch release numbers from the [Lock Github repository](https://github.com/auth0/lock/releases)): - -```html - -``` - -::: note -It is recommended that production applications use a specific patch version, or at the very least a specific minor version. Regardless of the method by which Lock is included, the recommendation is that the version should be locked down and only manually updated, to ensure that those updates do not adversely affect your implementation. Check the [GitHub repository](https://github.com/auth0/lock/releases) for a current list of releases. -::: - -### Mobile - -If you are targeting mobile audiences, Auth0 recommends that you add the following meta tag to your application's `head`: - -```html - -``` - -### Bundling Dependencies - -If you are using browserify or webpack to build your project and bundle its dependencies, after installing the `auth0-lock` module, you will need to bundle it with all its dependencies. Examples are available for [Browserify][example-browserify] and [webpack][example-webpack]. - -## Usage - -### 1. Initializing Lock - -First, you'll need to initialize a new `Auth0Lock` object, and provide it with your Auth0 client ID (the unique application ID for each Auth0 application app, which you can get from the [management dashboard](${manage_url})) and your Auth0 domain (for example, `yourname.auth0.com`). - -```js -// Initializing Auth0Lock -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}' -); -``` - -### 2. Authenticating and Getting User Info - -Next, listen using the `on` method for the `authenticated` event. When the event occurs, use the `accessToken` which was received to call the `getUserInfo` method and acquire the user's profile information (as needed). You can also save the token or profile to `localStorage` for later use. - -```js -// Listening for the authenticated event -lock.on("authenticated", function(authResult) { - // Use the token in authResult to getUserInfo() and save it to localStorage - lock.getUserInfo(authResult.accessToken, function(error, profile) { - if (error) { - // Handle error - return; - } - - document.getElementById('nick').textContent = profile.nickname; - - localStorage.setItem('accessToken', authResult.accessToken); - localStorage.setItem('profile', JSON.stringify(profile)); - }); -}); -``` - -You can then manipulate page content and display profile information to the user (for example, displaying their name in a welcome message). - -```html -

    Welcome

    -``` - -::: note -Note that if you are storing the user profile, you will want to `JSON.stringify` the profile object and then, when using it later, `JSON.parse` it, because it will need to be stored in `localStorage` as a string rather than a JSON object. -::: - -### 3. Showing Lock - -Here you're showing the Lock widget after the user clicks a login button; you can just as easily show Lock automatically when arriving at a page by just using `lock.show();` on page load. - -This will show the Lock widget, and paired with the above, you're now ready to handle logins! - -```js -document.getElementById('btn-login').addEventListener('click', function() { - lock.show(); -}); -``` - -## Cross-Origin Authentication - -Embedding Lock within your application, rather than using [universal login](/hosted-pages/login), requires [cross-origin authentication](/cross-origin-authentication). In order to use embedded Lock v10 via cross-origin authentication, you must set the [oidcconformant](/libraries/lock/v10/configuration#oidcconformant-boolean-) option to `true`. - -## Browser Compatibility - -Browser compatibility is ensured for **Chrome**, **Safari**, **Firefox** and **IE >= 10**. Auth0 currently uses [zuul](https://github.com/defunctzombie/zuul) along with [Saucelabs](https://saucelabs.com) to run integration tests on each push. - -## More Examples - -The below widget displays brief examples of implementing Auth0 in several ways: Lock as a modal "popup" widget, Lock embedded inline in a div, Lock Passwordless, a custom UI with [Auth0.js](/libraries/auth0js), and a simple link using the API. - -## Next Steps - -This document has shown how to use Lock 10 within a Single Page Application (SPA). Take a look at the following resources to see how Lock can be used with other kinds of web apps, or how it can be customized for your needs: - -::: next-steps -* [Lock v10 API Reference][lock-api] -* [Lock Configuration Options][lock-configuration] -* [Lock UI Customization][ui-customization] -::: - - - -[auth0-main]: https://auth0.com -[playground-url]: http://auth0.github.com/playground -[new-features]: /libraries/lock/v10/new-features -[example-browserify]: https://github.com/auth0/lock/tree/master/examples/bundling/browserify -[example-webpack]: https://github.com/auth0/lock/tree/master/examples/bundling/webpack -[display-modes]: /libraries/lock/v10/customization#container -[development-notes]: https://github.com/auth0/lock -[release-process]: https://github.com/auth0/lock -[sending-authentication-parameters]: /libraries/lock/v10/sending-authentication-parameters - -[getting-started]: /libraries/lock#lock-10-installation -[lock-configuration]: /libraries/lock/v10/configuration -[ui-customization]: /libraries/lock/v10/ui-customization -[lock-api]: /libraries/lock/v10/api -[lock-auth0js]: /libraries/lock/v10/auth0js -[lock-issues]: /libraries/lock/v10/issues -[migration-guide]: /libraries/lock/v10/migration-guide -[i18n-notes]: /libraries/lock/v10/i18n -[popup-mode]: /libraries/lock/v10/popup-mode diff --git a/articles/libraries/lock/v10/migration-guide.md b/articles/libraries/lock/v10/migration-guide.md deleted file mode 100644 index 5eed2c7561..0000000000 --- a/articles/libraries/lock/v10/migration-guide.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -section: libraries -toc: true -description: Lock 9 to Lock 10 Migration Guide ---- -# Lock 9 to Lock 10 Migration Guide - -The following instructions assume you are migrating from **Lock 9** to the latest **Lock 10**. If you are upgrading from a preview release of Lock 10, please refer to the [preview changes](#upgrading-from-preview-releases). Otherwise, read on! - -If you just want a quick list of new features to see what changes Lock 10 has introduced, take a look at the [new features page](/libraries/lock/v10/new-features). - -The goal of this migration guide is to provide you with all of the information you would need to update your Lock 9 installation to Lock 10. Of course, your first step is to install or include the latest version of Lock 10 rather than Lock 9. Beyond that, take a careful look at each of the areas on this page. You will need to change your implementation to reflect the new changes, not only the initialization of Lock and your calls to Lock methods, but especially any configuration options you were implementing may need inspected and changed. Take a look below for more information! - -## General Changes and Additions - -### User Profiles - -- The profile is no longer fetched automatically after a successful login, you need to call [lock.getUserInfo](/libraries/lock/v10/api#getuserinfo-). - -### Redirect Mode vs Popup Mode - -- Lock now uses Redirect Mode by default. To use [Popup Mode](/libraries/lock/v10/popup-mode), you must enable this explicitly with the [redirect](/libraries/lock/v10/configuration#redirect-boolean-) option `auth: { redirect: false }`. -- You no longer need to call `parseHash` when implementing Redirect Mode. The data returned by that method is provided to the `authenticated` event listener. - -### Configuration and Customization Options - -- The show method is no longer the place to include options to configure Lock's appearance or behavior. You instead pass the options to the constructor and then you [listen for an authenticated event](/libraries/lock/v10/api#on-) instead of providing a callback. - -```js -var options = { - theme: { - logo: 'https://example.com/logo.png', - primaryColor: '#31324F' - } -}; -``` - -```js -var lock = new Auth0Lock('${account.clientId}', '${account.namespace}', options); -``` - -::: note -Lock 10 does _allow_ some configuration methods to be added to the show() method in order to override the defaults for special use cases. See more [in the Lock api doc](/libraries/lock/v10/api#show-). -::: - -### Events Changed - -- Events have significantly changed between Lock 9 and Lock 10. The events that were emitted [in Lock 9](/libraries/lock/v9/events) are no longer used in Lock 10. The new events list for Lock 10 can be found on the [Lock 10 API page](/libraries/lock/v10/api#on-). -- Important notes about the new `authenticated` event: The `authenticated` event listener has a single argument, an `authResult` object. This object contains the following properties: `idToken`, `accessToken`, `state`, `refreshToken` and `idTokenPayload`. Most of them correspond to the arguments which were previously passed to the `show` method's callback. - -### Internationalization - -- Not all languages supported by Lock v9 are supported by Lock v10. Please see the [i18n directory](https://github.com/auth0/lock/tree/master/src/i18n) in the GitHub repository for a current list of supported languages in Lock. - -### Removed Methods - -- The `showSignin`, `showSignup` and `showReset` methods are no longer available. You can emulate the behavior of this options with the [initialScreen](/libraries/lock/v10/configuration#initialscreen-string-), [allowLogin](/libraries/lock/v10/configuration#allowlogin-boolean-), [allowSignUp](/libraries/lock/v10/configuration#allowsignup-boolean-) and [allowForgotPassword](/libraries/lock/v10/configuration#allowforgotpassword-boolean-) options. -- The `getClient` method and the `$auth0` property are no longer available. You can, instead, simply instantiate `Auth0` when using functionality from `auth0.js`. If you need help with how to do this, see the [Using Lock with auth0js page](/libraries/lock/v10/auth0js). - -## Changes to configuration Options - -Some existing options suffered changes, in addition to the beforementioned removals and additions. Please see below for brief descriptions, or consult the [configuration reference](/libraries/lock/v10/configuration) for more information. - -### Display Options - -- The `connections` option was renamed to [allowedConnections](/libraries/lock/v10/configuration#allowedconnections-array-). -- The `focusInput` option was renamed to [autofocus](/libraries/lock/v10/configuration#autofocus-boolean-). -- The `gravatar` option was renamed to [avatar](/libraries/lock/v10/configuration#avatar-object-) and instead of taking `true` and `false` it now takes `null` or an object. -- The `dict` option was split into [language](/libraries/lock/v10/configuration#language-string-) and [languageDictionary](/libraries/lock/v10/configuration#languagedictionary-object-). The `language` option allows you to set the base dictionary for a given language and the `languageDictionary` option allows you to overwrite any translation. Also, the structure of the dictionary has been changed. - -### Theming Options - -- The `icon` option was renamed to [logo](/libraries/lock/v10/configuration#logo-string-) and namespaced under `theme`. Now you use it like this `theme: {logo: "https://example.com/icon.png"}`. -- The [primaryColor](/libraries/lock/v10/configuration#primarycolor-string-) option was namespaced under `theme`. Now you use it like this `theme: {primaryColor: "#ec4889"}`. - -### Social Options - -- The `socialBigButtons` option was renamed to [socialButtonStyle](/libraries/lock/v10/configuration#socialbuttonstyle-string-) and its possible values are `"small"` or `"big"` instead of `true` or `false`. - -### Authentication Options - -- The `authParams` option was renamed to [params](/libraries/lock/v10/configuration#params-object-) and namespaced under `auth`. Now you use it like this `auth: {params: {myparam: "myvalue"}}`. -- The `connection_scopes` parameter under `authParams` is now `connectionScopes` (under the `auth` option) `auth: {connectionScopes: {'facebook': ['scope1', 'scope2']}}`. -- The `popup` option was replaced by [redirect](/libraries/lock/v10/configuration#redirect-boolean-) which is namespaced under `auth`. If you previously used `popup: true` now you need to provide `auth: {redirect: false}`. -- The `callbackURL` option was renamed to [redirectUrl](/libraries/lock/v10/configuration#redirecturl-string-) and namespaced under `auth`. Now you use it like this `auth: {redirectUrl: "https://example.com/callback"}`. -- The [responseType](/libraries/lock/v10/configuration#responsetype-string-) option was namespaced under `auth`. Now you use it like this `auth: {responseType: "code"}`. -- The [sso](/libraries/lock/v10/configuration#sso-boolean-) option was namespaced under `auth`. Now you use it like this `auth: {sso: false}`. - -### Database Options - -- The `disableResetAction` option was renamed to [allowForgotPassword](/libraries/lock/v10/configuration#allowforgotpassword-boolean-). -- The `disableSignUpAction` option was renamed to [allowSignUp](/libraries/lock/v10/configuration#allowsignup-boolean-). -- The `defaultUserPasswordConnection` option has been replaced by the [defaultDatabaseConnection](/libraries/lock/v10/configuration#defaultdatabaseconnection-string-) and the [defaultEnterpriseConnection](/libraries/lock/v10/configuration#defaultenterpriseconnection-string-) options. -- The `resetLink` option was renamed to [forgotPasswordLink](/libraries/lock/v10/configuration#forgotpasswordlink-string-). -- The `signupLink` option was renamed to [signUpLink](/libraries/lock/v10/configuration#signuplink-string-) (change in casing). - -### Other Options - -- The `forceJSONP` option was removed. - -## Further Reading - -- Some other options were added, see [New Features page](/libraries/lock/v10/new-features) for details. -- Check out the [configuration page](/libraries/lock/v10/configuration) for more details on all of the configuration options that are available. -- Take a look at the [api page](/libraries/lock/v10/api) for more details on Lock 10's API. diff --git a/articles/libraries/lock/v10/new-features.md b/articles/libraries/lock/v10/new-features.md deleted file mode 100644 index b1e17b9278..0000000000 --- a/articles/libraries/lock/v10/new-features.md +++ /dev/null @@ -1,216 +0,0 @@ ---- -section: libraries -title: New Features in Lock 10 -description: Describes the new features introduced at Lock v10 -toc: true ---- -# New Features in Lock 10 - -<%= include('../../../_includes/_version_warning_lock') %> - -## Custom sign up fields - -You can add input fields to the sign up form with the new option `additionalSignUpFields`. - -```js -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - { - additionalSignUpFields: [{ - name: "address", // required - placeholder: "enter your address", // required - icon: "https://example.com/address_icon.png", // optional - prefill: "street 123", // optional - validator: function(value) { // optional - // only accept addresses with more than 10 chars - return value.length > 10; - } - }] // more fields could be specified - }); -``` - -If the possible values for the field are predefined, you can add a field with the `"select"` `type`. - -```js -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - { - additionalSignUpFields: [{ - type: "select", // required - name: "location", // required - placeholder: "choose your location", // required - options: [ // required - {value: "us", label: "United States"}, - {value: "fr", label: "France"}, - {value: "ar", label: "Argentina"} - ], - prefill: "us", // optional - icon: "https://example.com/assests/location_icon.png" // optional - }] - }, - function(error, result) { - // handle auth -}); -``` - -The `options` and `prefill` properties can also be functions, which is useful when you need to make a request to obtain their values. - -```js -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - { - additionalSignUpFields: [{ - type: "select", // required - name: "location", // required - placeholder: "choose your location", // required - options: function(cb) { // required - // obtain options, in case of error you call cb with the error in the - // first arg instead of null - cb(null, options); - }, - prefill: function(cb) { // optional - // obtain prefill, in case of error you call cb with the error in the - // first arg instead of null - cb(null, prefill); - }, - icon: "https://example.com/assests/location_icon.png" // optional - }] - }, - function(error, result) { - // handle auth -}); -``` - -## Custom avatar provider - -By default, [Gravatar](http://gravatar.com/) is used to fetch the user avatar and display name, but you can obtain them from anywhere with the `avatar` option. - -```js -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - { - avatar: { - url: function(email, cb) { - // Obtain the avatar url for the email input by the user, Lock - // will preload the image it before displaying it. - // Note that in case of an error you call cb with the error in - // the first arg instead of `null`. - var url = obtainAvatarUrl(email); - cb(null, url); - }, - displayName: function(email, cb) { - // Obtain the display name for the email input by the user. - // Note that in case of an error you call cb with the error in - // the first arg instead of `null`. - var displayName = obtainDisplayName(email); - cb(null, displayName); - } - } - } -); -``` - -If you don't want to display an avatar pass `null`. - -```js -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - { - avatar: null - } -); -``` - -## Prefilled fields - -It is now possible to fill the user's email and/or username input if you know them beforehand with the `prefill` option. - -```js -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - { - prefill: { - email: "someone@example.com", - username: "someone" - } - } -); -``` - -## Authentication options - -Authentication options have been grouped in their own namespace. - -```js -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - { - auth: { - params: {name: "value"}, - redirect: true, - redirectUrl: window.location.href - responseType: "token", - sso: true - } - } -); -``` - -## Initial screen - -You may now choose the screen that will be first displayed when Lock is shown with the `initialScreen` option. The following are valid values: - -* `login` (default); -* `forgotPassword`; -* `signUp`; - -```js -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - { - initialScreen: "signUp" // "login" or "forgotPassword" - } -); -``` - -## Theme options - -Theme options have been grouped in their own namespace. - -```js -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - { - theme: { - logo: "https://example.com/icon.png", - primaryColor: "#ec4889" - } - } -); -``` - -## Sign up Terms and Conditions - -You can ask the user to accept the terms and conditions by clicking a checkbox input before signing up with the `mustAcceptTerms` option. - -```js -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - { - languageDictionary: { - signUpTerms: "I agree to the terms of service and privacy policy." - }, - mustAcceptTerms: true - } -); -``` diff --git a/articles/libraries/lock/v10/selecting-the-connection-for-multiple-logins.md b/articles/libraries/lock/v10/selecting-the-connection-for-multiple-logins.md deleted file mode 100644 index 0d833894d5..0000000000 --- a/articles/libraries/lock/v10/selecting-the-connection-for-multiple-logins.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -section: libraries -description: How to select different connection types for multiple login options with Lock V10. ---- -# Selecting the Connection in Lock - -<%= include('../../../_includes/_version_warning_lock') %> - -Auth0 allows you to offer your users multiple ways of authenticating. This is especially important with SaaS, multi-tenant apps, in which a single app is used by many different organizations, each one of which is potentially using different systems such as LDAP, Active Directory, Google Apps, or username/password stores. - -![](/media/articles/hrd/sd4h-6wlwOsQA1PCQKLAmtQ.png) - -::: note -Selecting the appropriate Identity Providers from multiple options is called "Home Realm Discovery". A pompous name for a simple problem. -::: - -## Option 1: Programmatically - -When you initiate an authentication transaction with Auth0 you can optionally send a `connection` parameter. This value maps directly with any connection defined in the [Dashboard](${manage_url}). - -If using the [Lock](/libraries/lock/v10), this is as simple as initiating Lock with the following option: - -```js -var lock = new Auth0Lock( - '${account.clientId}', - '${account.namespace}', - { - allowedConnections: ['YOUR CONNECTION HERE']; - } -); -``` - -::: note -Note that you can also provide the `allowedConnections` option to the `lock.show()` method if providing it at instantiation is not ideal for your use case. Please refer to the [API documentation](/libraries/lock/v10/api#show-) for the `show` method for more information. -::: - -There are multiple practical ways of determining which of your `connection` value to indicate for any given user. Here are two common scenarios: - -* You can use vanity URLs: `https://{connection}.yoursite.com` or `https://www.yoursite.com/{connection}`. When a user arrives at your application with the vanity URL, you can pick up that value and pass it to Lock as the `allowedConnections` value. -* You can just ask the user to pick from a list of all of your available connections (or those you want to be chosen from) at some point, and then show only that connection to that user. -* You could use non-human-readable connection names and use some external mechanism to map these to users (for example, through a primary verification, out of band channel for example). - -::: note -The first two methods above assume it is acceptable for your app to disclose the names of all of your connections, which may not be appropriate for your application. -::: - -## Option 2: Using Email Domains with Lock - -The [Lock](/libraries/lock/v10) has built in functionality for identity provider selection. For social connections it will show logos for all those enabled in that particular app. - -An additional feature in the Lock is the use of email domains as a way of routing authentication requests. Enterprise connections in Auth0 can be mapped to `domains`. For example, when configuring an ADFS or a SAML-P identity provider: - -![](/media/articles/libraries/lock/enterprise-connection.png) - -If a connection has domains mapped to it, then the password input field gets disabled automatically when a user is typing an e-mail with a mapped domain. - -![Lock using HRD/SSO](/media/articles/libraries/lock/hrd-sso.png) - -In the example above the domain `auth0.com` has been mapped to an enterprise connection. - -Notice that you can associate multiple domains to a single connection. diff --git a/articles/libraries/lock/v10/sending-authentication-parameters.md b/articles/libraries/lock/v10/sending-authentication-parameters.md deleted file mode 100644 index 1512bdea40..0000000000 --- a/articles/libraries/lock/v10/sending-authentication-parameters.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -section: libraries -description: Lock V10 documentation on setting authentication parameters. ---- -# Lock: Authentication Parameters - -<%= include('../../../_includes/_version_warning_lock') %> - -You can send parameters when starting a login by adding them to the options object. The example below adds a `state` parameter with a value equal to `'foo'`. - -```js -var options = { - auth: { - params: {state: 'foo'}, - } -}; -``` - -The following parameters are supported: `access_token`, `scope`, `protocol`, `device`, `request_id`, `nonce` and `state`. - -::: note -This would be analogous to triggering the login with `https://${account.namespace}/authorize?state=foo&...`. -::: - -## Supported parameters - -### scope {string} - -```js -var options = { - auth: { - params: {scope: 'openid email user_metadata app_metadata picture'}, - } -}; -``` - -There are different values supported for scope: - -* `scope: 'openid'`: _(default)_ It will return not only the `access_token`, but also an `id_token` which is a JSON Web Token (JWT). The JWT will only contain the user ID (`sub` claim). -* `scope: 'openid profile'`: will return all the user attributes in the token. Keep in mind that JWTs are sent on every API request, so it is desirable to keep them as small as possible. -* `scope: 'openid {attr1} {attr2} {attrN}'`: If you want only specific user attributes to be part of the `id_token` (For example: `scope: 'openid name email picture'`). When selecting specific attributes, the attributes chosen are from those available in the user's profile, which will vary from application to application. - -For more information about scopes, see the [scopes documentation page](/scopes). - -#### Example: retrieve a token with the profile data - -If you want to do this using Lock widget version 10, you should add the `scope` parameter. For example in AngularJS you would use the initializing method of `authProvider`: - -```js -authProvider.init({ - domain: AUTH0_DOMAIN, - clientID: AUTH0_CLIENT_ID, - loginUrl: '/login', - - auth: { - params: { - scope: 'openid profile' - } - } -}); -``` - -::: note -There is also a `connectionScopes` configuration option for Lock 10, which allows you to specify scopes on any specific connection. This will be useful if you want to initially start with a set of scopes (defined on the dashboard), but later on request additional permissions or attributes. Read more about it on the [Lock Configuration Options](/libraries/lock/v10/customization#connectionscopes-object-) page. -::: - -### state {string} - -The `state` parameter is an arbitrary state value that will be mantained across redirects. It is useful to mitigate [CSRF attacks](http://en.wikipedia.org/wiki/Cross-site_request_forgery) and for any contextual information, [such as a return url](/tutorials/redirecting-users), that you might need after the authentication process is finished. - -[Click here to learn more about how to send/receive the state parameter.](/protocols/oauth-state) diff --git a/articles/libraries/lock/v10/ui-customization.md b/articles/libraries/lock/v10/ui-customization.md deleted file mode 100644 index 2759d6921d..0000000000 --- a/articles/libraries/lock/v10/ui-customization.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -section: libraries -description: Customizing the appearance of your Lock widget can be important for branding and a cohesive UI, and this resource highlights the ways in which you can do so while implementing Lock in your project. ---- -# Lock: UI Customization - -<%= include('../../../_includes/_version_warning_lock') %> - -You can customize the appearance of your Lock widget in a few different ways. The best and safest way to do so is with the provided JavaScript options. - -## JavaScript Options - -You can set up a variety of customizations to your Lock via the `options` parameter when you instantiate your Lock. Some of them allow you to customize your UI. The UI customization options are a work in progress - we expect to be adding more as we go. - -First, you'll define the `options` object, containing whichever options you're wanting to customize. Then you'll need to include that options object as the third parameter when you instantiate Lock; more on that below. - -### Theming Options - -There are a couple of theming options currently available, namespaced under the `theme` property. - -#### logo {String} - -![Lock - Theme - Logo](/media/articles/libraries/lock/v10/customization/lock-theme-logo.png) - -The value for `logo` is a URL for an image that will be placed in the Lock's header, and defaults to Auth0's logo. It has a recommended max height of `58px` for a better user experience. - -```js -var options = { - theme: { - logo: 'https://example.com/logo.png' - } -}; -``` - -#### primaryColor {String} - -![Lock - Theme - Primary Color](/media/articles/libraries/lock/v10/customization/lock-theme-primarycolor.png) - -The `primaryColor` property defines the primary color of the Lock; all colors used in the widget will be calculated from it. This option is useful when providing a custom `logo`, to ensure all colors go well together with the `logo`'s color palette. Defaults to `#ea5323`. - -```js -var options = { - theme: { - logo: 'https://example.com/logo.png', - primaryColor: '#31324F' - } -}; -``` - -#### authButtons {Object} - -Allows the customization of buttons in Lock. Each custom connection whose button you desire to customize should be listed by name, each with their own set of parameters. The customizable parameters are listed below: - -- **displayName** {String}: The name to show instead of the connection name when building the button title, such as `LOGIN WITH MYCONNECTION` for login). -- **primaryColor** {String}: The button's background color. Defaults to `#eb5424`. -- **foregroundColor** {String}: The button's text color. Defaults to `#FFFFFF`. -- **icon** {String}: The URL of the icon for this connection. For example: `http://site.com/logo.png`. - -```js -var options = { - theme: { - authButtons: { - "testConnection": { - displayName: "Test Conn", - primaryColor: "#b7b7b7", - foregroundColor: "#000000", - icon: "http://example.com/icon.png" - }, - "testConnection2": { - primaryColor: "#000000", - foregroundColor: "#ffffff", - } - } - } -}; -``` - -### Customizing Text - -The `languageDictionary` option allows customization of every piece of text displayed in the Lock. Defaults to {}. See below for an example. - -```js -var options = { - languageDictionary: { - emailInputPlaceholder: "something@youremail.com", - title: "Log me in" - }, -}; -``` - -![Lock - Language Dictionary](/media/articles/libraries/lock/v10/customization/lock-languagedictionary.png) - -::: note -For a complete list of the items able to be customized using `languageDictionary`, see the [English Language Dictionary Specification](https://github.com/auth0/lock/blob/master/src/i18n/en.js) in the repository. -::: - -### Instantiating Lock - -Finally, you'll want to go ahead and instantiate your Lock, with the `options` object that you've defined with your custom options in it. - -```js -// Initiating our Auth0Lock -var lock = new Auth0Lock('${account.clientId}', '${account.namespace}', options); -``` - -## Overriding CSS - -Customizing your Lock by overriding its CSS isn't the recommended method with Lock 10. The issue is that with new releases of Lock, some styling may change, leading to unintended problems if you are overriding the CSS. Additonally, it's possible to simply overlook use of styles in other places and while the change may look fine in one view, it might not in another. - -If you still intend to override CSS to further style your Lock, we recommend that you use a specific patch version of Lock rather than a major or minor version, so that you limit the amount of unexpected results that may occur when you alter the styles, and then another patch is deployed that might cause unexpected behavior in your UI due to the changes. This can be done by ensuring that you specify that patch verion (`x.y.z`) when including Lock, or downloading it. - -Additionally, we of course recommend that you test your CSS changes exhaustively, to ensure that the experience is the one you intend it to be for your customers. - -::: panel-warning Regarding Lock CSS Themes -At this time, Auth0 doesn't offer any alternative pre-made CSS themes for Lock 10, and the ones that existed for earlier versions of Lock will not work with Lock 10. -::: - -## Further Information - -If you're looking for more detailed information while working to customize Lock for your application, check out the [configuration options](/libraries/lock/v10/customization) page or the [Lock API](/libraries/lock/v10/api) page! - -If you have specific theming options that you would like to see added, let us know. We are working on improving the customization options that are available through JavaScript, and this list will be updated as new options are added. diff --git a/articles/libraries/lock/v11/api.md b/articles/libraries/lock/v11/api.md index 9dbf23c18c..58949c9ed4 100644 --- a/articles/libraries/lock/v11/api.md +++ b/articles/libraries/lock/v11/api.md @@ -2,10 +2,17 @@ section: libraries toc: true description: Details on the Lock v11 API. +topics: + - libraries + - lock +contentType: + - reference +useCase: + - add-login --- # Lock API Reference -Lock has many methods, features, and configurable options. This reference is designed to direct you to the ones that you need, and discuss how to use them. Click below to go straight the method you're looking for, or just browse! If you're looking for information about events emitted by Lock, they're listed under the [on()](#on-event-callback-) method section! +Lock has many methods, features, and configurable options. This reference is designed to direct you to the ones that you need, and discuss how to use them. Click below to go straight the method you're looking for, or just browse! If you're looking for information about events emitted by Lock, they're listed under the [on()](#on-) method section! - [new Auth0Lock](#auth0lock) - Instantiating Lock - [getUserInfo()](#getuserinfo-) - Obtaining the profile of a logged in user @@ -30,26 +37,42 @@ Initializes a new instance of `Auth0Lock` configured with your application's `cl **Example:** ```js -var clientId = '${account.clientId}'; -var domain = '${account.namespace}'; -// Instantiate Lock - without custom options -var lock = new Auth0Lock(clientId, domain); - -// Listen for the authenticated event and get profile -lock.on("authenticated", function(authResult) { - lock.getUserInfo(authResult.accessToken, function(error, profile) { - if (error) { - // Handle error - return; - } +var Auth = (function() { - // Save token and profile locally - localStorage.setItem("accessToken", authResult.accessToken); - localStorage.setItem("profile", JSON.stringify(profile)); + var privateStore = {}; - // Update DOM - }); -}); + function Auth() { + // Instantiate Lock - without custom options + this.lock = new Auth0Lock( + '', + '' + ); + } + + Auth.prototype.getProfile = function() { + return privateStore.profile; + }; + + Auth.prototype.authn = function() { + // Listening for the authenticated event and get profile + this.lock.on("authenticated", function(authResult) { + // Use the token in authResult to getUserInfo() and save it if necessary + this.getUserInfo(authResult.accessToken, function(error, profile) { + if (error) { + // Handle error + return; + } + + //save Access Token only if necessary + privateStore.accessToken = accessToken; + privateStore.profile = profile; + + // Update DOM + }); + }); + }; + return Auth; +}()); ``` ## getUserInfo() @@ -58,7 +81,7 @@ lock.on("authenticated", function(authResult) { getUserInfo(accessToken, callback) ``` -Once the user has logged in and you are in possesion of a token, you can use that token to obtain the user's profile with `getUserInfo`. This method replaces the deprecated `getProfile()`. +Once the user has logged in and you are in possession of a token, you can use that token to obtain the user's profile with `getUserInfo`. This method replaces the deprecated `getProfile()`. - **accessToken {String}**: User token. - **callback {Function}**: Will be invoked after the user profile been retrieved. @@ -191,34 +214,60 @@ Lock will emit events during its lifecycle. The `on` method can be used to liste - `hash_parsed`: every time a new Auth0Lock object is initialized in redirect mode (the default), it will attempt to parse the hash part of the url looking for the result of a login attempt. This is a low level event for advanced use cases and `authenticated` and `authorization_error` should be preferred when possible. After that this event will be emitted with `null` if it couldn't find anything in the hash. It will be emitted with the same argument as the `authenticated` event after a successful login or with the same argument as `authorization_error` if something went wrong. This event won't be emitted in [popup mode](/libraries/lock/v11/authentication-modes) because there is no need to parse the url's hash part. - `forgot_password ready`: emitted when the "Forgot password" screen is shown. (Only in Version >`10.18`) - `forgot_password submit`: emitted when the user clicks on the submit button of the "Forgot password" screen. (Only in Version >`10.14`) +- `signin ready`: emitted when the "Sign in" screen is shown. +- `signup ready`: emitted when the "Sign up" screen is shown. - `signin submit`: emitted when the user clicks on the submit button of the "Login" screen. (Only in Version >`10.18`) - `signup submit`: emitted when the user clicks on the submit button of the "Sign Up" screen. (Only in Version >`10.18`) - `federated login`: emitted when the user clicks on a social connection button. Has the connection name and the strategy as arguments. (Only in Version >`10.18`) +- `socialOrPhoneNumber ready`: emitted when the Passwordless screen with Social + Phone Number is shown +- `socialOrPhoneNumber submit`: emitted when the Passwordless screen with Social + Phone Number is submitted +- `socialOrEmail ready`: emitted when the Passwordless screen with Social + Email is shown +- `socialOrEmail submit`: emitted when the Passwordless screen with Social + Email is submitted +- `vcode ready`: emitted when the Passwordless screen with the one-time-password is shown +- `vcode submit`: emitted when the Passwordless screen with the one-time-password is submitted The `authenticated` event listener has a single argument, an `authResult` object. This object contains the following properties: `accessToken`, `idToken`, `state`, `refreshToken` and `idTokenPayload`. An example use of the `authenticated` event: ```js -// Listen for authenticated event; pass the result to a function as authResult -lock.on("authenticated", function(authResult) { - // Call getUserInfo using the token from authResult - lock.getUserInfo(authResult.accessToken, function(error, profile) { - if (error) { - // Handle error - return; - } - // Store the token from authResult for later use - localStorage.setItem('accessToken', authResult.accessToken); - // Display user information - show_profile_info(profile); - }); -}); +var Auth = (function() { + + var privateStore = {}; + + function Auth() { + this.lock = new Auth0Lock( + '', + '' + ); + } + + Auth.prototype.getProfile = function() { + return privateStore.profile; + }; + + Auth.prototype.authn = function() { + // Listening for the authenticated event + this.lock.on("authenticated", function(authResult) { + // Use the token in authResult to getUserInfo() and save it if necessary + this.getUserInfo(authResult.accessToken, function(error, profile) { + if (error) { + // Handle error + return; + } + + privateStore.profile = profile; + + }); + }); + }; + return Auth; +}()); ``` ## resumeAuth() -If you set the [auth.autoParseHash](/libraries/lock/v11/configuration#autoparsehash-boolean-) option to `false`, you'll need to call this method to complete the authentication flow. This method is useful when you're using a client-side router that uses a `#` to handle urls (angular2 with `useHash`, or react-router with `hashHistory`). +This method can only be used when you set the [auth.autoParseHash](/libraries/lock/v11/configuration#autoparsehash-boolean-) option to `false`. You'll need to call `resumeAuth` to complete the authentication flow. This method is useful when you're using a client-side router that uses a `#` to handle urls (angular2 with `useHash`, or react-router with `hashHistory`). - **hash** {String}: The hash fragment received from the redirect. - **callback** {Function}: Will be invoked after the parse is done. Has an error (if any) as the first argument and the authentication result as the second one. If there is no hash available, both arguments will be `null`. @@ -228,6 +277,7 @@ lock.resumeAuth(hash, function(error, authResult) { if (error) { alert("Could not parse hash"); } + //This is just an example; you should not log Access Tokens in production. console.log(authResult.accessToken); }); ``` diff --git a/articles/libraries/lock/v11/auth0js.md b/articles/libraries/lock/v11/auth0js.md deleted file mode 100644 index 63e285a1aa..0000000000 --- a/articles/libraries/lock/v11/auth0js.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -section: libraries -description: How to use Lock v11 with auth0.js v9 ---- -# Using Lock With auth0.js - -By nature, Lock and the Auth0.js SDK are different things. Lock provides a UI that is customizable (to an extent) with behavior that is customizable (to an extent). It is an easily deployed, easily used interface for Auth0 authentication in custom applications. - -For simple uses, Lock is all that is necessary. However, while using Lock, if more customization is required in an application than Lock allows, functionality from the Auth0.js SDK can be used alongside Lock to meet those needs. An example might be using Lock to handle signups and logins, while using auth0.js to [manage users](/libraries/auth0js#user-management) (read and update user metadata, link user accounts together, and similar tasks). - -### Including auth0.js - -If you are using the Auth0 CDN, you can also include the auth0.js script in the same manner: - -```html - - -``` - -If you installed Lock from npm, you should include `auth0-js` in your project dependencies and import it to pin the particular `auth0-js` version you're using. Before instantiating the `Auth0` object, you will need to require `auth0-js`: - -```js -var auth0 = require('auth0-js'); -``` - -Then, to use `auth0.js`, simply instantiate a new object: - -```js -var webAuth = new auth0.WebAuth({ - domain: '${account.namespace}', - clientID: '${account.clientId}' -}); -``` - -If you need further detail about usage, check out the [Auth0.js v9 Reference](/libraries/auth0js). diff --git a/articles/libraries/lock/v11/authentication-modes.md b/articles/libraries/lock/v11/authentication-modes.md index 9b971cad37..b11a8d6310 100644 --- a/articles/libraries/lock/v11/authentication-modes.md +++ b/articles/libraries/lock/v11/authentication-modes.md @@ -2,10 +2,18 @@ section: libraries description: Details about Authentication Modes with Lock v11. toc: true +topics: + - libraries + - lock +contentType: + - how-to + - concept +useCase: + - add-login --- # Lock Authentication Modes -Lock can function in two different modes. The default mode is **redirect mode**. In this mode, your user is redirected to be authenticated, and then is returned to the application. In the second mode, **popup mode**, a popup window allows the user to authenticate with the identity provider without leaving the application. +Lock can function in two different modes. The default mode is **redirect mode**. In this mode, your user is redirected to be authenticated, and then is returned to the application. In the second mode, **popup mode**, a popup window allows the user to authenticate with the identity provider without leaving the application. ## Redirect Mode @@ -15,10 +23,6 @@ When you click the IdP button (For example, Facebook) with redirect mode, you ar If after you click on the IdP button (Facebook for example), a popup (new tab or window) is opened, it means you are using popup mode. In that popup, you'll see that Facebook page is displayed. Once you successfully login to Facebook, the popup will be closed and your web app will recognize that the user has been authenticated. The web app has **never been redirected to any other page**. -::: warning -There is a known bug that prevents popup mode from functioning properly in Android or Firefox on iOS, and in Internet Explorer under certain circumstances. As such we recommend only using redirect mode (or if popup mode is absolutely required, detecting these special cases in which popup mode will fail and selectively enabling redirect mode). -::: - Implementing Lock with Popup Mode is again a simple change of the `redirect` option from its default. ```js @@ -33,13 +37,19 @@ var lock = new Auth0Lock( ); ``` -## Database connections and popup mode +::: note +Multi-factor authentication (MFA) is not supported when Lock is in popup mode and embedded in your application. +::: + +::: note +Popup mode does not work with Universal Login. +::: -Some Auth0 features such as [MFA](/multifactor-authentication) and [SSO](/sso/single-sign-on) between multiple applications depend on users being redirected to Auth0 to set a cookie on `'${account.namespace}'`. +Some Auth0 features such as [Single Sign-out (SSO)](/sso/current/sso-auth0) between multiple applications depend on users being redirected to Auth0 to set a cookie on `'${account.namespace}'`. -When using popup mode, a popup window will be displayed in order to set this cookie and display MFA prompts if necessary. If prompts are unnecessary, this popup window will be blank and be in a hidden iframe to minimize disruption. The reason for this is that cross-origin requests sent from your application to Auth0 are not be able to set cookies. +When using popup mode, a popup window will be displayed in order to set this cookie. If prompts are unnecessary, this popup window will be blank and be in a hidden iframe to minimize disruption. The reason for this is that cross-origin requests sent from your application to Auth0 are not be able to set cookies. -If you do not want to display a popup window and do not need MFA or SSO between multiple applications, you can set `sso: false` when using Lock or auth0.js. +If you do not want to display a popup window and do not need SSO between multiple applications, you can set `sso: false` when using Lock or auth0.js. For example: diff --git a/articles/libraries/lock/v11/configuration.md b/articles/libraries/lock/v11/configuration.md index 3de60e9cec..d5c1e9492c 100644 --- a/articles/libraries/lock/v11/configuration.md +++ b/articles/libraries/lock/v11/configuration.md @@ -2,64 +2,69 @@ section: libraries toc: true description: Lock v11 has many configurable options that allow you to change the behavior, appearance, and connectivity of the Lock widget - this resource provides the details on those options for you! +topics: + - libraries + - lock +contentType: + - how-to + - reference +useCase: + - add-login --- # Lock Configuration Options -The **Auth0Lock** can be configured through the `options` parameter sent to the constructor. These options can alter the way that the Lock widget behaves, how it deals with connections, additional signup fields that you require for your project, the language and text values, colors, and images on the widget, and many more. Take a look at the index below if you know what you are looking for, or browse the options for more details. +The **Auth0Lock** can be configured through the `options` parameter sent to the constructor. These options can alter the way that the Lock widget behaves, how it deals with connections, additional signup fields that you require for your project, the language and text values, colors, and images on the widget, and many more. Take a look at the index below if you know what you are looking for, or browse the options for more details. ```js var lock = new Auth0Lock('clientID', 'account.auth0.com', options); ``` -## Index of Configurable Options - -### Display +## UI | Option | Description | | --- | --- | -| [allowAutocomplete](#allowautocomplete-boolean-) | Whether or not to allow autocomplete in the widget | -| [allowedConnections](#allowedconnections-array-) | limit the application connections shown in Lock to a particular set | -| [allowShowPassword](#allowshowpassword-boolean-) | Whether to allow the user to show password as typing | -| [autoclose](#autoclose-boolean-) | Whether or not Lock auto closes after a login | -| [autofocus](#autofocus-boolean-) | Whether or not focus is set on first input field | -| [avatar](#avatar-object-) | Obtain avatar from a non gravatar source | -| [closable](#closable-boolean-) | Whether or not Lock is closable | -| [container](#container-string-) | Embed Lock in a container | -| [language](#language-string-) | Change the language of Lock | +| [allowAutocomplete](#allowautocomplete-boolean-) | Enable or disable autocompletion on the email or username inputs | +| [allowPasswordAutocomplete](#allowpasswordautocomplete-boolean-) | Enable or disable autocompletion on password input | +| [allowShowPassword](#allowshowpassword-boolean-) | Specifies if the user can choose to show password while typing it | +| [allowedConnections](#allowedconnections-array-) | List of connections that will be available to perform authentication | +| [autoclose](#autoclose-boolean-) | Specifies if Lock closes after a login | +| [autofocus](#autofocus-boolean-) | Specifies if focus is set on the first input field | +| [avatar](#avatar-object-) | Specifies if an avatar and a username should be displayed on the Lock's header once an email or username has been entered and how to obtain it | +| [closable](#closable-boolean-) | Determines whether or not Lock can be closed | +| [container](#container-string-) | The HTML element where Lock will be rendered. This causes Lock to appear inline instead of in a modal window | +| [flashMessage](#) | Shows an `error` or `success` flash message when Lock is shown | +| [language](#language-string-) | Specifies the language of the widget | | [languageDictionary](#languagedictionary-object-) | Change text in particular sections of Lock | -| [popupOptions](#popupoptions-object-) | Customize the location of the popup | -| [rememberLastLogin](#rememberlastlogin-boolean-) | Whether to remember the last login option chosen | +| [popupOptions](#popupoptions-object-) | Customize the location of the popup in the screen | +| [rememberLastLogin](#rememberlastlogin-boolean-) | Whether or not to show a screen that allows you to quickly log in with the account you used the last time | +| [scrollGlobalMessagesIntoView](#scrollglobalmessagesintoview-boolean-) | Specify if a globalMessage should be scrolled into the user's viewport | + +## Theme -### Theming +Theme options are grouped in the `theme` property of the `options` object. | Option | Description | | --- | --- | -| [theme](#theme-object-) | The theme object contains the below theming options | | [authButtons](#authbuttons-object-) | Customize the appearance of specific connection buttons | | [labeledSubmitButton](#labeledsubmitbutton-boolean-) | whether or not the submit button has text | | [logo](#logo-string-) | What logo should be used | | [primaryColor](#primarycolor-string-) | Color of the primary button on the widget | -### Social - -| Option | Description | -| --- | --- | -| [socialButtonStyle](#socialbuttonstyle-string-) | Force small or large social connection buttons | +## Authentication -### Authentication +Authentication options are grouped in the `auth` property of the `options` object. | Option | Description | | --- | --- | -| [auth](#auth-object-) | The auth object contains the below auth options | -| [audience](#audience-string-) | The API which will be consuming your `access_token` | +| [audience](#audience-string-) | The API which will be consuming your Access Token | | [autoParseHash](#autoparsehash-boolean-) | Whether or not to automatically parse hash and continue | -| [connectionScopes](#connectionscopes-object-) | Specify connection scopes | +| [connectionScopes](#connectionscopes-object-) | Specify connection scopes | | [params](#params-object-) | Option to send parameters at login | | [redirect](#redirect-boolean-) | Whether or not to use redirect mode | | [redirectUrl](#redirecturl-string-) | The URL to redirect to after auth | | [responseMode](#responsemode-string-) | Option to send response as POST | | [responseType](#responsetype-string-) | Response as a code or token | -| [sso](#sso-boolean-) | Whether or not to enable Single Sign On behavior in Lock | +| [sso](#sso-boolean-) | Determines whether Single Sign-On is enabled or not in Lock | ### Database @@ -73,33 +78,41 @@ var lock = new Auth0Lock('clientID', 'account.auth0.com', options); | [initialScreen](#initialscreen-string-) | Which screen to show when the widget is opened | | [loginAfterSignUp](#loginaftersignup-boolean-) | After signup, whether or not to auto login | | [forgotPasswordLink](#forgotpasswordlink-string-) | Link to a custom forgot password page | +| [showTerms](#showterms-boolean-) | Specify if signup terms should be display | | [mustAcceptTerms](#mustacceptterms-boolean-) | Whether or not terms must be accepted (checkbox) | | [prefill](#prefill-object-) | Prefill values for email/username fields | | [signUpLink](#signuplink-string-) | Set a custom url to fire when clicking "sign up" | -| [usernameStyle](#usernamestyle-string-) | Toggle "username", "password" or "username and password" | +| [usernameStyle](#usernamestyle-string-) | Limit username field to accept only "username" values or only "email" values | +| [signUpFieldsStrictValidation](#signUpFieldsStrictValidation-boolean-) | Strict format validation for username and email fields at signup | -### Enterprise +## Enterprise | Option | Description | | --- | --- | | [defaultEnterpriseConnection](#defaultenterpriseconnection-string-) | Specifies a connection if more than one present | +## Passwordless + +| Option | Description | +| --- | --- | +| [passwordlessMethod](#passwordlessmethod-string-) | When using `Auth0LockPasswordless` with an email connection, you can use this option to pick between sending a [code](/connections/passwordless/spa-email-code) or a [magic link](/connections/passwordless/spa-email-link) to authenticate the user | + ### Other | Option | Description | | --- | --- | -| [clientBaseUrl](#clientbaseurl-string-) | Override your application's base URL | +| [configurationBaseUrl](#configurationbaseurl-string-) | Override your application's base URL | | [languageBaseUrl](#languagebaseurl-string-) | Override your language file base URL | | [hashCleanup](#hashcleanup-boolean-) | Override the default removal of the hash from the URL | -| [leeway](#leeway-integer-) | Add leeway for clock skew to JWT expiration times | +| [connectionResolver](#connectionresolver-function-) | Optional callback function for choosing a connection based on the username information | --- -## Display Options +## UI Options ### allowAutocomplete {Boolean} -Determines whether or not the email or username inputs will allow autocomplete (``). Defaults to `false`. +Determines whether or not the email or username fields will allow autocomplete (``). Defaults to `false`. ```js var options = { @@ -107,6 +120,32 @@ var options = { }; ``` +### allowPasswordAutocomplete {Boolean} + +Determines whether or not the password field will allow autocomplete (``). Defaults to `false`. + +Set `allowPasswordAutocomplete` to `true` for password manager support and to avoid other cases of adverse behavior. + +```js +var options = { + allowPasswordAutocomplete: true +}; +``` + +### allowShowPassword {Boolean} + +This option determines whether or not to add a checkbox to the UI which, when selected, will allow the user to show their password when typing it. The option defaults to `false`. + +```js +var options = { + allowShowPassword: true +}; +``` + +Lock with `allowShowPassword` set to `true` and toggled to show the password: + +![Lock - Avatar](/media/articles/libraries/lock/v11/customization/lock-allowshowpassword.png) + ### allowedConnections {Array} Array of connections that will be used for the `signin|signup|reset` actions. Defaults to all enabled connections. @@ -131,23 +170,9 @@ var options = { Examples of `allowedConnections`: -![Lock - Allowed Connections](/media/articles/libraries/lock/v10/customization/lock-allowedconnections-database.png) - -![Lock - Allowed Connections](/media/articles/libraries/lock/v10/customization/lock-allowedconnections-social.png) +![Lock - Allowed Connections](/media/articles/libraries/lock/v11/customization/lock-allowedconnections-database.png) -### allowShowPassword {Boolean} - -This option determines whether or not to add a checkbox to the UI which, when selected, will allow the user to show their password when typing it. The option defaults to `false`. - -```js -var options = { - allowShowPassword: true -}; -``` - -Lock with `allowShowPassword` set to `true` and toggled to show the password: - -![Lock - Avatar](/media/articles/libraries/lock/v10/customization/lock-allowshowpassword.png) +![Lock - Allowed Connections](/media/articles/libraries/lock/v11/customization/lock-allowedconnections-social.png) ### autoclose {Boolean} @@ -209,7 +234,7 @@ var options = { Default behavior with Gravatar: -![Lock - Avatar](/media/articles/libraries/lock/v10/customization/lock-avatar.png) +![Lock - Avatar](/media/articles/libraries/lock/v11/customization/lock-avatar.png) ### closable {Boolean} @@ -221,15 +246,13 @@ var options = { }; ``` -![Lock - Closable](/media/articles/libraries/lock/v10/customization/lock-closable.png) +![Lock - Closable](/media/articles/libraries/lock/v11/customization/lock-closable.png) ### container {String} The `id` of the html element where the widget will be shown. -::: note This makes the widget appear inline within your `div` instead of in a modal pop-out window. -::: ```html
    @@ -247,7 +270,23 @@ This makes the widget appear inline within your `div` instead of in a modal pop- ``` -![Lock - Container](/media/articles/libraries/lock/v10/customization/lock-container.png) +![Lock - Container](/media/articles/libraries/lock/v11/customization/lock-container.png) + +### flashMessage {Object} + +Shows an `error` or `success` flash message when Lock is shown. This object has the following properties: + +- type {String}: The message type, supported types are `error`, `info`, and `success` +- text {String}: The text to show. + +```js +var options = { + flashMessage: { + type: 'success', + text: 'Welcome!' + } +}; +``` ### language {String} @@ -260,7 +299,7 @@ var options = { }; ``` -![Lock - Language](/media/articles/libraries/lock/v10/customization/lock-language.png) +![Lock - Language](/media/articles/libraries/lock/v11/customization/lock-language.png) ### languageDictionary {Object} @@ -275,7 +314,7 @@ var options = { }; ``` -![Lock - Language Dictionary](/media/articles/libraries/lock/v10/customization/lock-languagedictionary.png) +![Lock - Language Dictionary](/media/articles/libraries/lock/v11/customization/lock-languagedictionary.png) Additionally, check out the [Customizing Error Messages](/libraries/lock/v11/customizing-error-messages) page or the [Internationalization](/libraries/lock/v11/i18n) page for more information about the use of the `languageDictionary` option. @@ -287,31 +326,63 @@ Options for the `window.open` [position and size][windowopen-link] features. Thi ```js var options = { - redirect: false, + auth: { + redirect: false + }, popupOptions: { width: 300, height: 400, left: 200, top: 300 } }; ``` ### rememberLastLogin {Boolean} -Determines whether or not to show a screen that allows you to quickly log in with the account you used the last time. Defaults to true. -Request for SSO data and enable **Last time you signed in with[...]** message. Defaults to `true`. +Determines whether or not to show a screen that allows you to quickly log in with the account you used the last time. +Requests Single Sign-on (SSO) data and enables a **Last time you signed in with[...]** message. Defaults to `true`. This information comes from the user's Auth0 session, so this ability will last as long as their Auth0 session would (which is [configurable](/dashboard/reference/settings-tenant#login-session-management). ```js var options = { rememberLastLogin: false }; ``` +::: note +New tenants [automatically have Seamless SSO enabled](https://auth0.com/docs/dashboard/guides/tenants/enable-sso-tenant). With this enabled, the `rememberLastLogin` option will not be relevant because if there is a session in place then the hosted login page will not be displayed at all. Using Seamless SSO is highly recommended because it provides a seamless authentication experience: users log in once and won’t have to enter credentials again when they navigate either through the applications you have built, or third party apps. If the user is not logged in they will be redirected to the login screen, as expected. +::: -## Theming Options +::: note +The **Last time you signed in with [...]** message will not be available under the following circumstances: -### theme {Object} +- You used Lock in a [Hosted Login Page](/universal-login) with the session established using [Passwordless authentication](/connections/passwordless). +- You used Lock in an [embedded login scenario](/guides/login/universal-vs-embedded#embedded-login-with-auth0) where `responseType: code` (indicating the [Authorization Code Flow](/flows/concepts/auth-code), which is used for Regular Web Apps). +::: + +### scrollGlobalMessagesIntoView {Boolean} + +Determines whether or not a `globalMessage` should be scrolled into the user's viewport. Defaults to `true`. + +## Theme Options Theme options are grouped in the `theme` property of the `options` object. -#### authButtons {Object} +```js +var options = { + theme: { + labeledSubmitButton: false, + logo: "https://example.com/assets/logo.png", + primaryColor: "green", + authButtons: { + connectionName: { + displayName: "...", + primaryColor: "...", + foregroundColor: "...", + icon: "https://.../logo.png" + } + } + } +}; +``` -Allows the customization of buttons in Lock. Each custom connection whose button you desire to customize should be listed by name, each with their own set of parameters. The customizable parameters are listed below: +### authButtons {Object} + +Allows the customization of buttons in Lock with custom OAuth2 connections. Each custom connection whose button you desire to customize should be listed by name, each with their own set of parameters. The customizable parameters are listed below: - **displayName** {String}: The name to show instead of the connection name when building the button title, such as `LOGIN WITH MYCONNECTION` for login). - **primaryColor** {String}: The button's background color. Defaults to `#eb5424`. @@ -337,7 +408,7 @@ var options = { }; ``` -#### labeledSubmitButton {Boolean} +### labeledSubmitButton {Boolean} This option indicates whether or not the submit button should have a label, and defaults to `true`. When set to `false`, an icon will be shown instead. @@ -349,11 +420,11 @@ var options = { }; ``` -![Lock - Labeled Submit Button](/media/articles/libraries/lock/v10/customization/lock-theme-labeledsubmitbutton.png) +![Lock - Labeled Submit Button](/media/articles/libraries/lock/v11/customization/lock-theme-labeledsubmitbutton.png) If the label is set to true, which is the default, the label's text can be customized through the [languageDictionary](#languagedictionary-object-) option. -#### logo {String} +### logo {String} The value for `logo` is a URL for an image that will be placed in the Lock's header, and defaults to Auth0's logo. It has a recommended max height of `58px` for a better user experience. @@ -365,9 +436,9 @@ var options = { }; ``` -![Lock - Theme - Logo](/media/articles/libraries/lock/v10/customization/lock-theme-logo.png) +![Lock - Theme - Logo](/media/articles/libraries/lock/v11/customization/lock-theme-logo.png) -#### primaryColor {String} +### primaryColor {String} The `primaryColor` property defines the primary color of the Lock; all colors used in the widget will be calculated from it. This option is useful when providing a custom `logo`, to ensure all colors go well together with the `logo`'s color palette. Defaults to `#ea5323`. @@ -380,74 +451,37 @@ var options = { }; ``` -![Lock - Theme - Primary Color](/media/articles/libraries/lock/v10/customization/lock-theme-primarycolor.png) - -## Social Options - -### socialButtonStyle {String} - -Determines the size of the buttons for the social providers. Possible values are `big` and `small`. The default style depends on the connections that are available: - -- If only social connections are available, it will default to `big` when there are 5 connections at most, and default to `small` otherwise. -- If connections from types other than social are also available, it will default to `big` when there are 3 social connections at most, and default to `small` otherwise. - -First example, with three social connections, and other connections (in this case, a username-password connection) - with forced small buttons. - -```js -var options = { - socialButtonStyle: 'small' -}; -``` - -![Lock - Social Button Style](/media/articles/libraries/lock/v10/customization/lock-socialbuttonstyle-small.png) - -Second example, with `socialButtonStyle` remaining at default behavior - three social connections, with no other connections enabled for this application in the dashboard. - -```js -var options = {}; -``` - -![Lock - Social Button Style](/media/articles/libraries/lock/v10/customization/lock-socialbuttonstyle-default-social.png) - -Third example, with `socialButtonStyle` remaining at default behavior - the app has three social connections, with other connections turned on in the dashboard (in this case, a username-password connection). - -```js -var options = {}; -``` - -![Lock - Social Button Style](/media/articles/libraries/lock/v10/customization/lock-socialbuttonstyle-default.png) - -Fourth example, with three social connections, and no other connections enabled in the dasbboard, but with forced small buttons. - -```js -var options = { - socialButtonStyle: 'small' -}; -``` - -![Lock - Social Button Style](/media/articles/libraries/lock/v10/customization/lock-socialbuttonstyle-small-social.png) +![Lock - Theme - Primary Color](/media/articles/libraries/lock/v11/customization/lock-theme-primarycolor.png) ## Authentication Options -### auth {Object} +Authentication options are grouped in the `auth` property of the `options` object. -Authentication options are grouped in the auth property of the options object. +The default scope used by Lock is `openid profile email`. ```js var options = { auth: { - params: {param1: "value1"}, + params: { + param1: "value1", + scope: "openid profile email" + }, + autoParseHash: true, redirect: true, redirectUrl: "some url", + responseMode: "form_post", responseType: "token", - sso: true + sso: true, + connectionScopes: { + connectionName: [ 'scope1', 'scope2' ] + } } }; ``` ### audience {String} -The `audience` option indicates the API which will be consuming the `access_token` that is received after authentication. +The `audience` option indicates the API which will be consuming the Access Token that is received after authentication. ```js var options = { @@ -457,7 +491,7 @@ var options = { } ``` -#### autoParseHash {Boolean} +### autoParseHash {Boolean} When `autoParseHash` is set to `true`, Lock will parse the `window.location.hash` string when instantiated. If set to `false`, you'll have to manually resume authentication using the [resumeAuth](/libraries/lock/v11/api#resumeauth-) method. @@ -469,9 +503,9 @@ var options = { }; ``` -#### connectionScopes {Object} +### connectionScopes {Object} -This option allows you to set scopes to be sent to the oauth2/social connection for authentication. +This option allows you to set scopes to be sent to the oauth2/social connection for authentication. ```js var options = { @@ -485,7 +519,7 @@ var options = { A listing of particular scopes for your social connections can be acquired from the provider in question. For example, [Facebook for Developers](https://developers.facebook.com/docs/facebook-login/permissions/) reference has a listing of separate permissions that can be requested for your connection. -#### params {Object} +### params {Object} You can send parameters when starting a login by adding them to the options object. The example below adds a `state` parameter with a value equal to `foo` and also adds a `scope` parameter (which includes the scope, and then the requested attributes). [Read here][authparams-link] to learn more about what `authParams` can be set. @@ -504,14 +538,10 @@ var options = { For more details about supported parameters check the [Authentication Parameters][authparams-link] documentation page. ::: -#### redirect {Boolean} +### redirect {Boolean} Defaults to true. When set to true, redirect mode will be used. If set to false, [popup mode](/libraries/lock/v11/authentication-modes#popup-mode) is chosen. -::: warning -There is a known bug that prevents popup mode from functioning properly in Android or Firefox on iOS, and in Internet Explorer under certain circumstances. As such we recommend either only using redirect mode or detecting these special cases and selectively enabling redirect mode. -::: - ```js var options = { auth: { @@ -520,7 +550,7 @@ var options = { }; ``` -#### redirectUrl {String} +### redirectUrl {String} The URL Auth0 will redirect back to after authentication. Defaults to the empty string "" (no redirect URL). @@ -536,7 +566,7 @@ var options = { When the `redirectUrl` is provided (set to non blank value) the `responseType` option will be defaulted to `code` if not manually set. ::: -#### responseMode {String} +### responseMode {String} Should be set to `"form_post"` if you want the code or the token to be transmitted via an HTTP POST request to the `redirectUrl`, instead of being included in its query or fragment parts. @@ -550,9 +580,9 @@ var options = { }; ``` -#### responseType {String} +### responseType {String} -The value of `responseType` should be set to "token" for Single Page Applications, and "code" otherwise. Defaults to "code" when redirectUrl is provided, and to "token" otherwise. +The value of `responseType` should be set to "token" for Single-Page Applications, and "code" otherwise. Defaults to "code" when redirectUrl is provided, and to "token" otherwise. ```js var options = { @@ -566,27 +596,11 @@ var options = { When the `responseType` is set to `code`, Lock will never show the **Last time you logged in with** message, and will always prompt the user for credentials. ::: -#### sso {Boolean} - -Tells Lock to use or not the Single Sign On session created by Auth0 so it can prompt the user to login with the last logged in user. The Auth0 session is not tied to this value since it depends on the application's or tenant' settings. - -::: warning -Failing to set this to true will result in multifactor authentication not working correctly. -::: - -```js -var options = { - auth: { - sso: true - } -}; -``` - ## Database Options ### additionalSignUpFields {Array} -Extra input fields can be added to the sign up screen with the `additionalSignUpFields` option. Each option added in this manner will then be added to that user's `user_metadata`. See the [user metadata documentation](/metadata) for more information. Every input must have a `name` and a `placeholder`, and an `icon` URL can also be provided. Also, the initial value can be provided with the `prefill` option, which can be a string with the value or a function that obtains it. Other options depend on the type of the field, which is defined via the type option and defaults to "text". +Extra input fields can be added to the sign up screen with the `additionalSignUpFields` option. Each option added in this manner will then be added to that user's `user_metadata`. See [Metadata](/users/concepts/overview-user-metadata) for more information. Every input must have a `name` and a `placeholder`, and an `icon` URL can also be provided. Also, the initial value can be provided with the `prefill` option, which can be a string with the value or a function that obtains it. Other options depend on the type of the field, which is defined via the type option and defaults to "text". ::: panel Intended for use with database signup only `additionalSignUpFields` are intended for use with database signups only. If you have social sign ups too, you can ask for the additional information after the users sign up (see this [page about custom signup](/libraries/custom-signup) for more details). You can use the `databaseAlternativeSignupInstructions` i18n key to display these instructions. @@ -620,7 +634,32 @@ var options = { } ``` -![Lock - Additional Signup Fields](/media/articles/libraries/lock/v10/customization/lock-additionalsignupfields.png) +If you don't specify a `validator` the text field will be **required**. If you want to make the text field optional, use a validator that always returns `true` like this: + +```js +var options = { + additionalSignUpFields: [{ + name: "favorite_color", + placeholder: "Enter your favorite color (optional)", + validator: function() { + return true; + } + }] +} +``` + +If you want to save the value of the attribute in the root of your profile, use `storage: 'root'`. Only a subset of values can be stored this way. The list of attributes that can be added to your root profile is [here](/api/management/v2#!/Users/patch_users_by_id). By default, every additional sign up field is stored inside the user_metadata object. + +```js +var options = { + additionalSignUpFields: [{ + name: "name", + storage: "root" + }] +}; +``` + +![Lock - Additional Signup Fields](/media/articles/libraries/lock/v11/customization/lock-additionalsignupfields.png) #### Select Field @@ -685,6 +724,20 @@ var options = { } ``` +#### Hidden field + +The signup field `type: "hidden"` will allow you to use a hidden input with a fixed value. + +```js +var options = { + additionalSignUpFields: [{ + type: "hidden", + name: "signup_code", + value: "abc123" + }] +} +``` + ::: note Some use cases may be able to use `additionalSignUpFields` data for email templates, such as an option for language preferences, the value of which could then be used to set the language of templated email communications. ::: @@ -700,7 +753,7 @@ var options = { }; ``` -![Lock - Allow Login](/media/articles/libraries/lock/v10/customization/lock-allowlogin.png) +![Lock - Allow Login](/media/articles/libraries/lock/v11/customization/lock-allowlogin.png) ### allowForgotPassword {Boolean} @@ -717,7 +770,7 @@ var options = { }; ``` -![Lock - Allow Forgot Password](/media/articles/libraries/lock/v10/customization/lock-allowforgotpassword.png) +![Lock - Allow Forgot Password](/media/articles/libraries/lock/v11/customization/lock-allowforgotpassword.png) ### allowSignUp {Boolean} @@ -731,7 +784,7 @@ var options = { }; ``` -![Lock - Social Button Style](/media/articles/libraries/lock/v10/customization/lock-allowsignup.png) +![Lock - Social Button Style](/media/articles/libraries/lock/v11/customization/lock-allowsignup.png) ### defaultDatabaseConnection {String} @@ -758,7 +811,7 @@ var options = { Determines whether or not the user will be automatically signed in after a successful sign up. Defaults to `true`. ```js -var option = { +var options = { loginAfterSignUp: false }; ``` @@ -773,6 +826,10 @@ var options = { }; ``` +### showTerms {Boolean} + +When set to `true` displays the `languageDictionary.signUpTerms` string. Defaults to `true`. + ### mustAcceptTerms {Boolean} When set to `true` displays a checkbox input alongside the terms and conditions that must be checked before signing up. The terms and conditions can be specified via the `languageDictionary` option. This option will only take effect for users signing up with database connections. Defaults to `false`. @@ -791,7 +848,8 @@ Allows to set the initial value for the email and/or username inputs. When omitt var options = { prefill: { email: "someone@auth0.com", - username: "someone" + username: "someone", + phoneNumber: "+1234567890" } }; ``` @@ -821,6 +879,16 @@ var options = { }; ``` +### signUpFieldsStrictValidation {Boolean} + +This option enables strict format validation for username and email fields at the signup screen. This ensures presenting validation errors instead of the generic "We're sorry, something went wrong when attempting to sign up." message. Defaults to `false`. + +```js +var options = { + signUpFieldsStrictValidation: true +}; +``` + ## Enterprise Options ### defaultEnterpriseConnection {String} @@ -843,15 +911,21 @@ var options = { }; ``` +## Passwordless Options + +### passwordlessMethod {String} + +When using `Auth0LockPasswordless` with an email connection, you can use this option to pick between sending a [code](/connections/passwordless/spa-email-code) or a [magic link](/connections/passwordless/spa-email-link) to authenticate the user. Available values for email connections are `code` and `link`. Defaults to `code`. SMS passwordless connections will always use `code`. + ## Other Options -### clientBaseUrl {String} +### configurationBaseUrl {String} -This option can provide a URL to override the application settings base URL. By default, it uses Auth0's CDN URL when the domain has the format `*.auth0.com`. For example, if your URL is `contoso.eu.auth0.com`, then by default, the `clientBaseUrl` is `cdn.eu.auth0.com`. If the `clientBaseUrl` option is set instead, it uses the provided domain. This would only be necessary if your specific use case dictates that your application not use the default behavior. +This option can provide a URL to override the application settings base URL. By default, it uses Auth0's CDN URL when the domain has the format `*.auth0.com`. For example, if your URL is `contoso.eu.auth0.com`, then by default, the `clientBaseUrl` is `cdn.eu.auth0.com`. If the `clientBaseUrl` option is set to something else instead, it uses the provided domain. This would only be necessary if your specific use case dictates that your application not use the default behavior. ```js var options = { - clientBaseUrl: "http://www.example.com" + clientBaseUrl: "https://www.example.com" }; ``` @@ -861,13 +935,13 @@ Overrides the language source url for Auth0's provided translations. By default, ```js var options = { - languageBaseUrl: "http://www.example.com" + languageBaseUrl: "https://www.example.com" }; ``` ### hashCleanup {Boolean} -When the `hashCleanup` option is enabled, it will remove the hash part of the callback url after the user authentication. It defaults to true. +When the `hashCleanup` option is enabled, it will remove the hash part of the callback URL after the user authentication. It defaults to true. ```js var options = { @@ -875,9 +949,17 @@ var options = { }; ``` +### connectionResolver {Function} + +When in use, provides an extensibility point to make it possible to choose which connection to use based on the username information. + +Has `username`, `context`, and `callback` as parameters. The callback expects an object like: `{type: 'database', name: 'connection name'}`. **This only works for database connections.** Keep in mind that this resolver will run in the form's `onSubmit` event, so keep it simple and fast. + +This is a beta feature. If you find a bug, please open a GitHub [issue](https://github.com/auth0/lock/issues/new). + ### leeway {Integer} -The `leeway` option can be set to an integer - a value in seconds - which can be used to account for clock skew in JWT expirations. Typically the value is no more than a minute or two at maximum. +The `leeway` option can be set to an integer - a value in seconds - which can be used to account for clock skew in ID Token expirations. Typically the value is no more than a minute or two at maximum. ```js var options = { diff --git a/articles/libraries/lock/v11/customizing-error-messages.md b/articles/libraries/lock/v11/customizing-error-messages.md index 63437efa19..1d06250ce5 100644 --- a/articles/libraries/lock/v11/customizing-error-messages.md +++ b/articles/libraries/lock/v11/customizing-error-messages.md @@ -1,6 +1,15 @@ --- section: libraries description: Customizing error messages with Lock v11 +topics: + - libraries + - lock + - error-messages +contentType: + - how-to + - reference +useCase: + - add-login --- # Customizing Lock Error Messages @@ -33,23 +42,9 @@ var lock = new Auth0Lock( ); ``` -If you are returning custom error codes from a [rule](/rules) or a [custom database script](/connections/database/custom-db#error-handling), you can also add the error messages in the dictionary: +## Custom errors in Rules -```js -//custom database script: getUser -function getByEmail (email, callback) { - callback(new ValidationError('custom-error-code', 'Some custom message')); -} -``` - -```js -languageDictionary: { - error: { - forgotPassword: { - "custom-error-code": "Your custom error message" - } - } -} -``` +If you are returning custom error codes from a [rule](/rules) or a [custom database script](/connections/database/custom-db#error-handling), you can handle custom errors: -These errors will be shown on the widget header. +* In your application's redirect URL by reading the `error` and `error_mesage` query string parameters. +* By redirecting the user back to your hosted pages with a custom error message and displaying the message with a [flash message](/libraries/lock/v11/api#flashmessage). diff --git a/articles/libraries/lock/v11/i18n.md b/articles/libraries/lock/v11/i18n.md index 826fc4daf8..cdd35c7c3e 100644 --- a/articles/libraries/lock/v11/i18n.md +++ b/articles/libraries/lock/v11/i18n.md @@ -1,19 +1,74 @@ --- section: libraries description: Lock v11 supports multiple languages, and allows for the addition of other custom language files, as well as for customizing the values of specific pieces of text that are displayed in the Lock widget. +topics: + - libraries + - lock + - i18n +contentType: + - how-to + - concept +useCase: + - add-login --- # Lock Internationalization -You can change the language of Lock by using the `language` configuration option. This will pull the corresponding language file from the `i18n` directory in Lock. Take a look at that [i18n directory](https://github.com/auth0/lock/blob/master/src/i18n/) for a current list of provided languages. +You can change the language of Lock by using the `language` configuration option. This will pull the corresponding language file from the `i18n` directory in Lock. -In order to use the below examples, you'll need to first include Lock in your page: +## Provided languages + +Take a look at the [i18n directory](https://github.com/auth0/lock/blob/master/src/i18n/) for language files. + +| Language | Code | Source | +|----------|------|--------| +| Afrikaans | `'af'` | [af.js](https://github.com/auth0/lock/blob/master/src/i18n/af.js) | +| Catalan | `'ca'` | [ca.js](https://github.com/auth0/lock/blob/master/src/i18n/ca.js) | +| Chinese | `'zh'` | [zh.js](https://github.com/auth0/lock/blob/master/src/i18n/zh.js) | +| Chinese (Taiwan) | `'zh-tw'` | [zh-tw.js](https://github.com/auth0/lock/blob/master/src/i18n/zh-tw.js) | +| Croatian | `'hr'` | [hr.js](https://github.com/auth0/lock/blob/master/src/i18n/hr.js) | +| Czech | `'cs'` | [cs.js](https://github.com/auth0/lock/blob/master/src/i18n/cs.js) | +| Danish | `'da'` | [da.js](https://github.com/auth0/lock/blob/master/src/i18n/da.js) | +| Dutch | `'nl'` | [nl.js](https://github.com/auth0/lock/blob/master/src/i18n/nl.js) | +| English | `'en'` | [en.js](https://github.com/auth0/lock/blob/master/src/i18n/en.js) | +| Estonian | `'et'` | [et.js](https://github.com/auth0/lock/blob/master/src/i18n/et.js) | +| Farsi (Persian) | `'fa'` | [fa.js](https://github.com/auth0/lock/blob/master/src/i18n/fa.js) | +| Finnish | `'fi'` | [fi.js](https://github.com/auth0/lock/blob/master/src/i18n/fi.js) | +| French | `'fr'` | [fr.js](https://github.com/auth0/lock/blob/master/src/i18n/fr.js) | +| German | `'de'` | [de.js](https://github.com/auth0/lock/blob/master/src/i18n/de.js) | +| Greek | `'el` | [el.js](https://github.com/auth0/lock/blob/master/src/i18n/el.js) | +| Hebrew | `'he'` | [he.js](https://github.com/auth0/lock/blob/master/src/i18n/he.js) | +| Hungarian | `'hu'` | [hu.js](https://github.com/auth0/lock/blob/master/src/i18n/hu.js) | +| Italian | `'it'` | [it.js](https://github.com/auth0/lock/blob/master/src/i18n/it.js) | +| Japanese | `'ja'` | [ja.js](https://github.com/auth0/lock/blob/master/src/i18n/ja.js) | +| Korean | `'ko'` | [ko.js](https://github.com/auth0/lock/blob/master/src/i18n/ko.js) | +| Lithuanian | `'lt'` | [lt.js](https://github.com/auth0/lock/blob/master/src/i18n/lt.js) | +| Norwegian | `'no'` | [no.js](https://github.com/auth0/lock/blob/master/src/i18n/no.js) | +| Norwegian (Bokmål) | `'nb'` | [nb.js](https://github.com/auth0/lock/blob/master/src/i18n/nb.js) | +| Norwegian (Nynorsk) | `'nn'` | [nn.js](https://github.com/auth0/lock/blob/master/src/i18n/nn.js) | +| Polish | `'pl'` | [pl.js](https://github.com/auth0/lock/blob/master/src/i18n/pl.js) | +| Portuguese (Brazil) | `'pt-br'` | [pt-br.js](https://github.com/auth0/lock/blob/master/src/i18n/pt-br.js) | +| Romanian | `'ro'` | [ro.js](https://github.com/auth0/lock/blob/master/src/i18n/ro.js) | +| Russian | `'ru'` | [ru.js](https://github.com/auth0/lock/blob/master/src/i18n/ru.js) | +| Slovak | `'sk'` | [sk.js](https://github.com/auth0/lock/blob/master/src/i18n/sk.js) | +| Slovenian | `'sl'` | [sl.js](https://github.com/auth0/lock/blob/master/src/i18n/sl.js) | +| Spanish | `'es'` | [es.js](https://github.com/auth0/lock/blob/master/src/i18n/es.js) | +| Swedish | `'sv'` | [sv.js](https://github.com/auth0/lock/blob/master/src/i18n/sv.js) | +| Turkish | `'tr'` | [tr.js](https://github.com/auth0/lock/blob/master/src/i18n/tr.js) | +| Ukrainian | `'ua'` | [ua.js](https://github.com/auth0/lock/blob/master/src/i18n/uk.js) | +| Vietnamese | `'vi'` | [vi.js](https://github.com/auth0/lock/blob/master/src/i18n/vi.js) | + +## Set language option + +To use the following examples, you'll need to first include Lock in your page: ```html ``` -Then, you will need to define your `options` object, and instantiate Lock. +Next define your `options` object and include the `language` option. The `language` option needs to be a string matching the name of the corresponding file in the `i18n` directory [within Lock](https://github.com/auth0/lock/tree/master/src/i18n). Then instantiate Lock. + +For example, ```js // Select a supported language @@ -29,13 +84,13 @@ var lock = new Auth0Lock( ); ``` -The `language` option needs to be a string matching the name of the corresponding file in the `i18n` directory [within Lock](https://github.com/auth0/lock/tree/master/src/i18n). You can look at existing language files to provide an example format to copy for any new languages you wish to add yourself. If and when supported languages are added to Lock, they will be added to the `i18n` directory with new releases. - ::: panel Missing translation values Translation data for Lock comes from language files which have key-value pairs representing various translations. For some languages, certain values may be missing, in which case you will see a warning: `language does not have property `. We encourage you to submit a [pull request](https://github.com/auth0/lock/tree/master/src/i18n) to add these missing values. Alternatively, you may define the missing values in your Lock `options` (see below). ::: -You can also customize your own specific dictionary items using the `languageDictionary`option. This is especially useful if you want to keep the language using one of the supported languages, but change the specific wording of a few items, such as re-wording the `title` or making various other labels read different messages, but leaving the remaining text on the widget intact. +## Replace dictionary terms + +You can also customize your own specific dictionary items using the `languageDictionary` option. This is useful if you are using one of the supported languages, but change the specific wording of a few items. For example, you might re-word the `title` or change the way other labels display to the user while leaving the remaining text on the widget intact. ```js // Customize some languageDictionary attributes @@ -54,8 +109,8 @@ var lock = new Auth0Lock( ); ``` -Furthermore, the `languageBaseUrl` option, which takes a string value (a URL), overrides the language source url for Auth0's provided translations. By default it uses to Auth0's CDN URL `https://cdn.auth0.com` because that is where the provided language translations are stored. By providing another value, you can use your own source for the language translations as needed for your applications. - ::: note -For an example of available `languageDictionary` property names, and of how to structure a `language` file, see the [English dictionary file for Lock](https://github.com/auth0/lock/blob/master/src/i18n/en.js). And for more information on how to configure Lock, check out the [api reference](/libraries/lock/v11/api) or the full reference of [configuration options](/libraries/lock/v11/configuration) that are available. +For an example of available `languageDictionary` property names and how to structure a `language` file, see the [English dictionary file for Lock](https://github.com/auth0/lock/blob/master/src/i18n/en.js). ::: + +The `languageBaseUrl` option, which takes a string value (a URL), overrides the language source URL for Auth0's provided translations. By default, it uses the Auth0's CDN URL `https://cdn.auth0.com` because that is where the provided language translations are stored. By providing another value, you can use your own source for the language translations as needed for your applications. Your language source should be a JavaScript file. diff --git a/articles/libraries/lock/v11/index.md b/articles/libraries/lock/v11/index.md index 5aef029a02..babcef08a8 100644 --- a/articles/libraries/lock/v11/index.md +++ b/articles/libraries/lock/v11/index.md @@ -4,10 +4,20 @@ toc: true title: Lock v11 for Web description: A widget that provides a frictionless login and signup experience for your web apps. img: media/articles/libraries/lock-web.png +topics: + - libraries + - lock +contentType: + - how-to + - index +useCase: + - add-login --- # Lock v11 for Web -Lock is an embeddable login form, [configurable to your needs](/libraries/lock/v11/configuration), and recommended for use in single page apps. It enables you to easily add social identity providers, so that your users can login seamlessly using any provider they want. +Lock is an embeddable login form that can be [configured to your needs](/libraries/lock/v11/configuration) and is recommended for use in single-page apps, preferably in conjunction with [Universal Login](/universal-login), which should be used whenever possible. Lock enables you to easily add social identity providers, so that your users can log in seamlessly using any desired provider. + +<%= include('../../../_includes/_embedded_login_warning') %> ## Lock Installation @@ -55,17 +65,19 @@ If you are using browserify or webpack to build your project and bundle its depe ### Cross-Origin Authentication +<%= include('../../../_includes/_embedded_login_warning') %> + Embedding Lock within your application requires [cross-origin authentication](/cross-origin-authentication) to be properly configured. Specifically, you need to set the **Allowed Web Origins** property to the domain making the request. You can find this field in the [Application Settings](${manage_url}/#/applications/${account.clientId}/settings). ![Allowed Web Origins](/media/articles/libraries/lock/allowed-origins.png) -Make sure you read about the [limitations of cross-origin authentication](/cross-origin-authentication#limitations-of-cross-origin-authentication) before implementing Lock. +Make sure you read about the [limitations of cross-origin authentication](/cross-origin-authentication#limitations) before implementing Lock. ## Usage ### 1. Initializing Lock -First, you'll need to initialize a new `Auth0Lock` object, and provide it with your Auth0 client ID (the unique client ID for each Auth0 application, which you can get from the [management dashboard](${manage_url})) and your Auth0 domain (for example `yourname.auth0.com`). +First, you'll need to initialize a new `Auth0Lock` object, and provide it with your Auth0 client ID (the unique client ID for each Auth0 application, which you can get from the [management dashboard](${manage_url})) and your Auth0 domain (for example, `yourname.auth0.com`). ```js // Initializing our Auth0Lock @@ -75,26 +87,56 @@ var lock = new Auth0Lock( ); ``` -## 2. Authenticating and Getting User Info +### 2. Authenticating and Getting User Info -Next, listen using the `on` method for the `authenticated` event. When the event occurs, use the `accessToken` which was received to call the `getUserInfo` method and acquire the user's profile information (as needed). You can also save the token or profile to `localStorage` for later use. +Next, listen using the `on` method for the `authenticated` event. When the event occurs, use the `accessToken` which was received to call the `getUserInfo` method and acquire the user's profile information (as needed). ```js -// Listening for the authenticated event -lock.on("authenticated", function(authResult) { - // Use the token in authResult to getUserInfo() and save it to localStorage - lock.getUserInfo(authResult.accessToken, function(error, profile) { - if (error) { - // Handle error - return; - } - - document.getElementById('nick').textContent = profile.nickname; - - localStorage.setItem('accessToken', authResult.accessToken); - localStorage.setItem('profile', JSON.stringify(profile)); - }); -}); +var Auth = (function() { + + var wm = new WeakMap(); + var privateStore = {}; + var lock; + + function Auth() { + this.lock = new Auth0Lock( + '', + '' + ); + wm.set(privateStore, { + appName: "example" + }); + } + + Auth.prototype.getProfile = function() { + return wm.get(privateStore).profile; + }; + + Auth.prototype.authn = function() { + // Listening for the authenticated event + this.lock.on("authenticated", function(authResult) { + // Use the token in authResult to getUserInfo() and save it if necessary + this.getUserInfo(authResult.accessToken, function(error, profile) { + if (error) { + // Handle error + return; + } + + //we recommend not storing Access Tokens unless absolutely necessary + wm.set(privateStore, { + accessToken: authResult.accessToken + }); + + wm.set(privateStore, { + profile: profile + }); + + }); + }); + }; + return Auth; +}()); + ``` You can then manipulate page content and display profile information to the user (for example, displaying their name in a welcome message). @@ -122,7 +164,7 @@ document.getElementById('btn-login').addEventListener('click', function() { ## Passwordless ::: note -Lock's Passwordless Mode is only available in Lock v11.2.0 and later. Please use the [latest release of Lock](https://github.com/auth0/lock/releases) for this feature! +Lock's Passwordless Mode is only available in Lock v11.2.0 and later. Please use the [latest release of Lock](https://github.com/auth0/lock/releases) for this feature! ::: You can use Lock's Passwordless Mode to allow users to authenticate using just an email or mobile number. They will receive the code and then return to input it, or click the link, and they can be authenticated without remembering a password. @@ -199,7 +241,7 @@ The below widget displays brief examples of implementing Auth0 in several ways: ## Next Steps -This document has shown how to use Lock 11 within a Single Page Application (SPA). Take a look at the following resources to see how Lock can be used with other kinds of web apps, or how it can be customized for your needs: +This document has shown how to use Lock 11 within a Single-Page Application (SPA). Take a look at the following resources to see how Lock can be used with other kinds of web apps, or how it can be customized for your needs: ::: next-steps * [Lock v11 API Reference](/libraries/lock/v11/api) diff --git a/articles/libraries/lock/v11/migration-angular.md b/articles/libraries/lock/v11/migration-angular.md index 490daab83f..1eb1e5647d 100644 --- a/articles/libraries/lock/v11/migration-angular.md +++ b/articles/libraries/lock/v11/migration-angular.md @@ -2,9 +2,20 @@ section: libraries title: Migrating Angular applications to Lock v11 description: How to migrate Angular applications to Lock v11 +public: false +topics: + - libraries + - lock + - migrations + - angular +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating Angular Applications to Lock v11 -Angular applications can use Lock directly without any kind of wrapper library. +Angular applications can use Lock directly without any kind of wrapper library. All Angular applications will be using Lock 10, so you can follow the [Migrating from Lock v10](/libraries/lock/v11/migration-v10-v11) guide. diff --git a/articles/libraries/lock/v11/migration-angularjs-v10.md b/articles/libraries/lock/v11/migration-angularjs-v10.md index 3cb8875969..621be6bea3 100644 --- a/articles/libraries/lock/v11/migration-angularjs-v10.md +++ b/articles/libraries/lock/v11/migration-angularjs-v10.md @@ -2,7 +2,18 @@ section: libraries title: Migrating Angular 1.x Applications to from Lock v10 to Lock v11 description: How to migrate Angular 1.x Applications from Lock v10 to v11 +public: false toc: true +topics: + - libraries + - lock + - migrations + - angular +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating Angular 1.x applications from Lock v10 to v11 diff --git a/articles/libraries/lock/v11/migration-angularjs-v8.md b/articles/libraries/lock/v11/migration-angularjs-v8.md index 34cf927232..8152ec0ef0 100644 --- a/articles/libraries/lock/v11/migration-angularjs-v8.md +++ b/articles/libraries/lock/v11/migration-angularjs-v8.md @@ -2,10 +2,21 @@ section: libraries title: Migrating Angular 1.x Applications to from Lock v8 to Lock v11 description: How to migrate Angular 1.x Applications from Lock v8 to v11 +public: false toc: true +topics: + - libraries + - lock + - migrations + - angular +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating Angular 1.x Applications from Lock v8 to v11 -Lock v8 is [very similar](/libraries/lock/v9/migration-guide) to Lock v9 from an API standpoint. +Lock v8 is [very similar](/libraries/lock/v9/migration-guide) to Lock v9 from an API standpoint. You can follow the instructions on [how to migrate Angular 1.x applications from Lock v9 to v11]((/libraries/lock/v11/migration-v9-v11), as they also are applicable for Lock 8. diff --git a/articles/libraries/lock/v11/migration-angularjs-v9.md b/articles/libraries/lock/v11/migration-angularjs-v9.md index 2fd17e4194..6217541cf6 100644 --- a/articles/libraries/lock/v11/migration-angularjs-v9.md +++ b/articles/libraries/lock/v11/migration-angularjs-v9.md @@ -2,11 +2,22 @@ section: libraries title: Migrating Angular 1.x Applications to from Lock v9 to Lock v11 description: How to migrate Angular 1.x Applications from Lock v9 to v11 +public: false toc: true +topics: + - libraries + - lock + - migrations + - angular +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating Angular 1.x Applications from Lock v9 to v11 -This guide will help you migrating your Angular 1.x application from Lock 9 to Lock v11. +This guide will help you migrating your Angular 1.x application from Lock 9 to Lock v11. <%= include('../../_includes/_get_lock_latest_version') %> diff --git a/articles/libraries/lock/v11/migration-cordova.md b/articles/libraries/lock/v11/migration-cordova.md index a433940551..ce7a0e9ef2 100644 --- a/articles/libraries/lock/v11/migration-cordova.md +++ b/articles/libraries/lock/v11/migration-cordova.md @@ -1,10 +1,21 @@ --- title: Migration from Lock 10 in Cordova Apps description: Learn how to migrate from Lock 10 in your Cordova app. +public: false +topics: + - libraries + - lock + - migrations + - cordova +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migration from Lock in Cordova Applications -For Cordova applications, the only migration path forward at this time is to [migrate to Universal Login](/guides/login/migration-embedded-universal). Embedded Lock will not be supported in Cordova apps going forward, as part of an effort to align Auth0's Cordova support with more stringent standards and security policies. +For Cordova applications, the only migration path forward at this time is to [migrate to Universal Login](/guides/login/migration-embedded-universal). Embedded Lock will not be supported in Cordova apps going forward, as part of an effort to align Auth0's Cordova support with more stringent standards and security policies. -Instead of updating embedded Lock versions, Cordova apps using Auth0 should instead use the [auth0-cordova](https://github.com/auth0/auth0-cordova) library to initiate [Universal Login](/hosted-pages/login) in Cordova apps. See the [Cordova Quickstart](/quickstart/native/cordova/01-login) for an example of setting this up. +Instead of updating embedded Lock versions, Cordova apps using Auth0 should instead use the [auth0-cordova](https://github.com/auth0/auth0-cordova) library to initiate Universal Login in Cordova apps. See the [Cordova Quickstart](/quickstart/native/cordova/01-login) for an example of setting this up. diff --git a/articles/libraries/lock/v11/migration-guide.md b/articles/libraries/lock/v11/migration-guide.md index 7a70fa7f08..a815c11a66 100644 --- a/articles/libraries/lock/v11/migration-guide.md +++ b/articles/libraries/lock/v11/migration-guide.md @@ -2,18 +2,26 @@ section: libraries title: Migrating to Lock v11 description: How to migrate to Lock v11 +public: false +topics: + - libraries + - lock + - migrations +contentType: + - how-to + - reference + - concept +useCase: + - add-login + - migrate --- # Migrating to Lock v11 -[Lock v11](/libraries/lock) operates with enhanced security and removes dependencies that have been deprecated as per Auth0's roadmap. In some cases, these security enhancements may impact application behavior when upgrading from an earlier version of Lock. +[Lock v11](/libraries/lock) operates with enhanced security and removes dependencies that have been deprecated as per Auth0's roadmap. In some cases, these security enhancements may impact application behavior when upgrading from an earlier version of Lock. ## Should I migrate to v11? -Everyone should migrate to v11. All previous versions are deprecated, and will be removed from service July 16, 2018. For applications that use Lock within an Auth0 login page, this migration is recommended; for applications with Lock embedded within them, this migration is mandatory. - -::: note -Previously, deprecated Lock versions were planned to be removed from service on April 1, 2018. However, the Removal of Service date has been extended to **July 16, 2018** due to a [mitigation of the risks posed by deprecated versions](/cross-origin-authentication/fingerprinting). Customers are still encouraged to migrate applications to the latest version **as soon as possible** in order to ensure that applications continue to function properly. -::: +Everyone should migrate to v11. All previous versions are deprecated, and the Legacy Lock API was removed from service on August 6, 2018. For applications that use Lock within an Auth0 login page, this migration is recommended; for applications with Lock embedded within them, this migration is mandatory. ## Migration instructions @@ -21,7 +29,7 @@ The documents below describe all the changes that you should be aware of when mi * [Migrating from the lock-passwordless widget](/libraries/lock/v11/migration-lock-passwordless) * [Migrating from Lock v10](/libraries/lock/v11/migration-v10-v11) - * [Recommendations for migrating from Lock v10 when SSO is required](/guides/login/migration-sso) +* [Recommendations for migrating from Lock v10 when Single Sign-on (SSO) is required](/guides/login/migration-sso) * [Migrating from Lock v10 in Angular 1.x Applications](/libraries/lock/v11/migration-angularjs-v10) * [Migrating from Lock v10 in Angular 2+ Applications](/libraries/lock/v11/migration-angular) * [Migrating from Lock v10 in React Applications](/libraries/lock/v11/migration-react) @@ -31,21 +39,13 @@ The documents below describe all the changes that you should be aware of when mi * [Migrating from Lock v8](/libraries/lock/v11/migration-v8-v11) * [Migrating from Lock v8 in Angular 1.x Applications](/libraries/lock/v11/migration-angularjs-v8) -:::note If you have any questions or concerns, you can discuss them in the [Auth0 Community](https://community.auth0.com/), submit them using the [Support Center](${env.DOMAIN_URL_SUPPORT}), or directly through your account representative, if applicable. -::: - -## Disabling legacy Lock API - -After you update to Lock v11 and/or Auth0.js v9, it is advised that you turn off the **Legacy Lock API** toggle in the Dashboard. This will make your Auth0 tenant behave as if the legacy API is no longer available. Starting on July 16, 2018, this option will be forcibly disabled, so it is recommended you opt-in before that time to verify that your configuration will work correctly. -You can find the setting in the [Advanced section](${manage_url}/#/tenant/advanced) of Tenant Settings. - -![Allowed Web Origins](/media/articles/libraries/lock/legacy-lock-api-off.png) +<%= include('../../../_includes/_embedded_login_warning') %> ## Troubleshooting -### Lock takes long to display the login options +### Lock takes too long to display the login options If Lock takes a lot of time to display the login options, it could be because the [Allowed Web Origins](/libraries/lock/v11/migration-v10-v11#configure-auth0-for-embedded-login) property is not correctly set. @@ -63,4 +63,6 @@ You have already migrated to Lock 11 but you still see this error in your logs: Legacy Lock API: This feature is being deprecated. Please refer to our documentation to learn how to migrate your application. ``` -These deprecation notices most likely originate from a user visiting the [Universal Login page](/hosted-pages/login) directly without initiating the authentication flow from your app. This can happen if a user bookmarks the login page directly. If this happens after **July 16, 2018** the user will not be able to log in. +These deprecation notices most likely originate from a user visiting the Universal Login [page](/universal-login) directly without initiating the authentication flow from your app. This can happen if a user bookmarks the login page directly. After August 6, 2018, these users will not be able to log in. + +See [Check Deprecation Errors](/troubleshoot/guides/check-deprecation-errors) for more information on deprecation-related errors. diff --git a/articles/libraries/lock/v11/migration-lock-passwordless.md b/articles/libraries/lock/v11/migration-lock-passwordless.md index 0fd8d19c07..3108edcae5 100644 --- a/articles/libraries/lock/v11/migration-lock-passwordless.md +++ b/articles/libraries/lock/v11/migration-lock-passwordless.md @@ -2,12 +2,25 @@ section: libraries toc: true description: Migration Guide from lock-passwordless to Lock v11 with Passwordless Mode +public: false +topics: + - libraries + - lock + - migrations + - passwordless +contentType: + - how-to + - reference + - concept +useCase: + - add-login + - migrate --- # Migration Guide for lock-passwordless to Lock v11 with Passwordless Mode The following instructions assume you are migrating from the **lock-passwordless** widget to Lock v11.2+ using **Passwordless Mode**. -The [lock-passwordless](https://github.com/auth0/lock-passwordless) widget was previously a standalone library, separate from [Lock](/libraries/lock). Now, you can migrate your apps to use the Passwordless Mode which is integrated directly into Lock v11. Lock v11 with Passwordless Mode is the latest method by which to deploy a login widget for passwordless authentication in your apps. +The [lock-passwordless](https://github.com/auth0/lock-passwordless) widget was previously a standalone library, separate from [Lock](/libraries/lock). Now, you can migrate your apps to use the Passwordless Mode which is integrated directly into Lock v11. Lock v11 with Passwordless Mode is the latest method by which to deploy a login widget for passwordless authentication in your apps. To get started, you will need to remove **lock-passwordless** from your project, and instead include the [latest release version of Lock v11](https://github.com/auth0/lock/releases). @@ -169,7 +182,7 @@ lock.show(); ### Subscribe to events -Lock exposes a few events that you can subscribe to in order to be notified when the user is authenticated or an error occurs. So, instead of callbacks from `lock-passwordless`, you have to subscribe to events that you want to know about. To read more about Lock events, see [here](/libraries/lock/v11/api#on-). +Lock exposes a few events that you can subscribe to in order to be notified when the user is authenticated or an error occurs. So, instead of callbacks from `lock-passwordless`, you have to subscribe to events that you want to know about. To read more about Lock events, see [here](/libraries/lock/v11/api#on-). ```js var lock = new Auth0LockPasswordless(clientID, domain); @@ -184,7 +197,7 @@ Some options have to be renamed. * `dict` is now [languageDictionary](/libraries/lock/v11/configuration#languagedictionary-object-) * `connections` is now [allowedConnections](/libraries/lock/v11/configuration#allowedconnections-array-) -* `socialBigButtons` is now [socialButtonStyle](/libraries/lock/v11/configuration#socialbuttonstyle-string-) +* `socialBigButtons` is no longer available as an option and all the social connection buttons will be shown with a "big" style. * all the authentication options were moved into an [auth object](/libraries/lock/v11/configuration#auth-object-) ## Further Reading diff --git a/articles/libraries/lock/v11/migration-react.md b/articles/libraries/lock/v11/migration-react.md index 88b48ffdb7..fbac6ae04c 100644 --- a/articles/libraries/lock/v11/migration-react.md +++ b/articles/libraries/lock/v11/migration-react.md @@ -2,10 +2,21 @@ section: libraries title: Migrating React applications to Lock v11 description: How to migrate React applications to Lock v11 +public: false +topics: + - libraries + - lock + - migrations + - react +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating React Applications to Lock v11 -React applications use Lock directly without any kind of wrapper library. +React applications use Lock directly without any kind of wrapper library. Most React applications will be using Lock v10, so you can follow the [Migrating from Lock v10](/libraries/lock/v11/migration-v10-v11) guide. diff --git a/articles/libraries/lock/v11/migration-v10-v11.md b/articles/libraries/lock/v11/migration-v10-v11.md index 9c141698b7..16e9b75071 100644 --- a/articles/libraries/lock/v11/migration-v10-v11.md +++ b/articles/libraries/lock/v11/migration-v10-v11.md @@ -2,11 +2,21 @@ section: libraries title: Migrating from Lock v10 to v11 description: How to migrate from Lock v10 to v11 +public: false toc: true +topics: + - libraries + - lock + - migrations +contentType: + - how-to +useCase: + - add-login + - migrate --- -# Migrating from Lock v10 to v11 +# Migrate from Lock v10 to v11 -This guide includes all the information you need to update your Lock v10 application to [Lock v11](/libraries/lock). +This guide includes all the information you need to update your Lock v10 application to [Lock v11](/libraries/lock). ## Migration demo diff --git a/articles/libraries/lock/v11/migration-v8-v11.md b/articles/libraries/lock/v11/migration-v8-v11.md index 638e589afa..2f2e3e53c6 100644 --- a/articles/libraries/lock/v11/migration-v8-v11.md +++ b/articles/libraries/lock/v11/migration-v8-v11.md @@ -2,11 +2,21 @@ section: libraries title: Migrating from Lock v8 to v11 description: How to migrate from Lock v8 to v11 +public: false toc: true +topics: + - libraries + - lock + - migrations +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating from Lock v8 to v11 -Lock v8 is [very similar](/libraries/lock/v9/migration-guide) to Lock v9 from an API standpoint. +Lock v8 is [very similar](/libraries/lock/v9/migration-guide) to Lock v9 from an API standpoint. You can follow the instructions on [how to migrate from Lock v9 to Lock v11](/libraries/lock/v11/migration-v9-v11), as they also are applicable for Lock v8. diff --git a/articles/libraries/lock/v11/migration-v9-v11.md b/articles/libraries/lock/v11/migration-v9-v11.md index 79d26ad0b2..cb56f72034 100644 --- a/articles/libraries/lock/v11/migration-v9-v11.md +++ b/articles/libraries/lock/v11/migration-v9-v11.md @@ -2,17 +2,27 @@ section: libraries title: Migrating from Lock v9 to v11 description: How to migrate from Lock v9 to v11 +public: false toc: true +topics: + - libraries + - lock + - migrations +contentType: + - how-to +useCase: + - add-login + - migrate --- # Migrating from Lock v9 to v11 -This guide includes all the information you need to update your Lock v9 applications to [Lock v11](/libraries/lock). +This guide includes all the information you need to update your Lock v9 applications to [Lock v11](/libraries/lock). ## Migration Steps Given that Lock v10 is very similar to Lock v11 you can read the [Lock v9 to Lock v10 migration guide](/libraries/lock/v10/migration-guide). -Building Single Page Applications with Lock v9 has some key differences with the way they should be built in Lock v11. Lock v11 uses OIDC conformant APIs that are more secure, and some of the coding patterns with Lock v9 need to be changed. +Building Single-Page Applications with Lock v9 has some key differences with the way they should be built in Lock v11. Lock v11 uses OIDC conformant APIs that are more secure, and some of the coding patterns with Lock v9 need to be changed. <%= include('../../_includes/_get_lock_latest_version') %> @@ -77,7 +87,7 @@ function login() } ``` -Note that the parameters that were passed to `show()` in Lock v9 are used to initialize Lock in Lock v11, and that the callback specified in `show()` is replaced by an `authenticated` event handler. +Note that the parameters that were passed to `show()` in Lock v9 are used to initialize Lock in Lock v11, and that the callback specified in `show()` is replaced by an `authenticated` event handler. ### Using Lock in SPAs with Redirect Mode diff --git a/articles/libraries/lock/v11/selecting-the-connection-for-multiple-logins.md b/articles/libraries/lock/v11/selecting-the-connection-for-multiple-logins.md index fd41b45814..928c694dac 100644 --- a/articles/libraries/lock/v11/selecting-the-connection-for-multiple-logins.md +++ b/articles/libraries/lock/v11/selecting-the-connection-for-multiple-logins.md @@ -1,22 +1,82 @@ --- section: libraries description: How to select different connection types for multiple login options with Lock V11. +topics: + - libraries + - lock + - connections +contentType: + - how-to +useCase: + - add-login + - customize-connections --- -# Selecting the Connection in Lock +# Selecting from Multiple Connection Options -Auth0 allows you to offer your users multiple methods of authenticating. This is especially important with SaaS, multi-tenant apps, in which a single app is used by many different organizations, each one of which is potentially using different systems such as LDAP, Active Directory, Google Apps, or username/password stores. +With Auth0 you can offer users multiple methods of authenticating. This is important with SaaS or multi-tenant apps, where many organization use a single app. Each organization might use different systems such as LDAP, Active Directory, G Suite, or username/password stores. + +In Auth0, you can associate different *connections* (methods of authentication) to specific applications, or directly to a tenant (as [domain connections](/api/management/guides/connections/promote-connection-domain-level)). When a user logs in, one of these connections will need to be selected as the one to use. ![](/media/articles/hrd/sd4h-6wlwOsQA1PCQKLAmtQ.png) ::: note -Selecting the appropriate Identity Providers from multiple options is called "Home Realm Discovery". A pompous name for a simple problem. +Selecting the appropriate Identity Providers from multiple options is called "Home Realm Discovery". ::: -## Option 1: Programmatically +If you use at most one database connection and zero or more social connections the selection process is straightforward. The user will either: + +* Click on one of the social identity providers buttons (e.g. "Log in with Google") +* Enter their email and password (meaning "I will use the database connection"). + +But if the application or tenant have other connection types enabled (like enterprise connections or multiple databases) the selection process might be more involved. How do you indicate that a user wants to use a specific database connection if more than one is enabled? What if a user wants to use an enterprise connection to log in using Single Sign-on (SSO)? + +If you implement [a custom login UI](/libraries/when-to-use-lock#when-to-implement-lock-vs-a-custom-ui) you have full control over the authentication flow. You can choose the connection based on context (like the given email address) or by asking the user, then provide the `connection` parameter to one of Auth0.js' [login methods](/libraries/auth0js/v9#login). + +## Lock and multiple connections + +Lock has built in functionality for identity provider selection. For social connections, it shows logos for all those enabled in a particular app. It also provides username/email and password fields if a database connection or Active Directory connection are enabled. + +## Using email domains with enterprise connections + +An additional feature in Lock is the use of email domains as a way of routing authentication requests. Enterprise connections in Auth0 can be mapped to `domains`. For example, when configuring an ADFS or a SAML-P identity provider: + +![](/media/articles/libraries/lock/enterprise-connection.png) + +If a connection has domains mapped to it, then the password input field gets disabled automatically when a user enters an email with a mapped domain. + +![Lock using HRD/SSO](/media/articles/libraries/lock/hrd-sso.png) + +In the example above the domain `auth0.com` has been mapped to an enterprise connection. + +Notice that you can associate multiple domains to a single connection. -When you initiate an authentication transaction with Auth0 you can optionally send a `connection` parameter. This value maps directly with any connection defined in the [Dashboard](${manage_url}). +## Selecting among multiple database connections + +If your application has multiple database connections enabled, Lock needs to know which one to use. You can provide a [`connectionResolver` option](https://github.com/auth0/lock#other-options), which takes a function that decides the connection to use based on the user input and context. In this example an alternative database connection is used if the email domain is "auth0.com": + +``` +var options = { + connectionResolver: function (username, context, cb) { + var domain = username.indexOf('@') !== -1 && username.split('@')[1]; + if (domain && domain ==='auth0.com') { + // If the username is test@auth0.com, the connection used will be the `auth0-users` connection. + cb({ type: 'database', name: 'auth0-users' }); + } else { + // Use the default approach to figure it out the connection + cb(null); + } + } +} +``` + +You can use the [`defaultDatabaseConnection` option](/libraries/lock/v11/configuration#defaultdatabaseconnection-string-) to specify the database connection that will be used by default. + +## Filtering available connections programmatically + +The [`allowedConnections` option](/libraries/lock/v11/configuration#allowedconnections-array-) in Lock lets you indicate which of the available connections should be presented as an option to the user. + +This lets you tailor the experience based on additional input or context (e.g. "Click here to log in as a student, or here to log in as a faculty member"). -If using [Lock](/libraries/lock), this is as simple as initiating Lock with the following option: ```js var lock = new Auth0Lock( @@ -32,28 +92,48 @@ var lock = new Auth0Lock( Note that you can also provide the `allowedConnections` option to the `lock.show()` method if providing it at instantiation is not ideal for your use case. Please refer to the [API documentation](/libraries/lock/v11/api#show-) for the `show` method for more information. ::: -There are multiple practical ways of determining which of your `connection` value to indicate for any given user. Here are two common scenarios: - -* You can use vanity URLs: `https://{connection}.yoursite.com` or `https://www.yoursite.com/{connection}`. When a user arrives at your application with the vanity URL, you can pick up that value and pass it to Lock as the `allowedConnections` value. -* You can just ask the user to pick from a list of all of your available connections (or those you want to be chosen from) at some point, and then show only that connection to that user. -* You could use non-human-readable connection names and use some external mechanism to map these to users (such as through a primary verification, out of band channel for example). - -::: note -The first two methods above assume it is acceptable for your app to disclose the names of all of your connections, which may not be appropriate for your application. -::: +# Sending realm information from the application -## Option 2: Using Email Domains with Lock +Sometimes the application requesting an authentication can know, in advance, the realm intented to be used by the user. E.g. a multi-tenant application might use URLs in the form of: `https://{customer}.yoursite.com` or `https://www.yoursite.com/{customer}`. When a user arrives at your application with the vanity URL, you can pick up that `tenant` value and pass it as the `login_hint` in the `authorize` request: -[Lock](/libraries/lock) has built in functionality for identity provider selection. For social connections it will show logos for all those enabled in that particular app. +``` +https://{YOUR_AUTH0_DOMAIN}/authorize?client_id=[...]&login_hint={customer} +``` -An additional feature in the Lock is the use of email domains as a way of routing authentication requests. Enterprise connections in Auth0 can be mapped to `domains`. For example, when configuring an ADFS or a SAML-P identity provider: +`login_hint` is a hint to the authorization server (Auth0) to indicate what the user might use to log in. In this case, based on the URL where the user landed, we treat the "customer" as the realm. -![](/media/articles/libraries/lock/enterprise-connection.png) +The default hosted login page code uses it to pre-fill the email field in Lock, but we can modify the code to alter the default database connection to be used if a realm is provided instead of an actual email address: -If a connection has domains mapped to it, then the password input field gets disabled automatically when a user is typing an e-mail with a mapped domain. - -![Lock using HRD/SSO](/media/articles/libraries/lock/hrd-sso.png) +```js +// from the default Hosted Login Page template +var config = JSON.parse(decodeURIComponent(escape(window.atob('@@config@@')))); +[...] + +var loginHint = config.extraParams.login_hint; +var realmHint; + +// if the login hint is not an email address, we treat it as a realm hint +if (loginHint && loginHint.indexOf('@') < 0) { + realmHint = loginHint; + loginHint = null; +} + +// now we map the realm into an actual database +var defaultDatabaseConnection; +if (realmHint === 'acme') { + defaultDatabaseConnection = 'acme-users'; +} else if (realmHint === 'auth0') { + defaultDatabaseConnection = 'auth0-DB'; +} + +// When configuring Lock, we provide the values obtained before +var lock = new Auth0Lock(config.clientID, config.auth0Domain, { + [...] // other options + prefill: loginHint ? { email: loginHint, username: loginHint } : null, + defaultDatabaseConnection: defaultDatabaseConnection +} +``` -In the example above the domain `auth0.com` has been mapped to an enterprise connection. +The above code is, of course, just a sample. You could expand this logic to filter out social connections, or to set a default connection to be used even if an email address is provided as a `login_hint`. -Notice that you can associate multiple domains to a single connection. +Mapping the "customer" as a realm is an arbitrary design decision for this example. But it is generally a good idea to isolate applications from the actual "connection" concept used within Auth0 and use the more abstract "realm" concept instead, possibly doing a realm-to-connection mapping within the hosted login page (where it's easier to make changes if necessary). diff --git a/articles/libraries/lock/v11/sending-authentication-parameters.md b/articles/libraries/lock/v11/sending-authentication-parameters.md index c7ed408449..fa5e7055ff 100644 --- a/articles/libraries/lock/v11/sending-authentication-parameters.md +++ b/articles/libraries/lock/v11/sending-authentication-parameters.md @@ -1,6 +1,14 @@ --- section: libraries description: Lock v11 documentation on setting authentication parameters. +topics: + - libraries + - lock +contentType: + - how-to + - reference +useCase: + - add-login --- # Lock Authentication Parameters @@ -14,7 +22,7 @@ var options = { }; ``` -The following parameters are supported: `access_token`, `scope`, `protocol`, `device`, `request_id`, `nonce` and `state`. +The following parameters are supported: `scope`, `device`, `nonce` and `state`. ::: note This would be analogous to triggering the login with `https://${account.namespace}/authorize?state=foo&...`. @@ -66,10 +74,12 @@ There is also a `connectionScopes` configuration option for Lock v11, which allo ### state {string} -The `state` parameter is an arbitrary state value that will be mantained across redirects. It is useful to mitigate [XSRF attacks](http://en.wikipedia.org/wiki/Cross-site_request_forgery) and for any contextual information, [such as a return url](/tutorials/redirecting-users), that you might need after the authentication process is finished. If a custom state parameter is not provided, Lock will automatically generate one. - -[Click here to learn more about how to send/receive the state parameter.](/protocols/oauth-state) +The `state` parameter is an arbitrary state value that will be maintained across redirects. It is useful to mitigate [XSRF attacks](http://en.wikipedia.org/wiki/Cross-site_request_forgery) and for any contextual information, [such as a return url](/protocols/oauth2/redirect-users) that you might need after the authentication process is finished. If a custom state parameter is not provided, Lock will automatically generate one. For more information, see [State Parameter](/protocols/oauth-state). ### nonce {string} The `nonce` parameter is used to help prevent replay attacks, and will be automatically generated by Lock if a custom value is not provided. + +### device {string} + +The `device` parameter sets the name of the device or browser requesting authentication. diff --git a/articles/libraries/lock/v11/ui-customization.md b/articles/libraries/lock/v11/ui-customization.md index 2ad64426c8..6bbb747ae9 100644 --- a/articles/libraries/lock/v11/ui-customization.md +++ b/articles/libraries/lock/v11/ui-customization.md @@ -1,10 +1,19 @@ --- section: libraries description: Customizing the appearance of your Lock widget can be important for branding and a cohesive UI, and this resource highlights the ways in which you can do so while implementing Lock in your project. +topics: + - libraries + - lock + - lock-ui +contentType: + - how-to + - reference +useCase: + - add-login --- # Lock UI Customization -You can customize the appearance of your Lock widget in a few different ways. The best and safest way to do so is with the provided JavaScript options. +You can customize the appearance of your Lock widget in a few different ways. The best and safest way to do so is with the provided JavaScript options. ## JavaScript Options @@ -18,7 +27,7 @@ There are a couple of theming options currently available, namespaced under the #### logo {String} -![Lock - Theme - Logo](/media/articles/libraries/lock/v10/customization/lock-theme-logo.png) +![Lock - Theme - Logo](/media/articles/libraries/lock/v11/customization/lock-theme-logo.png) The value for `logo` is a URL for an image that will be placed in the Lock's header, and defaults to Auth0's logo. It has a recommended max height of `58px` for a better user experience. @@ -32,7 +41,7 @@ var options = { #### primaryColor {String} -![Lock - Theme - Primary Color](/media/articles/libraries/lock/v10/customization/lock-theme-primarycolor.png) +![Lock - Theme - Primary Color](/media/articles/libraries/lock/v11/customization/lock-theme-primarycolor.png) The `primaryColor` property defines the primary color of the Lock; all colors used in the widget will be calculated from it. This option is useful when providing a custom `logo`, to ensure all colors go well together with the `logo`'s color palette. Defaults to `#ea5323`. @@ -86,7 +95,7 @@ var options = { }; ``` -![Lock - Language Dictionary](/media/articles/libraries/lock/v10/customization/lock-languagedictionary.png) +![Lock - Language Dictionary](/media/articles/libraries/lock/v11/customization/lock-languagedictionary.png) ::: note For a complete list of the items able to be customized using `languageDictionary`, see the [English Language Dictionary Specification](https://github.com/auth0/lock/blob/master/src/i18n/en.js) in the repository. @@ -103,9 +112,9 @@ var lock = new Auth0Lock('${account.clientId}', '${account.namespace}', options) ## Overriding CSS -Customizing your Lock by overriding its CSS isn't recommended. The issue is that with new releases of Lock, some styling may change, leading to unintended problems if you are overriding the CSS. Additonally, it's possible to simply overlook use of styles in other places and while the change may look fine in one view, it might not in another. +Customizing your Lock by overriding its CSS isn't recommended. The issue is that with new releases of Lock, some styling may change, leading to unintended problems if you are overriding the CSS. Additionally, it's possible to simply overlook use of styles in other places and while the change may look fine in one view, it might not in another. -If you still intend to override CSS to further style your Lock, we recommend that you use a specific patch version of Lock rather than a major or minor version, so that you limit the amount of unexpected results that may occur when you alter the styles, and then another patch is deployed that might cause unexpected behavior in your UI due to the changes. This can be done by ensuring that you specify that patch verion (`x.y.z`) when including Lock, or downloading it. +If you still intend to override CSS to further style your Lock, we recommend that you use a specific patch version of Lock rather than a major or minor version, so that you limit the amount of unexpected results that may occur when you alter the styles, and then another patch is deployed that might cause unexpected behavior in your UI due to the changes. This can be done by ensuring that you specify that patch version (`x.y.z`) when including Lock, or downloading it. Additionally, we of course recommend that you test your CSS changes exhaustively, to ensure that the experience is the one you intend it to be for your customers. diff --git a/articles/libraries/lock/v9/api.md b/articles/libraries/lock/v9/api.md deleted file mode 100644 index ce5cd394c2..0000000000 --- a/articles/libraries/lock/v9/api.md +++ /dev/null @@ -1,234 +0,0 @@ ---- -section: libraries -description: Lock V9 API Reference -title: Lock 9 API Reference -toc: true ---- -# Lock 9: API Reference - -<%= include('../../../_includes/_version_warning_lock') %> - -## Methods - -### Auth0Lock(clientID, domain[, options]) - -Initialize `Auth0Lock` with a `clientID` and the account's `domain`. - -```js -var lock = new Auth0Lock('xxxxxx', '.auth0.com'); -``` - -::: note -For a full detail on options and parameters you can check the [Auth0Lock initialization][lock-initialization] wiki notes. -::: - -### .show([options, callback]) - -Open the widget on `signin` mode with `signup` and `reset` button actions if enabled for the configured/default account connection. - -You may call this method with a single parameter, two or even none. The following examples ilustrate this: - -```js -var lock = new Auth0Lock('xxxxxx', '.auth0.com'); - -// using defaults and resolved configuration -// from you account details -lock.show(); - -// passing some options -lock.show(options); - -// provide with a callback `fn` to be invoked -// at success or error authentication -lock.show(function (err, profile, token) {}); - -// or both options and callback -lock.show(options, function (err, profile, token) {}); - -``` - -::: note -Check the [Auth0Lock customization][lock-customization] article for more examples and options specification. Or enter the [Authentication modes][application-types] notes to learn more about implementing different authentication mechanics. -::: - -### .showSignin([options, callback]) - -Open the widget on `signin` mode, but without the bottom `signup` nor `reset` button actions. This method is useful when your site has custom *signup* and *reset* links at a different form. - -You may call this method with a single parameter, two or even none. The following examples ilustrate this: - -```js -var lock = new Auth0Lock('xxxxxx', '.auth0.com'); - -// using defaults and resolved configuration -// from you account details -lock.showSignin(); - -// passing some options -lock.showSignin(options); - -// provide with a callback `fn` to be invoked -// on `reset` success or error -lock.showSignin(function (err, profile, token) {}); - -// or both options and callback -lock.showSignin(options, function (err, profile, token) {}); -``` - -::: note -Check the [Auth0Lock customization][lock-customization] article for more examples and options specification. Or enter the [Authentication modes][application-types] notes to learn more about implementing different authentication mechanics. -::: - -### .showSignup([options, callback]) - -Open the widget on `signup` mode, but without the `cancel` button action to go back to `signin`. This method is useful when your site has custom *signin* and *reset* links at a different form. - -You may call this method with a single parameter, two or even none. The following examples ilustrate this: - -```js -var lock = new Auth0Lock('xxxxxx', '.auth0.com'); - -// using defaults and resolved configuration -// from you account details -lock.showSignup(); - -// passing some options -lock.showSignup(options); - -// provide with a callback `fn` to be invoked -// on `reset` success or error -lock.showSignup(function (err) {}); - -// or both options and callback -lock.showSignup(options, function (err) {}); -``` - -::: note -Check the [Auth0Lock customization][lock-customization] article for more examples and options specification. Or enter the [Authentication modes][application-types] notes to learn more about implementing different authentication mechanics. -::: - -### .showReset([options, callback]) - -Open the widget on `reset` mode, but without the bottom `cancel` button action to go back to `signin`. This method is useful when your site has custom *signin* and *signup* links at a different form. - -You may call this method with a single parameter, two or even none. The following examples ilustrate this: - -```js -var lock = new Auth0Lock('xxxxxx', '.auth0.com'); - -// using defaults and resolved configuration -// from you account details -lock.showReset(); - -// passing some options -lock.showReset(options); - -// provide with a callback `fn` to be invoked -// on `reset` success or error -lock.showReset(function (err) {}); - -// or both options and callback -lock.showReset(options, function (err) {}); -``` - -::: note -Check the [Auth0Lock customization][lock-customization] article for more examples and options specification. Or enter the [Authentication modes][application-types] notes to learn more about implementing different authentication mechanics. -::: - -### .hide([callback]) - -Close the widget and invoke `callback` when removed from DOM. - -```js -var lock = new Auth0Lock('xxxxxx', '.auth0.com'); - -// normal display -lock.show(options); - -// trigger hide when esc key pressed -document.addEventListener('keypress', function(e) { - // hide if esc - lock.hide(); -}, false); -``` - -### .logout([query]) - -Log out loggedin user with optional query parameters for the `GET` request. - -```js -var lock = new Auth0Lock('xxxxxx', '.auth0.com'); - -// Call logout with query parameters -lock.logout({ ref: window.location.href }); -``` - -## Events - -```js -var lock = new Auth0Lock(clientID, domain). - -// called every time triggered -lock.on('signin ready', function() { - // signin mode is displayed -}); - -// called only once -lock.once('signup ready', function() { - // signup mode is displayed -}); - -// remove all listener handlers for `event` -lock.removeAllListeners('signin ready'); - -// remove just the following handler -lock.removeListener('signin ready', signinHandlerFn); -``` - -### Index of events - -- `shown`: Triggers when the Lock early opens. -- `ready`: Triggers when the Lock is ready for user interaction. -- `close`: Triggers when the user manually closes the Lock. -- `hidden`: Triggers when the Lock has hidden. -- `signin ready`: Triggers when signin mode view is displayed. -- `signin submit`: Triggers when signin mode is submitted. -- `signin success`: Triggers when signin has succeeded with no error. -- `signin error`: Triggers when there's an error on the signin workflow. -- `signup ready`: Triggers when signup mode is displayed. -- `signup submit`: Triggers when singup mode is submitted. -- `signup success`: Triggers when signup was succeeded with no error. -- `signup error`: Triggers when there's an error on the signup workflow. -- `reset ready`: Triggers when reset mode is displayed. -- `reset submit`: Triggers when reset mode is submitted. -- `reset success`: Triggers when reset has succeeded with no error. -- `reset error`: Triggers when there's an error on the reset workflow. -- `loggedin ready`: Triggers when loggedin mode is displayed. -- `loggedin submit`: Triggers when loggedin panel is submitted. -- `kerberos ready`: Triggers when integrated windows authentication mode is displayed. -- `kerberos submit`: Triggers when integrated windows authentication mode is submitted. -- `loading ready`: Triggers when loading mode is displayed. -- `error shown`: Triggers when an error was displayed. - -### Examples - -```js -// Modify the options before the signin is submitted. -// Useful for changing the authParams based on the email address (which is available in the context). -lock.on('signin submit', function (options, context) { - if (!options.authParams) - options.authParams = {}; - options.authParams.login_hint = context.email; -}); -``` - -### Internals (use at your own risk) - -- `icon shown`: Triggered when Lock icon or gravatar image has been shown. -- `icon hidden`: Triggered when Lock icon or gravatar image has been hidden. -- `avatar shown`: Triggered when Lock avatar has been shown. -- `avatar hidden`: Triggered when Lock avatar has been hidden. -- `client fetch success`: Triggers when `clientID`'s config data is fetched. -- `client fetch error`: Triggers when there's an error when fetching `clientID`'s config data. -- `client loaded`: Triggers when `clientID`'s config data was loaded. -- `client initialized`: Triggers when `clientID`'s config data is fetched and loaded. \ No newline at end of file diff --git a/articles/libraries/lock/v9/authentication-modes.md b/articles/libraries/lock/v9/authentication-modes.md deleted file mode 100644 index 54b37f6eac..0000000000 --- a/articles/libraries/lock/v9/authentication-modes.md +++ /dev/null @@ -1,99 +0,0 @@ ---- -section: libraries -description: Lock v9 doc on the different types of authentication modes. -toc: true ---- -# Lock: Authentication Modes - -<%= include('../../../_includes/_version_warning_lock') %> - -After Auth0 Lock is opened, you can choose any of the Identity Providers (IdP) that Auth0 has, to Login. Depending on how the IdP Web/App is opened, a different authentication mode is used. - -## Redirect Mode - -If after you click on the IdP button (Facebook for example), the Webapp you built gets redirected to Facebook, it means you're using Redirect Mode. Once you successfully login to Facebook, Facebook will redirect you back to your app (through Auth0). This means that if you had **any state in memory in your WebApp, it will be lost**. This is why a successful login with Redirect mode **cannot be handled with a callback** and must be handled with the `parseHash` method. - -### Example: Redirect Mode in SPA - -In this first example you'll see that a `callbackURL` isn't set. That's because by default the `callbackURL` is set to `location.href` which means the current URL. - -Optionally, [you can set the callbackURL to whatever you need](/libraries/lock/v9/configuration#callbackurl-string). Please bear in mind that if you do, you'll also need to specify `responseType: token` as part of the options. - -```js -var lock = new Auth0Lock(${account.clientId}, ${account.namespace}); - -var hash = lock.parseHash(); - -if (hash) { - if (hash.error) { - console.log("There was an error logging in", hash.error); - } else { - lock.getProfile(hash.id_token, function(err, profile) { - if (err) { - console.log('Cannot get user :(', err); - return; - } - - console.log("Hey dude", profile); - }); - } -} - -lock.show(); -``` - -### Example: Redirect Mode in Regular Web Apps - -When you're doing a Regular web app, you need that after a successful login through Auth0, your app is redirected to a callback endpoint that you've created in your server. That callback endpoint will receive the `code` from Auth0 which must then [be exchanged for an access_token to get the user information](/protocols#3-getting-the-access-token). - -This means that in this case, only redirect mode makes sense. - -```js -var lock = new Auth0Lock(${account.clientId}, ${account.namespace}); - -lock.show({ - callbackURL: 'http://myUrl.com/auth/callback' -}); -``` - -## Popup Mode - -If after you click on the IdP button (Facebook for example), a popup (new tab or window) is opened, it means you're using Popup Mode. In that popup, you'll see that Facebook page is displayed. Once you successfully login to Facebook, the popup will be closed and your WebApp will recognize that the user has been authenticated. The WebApp has **never been redirected to any other page. This means that you won't lose any state in memory that your application had**. This is why we can **handle successful login with a callback** in this case. - -::: warning -There is a known bug that prevents popup mode from functioning properly in Android or Firefox on iOS, and in Internet Explorer under certain circumstances. As such we recommend only using redirect mode (or if popup mode is absolutely required, detecting these special cases in which popup mode will fail and selectively enabling redirect mode). -::: - -### Database connections and popup mode - -Some Auth0 features such as [MFA](/multifactor-authentication) and [SSO](/sso/single-sign-on) between multiple applications depend on users being redirected to Auth0 to set a cookie on `'${account.namespace}'`. - -When using popup mode, a popup window will be displayed in order to set this cookie and display MFA prompts if necessary; this popup window will be blank if users are not prompted for MFA, which might not be a desirable UX. The reason for this is that cross-origin requests sent from your application to Auth0 are not be able to set cookies. - -If you do not want to display a popup window and do not need MFA or SSO between multiple applications, you can set `sso: false` when using Lock or auth0.js. - -For example: - -```js -auth.signin({ - sso: false, - ... -}, function (err, profile, token) { ... }); -``` - -### Example: Popup Mode in SPA - -Below is an example of an implementation of popup mode in a Single Page Application: - -```js -var lock = new Auth0Lock(${account.clientId}, ${account.namespace}); - -lock.show(function(err, profile, id_token) { - if (err) { - console.log("There was an error :/", err); - return; - } - - console.log("Hey dude", profile); -}) -``` diff --git a/articles/libraries/lock/v9/configuration.md b/articles/libraries/lock/v9/configuration.md deleted file mode 100644 index 3c766847f5..0000000000 --- a/articles/libraries/lock/v9/configuration.md +++ /dev/null @@ -1,498 +0,0 @@ ---- -section: libraries -description: How to configure user options with Lock V9 ---- -# Lock: User configurable options - -<%= include('../../../_includes/_version_warning_lock') %> - -The **Auth0Lock** can be customized through the `options` parameter sent to the `.show()` methods. - -```js -var lock = new Auth0Lock('clientID', 'account.auth0.com'); - -// default signin with signup and reset actions -lock.show(options); - -// only signin -lock.showSignin(options); - -// only signup -lock.showSignup(options); - -// only reset -lock.showReset(options); -``` - -## Table of Contents - -**For display customization**: - -- [connections](#connections-array-) -- [dict](#dict-string-object-) -- [container](#container-string-) -- [icon](#icon-string-) -- [closable](#closable-boolean-) -- [socialBigButtons](#socialbigbuttons-boolean-) -- [focusInput](#focusinput-boolean-) -- [usernameStyle](#usernamestyle-string-) -- [gravatar](#gravatar-boolean-) -- [disableSignupAction](#disablesignupaction-boolean-) -- [signupLink](#signuplink-string-) -- [disableResetAction](#disableresetaction-boolean-) -- [resetLink](#resetlink-string-) -- [popup](#popup-boolean-) -- [popupOptions](#popupoptions-object-) -- [loginAfterSignup](#loginaftersignup-boolean-) -- [rememberLastLogin](#rememberlastlogin-boolean-) -- [integratedWindowsLogin](#integratedwindowslogin-boolean-) -- [defaultUserPasswordConnection](#defaultuserpasswordconnection-string-) -- [defaultADUsernameFromEmailPrefix](#defaultadusernamefromemailprefix-boolean-) -- [theme](#theme-string-) - -**For authentication setup**: - -- [callbackURL](#callbackurl-string-) -- [responseType](#responsetype-string-) -- [forceJSONP](#forcejsonp-boolean-) -- [authParams](#authparams-object-) -- [sso](#sso-boolean-) - -### connections {Array} - -Array of connections that will be used for the `signin|signup|reset` actions. Defaults to all enabled connections. - -```js -// The following will only display -// username and password signin form -lock.show({ - connections: ['Username-Password-Authentication'] -}); - -// ... social connections only -lock.show({ - connections: ['twitter', 'facebook', 'linkedin'] -}); - -// ... enterprise connections only -lock.show({ - connections: ['qraftlabs.com'] -}); -``` - -![](/media/articles/libraries/lock/customization/connections.png) - -### dict {String|Object} - -The `dict` option can be either a string matching any [supported language][lock-i18n] (`'en'`, `'es'`, `'it'`, ...) or an object containing your customized text labels. By using the last approach you can modify [any text label][lock-i18n] or even [customize error messages][lock-custom-errors]. - -```js -// select a supported language -lock.show({ - dict: 'es' -}); - -// or customize the text labels yourself -lock.show({ - dict: { - signin: { - title: "Login me in", - emailPlaceholder: "something@youremail.com" - } - } -}); -``` - -![](/media/articles/libraries/lock/customization/dict.png) - -### container {String} - -The Lock widget defaults to showing in a modal, but you can set the `container` option to the `id` of the HTML element where you wish the widget to be shown. This makes the widget appear inline, inside the element, instead of as a popup. - -````html -
    - - -```` - -![](/media/articles/libraries/lock/customization/container.png) - -### icon {String} - -`Url` for an image to load in place of the *Auth0Lock* header badge. Recommended max height of `58px` for a better user experience. Defaults to placeholder image. - -```js -// Show default placeholder -lock.show(); - -// customize with own logo/badge -lock.show({ - icon: 'https://auth0.com/boot/badge.png' -}); -``` - -![](/media/articles/libraries/lock/customization/icon.png) - -::: note -To disable the header badge entirely, [UI customizations][ui-customization] are required.. -::: - -### closable {Boolean} - -Enable/disable closable feature. Defaults to `true` for modal show and false for embedded. - -```js -// closable action enabled by default -lock.show(); - -// disable the closable action -lock.show({ - closable: false -}); -``` - -![](/media/articles/libraries/lock/customization/closable.png) - -### socialBigButtons {Boolean} - -Force large/small social buttons. Defaults to `true` when no `database` or `ad/ldap` connections enabled and `false` when at least one is configured. - -::: note -Setting this property will override previous defaults. -::: - -```js -// `false` when at least -// 1 database connection -lock.show(); - -// `true` when none -lock.show({ - connections: ['facebook', 'linkedin', 'amazon'] -}); - -// force big buttons -lock.show({ - socialBigButtons: true -}); - -// force small icons -lock.show({ - connections: ['facebook', 'linkedin', 'amazon'], - socialBigButtons: false -}); -``` - -![](/media/articles/libraries/lock/customization/socialBigButtons.png) - -### focusInput {Boolean} - -If true, the focus is set to the email field on the widget. Defaults to `false` when mobile or embedded mode, `true` in other cases. - -```js -lock.show({ - focusInput: false -}); -``` - -### usernameStyle {String} - -If you don't want to validate that the user enters an email, just set this to `username`. Defaults to `email` - -```js -// email as default username style -lock.show(); - -// force `username` input style -lock.show({ - usernameStyle: 'username' -}); -``` - -![](/media/articles/libraries/lock/customization/usernameStyle.png) - -### gravatar {Boolean} - -Default: `true` - -In `show`, `showSignin` and `showSignup` methods, when user types their email, their associated gravatar picture is displayed in the Lock header. - -![](/media/articles/libraries/lock/customization/gravatar.png) - -### disableSignupAction {Boolean} - -Hides the Signup button. Defaults to `true` on `show*()` options and `false` on `.show`. - -This option **only** controls client-side appearance, and does not completely stop new sign ups from determined anonymous visitors. If you are looking to fully prevent new users from signing up, you must use the **Disable Sign Ups** option in the dashboard, in the connection settings. - -```js -// -lock.show({ - disableSignupAction: true -}); -``` - -![](/media/articles/libraries/lock/customization/disableSignupAction.png) - -### signupLink {String} - -Set the URL to be requested when clicking on the Signup button. When set, forces `disableSignupAction` to `false`. - -```js -// -lock.show({ - signupLink: 'https://yoursite.com/signup' -}); -``` - -### disableResetAction {Boolean} - -Hides the reset password button. Defaults to `true` on `show*()` options and `false` on `.show`. - -```js -// -lock.show({ - disableResetAction: true -}); -``` - -![](/media/articles/libraries/lock/customization/disableResetAction.png) - -### resetLink {String} - -Set the URL to be requested when clicking on the Reset password button. When set, forces `disableSignupAction` to `false`. - -```js -// -lock.show({ - resetLink: 'https://yoursite.com/reset-password' -}); -``` - -### popup {Boolean} - -If set to true, shows a popup when trying to login with a Social or Enterprise IdP. For more information, [read this](/libraries/lock/v9/authentication-modes#popup-mode). Defaults to `true` when a `callback` is set, otherwise `false`. - -```js -lock.show({ - popup: true -}); - -lock.show({}, function(err, profile) { - // Popup automatically set to true in this case -}); -``` - -![](/media/articles/libraries/lock/customization/popup.png) - -### popupOptions {Object} - -Options for the `window.open` [position and size][windowopen-link] features. This only applies if `popup` is set to true. - -```js -lock.show({ - popup: true, - popupOptions: { width: 300, height: 400, left: 200, top: 300 } -}); -``` - -![](/media/articles/libraries/lock/customization/popupOptions.png) - -### loginAfterSignup {Boolean} - -Triggers a sign in call after sign up. Defaults to `true`. - -```js -// will sign in user after sign up -lock.show(); - -// won't sign in user after sign up -lock.show({ - loginAfterSignup: false -}); -``` - -### rememberLastLogin {Boolean} - -Request for SSO data and enable **Last time you signed in with[...]** message. Defaults to `true`. - -```js -// rememberLastLogin is enabled by default -lock.show(); - -// and this way you can disable it -// to force for input credentials -lock.show({ - rememberLastLogin: false -}); -``` - -![](/media/articles/libraries/lock/customization/rememberLastLogin.png) - -### integratedWindowsLogin {Boolean} - -Allows for Realm discovery by `AD`, `LDAP` connections. Defaults to `true`. - -```js -// AD|LDAP Realm discovery enabled by default -lock.show(); - -// disable Realm discovery to force -// input of credentials -lock.show({ - integratedWindowsLogin: false -}); -``` - -### defaultUserPasswordConnection {String} - -When multiple Database/AD-LDAP connections, specify which one should be used with the Email/Password fields. Defaults to the first Database connection found (if exists) or the first AD-LDAP connection found. - -::: note -Shall be renamed to just `forceDatabase`. -::: - -```js -// defaults to the first configured -// database connection in Auth0's dashboard -// configured are `production-database`, -// `staging-database` and `test-database` -lock.show(); - -// defaults to the first on the list -// of provided database connections -lock.show({ - // `production-database` not listed - connections: ['staging-database', 'test-database'] -}); - -// force `test-database` -lock.show({ - defaultUserPasswordConnection: 'test-database' -}); -``` - -### defaultADUsernameFromEmailPrefix {Boolean} - -Resolve the AD placeholder username from the email's prefix. Defaults to `true`. - -```js -// default username from email prefix -lock.show(); - -// does not fill username input -lock.show({ - defaultADUsernameFromEmailPrefix: false -}); -``` - -![](/media/articles/libraries/lock/customization/defaultADUsernameFromEmailPrefix.png) - -### theme {String} - -This property allows to change the default `a0-theme-default` class to whatever delivered by this option. The result will be a containing CSS class like `a0-theme-`. The result of this will be a complete style reset of the Lock allowing to set your own theme/styles. Defaults to `default`. - -```js -// Default theme out of the box -lock.show(); - -// Theme reset -lock.show({ theme: false }); - -// Theme rename to `a0-theme-mycroft` -lock.show({ theme: 'mycroft' }); -``` - -### callbackURL {String} - -The url auth0 will redirect back after authentication. If not set, it defaults to `location.href`. If you don't set `callbackURL`, [responseType](#responsetype-string) will default to `token`. - -```js -lock.show({ - callbackURL: 'http://mydomain.com/callback' -}); -``` - -### responseType {String} - -Should be set to `token` for *Single Page Applications*, otherwise `code`. Defaults to `token` if `callbackURL` is __not__ set, `popup` mode is set to true or if a `callback` is supplied. Otherwise, it'll be `code`. - -```js -lock.show({ - responseType: 'token' -}); -``` - -### forceJSONP {Boolean} - -Force JSONP requests for all `auth0-js` instance requests. This setup is useful when no CORS allowed. Defaults to `false`. - -```js -lock.show({ - forceJSONP: true -}); -``` - -### authParams {Object} - -You can send parameters when starting a login by adding them to the options object. The example below adds a `state` parameter with a value equal to `foo`. [Read here][authparams-link] to learn more about what `authParams` can be set. - -```js -lock.show({ - // ... other options ... - authParams: { - state: 'foo' - } -}); -``` - -::: note -For a full spec on every supported parameter check the wiki [article][authparams-link] on this topic. -::: - -### sso {Boolean} - -Sets a cookie used for single sign on. The cookie will be used later to allow `rememberLastLogin` display the **Last time you signed in with ...** message. This only applies to Database Connections when using `popup: true` and fires a popup where authentication takes place. Last but not least, it prompts for a multifactor authentication code, if enabled. - -::: warning -Failing to set this to true will result in multi-factor authentication not working correctly. -::: - -```js -lock.show({ - sso: true -}); -``` - -*** - -## Internally resolved - -The following are all internal options. The only reason they are listed here is to have a full documentation for the options object. - -::: note -Passing any of the following to the `options` object will be overridden by `Auth0Lock`s options manager. Do not attempt to modify these... it won't happen. -::: - -### mode {String} - -Set the `show` mode for the display. Allowed values are `signin`, `signup` and `reset`. Defaults to `signin`. - -### popupCallback {Function} - -Internally set from `callback` parameter - -[authparams-link]: /libraries/lock/v9/sending-authentication-parameters -[windowopen-link]: https://developer.mozilla.org/en-US/docs/Web/API/Window.open#Position_and_size_features - -[lock-i18n]: /libraries/lock/v9/i18n -[lock-custom-errors]: /libraries/lock/v9/customizing-error-messages -[ui-customization]: /libraries/lock/v9/ui-customization diff --git a/articles/libraries/lock/v9/customizing-error-messages.md b/articles/libraries/lock/v9/customizing-error-messages.md deleted file mode 100644 index 1fd3504d6c..0000000000 --- a/articles/libraries/lock/v9/customizing-error-messages.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -section: libraries -description: Customizing error messages with Lock V9 ---- -# Lock: Customizing Error Messages - -<%= include('../../../_includes/_version_warning_lock') %> - -You can customize the error messages that will be displayed on certain situations by providing a [dict option](/libraries/lock/v9/customization#dict-object) at the [customization options](/libraries/lock/v9/customization). A full listing of available `dict` fields to customize can be found in the GitHub repository's [English Dictionary file for Lock 9](https://github.com/auth0/lock/blob/v9/i18n/en.json). Below is an example of some customized error messages: - -```js -// Initialize the Auth0Lock instance -var lock = new Auth0Lock('${account.clientId}', '${account.namespace}'); - -// Customize your error messages in a dictionary -var dict = { - loadingTitle: 'loading...', - close: 'close', - signin: { - wrongEmailPasswordErrorText: 'Custom error message for invalid user/pass.', - serverErrorText: 'There was an error processing the sign in.', - strategyEmailInvalid: 'The email is invalid.', - strategyDomainInvalid: 'The domain {domain} has not been setup.' - }, - signup: { - serverErrorText: 'There was an error processing the sign up.', - enterpriseEmailWarningText: 'This domain {domain} has been configured for Single Sign On and you can\'t create an account. Try signing in instead.' - }, - reset: { - serverErrorText: 'There was an error processing the reset password.' - } - // wrongEmailPasswordErrorText, serverErrorText, enterpriseEmailWarningText are used only if you have a Database connection - // strategyEmailInvalid is shown if the email is not valid - // strategyDomainInvalid is shown if the email does not have a matching enterprise connection - } -}; - -// Invoke the lock show method with the customized dictionary -lock.show({ dict: dict }); -``` - -These errors will be shown on the widget header: - -![Widget Header Errors](/media/articles/libraries/lock/v9/custom-error.png) diff --git a/articles/libraries/lock/v9/i18n.md b/articles/libraries/lock/v9/i18n.md deleted file mode 100644 index 7fa73e6327..0000000000 --- a/articles/libraries/lock/v9/i18n.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -section: libraries -description: Lock V9 internationalization ---- -# Lock: Internationalization - -<%= include('../../../_includes/_version_warning_lock') %> - -You can call instantiate the widget with the `dict` option: - -```javascript -var lock = new Auth0Lock('dsa7d77dsa7d7', 'mine.auth0.com'); - -lock.show({ - dict: 'es' -}); -``` - -Where dict can be a string matching the name of the file in the `i18n` folder or it could be an object literal as follows: - -```javascript -var lock = new Auth0Lock('dsa7d77dsa7d7', 'mine.auth0.com'); - -lock.show({ - dict: { - "loadingTitle": "loading...", - "close": "close", - "signin": { - .. //same as in i18n json files - } -}); -``` - -Finally you can also make changes to an existing dictionary by merging a new dictionary in an existing one (this sample uses [underscore.js](http://underscorejs.org/)): - -```javascript -lock.show({ - dict: _.merge(lock.$dicts.en, { - "signup:headerText": "Hi there, please enter your email and password" - }) -}) -``` - -![i18n-image](/media/articles/libraries/lock/v9/i18n-image.gif) - -::: note -For an example of available property names, [see the English dictionary file for Lock 9](https://github.com/auth0/lock/blob/v9/i18n/en.json). -::: diff --git a/articles/libraries/lock/v9/index.md b/articles/libraries/lock/v9/index.md deleted file mode 100644 index 132b62ae0c..0000000000 --- a/articles/libraries/lock/v9/index.md +++ /dev/null @@ -1,201 +0,0 @@ ---- -section: libraries -description: Lock V9 documentation -title: Lock 9 for Web -toc: true ---- -# Lock 9 for Web - -<%= include('../../../_includes/_version_warning_lock') %> - -![Lock Image](/media/articles/libraries/lock/v9/lock-landing.png) - -[Auth0](https://auth0.com) is an authentication broker that supports social identity providers as well as enterprise identity providers such as Active Directory, LDAP, Google Apps, Salesforce. - -Lock makes it easy to integrate SSO in your app. You won't have to worry about: - -* Having a professional looking login dialog that displays well on any resolution and device. -* Finding the right icons for popular social providers. -* Remembering what was the identity provider the user chose the last time. -* Solving the home realm discovery challenge with enterprise users (such as asking the enterprise user the email, and redirecting to the right enterprise identity provider). -* Implementing a standard sign in protocol (OpenID Connect / OAuth2 Login) - -![Lock Sign Up](/media/articles/libraries/lock/v9/lock-signup.png) - -::: note -Check out the [Lock repository](https://github.com/auth0/lock/tree/v9) on GitHub. -::: - -::: note -You can try it out yourself online at our [Auth0 Lock playground][playground-url]. -::: - -## Install - -From [npm](https://npmjs.org): - -```sh -npm install auth0-lock -``` - -From [bower](http://bower.io): - -```sh -bower install auth0-lock -``` - -Or our CDN: - -```html - - - - - - - - -``` - -Replace `.x` and `.y` with the latest minor and patch release numbers from the [Lock Github repository](https://github.com/auth0/lock). - -If you are targeting mobile audiences, it's recommended that you add: - -```html - -``` - -### Browserify - -If you are using browserify to build your project, you will need to add the following transformations required by Auth0 Lock: - -``` json -{ - "devDependencies": { - "brfs": "0.0.8", - "ejsify": "0.1.0", - "packageify": "^0.2.0" - } -} -``` - -## Initialization - -Auth0Lock v9 can be initialized with just a clientID and domain, or it can also take a third parameter, an `options` object. - -```js -// Initialize with clientID and domain -var lock = new Auth0Lock(clientID, domain); - -// Or, initialize with options -var lock = new Auth0Lock(clientID, domain, options); -``` - -### Parameters - -The possible parameters are detailed below. - -* **clientID {String}**: Your application clientID in Auth0. -* **domain {String}**: Your Auth0 domain. Usually ```.auth0.com```. -* **options {Object}**: - * **cdn {String}**: Use as CDN base url. Defaults to `domain` if it doesn't equal `*.auth0.com`. - * **assetsUrl {String}**: Use as assets base url. Defaults to `domain` if it doesn't equal `*.auth0.com`. - * **useCordovaSocialPlugins {boolean}**: When Lock is used in a Cordova/Phonegap application, it will try authenticating with social connections using a native plugin. The only plugin supported is [phonegap-facebook-plugin](https://github.com/Wizcorp/phonegap-facebook-plugin) but more will come soon. - -## Usage - -You can use **Auth0Lock** with [Popup mode][popup-mode] or [Redirect mode][redirect-mode]. To learn more about these modes, you can read the [Authentication Modes][authentication-modes] page. -There are different ways of implementing them according to your application needs. To see what kind of settings you should be using you can check the [Types of Applications article][application-types]. - -```js -// Initialize Auth0Lock with your `clientID` and `domain` -var lock = new Auth0Lock('xxxxxx', '.auth0.com'); - -// and deploy it -var login = document.querySelector('a#login') - -login.onclick = function (e) { - e.preventDefault(); - lock.show(function onLogin(err, profile, id_token) { - if (err) { - // There was an error logging the user in - return alert(err.message); - } - - // User is logged in - }); -}; -``` - -This is just one example of how **Auth0Lock** could work with a **Single Page Application** (SPA). Read the [Single Page Applications][spa-notes] and the [Regular Web Applications][webapps-notes] articles for a full explanation on how to implement those scenarios with Auth0 Lock and when to use each. - -## Examples - -The `example` directory has a ready-to-go app. In order to run it you need [node](http://nodejs.org/) installed. - -Then execute `npm i` to install dependencies (only once) and `npm example` from the root of this project. - -Finally, point your browser at `http://localhost:3000/` and play around. - -## Browser Compatibility - -We ensure browser compatibility in `Chrome`, `Safari`, `Firefox` and `IE >= 9`. We currently use [zuul](https://github.com/defunctzombie/zuul) along with [Saucelabs](https://saucelabs.com) to run integration tests on each push. - -## Issue Reporting - -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. - -## Resources - -* [Complete API][lock-configuration] -* [UI customization][ui-customization] -* [Single Page Applications][spa-notes] implementation notes. -* [Regular Web Applications][webapps-notes] implementing notes. -* [Overlay vs Embedded mode][display-modes] -* [Popup vs Redirect mode][authentication-modes] notes. **What are the authentication modes?**. -* [Error customization][error-customization] notes. -* [I18n][i18n-notes] notes. -* [Events][events-notes] notes. -* [Development][development-notes] notes. -* [Release process][release-process] notes. -* [Auth0Lock playground][playground-url] -* [Lock Authentication Parameters][sending-authentication-parameters] -* [Using Refresh Tokens](/libraries/lock/v9/using-a-refresh-token) -* Legacy **Auth0Widget** [Migration guide][migration-guide] to **Auth0Lock** - - - -[download1]: https://raw.github.com/auth0/lock/master/build/auth0-lock.js -[download2]: https://raw.github.com/auth0/lock/master/build/auth0-lock.min.js - -[npm-image]: https://img.shields.io/npm/v/auth0-lock.svg?style=flat-square -[npm-url]: https://npmjs.org/package/auth0-lock -[strider-image]: https://ci.auth0.com/auth0/lock/badge -[strider-url]: https://ci.auth0.com/auth0/lock -[coveralls-image]: https://img.shields.io/coveralls/auth0/lock.svg?style=flat-square -[coveralls-url]: https://coveralls.io/r/auth0/lock?branch=master -[david-image]: http://img.shields.io/david/auth0/lock.svg?style=flat-square -[david-url]: https://david-dm.org/auth0/lock -[license-image]: http://img.shields.io/npm/l/auth0-lock.svg?style=flat-square -[license-url]: https://github.com/auth0/lock/blob/master/LICENSE -[downloads-image]: http://img.shields.io/npm/dm/auth0-lock.svg?style=flat-square -[downloads-url]: https://npmjs.org/package/auth0-lock - -[lock-initialization]: /libraries/lock/v9/initialization -[lock-configuration]: /libraries/lock/v9/configuration -[application-types]: /libraries/lock/v9/types-of-applications -[display-modes]: /libraries/lock/v9/display-modes -[spa-notes]: /libraries/lock/v9/types-of-applications#single-page-app -[webapps-notes]: /libraries/lock/v9/types-of-applications#regular-webapp -[authentication-modes]: /libraries/lock/v9/authentication-modes -[popup-mode]: /libraries/lock/v9/authentication-modes#popup-mode -[redirect-mode]: /libraries/lock/v9/authentication-modes#redirect-mode -[ui-customization]: /libraries/lock/v9/ui-customization -[error-customization]: /libraries/lock/v9/customizing-error-messages -[i18n-notes]: /libraries/lock/v9/i18n -[events-notes]: /libraries/lock/v9/events -[development-notes]: https://github.com/auth0/lock -[release-process]: https://github.com/auth0/lock -[playground-url]: http://auth0.github.com/playground -[sending-authentication-parameters]: /libraries/lock/v9/sending-authentication-parameters -[migration-guide]: /libraries/lock/v9/migration-guide diff --git a/articles/libraries/lock/v9/migration-guide.md b/articles/libraries/lock/v9/migration-guide.md deleted file mode 100644 index 0603dcc871..0000000000 --- a/articles/libraries/lock/v9/migration-guide.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -section: libraries -description: Guide to migrate from Auth0 Widget to Auth0 Lock. ---- -# Lock: Migration Guide - -<%= include('../../../_includes/_version_warning_lock') %> - -This guide will walk you through the needed changes to migrate from **Auth0Widget** to **Auth0Lock**. - -## Initialization - -While with the legacy Widget you had to: - -```js -var widget = new Auth0Widget({ - domain: 'your-domain.auth0.com', - clientID: 'YOUR_CLIENT_ID', - callbackURL: 'http:://your-domain.com/your_callback' -}); -``` - -In the new Auth0Lock becomes: - -```js -var lock = new Auth0Lock('YOUR_CLIENT_ID', 'your-domain.auth0.com'); -``` - -::: note -All other options that used to be passed along on the initialization process have been moved to the [show API](#api). -::: - -To learn how and when to set the `callbackURL` in **Auth0Lock** please read [this guide][callbackurl-link]. - -For more information about Auth0Lock's initialization, check the [[Auth0Lock Initialization]] section. - -## API - -The legacy `.signin()` method has been renamed to `.showSignin()`. Same applies to `.signup()` as `.showSignup()` and `.reset()` as `.showReset()`. There is also a `.show()` method which uses account's default settings to resolve what should be displayed. - -The following example illustrates the main changes: - -```js -widget.signin({ - connections: [ - 'facebook', - 'google-oauth2', - 'twitter', - 'Username-Password-Authentication' - ] -}); -``` - -In the new Auth0Lock becomes: - -```js -lock.showSignin({ - connections: [ - 'facebook', - 'google-oauth2', - 'twitter', - 'Username-Password-Authentication' - ] -}); -``` - -::: note -Check the [API documentation][api-readme-url] section in the [README][readme-url] for a further walk through this methods. -::: - -Also, `Auth0Widget` callback order has changed: `onload` widget event has been removed as a callback and added as an event. The callback that was executed when the user has been signed in is now the second argument. For instance, this: - -```js -widget.signin({ - popup: true -}, null, function (err, profile) { - -}); -``` - -now is written as: - -```js -lock.showSignin({ - popup: true -}, function (err, profile) { - -}); -``` - -## Customization - -Some of the customization options have been renamed. You can check the [[Auth0Lock Customization]] section for a detailed specification on each allowed option. - -You can also follow here the most important breaking changes on namings: - - -Widget Name | Lock Name -------------------------------|------------------------------------------------------- -`callbackOnLocationHash` | `responseType` [1](#response-type-ref) -`showIcon` | Removed from API options [2](#show-icon-ref) -`standalone` | `closable` -`_avoidInitialFocus` | `focusInput` -`showSignup` | `disableSignupAction` -`showPassword` | `disableResetAction` -`forgotLink` | `resetLink` -`chrome` | Removed from API options [3](#chrome-ref) -`standalone` | `closable` -`enableReturnUserExperience` | `rememberLastLogin` -`enableADRealmDiscovery` | `integratedWindowsLogin` -`username_style` | `usernameStyle` -`userPwdConnectionName` | `defaultUserPasswordConnection` -`extraParams` | `authParams` - - 1: [`responseType`][responseType] can be either `token` (`callbackOnLocation: true`) or `code` (`callbackOnLocation: false`). - - 2: The `showIcon` option has been removed. When [`icon`][icon] property is provided it will be immediately displayed. In case you'd like to hide the default icon badge, the recommended way is by CSS customization. Check our [[UI customization]] page for that. - - 3: The `chrome` option has been removed. In case you'd like to hide the default icon badge, the recommended way is by CSS customization. Check our [[UI customization]] page for that. - - -::: note -The following options have been moved under `authParams` main property for a matter of semantics: `access_token`, `scope`, `protocol`, `device`, `request_id`, `connection_scopes`, `nonce`, `offline_mode` and `state`. -::: - -## Events - -Many of the event names changed. The general rule to apply for the proper handling is to replace the underscore with a single space. - -So, for example if you had `signin_ready` now it is `signin ready`. - -Also, the one named `transition_mode` has been deprecated and removed from the list of Events. - -For more information about events, check [Auth0 Lock Events](/libraries/lock/v9/events) section. - - -[readme-url]: /libraries/lock -[api-readme-url]:/libraries/lock#api -[responseType]: /libraries/lock/v9/customization#responsetype-boolean -[icon]: /libraries/lock/v9/customization#icon-string -[callbackurl-link]: /libraries/lock/v9/customization#callbackurl-string diff --git a/articles/libraries/lock/v9/selecting-the-connection-for-multiple-logins.md b/articles/libraries/lock/v9/selecting-the-connection-for-multiple-logins.md deleted file mode 100644 index 3ce903cd50..0000000000 --- a/articles/libraries/lock/v9/selecting-the-connection-for-multiple-logins.md +++ /dev/null @@ -1,139 +0,0 @@ ---- -section: libraries -description: Describes different options for selecting the connection in Auth0 when there are multiple login options for Lock v9. ---- -# Selecting the connection in Auth0 for multiple login options - -<%= include('../../../_includes/_version_warning_lock') %> - -Auth0 allows you to offer your users multiple ways of authenticating. This is especially important with SaaS, multitenant apps in which a single app is used by many different organizations, each one potentially using different systems: LDAP, Active Directory, Google Apps, or username/password stores. - -![](/media/articles/hrd/sd4h-6wlwOsQA1PCQKLAmtQ.png) - -::: note -Selecting the appropriate Identity Providers from multiple options is called "Home Realm Discovery". A pompous name for a simple problem. -::: - -## Option 1: programmatically - -When you initiate an authentication transaction with Auth0 you can optionally send a `connection` parameter. This value maps directly with any connection defined in your dashboard. - -If using the [Lock](/lock), this is as simple as writing: - -```js -auth0.show({connections: ['YOUR_CONNECTION']}); -``` - -Notice that this is equivalent of just navigating to: - -```text -https://${account.namespace}/authorize/ -?client_id=${account.clientId} -&response_type=code -&redirect_uri=${account.callback} -&state=OPAQUE_VALUE&connection=YOUR_CONNECTION -``` - -There are multiple practical ways of getting the `connection` value. Among the most common ones: - -* You can use vanity URLs: `https://{connection}.yoursite.com` or `https://www.yoursite.com/{connection}` -* You can just ask the user to pick from a list (notice [there's an API](/api/v1#!#get--api-connections) to retrieve all connections available) - -::: note -These two methods assume it is acceptable for your app to disclose the names of all companies you are connected to. Sometimes this is not the case. -::: - -* You could use non-human-readable connection names and use some external mechanism to map these to users (for example, through a primary verification, out of band channel for example). - -## Option 2: using email domains with Lock - -The [Lock](/libraries/lock) has built in functionality for identity provider selection. For social connections it will show logos for all those enabled in that particular app. - -An additional feature in the Lock is the use of email domains as a way of routing authentication requests. Enterprise connections in Auth0 can be mapped to `domains`. For example, when configuring an ADFS or a SAML-P identity provider: - -![](/media/articles/hrd/k_LcfC8PHp.png) - -If a connection has this setup, then the password textbox gets disabled automatically when typing an e-mail with a mapped domain: - -![](/media/articles/hrd/R7mvAZpSnf.png) - -In the example above the domain `companyx.com` has been mapped to an enterprise connection. - -Notice that you can associate multiple domains to a single connection. - -## Option 3: adding custom buttons to Lock - -Using [Lock](/libraries/lock)'s [support for customization and extensibility](/libraries/lock/customization) it's also possible to add buttons for your Custom Social or Enterprise Connections. The following example (written in jQuery) adds a button for Azure AD to Lock: - -```js -var lock = new Auth0Lock(cid, domain); -lock.once('signin ready', function() { - var link = $('' + - 'Login with Fabrikam Azure AD'); - link.on('click', function() { - lock.getClient().login({ - connection: 'fabrikamdirectory.onmicrosoft.com' - }); - return false; - }); - - - $('.a0-iconlist', this.$container) - .append(link) - .removeClass('a0-hide'); -}); - -lock.show({ - connections: ['facebook', 'google-oauth2', 'windows-live'] -}); -``` - -This is useful when you want to give users a consistent login experience where they click on the connection they want to use. - -![](/media/articles/hrd/hrd-custom-buttons-lock.png) - -Lock's stylesheet contains the following provider icons which can be used when adding custom buttons: - -```text -.a0-amazon -.a0-aol -.a0-baidu -.a0-box -.a0-dropbox -.a0-dwolla -.a0-ebay -.a0-evernote -.a0-exact -.a0-facebook -.a0-fitbit -.a0-github -.a0-gmail -.a0-google -.a0-googleplus -.a0-guest -.a0-ie -.a0-instagram -.a0-linkedin -.a0-miicard -.a0-office365 -.a0-openid -.a0-paypal -.a0-planningcenter -.a0-renren -.a0-salesforce -.a0-sharepoint -.a0-shopify -.a0-soundcloud -.a0-stackoverflow -.a0-thecity -.a0-thirtysevensignals -.a0-twitter -.a0-vk -.a0-waad -.a0-weibo -.a0-windows -.a0-wordpress -.a0-yahoo -.a0-yammer -.a0-yandex -``` diff --git a/articles/libraries/lock/v9/sending-authentication-parameters.md b/articles/libraries/lock/v9/sending-authentication-parameters.md deleted file mode 100644 index 4e2aaac2e3..0000000000 --- a/articles/libraries/lock/v9/sending-authentication-parameters.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -section: libraries -description: Supported parameters that can be used with Lock V9. ---- -# Lock: Authentication Parameters - -<%= include('../../../_includes/_version_warning_lock') %> - -You can send parameters when starting a login by adding them to the options object. The example below adds a `state` parameter with a value equal to `'foo'`. - -```js -lock.show({ - // ... other options ... - authParams: { - state: 'foo' - } -}); -``` - -The following parameters are supported: `access_token`, `scope`, `protocol`, `device`, `request_id`, `connection_scopes`, `nonce` and `state`. - -::: note -This would be analogous to trigger the login with `https://${account.namespace}/authorize?state=foo&...`. -::: - -## Supported parameters - -### scope {string} - -```js -lock.show({ - authParams: { - scope: 'openid email user_metadata app_metadata picture' - } -}); -``` - -There are different values supported for scope: - -* `scope: 'openid'`: _(default)_ It will return not only the `access_token`, but also an `id_token` which is a JSON Web Token (JWT). The JWT will only contain the user ID (`sub` claim). -* `scope: 'openid profile'`: (not recommended): will return all the user attributes in the token. This can cause problems when sending or receiving tokens in URLs (for example, when using response_type=token) and will likely create an unnecessarily large token(especially with Azure AD which returns a fairly long JWT). Keep in mind that JWTs are sent on every API request, so it is desirable to keep them as small as possible. -* `scope: 'openid {attr1} {attr2} {attrN}'`: If you want only specific user attributes to be part of the `id_token` (For example: `scope: 'openid name email picture'`). - -### connection_scopes {Object} - -The `connection_scopes` parameter allows for dynamically specifying scopes on any connection. This is useful if you want to initially start with a set of scopes (defined on the dashboard), but later on request the user for extra permissions or attributes. - -The object keys must be the names of the connections and the values must be arrays containing the scopes to request to append to the dashboard specified scopes. An example is shown below: - -```js -lock.show({ - authParams: { - connections: ['facebook', 'google-oauth2', 'twitter', 'Username-Password-Authentication', 'fabrikam.com'], - connection_scopes: { - 'facebook': ['public_profile', 'user_friends'], - 'google-oauth2': ['https://www.googleapis.com/auth/orkut'] - // none for twitter - } - } -} -``` - -::: note -The values for each scope are not transformed in any way. They must match exactly the values recognized by each identity provider. -::: - -### state {string} - -The `state` parameter is an arbitrary state value that will be mantained across redirects. It is useful to mitigate [CSRF attacks](http://en.wikipedia.org/wiki/Cross-site_request_forgery) and for any contextual information (such as a return url) that you might need after the authentication process is finished. - -[Click here to learn more about how to send/receive the state parameter.](/protocols/oauth-state) diff --git a/articles/libraries/lock/v9/ui-customization.md b/articles/libraries/lock/v9/ui-customization.md deleted file mode 100644 index 7488d92d54..0000000000 --- a/articles/libraries/lock/v9/ui-customization.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -section: libraries -description: Customizing how Lock with CSS and Javascript ---- -# Lock: Customize the look and feel - -<%= include('../../../_includes/_version_warning_lock') %> - -You can apply your own styles to the elements of the Lock. - -All CSS `class`es and `id`s are prefixed with `a0-` to avoid conflicts with your application's basic stylesheets. - -There are two ways to override the Lock's main styles: - -## CSS specification - -Prepend a `body` key in front of the customization CSS in order to win in CSS specification: - -```css -body #a0-lock { - /* your css rules */ -} -``` - -## Disabling animations - -Since all `Lock` animations are CSS animations the way to disable them is through CSS - -```css -#a0-lock * { - -webkit-animation: none !important; - animation: none !important; - -webkit-transition: none !important; - transition: none !important; -} -``` - -## Adding a new UI element using JavaScript - -This code adds a new button to the widget. Since the widget runs as part of the same DOM of the page, you can manipulate it in the way you want. - -![](/media/articles/libraries/lock/ui-customization/lock-add-btn.png) - -```js -widget.once('signin ready', function() { - var link = $('Login with SharePoint'); - link.appendTo('.a0-iconlist'); - link.on('click', function() { - widget.getClient().login({connection: 'your-sharepoint-connection-name'}); - }); -}); -``` - -Here is a fiddle to play around with it - -## Automatically logging in with "Windows Authentication" - -When Kerberos is available you can automatically trigger Windows Authentication. As a result the user will immediately be authenticated without having to click the **windows authentication** button. - -![](/media/articles/libraries/lock/ui-customization/windows-auth-button.png) - -```js -lock.getClient().getSSOData(true, function (err, ssoData) { - if (!err && ssoData && ssoData.connection) { - lock.getClient().login({ connection: ssoData.connection }); - } -}); -``` - -## Order of definition - -Auth0 Lock inserts it's CSS definitions in the `head` node of the HTML Document and it does this at the very end. So, in order to override the Lock's main styles you must insert your CSS in the `body` node, right after the ` - - - -``` - -Make sure to use the one that fits the best to your use case. - -## Theme examples - -### Reflex theme - -![](/media/articles/libraries/lock/ui-customization/reflex-theme.png) - -- **repo**: -- **demo**: - -### Gradient theme - -![](/media/articles/libraries/lock/ui-customization/gradient-theme.png) - -- **repo**: -- **demo**: diff --git a/articles/libraries/lock/v9/using-a-refresh-token.md b/articles/libraries/lock/v9/using-a-refresh-token.md deleted file mode 100644 index c001cb78cf..0000000000 --- a/articles/libraries/lock/v9/using-a-refresh-token.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -section: libraries -description: Getting and using a Refresh Token with Lock. ---- -# Lock: Refresh Tokens - -<%= include('../../../_includes/_version_warning_lock') %> - -Mostly when building mobile apps, we want to show the signin page only once and then leave the user logged in forever. For those cases, it makes sense to have a `refreshToken`. A `refreshToken` lets us get a new `id_token` (`JWT`) anytime we want. - -::: warning -This means that if the `refreshToken` gets compromised, unless we revoke that token, somebody would be able to get a new JWT forever. -::: - -## 1. Getting the Refresh Token - -In order to be able to get the Refresh Token, all we need to do is add the scope `offline_access` when calling the `showSignin` or `showSignup` method. Optionally, we can specify a `device` name so that the user knows which device has a Refresh Token created. If not set, it'll be automatically calculated for you. - -````js -lock.showSignin({ - authParams: { - scope: 'openid offline_access', - // The following is optional - device: 'Chrome browser' - } -}); -```` - -If using popup mode, use the `refresh_token` returned in the callback: - -```js -lock.showSignin({ - authParams: { - scope: 'openid offline_access' - } -}, function (err, profile, id_token, access_token, state, refresh_token) { - // store refresh_token -}); -``` - -## 2. Using the refreshToken - -Now, you can use the `refreshToken` to get a new JWT whenever you want: - -````js -lock.getClient().refreshToken(refresh_token, function (err, delegationResult) { - // Get here the new JWT via delegationResult.id_token -}); -```` diff --git a/articles/libraries/secure-local-development.md b/articles/libraries/secure-local-development.md new file mode 100644 index 0000000000..577adafce8 --- /dev/null +++ b/articles/libraries/secure-local-development.md @@ -0,0 +1,143 @@ +--- +section: libraries +description: Securing local development servers to work with samesite cookies +topics: + - libraries + - samesite +contentType: + - guide +--- + +# Secure Local Development +Local development environments typically run on non-secure channels (ie: `http://localhost`) out of the box. This guide will discuss when you should run a secure local server and how to setup `https` on localhost. + +## When to use a secure local server +Testing over non-secure channels `http` is generally safe for local servers that don't communicate with external services, like Auth0. However, when your local server is communicating with external services, we recommend running your local server on `https` for the following reasons: + +- Communication between an external service and your localhost should be encrypted to protect any sensitive information. +- It tests a very critical part of the development stack if you run your server on secure channels in production. +- Cookies using a Secure attribute or SameSite attribute set to `None` will not be sent across insecure channels, disrupting authentication and other functionality. + +## How to set up a secure local server +When you visit a secure web page (served over https), your browser will verify the SSL certificate supplied by the server with a Certificate Authority. When loading a secure web page from a local server, you can create an authority just for your machine and generate certificates that only your browser will trust. + +The process to do this is: + +1. Create and install a local Certificate Authority +2. Generate an SSL certificate for the domain being used (ie. localhost) using this new Authority. +3. Serve the SSL certificate from your web application + +### 1. Install Mkcert Utility +To get started, download [mkcert](https://github.com/FiloSottile/mkcert) and follow the [installation instructions](https://github.com/FiloSottile/mkcert#installation) for your specific operating system. + +### 2. Install local Certificate Authority +The Certificate Authority is a trusted entity that the web browser uses to verify the certificate supplied by a webserver. Installing a local Certificate Authority will allow you to generate your own SSL Certificates to be used locally. + +```powershell +> mkcert -install +# Using the local CA at "/Users/$HOME/Library/Application Support/mkcert" ✨ +# The local CA is now installed in the system trust store! 👍 +# The local CA is now installed in the Firefox trust store (requires browser restart)! 🦊 +``` + +### 3. Generate an SSL Certificate +The next step is to generate the SSL certificate. This example will assume you are running your local server on `https://localhost:{port}`. + +```powershell +> mkcert localhost +# Using the local CA at "/Users/$HOME/Library/Application Support/mkcert" ✨ + +# Created a new certificate valid for the following names 📜 +# - "localhost" + +# The certificate is at "./localhost.pem" and the key at "./localhost-key.pem" ✅ +``` + +:::note +The utility saves the certificate `localhost.pem` and a key file `localhost-key.pem` in the folder where the command was executed. +::: + +### 4. Serve the SSL certificate +Now that you have generated an SSL certificate and key, you need to load them when starting your server. The way certificates are loaded depends on the technology used to serve the application. Please see below for examples. + +#### Node.js with Express + +```js +// app.js + +const express = require('express'); +const https = require('https'); +const fs = require('fs'); + +const key = fs.readFileSync('./localhost-key.pem'); +const cert = fs.readFileSync('./localhost.pem'); + +https.createServer({key, cert}, express()).listen('3000', () => { + console.log('Listening on https://localhost:3000'); +}); +``` + +#### webpack DevServer + +```js +// webpack.config.js + +module.exports = { + //... + devServer: { + https: { + key: fs.readFileSync('./localhost-key.pem'), + cert: fs.readFileSync('./localhost.pem'), + } + } +}; +``` + +#### Apache (including PHP, Python, Ruby) + +The actual path of the files mentioned below will differ depending on the OS and install method. The paths below are from Homebrew-installed Apache on macOS. + +``` +# /usr/local/etc/httpd/httpd.conf +# Find and uncomment the lines below + +LoadModule socache_shmcb_module lib/httpd/modules/mod_socache_shmcb.so +# ... +LoadModule ssl_module lib/httpd/modules/mod_ssl.so +# ... +Include /usr/local/etc/httpd/extra/httpd-ssl.conf +``` + +``` +# /usr/local/etc/httpd/extra/httpd-ssl.conf + +# Listen 8443 +Listen 443 +# ... + +# Change the line below and comment out the two lines referenced below +# + +# ... +# DocumentRoot "/usr/local/var/www" +# ServerName www.example.com:8443 +``` + +``` +# /usr/local/etc/httpd/extra/httpd-vhosts.conf + + + # Make sure this path points to your local application. + DocumentRoot "/path/to/application/root" + ServerName localhost + SSLEngine on + SSLCertificateFile "/usr/local/etc/httpd/localhost.pem" + SSLCertificateKeyFile "/usr/local/etc/httpd/localhost-key.pem" + +``` + +#### Nginx (for PHP) + +#### WordPress + +The WordPress documentation has some [specific considerations for running WordPress over HTTPS](https://make.wordpress.org/support/user-manual/web-publishing/https-for-wordpress/). Please see the Apache or nginx sections above for specifics on loading the certificates. diff --git a/articles/libraries/when-to-use-lock.md b/articles/libraries/when-to-use-lock.md index aff4be966f..fba0c02d30 100644 --- a/articles/libraries/when-to-use-lock.md +++ b/articles/libraries/when-to-use-lock.md @@ -1,27 +1,30 @@ --- section: libraries -description: When should you use Lock, Auth0's drop-in authentication widget, and when should you use a custom UI with an Auth0 Library? This page will help you decide. +description: When customizing the Classic Universal Login page what tools should you use? Lock (Auth0's drop-in authentication widget) or a custom UI built on top of an Auth0 SDK? This guide will help you decide. +topics: + - libraries + - lock + - custom-ui +contentType: + - concept +useCase: + - add-login + - enable-mobile-auth --- -# Lock vs. a Custom UI +# Universal Login Page Customization -<%= include('../_includes/_lock_auth0js_deprecations_notice') %> +When adding Auth0 to your web apps, the best solution is to use Auth0's Universal Login. If you plan to use the [New Experience](/universal-login/new), you won't even need to choose an Auth0 library to use inside of the login page, and can stop here. If you are using the [Classic Experience](/universal-login/classic), this guide will help you choose a technology to power your login page. -When adding Auth0 to your web apps, the best solution is to use Auth0's [universal login](/hosted-pages/login). Using universal login is an incredibly simple process, and prevents the dangers of cross-origin authentication. The login page uses the Lock Widget to allow your users to authenticate by default, but also has templates for Lock Passwordless and for a custom UI built with Auth0.js SDK. You can customize the page in the [Hosted Pages Editor](${manage_url}/#/login_page), and use any of the following to implement your authentication needs. +Universal Login is less complex than embedding the authentication process within your app. It also prevents the dangers of cross-origin authentication. -* Lock, Auth0's drop-in login and signup widget - * [Lock for Web](/libraries/lock) - * [Lock for iOS](/libraries/lock-ios) - * [Lock for Android](/libraries/lock-android) -* One of our libraries (along with a custom interface) - * [Auth0 SDK for Web](/libraries/auth0js) - * [Auth0 SDK for iOS](/libraries/auth0-swift) - * [Auth0 SDK for Android](/libraries/auth0-android) -* Or, a custom user interface that you have created directly tying into the [Authentication API](/auth-api). +The Classic login page uses the Lock Widget by default for user authentication. It also has templates for Lock in Passwordless Mode and for a custom UI built with the Auth0.js SDK. -If universal login doesn't work for you, all of the above can be embedded in your own application and used in that way, as well. +* [Lock for Web](/libraries/lock), Auth0's drop-in login and signup widget +* The [Auth0 SDK for Web](/libraries/auth0js) with your custom designed interface +* Or, a custom user interface that you have created which directly ties into the [Authentication API](/auth-api). ::: note -Passwordless authentication from native mobile apps currently must use universal login - there is no native passwordless option at this time. +Passwordless authentication from native mobile apps currently must use Universal Login - there is no native passwordless option at this time. ::: ## When to Implement Lock vs. a Custom UI @@ -98,11 +101,6 @@ Below is a quick overview of reasons you might want to use Lock, versus using an No Yes - - Adapts to a simpler process for username/password and social provider authentication - No - Yes - Handles multiple databases or Active Directory connections No @@ -113,7 +111,7 @@ Below is a quick overview of reasons you might want to use Lock, versus using an ## Lock -**Lock** is an embeddable login form that makes it easy for your users to authenticate using a selected connection. **Lock** will automatically handle most of the details involved in creating and authenticating users. Lock is provided as a drop-in solution for [Web](/libraries/lock), as well as for native [iOS](/libraries/lock-ios) or [Android](/libraries/lock-android) apps. +**Lock** is a login form that makes it easy for your users to authenticate using a selected connection. **Lock** will automatically handle most of the details involved in creating and authenticating users. [Lock](/libraries/lock) is provided as a drop-in solution for the Classic Universal Login experience. ![](/media/articles/libraries/lock/lock-default.png) @@ -127,7 +125,7 @@ With **Lock**, you will be implementing a UI that: * Automatically accommodates internationalization * Provides instant password policy checking at sign up -Although you cannot alter Lock's behavior, you can configure several [basic options](/libraries/lock/customization) to make Lock look and behave differently. +Although you cannot alter Lock's behavior significantly, you can configure several [basic options](/libraries/lock/customization) to make Lock look and behave differently. ![](/media/articles/libraries/lock/lock-phantom.png) @@ -135,7 +133,7 @@ Although you cannot alter Lock's behavior, you can configure several [basic opti Consider using **Lock** if: -* You like structure, look, and feel of **Lock** +* You like the structure, look, and feel of **Lock** * You prefer a quicker and easier implementation of Auth0 and a ready-made responsive UI * Your process includes many of the use cases that **Lock** handles out of the box: * Enterprise logins @@ -143,13 +141,12 @@ Consider using **Lock** if: * User signup and password reset * Authentication using social providers * Avatars -* You want a login form that can be reused in multiple areas ## Custom User Interface If the requirements of your app cannot be met by the standardized behavior of **Lock**, or if you have a complex custom authentication process, a custom user interface is needed. You also might prefer this option if you already have a user interface which you would prefer to keep. -With Auth0's library for [Web](/libraries/auth0js), or with native libraries for [iOS](/libraries/auth0-swift) or [Android](/libraries/auth0-android), you can customize the behavior and flow of the process used to trigger signup and authentication. You can also directly use the [Authentication API](/auth-api), without any wrapper at all, if you so choose. +With Auth0's library for [Web](/libraries/auth0js), you can customize the behavior and flow of the process used to trigger signup and authentication. You can also directly use the [Authentication API](/auth-api), without any wrapper at all, if you so choose. ![](/media/articles/libraries/lock-vs-customui/customui.png) @@ -160,11 +157,11 @@ Unlike with **Lock**, neither of these options includes a user interface. You wi Consider implementing a custom user interface in conjunction with an Auth0 library or the Authentication API for your app if: * You have strict requirements for the appearance of the user interface -* You have strict requirements for file sizes - the Auth0 libraries are significantly smaller than Lock, and if you instead choose to deal with the API directly, that would require add no additional weight. +* You have strict requirements for file sizes - the Auth0 libraries are significantly smaller than Lock, and if you instead choose to deal with the API directly, that would not require any additional weight. * You are comfortable with HTML, CSS, and JavaScript - you'll be creating your own UI * You only need to handle username/password and social provider authentication * You have multiple database or Active Directory Connections ## See Also -You can also see specific examples of the usage of both Lock and Auth0 SDKs for a wide variety of programming languages and platforms in our [Quickstarts](/). These guides may further assist you in your decision about which to use for your specific app needs. +You can also see specific examples of the usage of both Lock and Auth0 SDKs for a wide variety of programming languages and platforms in our [Quickstarts](/quickstart). These guides may further assist you in your decision about which to use for your specific app needs. diff --git a/articles/link-accounts/index.md b/articles/link-accounts/index.md deleted file mode 100644 index 6c8f76a6f9..0000000000 --- a/articles/link-accounts/index.md +++ /dev/null @@ -1,324 +0,0 @@ ---- -title: Linking User Accounts -description: Learn how to link user accounts from various identity providers, so your users can authenticate from any of their accounts and still be recognized by your app and associated with the same user profile -crews: crew-2 -toc: true ---- -# Linking User Accounts - -::: warning -We recently introduced some changes in Account Linking. For all the details see [Migration Guide: Account Linking and ID Tokens](/migrations/guides/account-linking). -::: - -Auth0 supports the linking of user accounts from various identity providers. This allows a user to authenticate from any of their accounts and still be recognized by your app and associated with the same user profile. This feature requires a paid subscription to the **Developer**, **Developer Pro** or **Enterprise** plan (see [Pricing](https://auth0.com/pricing)). - -Note that Auth0 will treat all identities as separate by default. For example, if a user logs in first against the Auth0 database and then via Google or Facebook, these two attempts would appear to Auth0 as two separate users. - -You can implement functionality to enable a user to explicitly link accounts. In this scenario, the user would log in with an initial provider, perhaps Google. Your application would provide a link or button to enable them to link another account to the first one. The user would click on this link/button and your application would make a call so that when the user logs in with the second provider, the second account is linked with the first. - -## Advantages of linking accounts - -* Allows users to log in with any identity provider without creating a separate profile for each -* Allows registered users to use a new social or passwordless login but continue using their existing profile -* Allows users that registered using a passwordless login to link to an account with a more complete profile -* Allows your apps to retrieve user profile data stored in various connections - -## The linking process - -The process of linking accounts merges two existing user profiles into a single one. When linking accounts, a **primary account** and a **secondary account** must be specified. - -In the example below you can see how the resulting linked profile will be for the sample primary and secondary accounts. - -
    - -
    -
    -
    -        {
    -  "email": "your0@email.com",
    -  "email_verified": true,
    -  "name": "John Doe",
    -  "given_name": "John",
    -  "family_name": "Doe",
    -  "picture": "https://lh3.googleusercontent..../photo.jpg",
    -  "gender": "male",
    -  "locale": "en",
    -  "user_id": "google-oauth2|115015401343387192604",
    -  "identities": [
    -    {
    -        "provider": "google-oauth2",
    -        "user_id": "115015401343387192604",
    -        "connection": "google-oauth2",
    -        "isSocial": true
    -    }
    -  ],
    -  "user_metadata": {
    -    "color": "red"
    -  },
    -  "app_metadata": {
    -    "roles": [
    -        "Admin"
    -    ]
    -  },
    -  ...
    -}
    -        
    -      
    -
    -
    -
    -        {
    -  "phone_number": "+14258831929",
    -  "phone_verified": true,
    -  "name": "+14258831929",
    -  "updated_at": "2015-10-08T18:35:18.102Z",
    -  "user_id": "sms|560ebaeef609ee1adaa7c551",
    -  "identities": [
    -    {
    -        "user_id": "560ebaeef609ee1adaa7c551",
    -        "provider": "sms",
    -        "connection": "sms",
    -        "isSocial": false
    -    }
    -  ],
    -  "user_metadata": {
    -      "color": "blue"
    -  },
    -  "app_metadata": {
    -      "roles": [
    -          "AppAdmin"
    -      ]
    -  },
    -  ...
    -}
    -        
    -      
    -
    -
    -
    -        {
    -  "email": "your@email.com",
    -  "email_verified": true,
    -  "name": "John Doe",
    -  "given_name": "John",
    -  "family_name": "Doe",
    -  "picture": "https://lh3.googleusercontent.../photo.jpg",
    -  "gender": "male",
    -  "locale": "en",
    -  "user_id": "google-oauth2|115015401343387192604",
    -  "identities": [
    -    {
    -      "provider": "google-oauth2",
    -      "user_id": "115015401343387192604",
    -      "connection": "google-oauth2",
    -      "isSocial": true
    -    },
    -    {
    -      "profileData": {
    -          "phone_number": "+14258831929",
    -          "phone_verified": true,
    -          "name": "+14258831929"
    -      },
    -      "user_id": "560ebaeef609ee1adaa7c551",
    -      "provider": "sms",
    -      "connection": "sms",
    -      "isSocial": false
    -    }
    -  ],
    -  "user_metadata": {
    -      "color": "red"
    -  },
    -  "app_metadata": {
    -      "roles": [
    -          "Admin"
    -      ]
    -  },
    -  ...
    -}
    -        
    -      
    -
    -
    -
    - -Note that: - -* The `user_id` and all other main profile properties continue to be those of the primary identity -* The secondary account is now embedded in the `identities` array of the primary profile -* The attributes of the secondary account are placed inside the `profileData` field of the corresponding identity inside the array -* The `user_metadata` and `app_metadata` of the primary account have not changed -* The `user_metadata` and `app_metadata` of the secondary account are discarded -* There is no automatic merging of user profiles with associated identities -* The secondary account is removed from the users list - -### Merging Metadata - -[Metadata](/metadata) are not automatically merged during account linking. If you want to merge them you have to do it manually, using the [Auth0 APIv2 Update User endpoint](/api/v2#!/Users/patch_users_by_id). - -The [Auth0 Node.js SDK for APIv2](https://github.com/auth0/node-auth0/tree/v2) is also available. You can find sample code for merging metadata before linking using this SDK [here](/link-accounts/suggested-linking#4-verify-and-merge-metadata-before-linking). - -## Use the Management API - -The Auth0 Management API provides the [Link a user account](/api/v2#!/Users/post_identities) endpoint, which can be invoked in two ways. - -1. With an Access Token that contains the `update:current_user_identities` scope, the `user_id` of the primary account as part of the URL, and the secondary account's ID Token in the payload: - - ```har - { - "method": "POST", - "url": "https://${account.namespace}/api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities", - "httpVersion": "HTTP/1.1", - "headers": [{ - "name": "Authorization", - "value": "Bearer ACCESS_TOKEN" - }, - { - "name": "content-type", - "value": "application/json" - }], - "postData" : { - "mimeType": "application/json", - "text": "{\"link_with\":\"SECONDARY_ACCOUNT_ID_TOKEN\"}" - } - } - ``` - - An Access Token that contains the `update:current_user_identities` scope, can only be used to update the information of the currently logged-in user. Therefore this method is suitable for scenarios where the user initiates the linking process. - - The following **must** apply: - - The secondary account's ID Token must be signed with `RS256` - - The `aud` claim in the secondary account's ID Token must identify the client, and hold the same value with the `azp` claim of the Access Token used to make the request. - -2. With an Access Token that contains the `update:users` scope, the `user_id` of the primary account as part of the URL, and the `user_id` of the secondary account in the payload: - - ```har - { - "method": "POST", - "url": "https://${account.namespace}/api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities", - "httpVersion": "HTTP/1.1", - "headers": [{ - "name": "Authorization", - "value": "Bearer ACCESS_TOKEN" - }, - { - "name": "content-type", - "value": "application/json" - }], - "postData" : { - "mimeType": "application/json", - "text": "{\"provider\":\"SECONDARY_ACCOUNT_PROVIDER\", \"user_id\": \"SECONDARY_ACCOUNT_USER_ID\"}" - } - } - ``` - - The `SECONDARY_ACCOUNT_USER_ID` and `SECONDARY_ACCOUNT_PROVIDER` can be deduced by the unique ID of the user. So for example, if the user ID is `google-oauth2|108091299999329986433`, set the `google-oauth2` part as the `provider`, and the `108091299999329986433` part as the `user_id` at your request. - - Instead of the `provider` and `user_id`, you can send the secondary account's ID Token as part of the payload: - - ```har - { - "method": "POST", - "url": "https://${account.namespace}/api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities", - "httpVersion": "HTTP/1.1", - "headers": [{ - "name": "Authorization", - "value": "Bearer ACCESS_TOKEN" - }, - { - "name": "content-type", - "value": "application/json" - }], - "postData" : { - "mimeType": "application/json", - "text": "{\"link_with\":\"SECONDARY_ACCOUNT_ID_TOKEN\"}" - } - } - ``` - - The following **must** apply in case you send the ID Token as part of the payload: - - The secondary account's ID Token must be signed with `RS256` - - The `aud` claim in the secondary account's ID Token must identify the client, and hold the same value with the `azp` claim of the Access Token used to make the request. - - Note also that since the Access Token contains the `update:users` scope, it can be used to update the information of **any** user. Therefore this method is intended for use in server-side code only. - -## Use Auth0.js - -Instead of calling directly the API, you can use the [Auth0.js](/libraries/auth0js) library. - -First, you must get an Access Token that can be used to call the Management API. You can do it by specifying the `https://${account.namespace}/api/v2/˜` audience when initializing Auth0.js. You will get the Access Token as part of the authentication flow. Alternatively, you can use the `checkSession` method. - -Once you have the Access Token, you can create a new `auth0.Management` instance by passing it the account's Auth0 domain, and the Access Token. - -For more information and sample scripts, see [Auth0.js > User management](/libraries/auth0js/v9#user-management). - -## Scenarios - -In this section we will see some scenarios that implement account linking: -* [Automatic account linking](#automatic-account-linking): automatically link accounts with the same e-mail address -* [User-initiated account linking](#user-initiated-account-linking): allow your users to link their accounts using an admin screen in your app -* [Suggested account linking](#suggested-account-linking): identify accounts with the same e-mail address and prompt the user in your app to link them - -::: warning -For security purposes, link accounts **only if both e-mails are verified**. -::: - -### Automatic account linking - -You can implement automatic linking by setting up a [Rule](/rules) that will run upon user login and link accounts with the same e-mail address. - -The rule is an example of linking accounts in server-side code using the Auth0 Management API [Link a user account endpoint](/api/v2#!/Users/post_identities) where you have both the primary and secondary user IDs and an [Management API Access Token](/api/v2/tokens) with `update:users` scope. - -Note, that if the primary account changes during the authorization transaction (for example, the account the user has logged in with, becomes a secondary account to some other primary account), you could get an error in the Authorization Code flow or an `id_token` with the wrong `sub` claim in the token flow. To avoid this, set `context.primaryUser = 'auth0|user123'` in the rule after account linking. This will tell the authorization server to use the user with id `auth0|user123` for the rest of the flow. - -For a rule template on automatic account linking, see [Link Accounts with Same Email Address](https://github.com/auth0/rules/blob/master/rules/link-users-by-email.md). If you want to merge metadata as well, see [Link Accounts with Same Email Address while Merging Metadata](https://github.com/auth0/rules/blob/master/rules/link-users-by-email-with-metadata.md). - -### User-initiated account linking - -Typically, account linking will be initiated by an authenticated user. Your app must provide the UI, such as a **Link accounts** button on the user's profile page. - -![Sample user profile page](/media/articles/link-accounts/spa-user-settings.png) - -You can follow the [Account Linking Using Client Side Code](/link-accounts/user-initiated-linking) tutorial or view the [Auth0 jQuery Single Page App Account Linking Sample](https://github.com/auth0/auth0-link-accounts-sample/tree/master/SPA) on Github for implementation details. - -### Suggested account linking - -As with automatic linking, in this scenario you will set up a [Rule](/rules) that will link accounts with the same verified e-mail address. However, instead of completing the link automatically on authentication, your app will first prompt the user to link their identities. - -![Sample linking suggestion](/media/articles/link-accounts/regular-web-app-suggest-linking.png) - -You can follow the [Account Linking Using Server Side Code](/link-accounts/suggested-linking) tutorial or view the [Auth0 Node.js Regular Web App Account Linking Sample](https://github.com/auth0/auth0-link-accounts-sample/tree/master/RegularWebApp) on Github for implementation details. - -## Unlinking accounts - -The Auth0 Management API V2 also provides an [Unlink a user account endpoint](/api/v2#!/Users/delete_provider_by_user_id) which can be used with either of these two **scopes**: - -* `update:current_user_identities`: when you call the endpoint from client-side code where you have an Access Token with this scope -* `update:users`: when you call the endpoint from server-side code where you have an Access Token with this scope - -```har -{ - "method": "DELETE", - "url": "https://${account.namespace}/api/v2/users/PRIMARY_ACCOUNT_USER_ID/identities/SECONDARY_ACCOUNT_PROVIDER/SECONDARY_ACCOUNT_USER_ID", - "httpVersion": "HTTP/1.1", - "headers": [{ - "name": "Authorization", - "value": "Bearer ACCESS_TOKEN" - }] -} -``` - -The result of the unlinking process is the following: -* The secondary account is removed from the identities array of the primary account -* A new secondary user account is created -* The secondary account will have no metadata - -If your goal is to delete the secondary identity entirely, you must first unlink the accounts, and then delete the newly created secondary account. diff --git a/articles/link-accounts/suggested-linking/index.md b/articles/link-accounts/suggested-linking/index.md deleted file mode 100644 index 612e410efb..0000000000 --- a/articles/link-accounts/suggested-linking/index.md +++ /dev/null @@ -1,278 +0,0 @@ ---- -description: How to link user accounts using server-side code. -crews: crew-2 -toc: true ---- - -# Account Linking Using Server Side Code - -::: warning -We recently introduced some changes in Account Linking. For all the details see [Migration Guide: Account Linking and ID Tokens](/migrations/guides/account-linking). -::: - -In this tutorial, you will use server-side code to facilitate account linking on a regular web application. Rather than automating the entire account linking process, you're engaging the user and asking them for permission before proceeding. Your code will: - -1. Authenticate the user -2. Search for and identify users using their email addresses -3. Prompt the user to link their accounts -4. Verify and merge metadata -5. Link the accounts - -Additionally, this tutorial will show you how you can unlink accounts at a later time. - -You can find sample code for this tutorial in the [Auth0 Node.js Regular Web App Account Linking](https://github.com/auth0/auth0-link-accounts-sample/tree/master/RegularWebApp) repo on Github. - -## Step 1: Authenticate the user - -Start by logging in the user to your application. - -The recommended implementation is to use [universal login](/hosted-pages/login). You can find detailed guidance on how to do just that at our [Node.js Quickstart](/quickstart/webapp/nodejs). - -If you choose instead to embed the [Lock](/libraries/lock/v11) widget in your app, you can review the sample code for this tutorial in the [Auth0 Node.js Regular Web App Account Linking](https://github.com/auth0/auth0-link-accounts-sample/tree/master/RegularWebApp) repo on Github. - -If you don't use Lock at all, but call the Authentication API directly, follow the [Execute an Authorization Code Grant Flow](/api-auth/tutorials/authorization-code-grant) tutorial. - -## Step 2: Search for users with identical email addresses - -During the post-login page load, your app invokes a custom endpoint that returns a list of users that could be linked together. This is done using the following code: - -```js -const ensureLoggedIn = require('connect-ensure-login').ensureLoggedIn(); -const Auth0Client = require('../Auth0Client'); -const express = require('express'); -const router = express.Router(); - -router.get('/suggested-users',ensureLoggedIn, (req,res) => { - let suggestedUsers = []; - Auth0Client.getUsersWithSameVerifiedEmail(req.user._json) - .then(identities => { - suggestedUsers = identities; - }).catch( err => { - console.log('There was an error retrieving users with the same verified email to suggest linking',err); - }).then(() => { - res.send(suggestedUsers); - }); -}); -``` - -To get a list of all of the user records with the same email address, your app calls the Management API's [Get Users By Email endpoint](/api/v2#!/users-by-email/) using a [Management API Access Token](/api/management/v2/tokens) with the `read:users` scope. - -```js -const request = require('request'); -class Auth0Client { - ... - getUsersWithSameVerifiedEmail(user) { - return new Promise((resolve, reject) => { - if (! user.email_verified){ - reject('User email is not verified'); - } - const reqOpts = { - url: 'https://${account.namespace}/api/v2/users-by-email', - headers: { - 'Authorization': 'Bearer ' + process.env.AUTH0_APIV2_TOKEN - }, - qs: { - email: user.email - } - }; - request(reqOpts, (error, response, body) => { - if (error) { - return reject(error); - } else if (response.statusCode !== 200) { - return reject('Error getting users: ' + response.statusCode + ' ' + body); - } else { - resolve(JSON.parse(body)); - } - }); - }); - } -} -``` - -## Step 3: Prompt the user to link accounts - -If Auth0 returns one or more records with matching email addresses, the user sees the list, as well as the following message prompting them to link the accounts: `We noticed there are other registered users with the same verified e-mail address as EMAIL_ADDRESS. Do you want to link the accounts?`. - -If the user wants to link a given account, they can click **Link** next to the appropriate account. - -![](/media/articles/link-accounts/regular-web-app-suggest-linking.png) - -## Step 4: Verify and merge metadata - -The user clicking on **Link** invokes your custom endpoint for account linking. However, before calling `linkAccounts`, you can verify or retrieve metadata from secondary accounts and merge them into the metadata fields for the primary account. After the accounts are linked, the metadata for the secondary accounts is discarded. - -Additionally, when calling `linkAccounts`, you can select the primary account identity. Your choice will depend on which set of attributes you want to retain in the user's profile. - -The following code snippet shows how you can implement both features. - -```js -const ensureLoggedIn = require('connect-ensure-login').ensureLoggedIn(); -const Auth0Client = require('../Auth0Client'); -const express = require('express'); -const router = express.Router(); - -router.post('/link-accounts/:targetUserId', ensureLoggedIn, (req,res,next) => { - // Fetch target user to make verifications and merge metadata - Auth0Client.getUser(req.params.targetUserId) - .then( targetUser => { - // verify email (this is needed because targetUserId came from client side) - if(! targetUser.email_verified || targetUser.email !== req.user._json.email){ - throw new Error('User not valid for linking'); - } - //merge metadata - return _mergeMetadata(req.user._json,targetUser); - }) - .then(() => { - return Auth0Client.linkAccounts(req.user.id,req.params.targetUserId); - }) - .then( identities => { - req.user.identities = req.user._json.identities = identities; - res.send(identities); - }) - .catch( err => { - console.log('Error linking accounts!',err); - next(err); - }); -}); -``` - -In the example above, you'll notice that the email address is verified a second time. This is to ensure that `targetUserId` hasn't been tampered with on the client side. - -### Merging metadata - -The following example shows explicitly how the `user_metadata` and `app_metadata` from the secondary account gets merged into the primary account using the [Node.js Auth0 SDK for API V2](https://github.com/auth0/node-auth0/tree/v2). - -```js -const _ = require('lodash'); -const auth0 = require('auth0')({ - token: process.env.AUTH0_APIV2_TOKEN -}); - -/* -* Recursively merges user_metadata and app_metadata from secondary into primary account. -* Data of primary user takes preponderance. -* Array fields are joined. -*/ -function _mergeMetadata(primaryUser, secondaryUser){ - const customizerCallback = function(objectValue, sourceValue){ - if (_.isArray(objectValue)){ - return sourceValue.concat(objectValue); - } - }; - const mergedUserMetadata = _.merge({}, secondaryUser.user_metadata, primaryUser.user_metadata, customizerCallback); - const mergedAppMetadata = _.merge({}, secondaryUser.app_metadata, primaryUser.app_metadata, customizerCallback); - - return Promise.all([ - auth0.users.updateUserMetadata(primaryUser.user_id, mergedUserMetadata), - auth0.users.updateAppMetadata(primaryUser.user_id, mergedAppMetadata) - ]).then(result => { - //save result in primary user in session - primaryUser.user_metadata = result[0].user_metadata; - primaryUser.app_metadata = result[1].app_metadata; - }); -} -``` - -## Step 5: Link accounts - -Once you've found the user accounts, prompted the user to merge the selected accounts, and verified/merged the metadata associated with the primary and secondary identities, you're ready to actually link the accounts. - -To link accounts, your app needs to call the Management API's [Link a User Account endpoint](/api/v2#!/Users/post_identities). You need to call the API using a [Management API Access Token](/api/management/v2/tokens) with the `update:users` scope. - -```js -const request = require('request'); - -class Auth0Client { - linkAccounts(rootUserId,targetUserId) { - - const provider = targetUserId.split('|')[0]; - const user_id = targetUserId.split('|')[1]; - - return new Promise((resolve, reject) => { - var reqOpts = { - method: 'POST', - url: 'https://${account.namespace}/api/v2/users/' + rootUserId +'/identities', - headers: { - 'Authorization': 'Bearer ' + process.env.AUTH0_APIV2_TOKEN - }, - json: { - provider, - user_id - } - }; - request(reqOpts,(error, response, body) => { - if (error) { - return reject(error); - } else if (response.statusCode !== 201) { - return reject('Error linking accounts. Status code: ' + response.statusCode + '. Body: ' + JSON.stringify(body)); - } else { - resolve(body); - } - }); - }); - } - ... -} - -module.exports = new Auth0Client(); -``` - -## Unlinking accounts - -If you need to unlink two or more user accounts, you can do so. - -First, you need to update the user in session with the new array of identities (each of which represent a separate user account). - -```js -const ensureLoggedIn = require('connect-ensure-login').ensureLoggedIn(); -const Auth0Client = require('../Auth0Client'); -const express = require('express'); -const router = express.Router(); -... -router.post('/unlink-accounts/:targetUserProvider/:targetUserId',ensureLoggedIn, (req,res,next) => { - Auth0Client.unlinkAccounts(req.user.id, req.params.targetUserProvider, req.params.targetUserId) - .then( identities => { - req.user.identities = req.user._json.identities = identities; - res.send(identities); - }) - .catch( err => { - console.log('Error unlinking accounts!',err); - next(err); - }); -}); -``` - -Then, call the Management API v2 [Unlink a User Account endpoint](/api/v2#!/Users/delete_provider_by_user_id) using an [Management API Access Token](/api/v2/tokens) with the `update:users` scope. - -```js -const request = require('request'); - -class Auth0Client { - ... - unlinkAccounts(rootUserId, targetUserProvider, targetUserId){ - return new Promise((resolve,reject) => { - var reqOpts = { - method: 'DELETE', - url: 'https://${account.namespace}/api/v2/users/' + rootUserId + - '/identities/' + targetUserProvider + '/' + targetUserId, - headers: { - 'Authorization': 'Bearer ' + process.env.AUTH0_APIV2_TOKEN - } - }; - request(reqOpts,(error, response, body) => { - if (error) { - return reject(error); - } else if (response.statusCode !== 200) { - return reject('Error unlinking accounts. Status: '+ response.statusCode + ' ' + JSON.stringify(body)); - } else { - resolve(JSON.parse(body)); - } - }); - }); - } -} - -module.exports = new Auth0Client(); -``` - -That's it, you are done! diff --git a/articles/link-accounts/user-initiated-linking/index.md b/articles/link-accounts/user-initiated-linking/index.md deleted file mode 100644 index e9e0a073e4..0000000000 --- a/articles/link-accounts/user-initiated-linking/index.md +++ /dev/null @@ -1,158 +0,0 @@ ---- -description: How to provide a UI for the user to authenticate to their other accounts and link these to their primary account. -crews: crew-2 ---- - -# Account Linking Using Client Side Code - -::: warning -We recently introduced some changes in Account Linking. For all the details see [Migration Guide: Account Linking and ID Tokens](/migrations/guides/account-linking). -::: - -Auth0 supports the linking of user accounts from various identity providers. - -One way to implement this functionality is to enable the user to explicitly link accounts. In this scenario, the user authenticates and can later on use a link or a button in order to link another account to the first one. The user would click on this link/button and your application would make a call so that when the user logs in with the second provider, the second account is linked with the first. - -The following steps implement this scenario for a Single Page Application (SPA). You can find the sample code at [User Initiated Account Linking within a Single Page App](https://github.com/auth0/auth0-link-accounts-sample/tree/master/SPA) on Github. - -## Step 1: Initial login - -Start by logging in the user to your application. - -The recommended implementation is to use [universal login](/hosted-pages/login). You can find detailed guidance on how to do just that at our [JavaScript Quickstart](/quickstart/spa/vanillajs). - -If you choose instead to embed the [Lock](/libraries/lock/v11) widget or the [auth0.js library](/libraries/auth0js/v9) in your app, you can review the sample code for this tutorial in the [Auth0 jQuery Single Page App Account Linking Sample](https://github.com/auth0-samples/auth0-link-accounts-sample/tree/master/SPA) repo on Github. - -If you don't use Lock at all, but call the Authentication API directly, follow the [How to implement the Implicit Grant](/api-auth/tutorials/implicit-grant) tutorial. - -## Step 2: User initiates account linking - -Your SPA must provide a UI for the user to initiate a link to their other accounts (social, passwordless, and so on). For example, in the user's settings page. - -![SPA user setting's page](/media/articles/link-accounts/spa-user-settings.png) - -When the user clicks on any of the **Link Account** buttons, your app will trigger authentication to the account selected. After successful authentication, use the obtained token to link the accounts. - -### Handle the second authentication with Lock - -```js -/* -* Link Accounts. -*/ -function linkPasswordAccount(connection) { - localStorage.setItem('linking','linking'); - - // Instantiates Lock, to get a token that will be then used to - // link the account - - var opts = { - rememberLastLogin: false, - auth: { - responseType: 'token id_token', - }, - dict: { - signin: { - title: 'Link another account' - } - } - }; - - if (connection) { - opts.allowedConnections = [connection]; - } - - lock = new Auth0Lock( AUTH0_CLIENT_ID , AUTH0_DOMAIN, opts); - lock.show(); -} - -/* -* Handles the "authenticated" event for all Lock log-ins. -*/ -function lockAuthenticated(authResult) { - if (localStorage.getItem('linking') === 'linking') { - // The "Link Account" method first saves the "linking" item and then authenticates - // We identify that flow here, so after each subsequent log-in, we link the accounts - localStorage.removeItem('linking'); - linkAccount(authResult.idToken); - } else { - localStorage.setItem('access_token', authResult.accessToken); - localStorage.setItem('id_token', authResult.idToken); - localStorage.setItem('user_id', authResult.idTokenPayload.sub); - reloadProfile(); - } -} -``` - -In the sample you can also find the code in order to handle the second authentication with Passwordless and SMS (see function `linkPasswordlessSMS`), Passwordless and email code (see `linkPasswordlessEmailCode`), or Passwordless and Magic Link (see `linkPasswordlessEmailLink`). - -## Step 3: Call the API to link accounts - -In the `linkAccount` function, call the Management API V2 [Link a user account endpoint](/api/v2#!/Users/post_identities). Authenticate with the API using the Access Token, and link using the primary user's ID and the secondary user's ID Token. - -```js -function linkAccount(secondaryIdToken) { - - // At this point you could fetch the secondary account's user_metadata for merging with the primary account. - // Otherwise, it will be lost after linking the accounts - - // Uses the access_token of the primary user as a bearer token to identify the account - // which will have the account linked to, and the id_token of the secondary user, to identify - // the user that will be linked into the primary account. - - var primaryAccessToken = localStorage.getItem('access_token'); - var primaryUserId = localStorage.getItem('user_id'); - - $.ajax({ - type: 'POST', - url: 'https://' + AUTH0_DOMAIN +'/api/v2/users/' + primaryUserId + '/identities', - data: { - link_with: secondaryIdToken - }, - headers: { - 'Authorization': 'Bearer ' + primaryAccessToken - } - }).then(function(identities){ - alert('linked!'); - reloadProfile(); - }).fail(function(jqXHR){ - alert('Error linking Accounts: ' + jqXHR.status + " " + jqXHR.responseText); - }); -} -``` - -If you wish to retain and merge the `user_metadata` from the secondary account, you must retrieve it before calling the API endpoint. It will be discarded when the accounts are linked. - -Also, you can select which identity will be used as the primary account and which as the secondary when calling the account linking. This choice will depend on which set of attributes you wish to retain in the primary profile. - -## Unlink accounts - -If you need to unlink two or more user accounts, you can do so. - -Call the Management API v2 [Unlink a User Account endpoint](/api/v2#!/Users/delete_provider_by_user_id) using an [Management API Access Token](/api/v2/tokens) with the `update:users` scope. - -```js -function unlinkAccount(secondaryProvider, secondaryUserId) { - var primaryUserId = localStorage.getItem('user_id'); - var primaryAccessToken = localStorage.getItem('access_token'); - - // Uses the access_token of the primary user as a bearer token to identify the account - // which will have the account unlinked to, and the user id of the secondary user, to identify - // the user that will be unlinked from the primary account. - - $.ajax({ - type: 'DELETE', - url: 'https://' + AUTH0_DOMAIN +'/api/v2/users/' + primaryUserId + - '/identities/' + secondaryProvider + '/' + secondaryUserId, - headers: { - 'Authorization': 'Bearer ' + primaryAccessToken - } - }).then(function(identities){ - alert('unlinked!'); - showLinkedAccounts(identities); - }).fail(function(jqXHR){ - alert('Error unlinking Accounts: ' + jqXHR.status + ' ' + jqXHR.responseText); - }); -} -``` - -That's it, you are done! diff --git a/articles/login/embedded/index.md b/articles/login/embedded/index.md new file mode 100644 index 0000000000..a2f469081e --- /dev/null +++ b/articles/login/embedded/index.md @@ -0,0 +1,15 @@ +--- +description: A brief overview of Embedded Login with Auth0 +topics: + - login + - embedded-login + - hosted-pages +contentType: index +useCase: customize-hosted-pages +--- + +# Embedded Login + +Embedded Login is the scenario in which users login directly in your application, and credentials are transmitted to the Auth0 server. There are security concerns with this approach, particularly if you do not use the [Custom Domains](/custom-domains) feature at Auth0, as this potentially opens your application up to [cross-origin authentication](/cross-origin-authentication) issues. + +If you need to implement embedded login, you need to have a custom domain set up, so that this can be mitigated. You can then use one of our libraries (Such as the [Lock Widget](/libraries/lock) or [auth0.js SDK](/libraries/auth0js)) to implement login in your application, or do it via our [API](/api/authentication). diff --git a/articles/login/index.md b/articles/login/index.md new file mode 100644 index 0000000000..ec29764282 --- /dev/null +++ b/articles/login/index.md @@ -0,0 +1,74 @@ +--- +description: Overview of Universal Login with Auth0 +topics: + - login + - universal-login + - password-reset + - mfa + - error-pages + - hosted-pages +contentType: index +toc: true +useCase: customize-hosted-pages +--- +# Login with Auth0 + +Auth0 provides two ways to implement authentication for your applications: + +* Universal Login: users log in to your application through a page hosted by Auth0. +* Embedded Login: users log in to your application through a page you host. + +For the vast majority use cases, we recommend Universal Login. It's safe and easy to implement. Check out [our comparison guide](/guides/login/universal-vs-embedded) for more on the differences between Universal Login and Embedded Login within your application. + +## Universal Login + +Universal Login is Auth0's implementation of the login flow, which is the key feature of an Authorization Server. With Universal Login, users are redirected from your application to a login page hosted by Auth0. Auth0 then authenticates the user and returns them to your application. Since login and authentication take place on the same domain, credentials are not sent across origins, increasing security and protecting against attacks such as phishing and man-in-the-middle. + +Universal Login functionality and features are driven from web pages served by Auth0, so you can adjust the login experience in real-time without changing your application code. Universal Login page appearance and behavior is customizable right from the [Dashboard](${manage_url}). + +### Classic or New? + +There are two versions of Universal Login: + +* Classic Universal Login: Auth0-hosted pages built with [Lock.js](/libraries/lock) and other Javascript widgets, or with a library like [Auth0.js](/libraries/auth0js). HTML and CSS can also be customized. +* New Universal Login: Auth0-hosted pages, rendered server-side, that do not use [Lock.js](/libraries/lock) or other Javascript widgets and libraries. Can only be customized based on the configuration available. HTML, CSS, and JS cannot be customized. + +In the [Dashboard](${manage_url}), the dialog shown below lets you select which Experience will be used for default, non-customized pages: + +![Login Page](/media/articles/universal-login/experience-picker.png) + +To learn more about each experience and their differences, check out the following articles: + +* [Classic Universal Login Experience](/universal-login/classic) +* [New Universal Login Experience](/universal-login/new) +* [New Universal Login Limitations](/universal-login/new-experience-limitations) + +### Implementing Universal Login + +In addition to configuring Universal Login for your tenant's applications, you will also need to complete a few other steps: + +1. Set up a connection(s) in the [Dashboard](${manage_url}) (Choose **Connections** in the Dashboard's sidebar, then choose a type and pick one to configure, such as a database or a social login provider). +1. Set up your application in the [Dashboard](${manage_url}/#/applications). +1. Configure your application's code to call Auth0's [`/authorize`](/api/authentication#login) endpoint in order to trigger Universal Login, and then to deal with the response. You can either do this directly or use one of our SDKs to make the process easier. + +For step by step instructions on setting up your application to use Universal Login, check out our [Quickstart guides](/quickstarts). + +### Simple Customization + +![Customization Settings for Login Page](/media/articles/universal-login/settings.png) + +In the [Dashboard](${manage_url}), you can see the settings for your login page by navigating to [Universal Login](${manage_url}/#/login_setting) and looking at the Settings tab. + +The settings available here are: + +* Logo +* Primary Color +* Background Color + +These settings, once changed, will take effect on all your Universal Login pages if you have not enabled customization of the pages' code. The settings will also work if you have enabled customization but are using the predefined templates and have not changed those options in the code. + +If you select the New Universal Login Experience, you can also configure the favicon URL and a custom font URL using [the Branding API](/api/management/v2#!/Branding). + +## Embedded Login + +Embedded Login refers to implementations where users log in on a page hosted by your application, and credentials are sent to Auth0. There are security concerns with this approach since login and authentication take place on the different domains. If you need to implement Embedded Login, you need to have a [custom domain](/custom-domains) set up, so that this can be mitigated. You can then use one of our libraries (Such as the [Lock Widget](/libraries/lock) or [auth0.js SDK](/libraries/auth0js)) to implement login in your application, or do it via our [API](/api/authentication). diff --git a/articles/login/spa/authenticate-with-cookies.md b/articles/login/spa/authenticate-with-cookies.md new file mode 100644 index 0000000000..aa00106d1a --- /dev/null +++ b/articles/login/spa/authenticate-with-cookies.md @@ -0,0 +1,221 @@ +--- +title: Single-Page App Authentication Using Cookies +description: Use your backend server to authenticate a single page app with cookies +topics: + - login + - spa +contentType: how-to +toc: true +useCase: spa-cookies +--- + +# Single-Page App Authentication Using Cookies + +Securing a single-page application (SPA) can be a challenge. However, if your SPA: + +* is served to the client using your own backend +* has the same domain as your backend +* makes API calls that require authentication to your backend + +Then you can simplify your implementation by using cookies to authenticate your SPA. In the following guide you'll find an overview of this approach as well as a sample implementation using [Node.js](https://nodejs.org/en/). + +## How it works + +The steps below show how tokens are retrieved and used. In this approach, the [Form Post Response Mode](https://openid.net/specs/oauth-v2-form-post-response-mode-1_0.html) is used instead of a traditional [Authorization Code flow](/flows/concepts/auth-code). This is because Form Post Response Mode is a simpler way to implement login when it’s your own resource you are requesting access to. + +![SPA Cookie Authentication](/media/articles/login/spa/image1.png) + +1. The user accesses a protected route using the browser, or performs some action that requires an authentication step to be initiated (such as clicking on a Login button) +2. The browser client redirects to a `/login` route on the backend, or to the protected route depending on what the user did +3. The backend constructs a request to the authorization server’s `/authorize` endpoint and redirects the browser client there +4. The user is prompted to authenticate themselves using whatever method the authorization server presents +5. The authorization server POSTs the tokens to the redirect URI as a URL-encoded form post. The backend is able to retrieve those tokens by parsing the body data. + +At this point, the user is authenticated and the backend has the required tokens. A cookie can now be created to represent this state on the client. The client browser is then redirected to a route that serves the SPA and also receives the authentication cookie. + +From now on, this cookie is traded between the client and backend when API calls are made using an AJAX call. On each request, the backend verifies if the cookie is still valid and if so, allows the request to continue. + +![Cookie Exchange Between Client & Backend](/media/articles/login/spa/image2.png) + +### Dealing with invalid or missing cookies + +When implementing this approach you'll need to handle cases where the authentication cookie is invalid or missing. The API call to the backend from the client happens in the background, so the client has to deal with any response from the server indicating the user should reauthenticate. + +In the following sample application, this case is handled in a naive way by prompting the user to reauthenticate if the API call results in a 302 Redirect result. The 302 occurs because, upon unsuccessful validation of the cookie, the server tries to redirect to the authorization endpoint of the authorization server and sends this response to the client. + +## Example: Authenticating a SPA using cookies + +The example application uses Node.js and Express to demonstrate the concepts covered above. + +### Prerequisites + +To follow along, make sure you have the [latest version of Node](https://nodejs.org/en/download/) installed. + +Once Node is installed, [download or clone the source code](https://github.com/auth0-blog/spa-cookie-demo/) and open the project folder inside a terminal window. + +```bash +// Clone the tutorial respository using SSH +git clone git@github.com:auth0-blog/spa-cookie-demo +// ... or if you use HTTPS: +git clone https://github.com/auth0-blog/spa-cookie-demo.git +// Move into the project directory +cd spa-cookie-demo +``` +The `master` branch represents the state of the application before any authentication is added. If you would like to refer to the final version of the application, `checkout` the `with-oidc` branch: +```bash +git checkout with-oidc +``` +### Initialize the Node.js application +Install the application dependencies by running `npm install` from your terminal window. To run the application, use `npm run dev`. This starts the Express server. Go to [http://localhost:3000](http://localhost:3000) in your browser to view the application. +::: note +The development server uses [`nodemon`](https://www.npmjs.com/package/nodemon), which automatically restarts whenever it detects any file changes. +::: +### Explore the application +With the application open at [http://localhost:3000](http://localhost:3000), click the **Call API** button. You should see a message displayed on the screen. +![Call API Message](/media/articles/login/spa/image3.png) +Note that you were able to make the API call without being logged in. Let's fix that by adding authentication some middleware that requires the user to authenticate before the API call can be made. +### Adding authentication middleware +Inside the terminal, run the following command to install the additional libraries: +```bash +npm install express-session express-openid-connect +``` +- [`express-openid-connect`](https://www.npmjs.com/package/express-openid-connect) — OpenID Connect middleware for Express. Creates authentication sessions and protects application routes +- [`express-session`](https://www.npmjs.com/package/express-session) — session middleware for Express; required by `express-openid-connect` +Next, open `server/index.js` and add in the middleware libraries underneath the existing `require` statements at the top of the file: +```js +// server/index.js +// Other 'require' statements... +// NEW - bring in our new middleware libraries +const { auth } = require("express-openid-connect") +const session = require("express-session") +``` +The `express-session` middleware can now be configured by adding the following code above the existing configuration for `body-parser` further down the file: +```js +// server/index.js +// Existing config for morgan +app.use(morgan("dev", { + stream: { + write: m => debug(m) + } +})) +// NEW - add this configuration for express-session +app.use( + session({ + secret: process.env.APP_SECRET || "keyboard cat", + resave: false, + saveUninitialized: true, + cookie: { + secure: process.env.NODE_ENV === "production", + httpOnly: true + } + }) +) +// Existing config for body-parser +app.use(bodyParser.urlencoded({ + extended: false +})) +``` +Finally, add in the configuration for the `express-openid-connect` middleware. The location of this is important; it should be inserted _after_ the configuration for the static file server, but _before_ the definition of the API routes. This ensures the static files can be served without requiring authentication, but the API routes are secured: +```js +// server/index.js +// Existing config for the static file server +app.use(express.static(join(__dirname, "..", "public"))) +// NEW - Configure the OpenID Connect middleware +app.use( + auth({ + required: req => req.originalUrl !== "/" + }) +) +// Existing config for the API routes +app.use("/api", require("./api")) +``` +Note that in this case, the authentication step is only applied if the request is for something other than the homepage. This lets us show some kind of UI even if the user is not logged in. We can display a "log in" button if they have not yet authenticated, or some other UI if they have. +After these changes, your server script should more-or-less look like this: +```js +require("dotenv").config() +const express = require("express") +const helmet = require("helmet") +const morgan = require("morgan") +const debug = require("debug")("app:server") +const session = require("express-session") +const bodyParser = require("body-parser") +const { + auth +} = require("express-openid-connect") +const { + join +} = require("path") +const app = express() +app.use(helmet()) +app.use(morgan("dev", { + stream: { + write: m => debug(m) + } +})) +// Set up express-session (required by express-openid-connect) +app.use( + session({ + secret: process.env.APP_SECRET || "keyboard cat", + resave: false, + saveUninitialized: true, + cookie: { + secure: process.env.NODE_ENV === "production", + httpOnly: true + } + }) +) +app.use(bodyParser.urlencoded({ + extended: false +})) +app.use(express.static(join(__dirname, "..", "public"))) +// Set up authentication middleware, only strictly required if +// the request isn't for the home page +app.use( + auth({ + required: req => req.originalUrl !== "/" + }) +) +app.use("/api", require("./api")) +app.get("/*", (req, res) => { + res.sendFile(join(__dirname, "..", "public", "index.html")) +}) +const port = process.env.PORT || 3000 +app.listen(port, () => debug("Application listening on port " + port)) +``` +### Setting up the environment +In order for the application to work with authentication, `express-openid-connect` requires some environment variables to be present. For this application, these variables can be specified in a `.env` file. +Create a `.env` file in the root of the project directory and populate it with the following: +```bash +ISSUER_BASE_URL= +CLIENT_ID= +BASE_URL=http://localhost:3000 +``` +### Setting up an Auth0 app +If you don't already have an Auth0 account, you can [sign up for a free Auth0 account here](https://auth0.com/signup). +Next, set up an Auth0 Client and API so Auth0 can interface with your app and API. +![Create App Dashboard](/media/articles/login/spa/image4.png) +1. Go to your [Auth0 Dashboard](${manage_url}) and click the [Create Application](https://manage.auth0.com/#/applications/create) button. +2. Name your new app, select **Regular Web Applications** and click the **Create** button. +3. In the **Settings** for your new Auth0 app, add `http://localhost:3000/callback` to the **Allowed Callback URLs**. +4. Add `http://localhost:3000` to the **Allowed Logout URLs**. +5. Click the **Save Changes** button. +6. If you'd like, you can [set up some social connections](${manage_url}/#/connections/social). You can then enable them for your app in the **Application** options under the **Connections** tab. The example shown in the screenshot above utilizes username/password database, Facebook, Google, and Twitter. +On the **Settings** screen, note the domain and client ID settings at the top. +![Application Settings](/media/articles/login/spa/image5.png) +These are the two values that need to be configured as part of the application. Reopen the `.env` file and set these values: +``` +ISSUER_BASE_URL=${account.namespace} +CLIENT_ID=${account.clientId} +BASE_URL=http://localhost:3000 +``` +### Running the application +With the server and environment configuration done, find your browser window that has the application open. If you've closed the browser and stopped the server, run the following from the terminal to restart the application +```bash +npm run dev +``` +Then open [http://localhost:3000](http://localhost:3000) in the browser. From a user interface perspective, the application should look the same. However, this time when the **Call API** button is clicked, you should receive a warning that the user is not logged in. Also note that you do not see the "Hello, World" message as before, since the call to the API has been rejected. +![User Is Not Logged In](/media/articles/login/spa/image6.png) +Click the "Log in now" to login. Once you have been authenticated, you'll return to the application and see an updated UI that reflects your newly-logged in state. You should be able to press the **Call API** button once more to invoke an API call to the server, and it now works! +![User Is Logged In](/media/articles/login/spa/image7.png) +You can click the "Profile" link at the top of the page to show user information retrieved from the ID token. +![User Profile](/media/articles/login/spa/image8.png) \ No newline at end of file diff --git a/articles/logout/_includes/_logout-endpoint.md b/articles/logout/_includes/_logout-endpoint.md new file mode 100644 index 0000000000..e1ee68dda9 --- /dev/null +++ b/articles/logout/_includes/_logout-endpoint.md @@ -0,0 +1,4 @@ +The [logout endpoint](/api/authentication?javascript#logout) in Auth0 works in one of two ways: + +- Clears the Single Sign-on (SSO) cookie in Auth0. +- Clears the SSO cookie in Auth0 and sign out the user from the IdP (such as ADFS or Google). diff --git a/articles/logout/guides/logout-applications.md b/articles/logout/guides/logout-applications.md new file mode 100644 index 0000000000..2368fd165f --- /dev/null +++ b/articles/logout/guides/logout-applications.md @@ -0,0 +1,27 @@ +--- +title: Log Users Out of Applications +description: Learn how to force a user to log out of applications using the Auth0 logout endpoint. +topics: + - logout +contentType: + - how-to +useCase: + - manage-logout +--- + +# Log Users Out of Applications + +Enterprise users typically have Single Sign-on (SSO) enabled for multiple applications (e.g., SharePoint, a few .NET applications, a few Java applications, Zendesk). In this case, when users sign out, often they must be signed out for all of their applications. + +<%= include('../_includes/_logout-endpoint') %> + +Redirecting users to the logout endpoint **does not** cover the scenario where users need to be signed out of all of the applications they used. If you need to provide this functionality you will have to handle this in one of two ways: +* Have short timeouts on your local session and redirect to Auth0 at short intervals to re-authenticate. NOTE: this can be done by calling `checkSession` from the client which does this redirect in a hidden iFrame. If you take the hidden iFrame approach you need to be aware of rate limits and third-party cookie issues. +* Handle this entirely at the application level by providing your applications a way to notify all other applications when a logout occurs. + +## Keep reading + +* [Log Users Out of Auth0](/logout/guides/logout-auth0) +* [Log Users Out of Identity Providers](/logout/guides/logout-idps) +* [Log Users Out of SAML Identity Providers](/logout/guides/logout-saml-idps) +* [Log Users Out of Auth0 as the SAML Identity Provider](/protocols/saml/saml-configuration/logout) diff --git a/articles/logout/guides/logout-auth0.md b/articles/logout/guides/logout-auth0.md new file mode 100644 index 0000000000..638f134afd --- /dev/null +++ b/articles/logout/guides/logout-auth0.md @@ -0,0 +1,30 @@ +--- +title: Log Users Out of Auth0 +description: Learn how to force a user to log out of Auth0 using the Auth0 logout endpoint. +topics: + - logout +contentType: how-to +useCase: + - manage-logout +--- + +# Log Users Out of Auth0 + +The [logout endpoint](/api/authentication?javascript#logout) in Auth0 works in one of two ways: + +1. **Clears the Single Sign-on (SSO) cookie in Auth0.** To force a logout, redirect the user to the following URL: + +```text +https://${account.namespace}/v2/logout +``` + +2. **Clears the SSO cookie in Auth0 and sign out the user from the IdP (such as ADFS or Google).** To [log the user out of both Auth0 *and* the IdP](/logout/guides/logout-idps), you must include the `federated` querystring parameter with your call to the logout endpoint. + +Redirecting the user to this URL clears all Single Sign-on (SSO) cookies set by Auth0 for the user. + +## Keep reading + +* [Log Users Out of Applications](logout/guides/logout-applications) +* [Log Users Out of Identity Providers](/logout/guides/logout-idps) +* [Log Users Out of SAML Identity Providers](/logout/guides/logout-saml-idps) +* [Log Users Out of Auth0 as the SAML Identity Provider](/protocols/saml/saml-configuration/logout) diff --git a/articles/logout/guides/logout-idps.md b/articles/logout/guides/logout-idps.md new file mode 100644 index 0000000000..c62112ac76 --- /dev/null +++ b/articles/logout/guides/logout-idps.md @@ -0,0 +1,73 @@ +--- +title: Log Users Out of Identity Providers +description: Learn how to force a user to log out of their identity provider. +topics: + - logout + - federated-logout +contentType: how-to +useCase: + - manage-logout +--- +# Log Users Out of Identity Providers + +Although this is not common practice, you can force the user to log out of their identity provider. + +For many providers, Auth0 will give you this behavior by simply having you add the `federated` query parameter to the redirect to `/v2/logout`. This will then additionally redirect the user to their identity provider and log them out there as well. + +To do this, add a `federated` querystring parameter to the logout URL: + +```text +https://${account.namespace}/v2/logout?federated +``` + +## Limitations + +There are a few limitations to federated logout to keep in mind: + +* No validation is performed on any URL provided as a value to the returnTo parameter, nor any querystring or hash information provided as part of the URL. + +* The behavior of federated logouts with social providers is inconsistent. Each provider will handle the returnTo parameter differently and for some, it will not work. Please check your social provider's settings to determine how it will behave. + +* If you are working with social identity providers such as Google or Facebook, you must set your Client ID and Secret for these providers in the Dashboard for the logout to function properly. + +* If you are an Auth0 Enterprise user, you will typically have SSO enabled for multiple applications, for example, SharePoint, a few .NET applications, a few Java applications, Zendesk, etc. In this case, it's very common that when users sign out, this needs to happen for all of their applications. + +::: panel-warning Single logout +Redirecting users to the Auth0 `logout` endpoint does not cover all scenarios where users need to be signed out of all of the applications they use. Other than when Auth0 is using SAML, Auth0 does not natively support Single Logout. Single Logout can be achieved by having each application check the active session after their tokens expire, or you can force log out by terminating your application sessions at the application level. + +You can configure Single Logout URLs for SAML that can log out of all SAML sessions, although Auth0 supports front-channel SAML SLO only, Auth0 does not support back-channel SLO. +Auth0 provides quickstart guides that show you how to implement logout functionality in your specific type of application and provides sample code. These quickstarts support native/mobile apps, single-page apps, and web apps. +::: + +## Federated logout support + +The following identity providers support federated logout: + +* Evernote +* Facebook +* Fitbit +* GitHub +* Google + * Apps + * OAuth 2.0 +* Microsoft + * Active Directory Federation Services + * Office 365 + * Windows Azure Active Directory + * Windows Live +* Salesforce/Salesforce Sandbox +* Twitter +* Yahoo +* Yammer + +::: panel-warning Clear your application session +The Auth0 [logout endpoint](/api/authentication?javascript#logout) logs you out from Auth0 and, optionally, from your identity provider. It does *not* log you out of your application! This is something that you must implement on your side. You need to log out the user from your application by clearing their session. +::: + +## Keep reading + +* [Log Users Out of Auth0](/logout/guides/logout-auth0) +* [Log Users Out of Applications](logout/guides/logout-applications) +* [Log Users Out of SAML Identity Providers](/logout/guides/logout-saml-idps) +* [Log Users Out of Auth0 as the SAML Identity Provider](/protocols/saml/saml-configuration/logout) +* [Sessions](/sessions) diff --git a/articles/logout/guides/logout-saml-idps.md b/articles/logout/guides/logout-saml-idps.md new file mode 100644 index 0000000000..a2bf39e8c8 --- /dev/null +++ b/articles/logout/guides/logout-saml-idps.md @@ -0,0 +1,44 @@ +--- +title: Log Users Out of SAML Identity Providers +description: Learn how to log users out of an external SAML identity provider. +topics: + - logout + - SAML-logout + - identity-providers +contentType: how-to +useCase: + - manage-logout +--- + +# Log Users Out of SAML Identity Providers + +To logout users from an external SAML identity provider, you must configure a [SAML logout URL](/saml-sp-generic#1-obtain-information-from-idp) in the SAML connection settings. If you don't configure a logout URL, Auth0 will use the __SAML login URL__. + +Auth0 will initiate a logout by sending a SAML logout request to the external identity provider if the `federated` query string parameter is included when redirecting the user to the [logout endpoint](/api/authentication?javascript#logout). + +The external SAML identity provider will need to know where to send SAML logout requests (if initiating the logout) and responses. The __SingleLogout service URL__ that will consume this SAML messages is the following: + +```text +https://${account.namespace}/logout +``` + +When viewing the logout metadata for your Auth0 Connection, you will notice two `SingleLogoutService` bindings with the above URL. + +* **SAML Request Binding** (also known as the **Protocol Binding**): Used for the transaction from Auth0 to the IdP. If the IdP provides a choice, select `HTTP-Redirect`. + +* **SAML Response Binding**: Used for transactions from the IdP to Auth0. It indicates to Auth0 what protocol the IdP will use to respond. If the IdP provides a choice, indicate that `HTTP-POST` should be used for Authentication Assertions. + +::: panel Unable to Logout Using a SAML Identity Provider +When logging in (with Auth0 as the SAML Service Provider), the SAML identity provider uniquely identifies the user's session with a `SessionIndex` attribute in the `AuthnStatement` element of the SAML assertion. The `SessionIndex` value must be used again when the user logs out. + +Occasionally, the `SessionIndex` value may not be present in the initial login assertion. When the user logs out, the request to the SAML identity provider will fail due to the missing value. + +In these cases, Auth0 may not be able to complete a logout request to the SAML identity provider even if the logout URL has been configured correctly. +::: + +## Keep reading + +* [Log Users Out of Auth0](/logout/guides/logout-auth0) +* [Log Users Out of Applications](logout/guides/logout-applications) +* [Log Users Out of Identity Providers](/logout/guides/logout-idps) +* [Log Users Out of Auth0 as the SAML Identity Provider](/protocols/saml/saml-configuration/logout) diff --git a/articles/logout/guides/redirect-users-after-logout.md b/articles/logout/guides/redirect-users-after-logout.md new file mode 100644 index 0000000000..1d7fc0ad91 --- /dev/null +++ b/articles/logout/guides/redirect-users-after-logout.md @@ -0,0 +1,85 @@ +--- +title: Redirect Users After Logout +description: Learn how to redirect users after logout. +topics: + - logout + - redirect +contentType: how-to +useCase: + - manage-logout +--- + +# Redirect Users After Logout + +You can redirect users to a specific URL after they logout. You will need to register the redirect URL in your tenant or application settings. Auth0 only redirects to whitelisted URLs after logout. If you need different redirects for each application, you can whitelist the URLs in your application settings. + +1. Add a `returnTo` querystring parameter with the target URL as the value. Encode the target URL being passed in. For example, to redirect the user to `http://www.example.com` after logout, make the following request: + + ```text + https://${account.namespace}/v2/logout?returnTo=http%3A%2F%2Fwww.example.com + ``` + +2. Add the non-encoded `returnTo` URL (for these examples, it is `http://www.example.com`) as an **Allowed Logout URLs** in one of two places: + + - **Tenant Settings**: For logout requests that do not include the `client_id` parameter you must add the `returnTo` URL (for example `http://www.example.com`) to the **Allowed Logout URLs** list in the [Advanced tab of your Tenant Settings](${manage_url}/#/tenant/advanced). For example: + + ```text + https://${account.namespace}/v2/logout?returnTo=http%3A%2F%2Fwww.example.com + ``` + + To add a list of URLs that the user may be redirected to after logging out at the tenant level, go to the [Tenant Settings > Advanced](${manage_url}/#/tenant/advanced) of the Auth0 Dashboard. + + ![Tenant level logout screen](/media/articles/logout/tenant-level-logout.png) + + - **Auth0 Application Settings**: For logout requests that include the `client_id` parameter you must add the `returnTo` URL (for example `http://www.example.com`) to the **Allowed Logout URLs** list in the **Settings** tab of your Auth0 app that is associated with the specified `CLIENT_ID`. For example: + + ```text + https://${account.namespace}/v2/logout?returnTo=http%3A%2F%2Fwww.example.com&client_id=CLIENT_ID + ``` + + To redirect the user after they log out from a specific application, you must add the URL used in the `returnTo` parameter of the redirect URL to the **Allowed Logout URLs** list in the **Settings** tab of your Auth0 application that is associated with the `CLIENT_ID` parameter. + + ![Application level logout screen](/media/articles/logout/client-level-logout.png) + + When providing the URL list, you can: + + * Specify multiple, valid, comma-separated URLs. + * Use `*` as a [wildcard for subdomains](/applications/reference/wildcard-subdomains) (such as `http://*.example.com`). + +::: warning +If the `client_id` parameter is included and the `returnTo` URL is NOT set, the server returns the user to the first Allowed Logout URLs set in the Dashboard. +::: + +::: note +In order to avoid validation errors, make sure that you include the protocol part of the URL. For example, setting the value to `*.example.com` will result in a validation error, so you should use `http://*.example.com` instead. +::: + +## Limitations + +* The validation of URLs provided as values to the `returnTo` parameter, the querystring, and hash information provided as part of the URL are not taken into account. + +* The behavior of federated logouts with social providers is inconsistent. Each provider will handle the `returnTo` parameter differently and for some it will not work. Please check your social provider's settings to ensure that they will accept the `returnTo` parameter and how it will behave. + +* The URLs provided in the **Allowed Logout URLs** list are case-sensitive, so the URL used for logouts must match the case of the logout URL configured on the dashboard. However, do note that the scheme and host parts are case insensitive. For example, if your URL is `http://www.Example.Com/FooHoo.html`, the `http://www.Example.Com` portion is case insensitive, while the `FooHoo.html` portion is case sensitive. + +::: note +If you are working with social identity providers such as Google or Facebook, you must set your `Client ID` and `Secret` for these providers in the [Dashboard](${manage_url}) for the logout to function properly. +::: + +## Additional requirements for Facebook + +If you are using Facebook, you will also need to encode the `returnTo` parameter. For example: + +```text +https://${account.namespace}/v2/logout?federated& + returnTo=https%3A%2F%2F${account.namespace}%2Flogout%3FreturnTo%3Dhttp%3A%2F%2Fwww.example.com + &access_token=[facebook access_token] +``` + +## Keep reading + +* [Log Users Out of Auth0](/logout/guides/logout-auth0) +* [Log Users Out of Applications](logout/guides/logout-applications) +* [Log Users Out of Identity Providers](/logout/guides/logout-idps) +* [Log Users Out of SAML Identity Providers](/logout/guides/logout-saml-idps) +* [Log Users Out of Auth0 as the SAML Identity Provider](/protocols/saml/saml-configuration/logout) diff --git a/articles/logout/index.md b/articles/logout/index.md index bdc6479a7a..55c25449b5 100644 --- a/articles/logout/index.md +++ b/articles/logout/index.md @@ -1,250 +1,45 @@ --- -description: How to log out a user and optionally redirect them to an authorized URL. -toc: true +description: Understand how logout works with Auth0. +topics: + - logout +contentType: index +useCase: + - manage-logout --- # Logout -When you're implementing the logout functionality for your app, there are typically three sessions layers you need to consider: +You can log a user out of the Auth0 session and (optionally) from the identity provider (IdP) session. When you're implementing the logout functionality, there are typically three session layers you need to consider: -- __Application Session__: The first is the session inside your application. Though your application uses Auth0 to authenticate users, you'll still need to track that the user has logged in to your application. In a regular web application, this is achieved by storing information inside a cookie. You need to log out the user from your application by clearing their session. +1. **Application Session Layer**: The first layer is the session inside your application. Though your application uses Auth0 to authenticate users, you'll still need to track that the user has logged in to your application. In a regular web application, you achieve this by storing information inside a cookie. [Log users out of your applications](/logout/guides/logout-applications) by clearing their session. You should handle the application session in your application. -- __Auth0 session__: Auth0 also keep a session for the user and stores their information inside a cookie. The next time a user is redirected to the Auth0 Lock screen, the user's information will be remembered. To log out a user from Auth0, you need to clear the single sign-on (SSO) cookie. +2. **Auth0 Session Layer**: Auth0 also maintains a session for the user and stores their information inside a cookie. The next time a user is redirected to the Auth0 Lock screen, the user's information will be remembered. [Log users out of Auth0](/logout/guides/logout-auth0) by clearing the Single Sign-on (SSO) cookie. -- __Identity Provider session__: The last layer is the Identity Provider, such as Facebook or Google. When users attempt to sign in with any of these providers and they are already signed into the provider, they will not be prompted again to sign in. They may simply be asked to give permissions to share their information with Auth0 and in turn, your application. +3. **Identity Provider Session Layer**: The last session layer is the identity provider layer (for example, Facebook or Google). When users attempt to sign in with any of these providers and they are already signed into the provider, they will not be prompted again to sign in. The users may be asked to give permission to share their information with Auth0 and, in turn, your application. It is not necessary to log the users out of this session layer, but you can force the logout. (For more information, see [Log Users Out of Identity Providers](/logout/guides/logout-idps) and [Log Users Out of SAML Identity Providers](/logout/guides/logout-saml-idps).) -This document explains how to log out a user from the Auth0 session and (optionally) from the Identity Provider session. Remember that you should handle the Application Session in your app! +## Quickstarts for logout functionality -## Log Out a User +For guidance on how to implement logout functionality in your specific type of application and sample code, refer to our [Quickstarts](/quickstarts) for the following types of applications: -The [logout endpoint](/api/authentication?javascript#logout) in Auth0 works in one of two ways: - -- Clear the SSO cookie in Auth0 -- Clear the SSO cookie in Auth0 and sign out the user from the IdP (such as ADFS or Google) - -To force a logout, redirect the user to the following URL: - -```text -https://${account.namespace}/v2/logout -``` - -Redirecting the user to this URL clears all single sign-on cookies set by Auth0 for the user. - -Although this is not common practice, you can also force the user to log out of their identity provider. To do this, add a `federated` querystring parameter to the logout URL: - -```text -https://${account.namespace}/v2/logout?federated -``` - -The following identity providers support federated logout: - -* AOL -* Evernote -* Facebook -* Fitbit -* GitHub -* Google - * Apps - * OAuth 2.0 -* LinkedIn -* Microsoft - * Active Directory Federation Services - * Office 365 - * Windows Azure Active Directory - * Windows Live -* Salesforce/Salesforce Sandbox -* Twitter -* Yahoo -* Yammer - -::: panel-warning Clear your application session -The Auth0 [logout endpoint](/api/authentication?javascript#logout) logs you out from Auth0, and (optionally) from your identity provider. It does *not* log you out of your application! This is something that you must implement on your side. You need to log out the user from your application by clearing their session. You might find [this video](/videos/session-and-cookies) helpful. -::: - - -## Redirect Users After Logout - -To redirect a user after logout, add a `returnTo` querystring parameter with the target URL as the value. We suggest that you encode the target URL being passed in -- for example, to redirect the user to `http://www.example.com` after logout, you can make the following request: - -```text -https://${account.namespace}/v2/logout?returnTo=http%3A%2F%2Fwww.example.com -``` - -You will need to add the non-encoded `returnTo` URL (for these examples, it is `http://www.example.com`) as an **Allowed Logout URLs** in one of two places: - -* For logout requests that do not include the `client_id` parameter, such as: - - ```text - https://${account.namespace}/v2/logout?returnTo=http%3A%2F%2Fwww.example.com - ``` - - you must add the `returnTo` URL (for example `http://www.example.com`) to the **Allowed Logout URLs** list in the [Advanced tab of your Tenant Settings](${manage_url}/#/tenant/advanced). See [Set the Allowed Logout URLs at the Tenant Level](#set-the-allowed-logout-urls-at-the-tenant-level) for more information. - -* For logout requests that include the `client_id` parameter, such as: - - ```text - https://${account.namespace}/v2/logout?returnTo=http%3A%2F%2Fwww.example.com&client_id=CLIENT_ID - ``` - - you must add the `returnTo` URL (for example `http://www.example.com`) to the **Allowed Logout URLs** list in the **Settings** tab of your Auth0 app that is associated with the specified `CLIENT_ID`. See [Set the Allowed Logout URLs at the Application Level](#set-the-allowed-logout-urls-at-the-application-level) for more information. - -### Set the Allowed Logout URLs at the Tenant Level - -To add a list of URLs that the user may be redirected to after logging out at the tenant level, go to the [Tenant Settings > Advanced](${manage_url}/#/tenant/advanced) of the Auth0 Dashboard. - -![Tenant level logout screen](/media/articles/logout/tenant-level-logout.png) - -When providing the URL list, you can: - -* Specify multiple, valid, comma-separated URLs -* Use `*` as a wildcard for subdomains (such as `http://*.example.com`) - -### Set the Allowed Logout URLs at the Application Level - -To redirect the user after they log out from a specific application, you must add the URL used in the `returnTo` parameter of the redirect URL to the **Allowed Logout URLs** list in the **Settings** tab of your Auth0 application that is associated with the `CLIENT_ID` parameter. - -![Application level logout screen](/media/articles/logout/client-level-logout.png) - -When providing the URL list, you can: - -* Specify multiple, valid, comma-separated URLs -* Use `*` as a wildcard for subdomains (such as `http://*.example.com`) - -::: note -In order to avoid validation errors, make sure that you include the protocol part of the URL. For example, setting the value to `*.example.com` will result in a validation error, so you should use `http://*.example.com` instead. -::: - -#### Limitations - -* The validation of URLs provided as values to the `returnTo` parameter, the querystring, and hash information provided as part of the URL are not taken into account. - -* The `returnTo` parameter does not work with all social providers. Please check your social provider's settings to ensure that they will accept the `redirectTo` parameter. - -* The URLs provided to the **Allowed Logout URLs** list are case-sensitive, so the URL used for logouts must match the case of the logout URL configured on the dashboard. Note, that the scheme and host parts, however, are case insensitive. For example, if your URL is `http://www.Example.Com/FooHoo.html`, the `http://www.Example.Com` portion is case insensitive, while the `FooHoo.html` portion is case sensitive. - -::: note -If you are working with social identity providers such as Google or Facebook, you must set your `Client ID` and `Secret` for these providers in the [Dashboard](${manage_url}) for the logout to function properly. -::: - -#### Facebook Users - -If you are using Facebook, please be aware of the additional requirements when triggering a logout. - -You will also need to encode the `returnTo` parameter. - -```text -https://${account.namespace}/v2/logout?federated& - returnTo=https%3A%2F%2F${account.namespace}%2Flogout%3FreturnTo%3Dhttp%3A%2F%2Fwww.example.com - &access_token=[facebook access_token] -``` - -### Supported Providers - -Auth0 supports use of the [`logout` endpoint](/api/authentication?javascript#logout) with the following providers: - -- AOL -- Auth0 - - AD/LDAP -- Custom (Passport/WS-Fed/SAML) -- Facebook -- FitBit -- GitHub -- Google - - Apps - - OAuth2 -- LinkedIn -- Microsoft - - Active Directory (AD) - - Active Directory Federation Services (ADFS) - - Office 365 - - Windows Live -- OAuth - - 1.0 - - 2.0 -- Salesforce - - Salesforce Community - - Salesforce Sandbox -- Samlp -- Twitter -- Waad -- WS-Fed -- Yahoo -- Yammer - -## SAML Logout - -SAML logout is configured differently depending on whether Auth0 acts as the Service Provider (i.e. when you create a SAML **connection**) or when Auth0 acts as the Identity Provider (i.e. when you have an application with the SAML2 Web App addon). - -### Logout for Auth0 as SAML Service Provider - -To logout users from an external SAML identity provider, you must configure a [SAML logout URL](/saml-sp-generic#1-obtain-information-from-idp) in the SAML connection settings. If you don't configure a logout URL, Auth0 will use the __SAML login URL__. - -Auth0 will initiate a logout by sending a SAML logout request to the external identity provider if the `federated` query string parameter is included when redirecting the user to the [logout endpoint](/api/authentication?javascript#logout) as [described above](#log-out-a-user). - -The external SAML identity provider will need to know where to send SAML logout requests (if initiating the logout) and responses. The __SingleLogout service URL__ that will consume this SAML messages is the following: - -```text -https://${account.namespace}/logout -``` - -When viewing the logout metadata for your Auth0 Connection, you might notice two `SingleLogoutService` bindings with the above URL. - -* The first is the **SAML Request Binding** (also known as the **Protocol Binding**), which is used for the transaction from Auth0 to the IdP. If the IdP provides a choice, select `HTTP-Redirect`. -* The second is the **SAML Response Binding**, which is used for transactions from the IdP to Auth0. It indicates to Auth0 what protocol the IdP will use to respond. If the IdP provides a choice, indicate that `HTTP-POST ` should be used for Authentication Assertions. - -### Unable to Logout Using a SAML Identity Provider - -When logging in (with Auth0 as the SAML Service Provider), the SAML identity provider uniquely identifies the user's session with a `SessionIndex` attribute in the `AuthnStatement` element of the SAML assertion. The `SessionIndex` value must be used again when the user logs out. - -Occasionally, the `SessionIndex` value may not be present in the initial login assertion. When the user logs out, the request to the SAML identity provider will fail due to the missing value. - -In these cases, Auth0 may not be able to complete a logout request to the SAML identity provider even if the logout URL has been configured correctly. - -### Logout for Auth0 as SAML IdP - -When Auth0 is acting as a [SAML Identity Provider](/protocols/saml/saml-idp-generic), you can have the following scenarios: - -#### Single Logout Scenario - -If your Service Provider supports SAML Single Logout, you will need to configure the Service Provider to call `https://${account.namespace}/samlp/CLIENT_ID/logout` (also listed in the SAML IdP Metadata). When a logout request is triggered by the Service Provider, a logout request will be sent to this endpoint and Auth0 starts the SAML SLO flow by notifying the existing session participants using a frontend channel. - -* To prevent a session participant from being notified, you can set `logout.slo_enabled` to `false` in the `SAML2 Web App` application addon's settings. -* To send the SAML Logout response using `HTTP-Redirect` bindings (instead of the default `HTTP-POST`), you can set `binding` to `urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect`. - -#### Non Single Logout Scenario - -If your Service Provider does not support SAML SLO, but provides a redirect URL where the user will be redirected to after logging out of the SP, the best thing to do is configure the redirect URL to `https://${account.namespace}/logout`. This won't notify other session participants that a logout was initiated, but it will at remove the session from Auth0. - -## Implementing in your Application - -For guidance and sample code on how to implement logout functionality in your application please refer to our [Quickstarts](/quickstarts): - -### Mobile / Native Apps +### Native/Mobile Apps * [Android](/quickstart/native/android/03-session-handling#log-out) * [Chrome Extension](/quickstart/native/chrome) * [Cordova](/quickstart/native/cordova) -* [Ionic](/quickstart/native/ionic) -* [Ionic 2+](/quickstart/native/ionic2) +* [Ionic 3+](/quickstart/native/ionic3) * [iOS Objective-C](/quickstart/native/ios-objc/03-user-sessions#on-logout-clear-the-keychain) * [iOS Swift](/quickstart/native/ios-swift/03-user-sessions#on-logout-clear-the-keychain) -### Single Page Apps +### Single-Page Apps * [Angular 2+](/quickstart/spa/angular2) -* [AngularJS](/quickstart/spa/angularjs) -* [Aurelia](/quickstart/spa/aurelia) -* [Cycle](/quickstart/spa/cyclejs#5-implement-the-logout) -* [Ember](/quickstart/spa/ember) * [JavaScript](/quickstart/spa/vanillajs) * [React](/quickstart/spa/react) * [Vue](/quickstart/spa/vuejs) -* [jQuery](/quickstart/spa/jquery) ### Web Apps * [ASP.NET (OWIN)](/quickstart/webapp/aspnet-owin/01-login#add-login-and-logout-methods) -* [ASP.NET (System.Web)](/quickstart/webapp/aspnet#logout) * [ASP.NET Core](/quickstart/webapp/aspnet-core/01-login#add-login-and-logout-methods) * [Java](/quickstart/webapp/java) * [Java Spring MVC](/quickstart/webapp/java-spring-mvc) @@ -256,3 +51,14 @@ For guidance and sample code on how to implement logout functionality in your ap * [Python](/quickstart/webapp/python#6-logout) * [Ruby on Rails](/quickstart/webapp/rails/02-session-handling#logout-action) +## Redirect users after logout + +After users log out, you can [redirect users](/logout/guides/redirect-users-after-logout) to a specific URL. You need to register the redirect URL in your tenant or application settings. Auth0 only redirects to whitelisted URLs after logout. If you need different redirects for each application, you can whitelist the URLs in your application settings. + +## Keep reading + +* [Log Users Out of Auth0](/logout/guides/logout-auth0) +* [Log Users Out of Applications](logout/guides/logout-applications) +* [Log Users Out of Identity Providers](/logout/guides/logout-idps) +* [Log Users Out of SAML Identity Providers](/logout/guides/logout-saml-idps) +* [Log Users Out of Auth0 as the SAML Identity Provider](/protocols/saml/saml-configuration/logout) diff --git a/articles/logs/concepts/logs-admins-devs.md b/articles/logs/concepts/logs-admins-devs.md new file mode 100644 index 0000000000..802913210f --- /dev/null +++ b/articles/logs/concepts/logs-admins-devs.md @@ -0,0 +1,37 @@ +--- +description: Examples of how logs are used if you are an administrator or a developer. +topics: + - logs +contentType: concept +useCase: + - analyze-logs + - integrate-analytics +--- +# Administrator and Developer Log Usage Examples + +## Administrator + +If you are an administrator, there are many helpful metrics and bits of information you can gather from the Logs. If a customer has raised a support ticket that they are unable to sign in to your service or application, you can verify in the logs that they have indeed tried, and are attempting in the manner they say they are. They may think it's a password issue, but you may discover they never completed setting up their multi-factor authentication (MFA). Additionally, Logs can help expose some business metrics you may not have had available before. These could include: + +- Finding prime times of usage for different regions +- Identifying a target audience +- Detecting patterns in user behavior that can be optimized +- Identifying problematic actors by IP address +- Calculating frequency and type of Anomaly Detection triggers + + The deeper the analysis, the more you can learn about your customers and your business. + +## Developer + +When debugging an issue, or setting up an integrations, logs are as good as gold. You can utilize the logs as a history of events to see where a flow may be broken, or where customers are getting confused. You can also detect nefarious behavior, or verify that Auth0 anomaly detection is being triggered during questionable behavior. We support searching the logs for specific events using our Dashboard or Management API directly, but also support exporting logs to your existing log processing systems, like Splunk or Sumo Logic, for deeper analysis over time. See [Export Auth0 logs to an external service](/extensions#export-auth0-logs-to-an-external-service) for more information. + +## Keep reading + +* [Log Data Retention](/logs/references/log-data-retention) +* [View Log Data in the Dashboard](/logs/guides/view-log-data-dashboard) +* [Retrieve Logs Using the Management API](/logs/guides/retrieve-logs-mgmt-api) +* [View Anomaly Detection Events](/anomaly-detection/guides/use-tenant-data-for-anomaly-detection) +* [Log Event Type Codes](/logs/references/log-event-type-codes) +* [Log Search Query Syntax](/logs/references/query-syntax) +* [Log Event Filters](/logs/references/log-event-filters) +* [Integrate AWS EventBridge with Auth0](/integrations/aws-eventbridge) \ No newline at end of file diff --git a/articles/logs/guides/migrate-logs-v2-v3.md b/articles/logs/guides/migrate-logs-v2-v3.md new file mode 100644 index 0000000000..8c803ae79c --- /dev/null +++ b/articles/logs/guides/migrate-logs-v2-v3.md @@ -0,0 +1,79 @@ +--- +title: Migrate from Logs Search v2 to v3 +description: Learn how to migrate from Auth0 Logs Search v2 to v3. +topics: + - logs + - search +contentType: how-to +useCase: + - logs +--- + +# Migrate from Logs Search v2 to v3 + +To provide our customers with the most reliable and scalable solution, Auth0 has deprecated Tenant Logs Search Engine v2 in favor of v3. +Auth0 is proactively migrating customers unaffected by this change, while those who are potentially affected are being notified to opt-in for v3 during the provided grace period. + +## Am I affected by the migration? + +Affected customers are those who meet all of the following criteria: +* With tenants created before or on May 21st, 2019 +* With tenants hosted in Auth0's public cloud in the AU or EU regions +* Who use the [GET /api/v2/logs](/api/v2#!/Logs/get_logs) or the [GET /api/v2/users/{user_id}/logs](/api/v2#!/Users/get_logs_by_user) endpoint with the parameter `include_totals=true` or the `q` parameter. +* Who paginate through more than 1000 results +* Who use the Delegated Admin Extension + * Older versions of the extension will continue to work after your Tenant is migrated to Logs Search Engine v3, however you might notice pagination totals being incorrect when viewing logs. Updating to v3.7 of the extension will address this. + +The following tenants are NOT affected: +* Cloud customers in the US region. The US region has been fully migrated and is already using Search Engine v3. +* Private Cloud customers (Migration for Private Cloud customers will begin at a later date). +* Cloud tenants in the EU and AU regions that: + * are not using the `GET /api/v2/logs` or `GET /api/v2/users/{user_id}/logs` endpoints of Management API at all. + * are consuming the logs from the Dashboard Logs section only. + * are using the `GET /api/v2/logs endpoint` with the by checkpoint method (using `from` parameter). + * are consuming logs using any of the [Auth0 Logs to External Service Dashboard extensions](/extensions#export-auth0-logs-to-an-external-service) (which use the by checkpoint method). + +## How can I check to see if I've migrated all my queries? + +You can search your tenant logs with the following to look for queries that would throw errors after you migrate to v3: + +``` +type:depnote AND description:*logs* +``` + +These log entries include a `description` field that specifies the deprecated behavior you're using. You can also check the `details.request.path` and `client_name` fields to see what application is calling either `GET /api/v2/logs` or `GET /api/v2/users/{user_id}/logs`. + +::: note +Auth0 generates only one log of the same **type** and **description** every 60 minutes. No matter how many calls you make using deprecated features to the impacted endpoints, you will still see a single log for *each* deprecated feature each hour. + +If you implement changes to your queries, you'll need to allow 60 minutes to elapse before you can conclusively determine that the lack of new `depnote` logs means the deprecated behavior has been removed from your code. +::: + +## What’s changing? + +The breaking changes are minor, but you should review your queries to make sure the results you are getting are as expected. + +Breaking changes are related to: +#### Pagination +* When your tenant is migrated to logs v3 the value of the `total` field returned in the summary result when calling `GET /api/v2/logs` or `GET /api/v2/users/{user_id}/logs` is changing. When searching for logs using search engine v2, the totals field in your results tells you the number of logs that match the query you provided. However, in v3, the totals field tells you how many logs are returned in the page (similar to what the length field returns). To avoid any potential disruption, if your application relies on the total field for pagination purposes, you should update your logic to handle this change appropriately. +* There is an existing limit of 100 logs per request. When your tenant is migrated to logs v3 you may only paginate through a maximum of 1,000 search results, resulting in calls for anything over 1,000 results returning an error. To avoid any potential disruption, you should review your queries to avoid this limit or handle errors accordingly. +#### `q` parameter validation +* The query syntax when using the `q` parameter in the `GET /api/v2/logs` has minor changes that need to be taken into account. When your tenant is migrated to logs v3 this validation will be enforced resulting in this query returning an error. To avoid any potential disruption, you should review your queries to make sure they comply with the supported query syntax. +* The `q` parameter includes an invalid field. When your tenant is migrated to logs v3 this validation will be enforced resulting in this call returning an error. To avoid any potential disruption, you should review your queries to make sure that only searchable fields are included. + +## How to Migrate? + +After reviewing your queries, you can opt-in to Tenant Logs Search Engine v3 via the Dashboard. Go to *Tenant Settings > Advanced*, then scroll down to *Migrations*. Toggle the *Legacy Logs Search V2* switch to off. +Toggling this switch to off disables the deprecated logs search engine v2 and forces the use of search engine v3. + +::: note +If you do not see the **Legacy Logs Search V2** toggle, you've already been migrated to v3. No further action is required. +::: + +![](/media/articles/logs/tenant-logs-migration.png) + +If you need help with the migration, contact us using the [Support Center](https://support.auth0.com/). + +## Keep reading + +* [Logs](/logs) diff --git a/articles/logs/guides/retrieve-logs-mgmt-api.md b/articles/logs/guides/retrieve-logs-mgmt-api.md new file mode 100644 index 0000000000..c8cec6a38d --- /dev/null +++ b/articles/logs/guides/retrieve-logs-mgmt-api.md @@ -0,0 +1,88 @@ +--- +description: Learn how to retrieve logs using the Auth0 Management API get_logs endpoint by checkpoint or by search criteria. +topics: + - logs +contentType: how-to +useCase: + - analyze-logs + - integrate-analytics +--- + +# Retrieve Logs Using the Management API + +You can use the Management API v2 to retrieve your logs using the [/api/v2/logs](/api/v2#!/Logs/get_logs) endpoint, which supports two types of consumption: [by checkpoint](/logs#get-logs-by-checkpoint) or [by search criteria](#get-logs-by-search-criteria). + +::: note +We highly recommend using [the checkpoint approach](#get-logs-by-checkpoint) to export logs to the external system of your choice and perform any search or analysis there, as logs stored in our system are subject to the [retention period](/logs/references/log-data-retention). You can use any of the [Export Auth0 logs to an external service](/extensions#export-auth0-logs-to-an-external-service) extensions to export the logs to the system of your choice (like Sumo Logic, Splunk or Loggly). +::: + +If you would like to perform a search for specific events you can also use the [search criteria approach](#get-logs-by-search-criteria), which is also the one used by the Management Dashboard. + +::: note +When you query for logs with the [list or search logs](/api/v2#!/Logs/get_logs) endpoint, you can retrieve a maximium of 100 logs per request. +::: + +## Get logs by checkpoint + +This method allows to retrieve logs from a particular `log_id`. For searching by checkpoint use the following parameters: + +| Parameter | Description | +| -- | -- | +| `from` | Log Event Id to start retrieving logs. You can limit the amount of logs using the take parameter. | +| `take` | The total amount of entries to retrieve when using the from parameter. | + +::: note +When fetching logs by checkpoint, the `q` or any parameter other than `from` and `take` will be ignored. Also the order by date is not guaranteed. +::: + +## Get logs by search criteria + +This method retrieves log entries that match the specified search criteria (or list all entries if no criteria is used). To search by criteria use the following parameters: + +| Parameter | Description | +| -- | -- | +| `q` | Search Criteria using Query String Syntax. See [Query Syntax](/logs/references/query-syntax) for information of how to build the queries. | +| `page` | The zero-based page number. | +| `per_page` | The number of entries per page. | +| `sort` | The field to use for sorting. Use `field:order`, where `order` is `1` for ascending and `-1` for descending. For example `date:-1`. | +| `fields:` | A comma-separated field list to include or exclude (depending on `include_fields`) from the result. Leave empty to retrieve all fields. | +| `include_fields` | `true` if the fields specified are to be included in the result, `false` otherwise. Defaults to `true`. | + +For the list of fields that can be used in the search query and the `fields` and `sort` parameters, see [Query Syntax: Searcheable fields](logs/references/query-syntax#searchable-fields). + +## Limitations + +Besides the limitation of 100 logs per request to retrieve logs, you may only paginate through up to 1,000 search results. + +If you get the error `414 Request-URI Too Large` this means that your query string is larger than the supported length. In this case, refine your search. + +::: panel Private Cloud Users +For Private Cloud users searching tenant logs, note that only the following fields are searchable at this time: + +* `user` +* `connection` +* `application` +* `type` +* `ip` + +Use double quotes for exact searches (e.g., `application:"test"` will search for all log entries specific to the application named `test`, but `application:test` will search log entries for applications with test in their name. +::: + +## Other log endpoints + +As an alternative or complement to retrieving logs by checkpoint or search criteria using the [/api/v2/logs](/api/v2#!/Logs/get_logs) endpoint, you can also use the following endpoints to look for logs: + +* [/api/v2/logs/{id}](/api/v2#!/Logs/get_logs_by_id): Retrieves the single log entry associated with the provided log id. +* [/api/v2/users/{user_id}/logs](/api/v2#!/Users/get_logs_by_user): Retrieves log events for a specific user id. + +## Keep reading + +* [Administrator and Developer Log Usage Examples](/logs/concepts/logs-admins-devs) +* [Log Data Retention](/logs/references/log-data-retention) +* [Log Event Type Codes](/logs/references/log-event-type-codes) +* [Log Search Query Syntax](/logs/references/query-syntax) +* [View Log Data in the Dashboard](/logs/guides/view-log-data-dashboard) +* [View Anomaly Detection Events](/anomaly-detection/guides/use-tenant-data-for-anomaly-detection) +* [Log Event Filters](/logs/references/log-event-filters) +* [Integrate AWS EventBridge with Auth0](/integrations/aws-eventbridge) +* [GDPR: Data Minimization](/compliance/gdpr/features-aiding-compliance/data-minimization) \ No newline at end of file diff --git a/articles/logs/guides/view-log-data-dashboard.md b/articles/logs/guides/view-log-data-dashboard.md new file mode 100644 index 0000000000..fc0cbcaa41 --- /dev/null +++ b/articles/logs/guides/view-log-data-dashboard.md @@ -0,0 +1,32 @@ +--- +description: Learn how to view log data in the Auth0 Dashboard for all events that occur including user authentication and administrative actions such as adding and updating applications, connections, and rules. +topics: + - logs +contentType: how-to +useCase: + - analyze-logs + - integrate-analytics +--- +# View Log Data in the Dashboard + +The **Logs** page of the [Dashboard](${manage_url}/#/logs) displays all events that occur, including user authentication and administrative actions such as adding/updating Applications, Connections, and Rules. + +![Log Search](/media/articles/logs/dashboard-logs.png) + +Please note that administrative actions will show up in the logs as `API Operation` events. + +## Event type filters + +You can choose a [filter](/logs/references/log-event-filters) for log error, warning, and success events. For example, you can choose the **Deprecation Notice** warning to filter logs related to deprecation warnings. + +![Log Event Filter](/media/articles/logs/log-event-filter.png) + +## Keep reading + +* [Administrator and Developer Log Usage Examples](/logs/concepts/logs-admins-devs) +* [Log Data Retention](/logs/references/log-data-retention) +* [Log Event Type Codes](/logs/references/log-event-type-codes) +* [Log Search Query Syntax](/logs/references/query-syntax) +* [Retrieve Logs Using the Management API](/logs/guides/retrieve-logs-mgmt-api) +* [Integrate AWS EventBridge with Auth0](/integrations/aws-eventbridge) +* [GDPR: Data Minimization](/compliance/gdpr/features-aiding-compliance/data-minimization) \ No newline at end of file diff --git a/articles/logs/index.md b/articles/logs/index.md index b81be1db3a..b8a85708f2 100644 --- a/articles/logs/index.md +++ b/articles/logs/index.md @@ -1,145 +1,29 @@ --- -description: How to view log data, lists log event types. +description: Understand how Auth0 logs work. url: /logs -crews: crew-2 +classes: topic-page +topics: + - logs +contentType: index +useCase: + - analyze-logs + - integrate-analytics --- - # Logs -Using the [Dashboard](${manage_url}), you can pull log data on actions performed by administrators using the Dashboard, and authentications made by your users. - -## How to View Log Data - -The **Logs** page of the [Dashboard](${manage_url}) displays all events that occur, including user authentication and administrative actions such as adding/updating Applications, Connections, and Rules. - -![](/media/articles/logs/dashboard-logs.png) - -Please note that administrative actions will show up in the logs as `API Operation` events. - -## Frequently Asked Questions - -### How long is log file data available? - -The length of time log data is stored varies depending on your plan. - -Plan | Log Retention ------|-------------- -Free | 2 days -Developer | 2 days -Developer Pro | 10 days -Enterprise | 30 days - -### How do I view or export log file data? - -If you would like to store log data longer than the time period offered by your subscription plan, we recommend you use the [Management API feature that allows you to retrieve the relevant data](api/management/v2#!/Logs/get_logs). Once you've retrieved your data, you can: - -* Store the data yourself -* Send the data to an external service such as Splunk (consider using the [Auth0 Logs to Splunk Extension](/extensions/splunk)) - -#### Retrieving logs from the Management API - -You can use the Management API v2 retrieve your logs. There are the two available endpoints, each providing slightly different quantities of information: - -* [/api/v2/logs](/api/v2#!/Logs/get_logs): Retrieves log entries that match the provided search criteria. If you do not provide any search criteria, you will get a list of all available entries; -* [/api/v2/logs/{id}](/api/v2#!/Logs/get_logs_by_id): Retrieves the single log entry associated with the provided ID. - -## Log data event listing - -The following table lists the codes associated with the appropriate log events. - -| **Event Code** | **Event** | **Event Description** | **Additional Info** | -| --- | --- | --- | --- | -| `admin_update_launch` | Auth0 Update Launched | | -| `api_limit` | Rate Limit On API | The maximum number of requests to the API in given time has reached. | [Rate Limit Policy](/policies/rate-limits) | -| `cls` | Code/Link Sent | Passwordless login code/link has been sent | [Passwordless](/passwordless) | -| `coff` | Connector Offline | AD/LDAP Connector is offline | [Active Directory/LDAP Connector](/connector) | -| `con` | Connector Online | AD/LDAP Connector is online and working | [Active Directory/LDAP Connector](/connector) | -| `cs` | Code Sent | Passwordless login code has been sent | [Passwordless](/passwordless) | -| `du` | Deleted User | User has been deleted. | [User Profile](/user-profile) | -| `f` | Failed Login | | | -| `fapi` | Failed API Operation | | | -| `fc` | Failed by Connector | | [Active Directory/LDAP Connector](/connector) | -| `fce` | Failed Change Email | Failed to change user email | [User Profile](/user-profile) | -| `fco` | Failed by CORS | Origin is not in the Allowed Origins list for the specified application | [Applications](/applications#application-settings) | -| `fcoa` | Failed cross-origin authentication | | | -| `fcp` | Failed Change Password | | [Changing a User's Password](/connections/database/password-change) | -| `fcph` | Failed Post Change Password Hook | | | -| `fcpn` | Failed Change Phone Number | | [User Profile](/user-profile) | -| `fcpr` | Failed Change Password Request | | [Changing a User's Password](/connections/database/password-change) | -| `fcpro` | Failed Connector Provisioning | Failed to provision a AD/LDAP connector | [Active Directory/LDAP Connector](/connector) | -| `fcu` | Failed Change Username | Failed to change username | [User Profile](/user-profile) | -| `fd` | Failed Delegation | Failed to generate delegation token | [Delegation Tokens](/tokens/delegation) | -| `fdu` | Failed User Deletion | | [User Profile](/user-profile) | -| `feacft` | Failed Exchange | Failed to exchange authorization code for Access Token | [Authorization Code Grant Flow](/api-auth/tutorials/authorization-code-grant) -| `feccft` | Failed Exchange | Failed exchange of Access Token for a Client Credentials Grant | [Asking for Access Tokens for a Client Credentials Grant](/api-auth/config/asking-for-access-tokens) | -| `feoobft` | Failed Exchange | Failed exchange of Password and OOB Challenge for Access Token | | -| `feotpft` | Failed Exchange | Failed exchange of Password and OTP Challenge for Access Token | | -| `fepft` | Failed Exchange | Failed exchange of Password for Access Token | | -| `fercft` | Failed Exchange | Failed Exchange of Password and MFA Recovery code for Access Token | | -| `fertft` | Failed Exchange | Failed Exchange of Refresh Token for Access Token | | -| `flo` | Failed Logout | User logout failed | [Logout](/logout) | -| `fn` | Failed Sending Notification | Failed to send email notification | [Emails](/email) | -| `fp` | Failed Login (Incorrect Password) | | | -| `fs` | Failed Signup | | | -| `fsa` | Failed Silent Auth | | | -| `fu` | Failed Login (Invalid Email/Username) | | | -| `fui` | Failed users import | Failed to import users | [User Import/Export](/extensions/user-import-export) | -| `fv` | Failed Verification Email | Failed to send verification email | [Verification Email](/email/custom#verification-email) | -| `fvr` | Failed Verification Email Request | Failed to process verification email request | [Verification Email](/email/custom#verification-email) | -| `gd_auth_failed` | OTP Auth failed | One-time password authentication failed. | [Multifactor Authentication](/multifactor-authentication) | -| `gd_auth_rejected` | OTP Auth rejected | One-time password authentication rejected. | [Multifactor Authentication](/multifactor-authentication) | -| `gd_auth_succeed` | OTP Auth success | One-time password authentication success. | [Multifactor Authentication](/multifactor-authentication) | -| `gd_enrollment_complete` | Guardian enrollment complete | | | -| `gd_module_switch` | Module switch | | | -| `gd_otp_rate_limit_exceed` | Too many failures | | | -| `gd_recovery_failed` | Recovery failed | Multifactor recovery code failed. | [Multifactor Authentication](/multifactor-authentication) | -| `gd_recovery_rate_limit_exceed` | Too many failures | Multifactor recovery code has failed too many times. | [Multifactor Authentication](/multifactor-authentication) | -| `gd_recovery_succeed` | Recovery success | Multifactor recovery code succeeded authorization. | [Multifactor Authentication](/multifactor-authentication) | -| `gd_send_pn` | Push notification sent | Push notification for MFA sent successfully sent with Guardian. | [Auth0 Guardian](/multifactor-authentication/guardian) | -| `gd_send_sms` | SMS Sent | SMS for MFA sent successfully sent. | [Using SMS for MFA](/multifactor-authentication/guardian/admin-guide#support-for-sms) | -| `gd_start_auth` | Second factor started | Second factor authentication event started for MFA. | [Multifactor Authentication](/multifactor-authentication) | -| `gd_start_enroll` | Enroll started | Multifactor authentication enroll has started. | [Multifactor Authentication](/multifactor-authentication) | -| `gd_tenant_update` | Guardian tenant update | | [Auth0 Guardian](/multifactor-authentication/guardian) | -| `gd_unenroll` | Unenroll device account | Device used for second factor authentication has been unenrolled. | [Multifactor Authentication](/multifactor-authentication) | -| `gd_update_device_account` | Update device account | Device used for second factor authentication has been updated. | [Multifactor Authentication](/multifactor-authentication) | -| `gd_user_delete` | User delete | Deleted multifactor user account. | [User Profile](/user-profile) | -| `limit_delegation` | Too Many Calls to /delegation | Rate limit exceeded to `/delegation` endpoint | [API Rate Limit Policy](/policies/rate-limits) | -| `limit_mu` | Blocked IP Address | An IP address is blocked with 100 failed login attempts using different usernames, all with incorrect passwords in 24 hours, or 50 sign-up attempts per minute from the same IP address. | [Anomaly Detection](/anomaly-detection) | -| `limit_ui` | Too Many Calls to /userinfo | Rate limit exceeded to `/limit_ui` endpoint | [API Rate Limit Policy](/policies/rate-limits) | -| `limit_wc` | Blocked Account | An IP address is blocked with 10 failed login attempts into a single account from the same IP address. | [Anomaly Detection](/anomaly-detection) | -| `pwd_leak` | Breached password | | | -| `s` | Success Login | Successful login event. | | -| `sapi` | Success API Operation | | | -| `sce` | Success Change Email | | [Emails in Auth0](/email) | -| `scoa` | Success cross-origin authentication | | | -| `scp` | Success Change Password | | | -| `scph` | Success Post Change Password Hook | | | -| `scpn` | Success Change Phone Number | | | -| `scpr` | Success Change Password Request | | | -| `scu` | Success Change Username | | | -| `sd` | Success Delegation | | [Delegation Tokens](/tokens/delegation) | -| `sdu` | Success User Deletion | User successfully deleted | [User Profile](/user-profile) | -| `seacft` | Success Exchange | Successful exchange of authorization code for Access Token | [Authorization Code Grant Flow](/api-auth/tutorials/authorization-code-grant) | -| `seccft` | Success Exchange | Successful exchange of Access Token for a Client Credentials Grant | [Asking for Access Tokens for a Client Credentials Grant](/api-auth/config/asking-for-access-tokens) | -| `seoobft` | Success Exchange | Successful exchange of Password and OOB Challenge for Access Token | | -| `seotpft` | Success Exchange | Successful exchange of Password and OTP Challenge for Access Token | | -| `sepft` | Success Exchange | Successful exchange of Password for Access Token | | -| `sercft` | Success Exchange | Successful exchange of Password and MFA Recovery code for Access Token | | -| `sertft` | Success Exchange | Successful exchange of Refresh Token for Access Token | | -| `slo` | Success Logout | User successfully logged out | [Logout](/logout) | -| `ss` | Success Signup | | | -| `ssa` | Success Silent Auth | | | -| `sui` | Success users import | Successfuly imported users | [User Import/Export](/extensions/user-import-export) | -| `sv` | Success Verification Email | | | -| `svr` | Success Verification Email Request | | | -| `sys_os_update_end` | Auth0 OS Update Ended | | | -| `sys_os_update_start` | Auth0 OS Update Started | | | -| `sys_update_end` | Auth0 Update Ended | | | -| `sys_update_start` | Auth0 Update Started | | | -| `ublkdu` | User login block released | User block setup by anomaly detection has been released | | -| `w` | Warnings During Login | | | - -### Tools to process logs - -* [Auth0 Logs Processor](https://www.npmjs.com/package/auth0-logs-processor) -* [GitHub Repo for the Auth0 Logs Processor](https://github.com/auth0/logs-processor) +Using the [Dashboard](${manage_url}/#/logs) or the [Management API logs endpoint](/api/v2#!/Logs/get_logs), you can pull log data on actions performed by administrators using the Dashboard, operations performed via the Management API, and authentications made by your users. + +::: warning +Auth0 does not provide real-time logs for your tenant. While we do our best to index events as they arrive, you may see some delays. +::: + +<%= include('../_includes/_topic-links', { links: [ + 'logs/streams', + 'logs/references/log-data-retention', + 'logs/guides/view-log-data-dashboard', + 'logs/references/log-event-filters', + 'logs/guides/retrieve-logs-mgmt-api', + 'logs/references/log-event-type-codes', + 'logs/references/query-syntax', + 'logs/concepts/logs-admins-devs' +] }) %> diff --git a/articles/logs/references/log-data-retention.md b/articles/logs/references/log-data-retention.md new file mode 100644 index 0000000000..4ea7b2c72d --- /dev/null +++ b/articles/logs/references/log-data-retention.md @@ -0,0 +1,58 @@ +--- +title: Log Data Retention +description: Describes how long log data is stored depending on your Auth0 plan. +topics: + - logs + - log-data +contentType: + - reference +useCase: + - manage-logs +--- +# Log Data Retention + +Auth0 provides event logging capability and you can scan logs to identify event anomalies. Standard log retention period for Auth0 logs is determined by subscription level with the shortest period being 2 days and the longest period being only 30 days. Leveraging Auth0 support for integrating with external logging services allows you to retain logs outside of this timeframe, and will also provide for log aggregation across your organization. + +To understand how you will use the Auth0 logs in your situation, review the log data retention period for your subscription level. + +Plan | Log Retention +-----|-------------- +Free | 2 days +Developer | 2 days +Developer Pro | 10 days +Enterprise | 30 days + +You can implement an Auth0 log data export extension to send log data to an external log analytics service. For example, you can use log files for troubleshooting and detecting intermittent errors that may be hard to find with quality assurance testing. You may also want log data in case forensic data is ever needed for security purposes. Log data can also provide comprehensive analytics to help you see patterns in usage trends and anomaly detection triggers. + +Auth0 extensions support following third-party services: + +- [Application Insights](/extensions/application-insight) +- [AWS Cloudwatch](/extensions/cloudwatch) +- [Azure Blob Storage](/extensions/azure-blob-storage) +- [Logentries](/extensions/logentries) +- [Loggly](/extensions/loggly) +- [Logstash](/extensions/logstash) +- [Mixpanel](/extensions/mixpanel) +- [Papertrail](/extensions/papertrail) +- [Sumo Logic](/extensions/sumologic) +- [Splunk](/extensions/splunk) + +You can also export logs to the following services using Auth0 Rules: + +* [Keen](/monitoring/guides/send-events-to-keenio) +* [Segment](/monitoring/guides/send-events-to-segment) +* [Splunk](/monitoring/guides/send-events-to-splunk) + +## Rate limits exceeded and other errors + +Auth0 provides a unique error code for errors reported when the [rate limit is exceeded](/policies/rate-limits#exceeding-the-rate-limit). You can set up automatic scanning of logs to check for rate limit errors so you can proactively address activity that hits rate limits before it causes too much trouble for your users. Auth0 also publishes error codes for other types of errors, and you can scan logs for [authentication errors](/libraries/error-messages) as well as errors from Auth0 Management API calls. (Management API error codes are shown below each call in the [Management API Explorer](/api/management/v2)). + +## Keep reading + +* [Administrator and Developer Log Usage Examples](/logs/concepts/logs-admins-devs) +* [View Log Data in the Dashboard](/logs/guides/view-log-data-dashboard) +* [Retrieve Logs Using the Management API](/logs/guides/retrieve-logs-mgmt-api) +* [Log Event Type Codes](/logs/references/log-event-type-codes) +* [Log Search Query Syntax](/logs/references/query-syntax) +* [Log Event Filters](/logs/references/log-event-filters) +* [Integrate AWS EventBridge with Auth0](/integrations/aws-eventbridge) \ No newline at end of file diff --git a/articles/logs/references/log-event-filters.md b/articles/logs/references/log-event-filters.md new file mode 100644 index 0000000000..6faa84fbf8 --- /dev/null +++ b/articles/logs/references/log-event-filters.md @@ -0,0 +1,148 @@ +--- +title: Log Event Filters +description: Lists the log filters for errors, warnings, and success events. +topics: + - logs + - log-data + - log-filter +contentType: + - reference +useCase: + - manage-logs + - filter-log-events +--- +# Log Event Filters + +You can filter logs for errors, warnings, and success events in the [Dashboard](${manage_url}/#/logs) when you click the **Filter** down arrow. + +## Error event filters + +| Filter | Description | +| -- | -- | +| Block Account | IP blocked for >10 failed attempts to login to single account | +| Blocked IP Address | IP blocked for >100 failed login attempts or >50 signup attempts | +| Breached password | Attempted login with a leaked password | +| Connector Offline | AD/LDAP Connector is offline | +| Device Confirmation Canceled by User | User did not confirm device | +| Error sending MFA Push Notification | Push notification for MFA failed | +| Error sending MFA SMS | SMS for MFA failed | +| Failed API Operation | Operation on API failed | +| Failed Change Email | Failed to change user email | +| Failed Change Password | Failed to change user password | +| Failed Change Password Request | Change password request failed | +| Failed Change Phone Number | Failed to change user phone number | +| Failed Change Username | Failed to change username | +| Failed Connector Provisioning | Failed to provision a AD/LDAP connector | +| Failed Delegation | Failed to generate delegation token | +| Failed Exchange | Token Exchange | +| Failed Exchange | Native Socal Login | +| Failed Exchange | Authorization Code for Access Token | +| Failed Exchange | Client Credentials for Access Token | +| Failed Exchange | Password for Access Token | +| Failed Exchange | Refresh Token for Access Token | +| Failed Exchange | Password and OOB Challenge for Access Token | +| Failed Exchange | Password and OTP Challenge for Access Token | +| Failed Exchange | Password and MFA Recovery code for Access Token | +| Failed Exchange | Device Code for Access Token | +| Failed Login | User failed to login | +| Failed Login (invalid email/username) | User failed to login due to invalid username | +| Failed Login (wrong password) | User failed to login due to invalid password | +| Failed Logout | User logout failed | +| Failed Post Change Password Hook | Post-change password hook failed | +| Failed Post User Registration Hook | Post user registration hook failed | +| Failed Sending Notification | Failed to send email notification | +| Failed Signup | Sign up failed | +| Failed Silent Auth | Silent authentication failed | +| Failed User Deletion | User deletion failed | +| Failed Verification Email | Failed to send verification email | +| Failed Verification Email Request | Failed to process verification email request | +| Failed CORS | Origin is not in the Allowed Origins list for the specified application | +| Failed by Connector | AD/LDAP Connector Failure | +| Failed cross origin authentication | Cross-origin authentication failed | +| Failed device activation | Failed to activate device | +| Failed device authorization request | Device authorization request failed | +| MFA Enrollment start failed | Multi-factor authentication enroll failed | +| OTP Auth failed | One-time password authentication failed | +| OTP Auth rejected | One-time password authentication rejected | +| Rate Limit on API | Maximum number of requests to the Authentication API in given time has been reached | +| Recovery failed | Multi-factor recovery code failed | +| Second factor email failed | Email for MFA failed | +| Too Many Calls to /delegation | Rate limt exceeded to /delegation endpoint | +| Too Many Calls to /userinfo | Rate limit exceeded to /userinfo endpoint | +| Too Many Invalid Device Codes | Rate limit exceeded for invalid device codes | + +## Warning event filters + +| Filter | Description | +| -- | -- | +| Deprecation Notice | Feature is deprecated | +| Too many failures | Multi-factor OTP has failed too many times | +| Too many failures | Mutli-factor recovery code has failed too many times | +| Users import | Failed to import users | +| Warning During Login | Warnings during login | + +## Success event filters + +| Filter | Description | +| -- | -- | +| API Operation | API operation completed successfully | +| Account unblocked | User block setup by anomay detection has been released | +| Auth0 OS Update Ended | Auth0 OS update ended | +| Auth0 OS Update Started | Auth0 OS update started | +| Auth0 Update Ended | Auth0 update ended | +| Auth0 Update Launched | New version of Auth0 released | +| Auth0 Update Started | Auth0 update started | +| Code Sent | Passwordess login code has been sent | +| Code/Link Sent | Passwordless lgoin code/link has been sent | +| Configuration read | PSaaS configuration has been read | +| Configuration status checked | PSaaS configuration's status has been checked | +| Configuration updated | PSaaS configuration has been updated | +| Connector Online | AD/LDAP Connector is online and working | +| Enroll started | Multi-factor authentication enroll has started | +| MFA enrollment complete | Multi-factor authentication enroll has completed | +| MFA settings update | Mutli-factor tenant settings updated | +| Module switch | Multi-factor module switched | +| OTP Auth Succeed | One-time password authentication success | +| Push notification sent | Push notification for MFA successfully sent | +| Recovery succeed | Multi-factor recovery code succeeded authorization | +| SMS Sent | SMS for MFA sent successfully sent | +| Second factor email sent | Email for MFA successfully sent | +| Second factor started | Second factor authentication event started for MFA | +| Success Change Email | Email changed successfully | +| Success Change Password | Password changed successfully | +| Success Change Password Request | Change password request succeeded | +| Success Change Phone Number | Phone number changed successfully | +| Success Change Username | Username changed successfully | +| Success Delegation | Delegation token generated successfully | +| Success Exchange | Authorization Code for Access Token | +| Success Exchange | Client Credentials for Access Token | +| Success Exchange | Password for Access Token | +| Success Exchange | Refresh Token for Access Token | +| Success Exchange | Token Exchange | +| Success Exchange | Native Social Login | +| Success Exchange | Password and OOB Challenge for Access Token | +| Success Exchange | Password and OTP Challenge for Access Token | +| Success Exchange | Password and MFA Recovery code for Access Token | +| Success Exchange | Device Code for Access Token | +| Success Login | Successful Login | +| Success Logout | User successfully logged out | +| Success Post Change Password Hook | Post-change password hook ran successfully | +| Success Signup | Successful signup | +| Success Silent Auth | Successful silent authentication | +| Success Verification Email | Successful verification email | +| Success Verification Email Request | Successful verification email request | +| Success cross origin authentication | Successful cross-origin authentication | +| Successful User Deletion | User successfully deleted | +| Unenroll device account | Device used for second factor authentication has been unenrolled | +| Update device account | Device used for second factor authentication has been updated | +| User delete | Deleted multi-factor user account | +| Users import | Successfully imported users | + +## Keep reading + +* [Administrator and Developer Log Usage Examples](/logs/concepts/logs-admins-devs) +* [View Log Data in the Dashboard](/logs/guides/view-log-data-dashboard) +* [Retrieve Logs Using the Management API](/logs/guides/retrieve-logs-mgmt-api) +* [Log Event Type Codes](/logs/references/log-event-type-codes) +* [Log Search Query Syntax](/logs/references/query-syntax) +* [Integrate AWS EventBridge with Auth0](/integrations/aws-eventbridge) \ No newline at end of file diff --git a/articles/logs/references/log-event-type-codes.md b/articles/logs/references/log-event-type-codes.md new file mode 100644 index 0000000000..e7496892b8 --- /dev/null +++ b/articles/logs/references/log-event-type-codes.md @@ -0,0 +1,132 @@ +--- +title: Log Event Type Codes +description: Lists the event codes associated with log events. +topics: + - logs + - log-data +contentType: + - reference +useCase: + - manage-logs +--- +# Log Event Type Codes + +The following table lists the codes associated with the each log event. + +| **Event Code** | **Event** | **Event Description** | **Additional Info** | +| --- | --- | --- | --- | +| `api_limit` | Rate Limit on the Authentication API | The maximum number of requests to the Authentication API in given time has reached. | [Rate Limit Policy](/policies/rate-limits) | +| `cls` | Code/Link Sent | Passwordless login code/link has been sent | [Passwordless](/connections/passwordless) | +| `coff` | Connector Offline | AD/LDAP Connector is offline | [Active Directory/LDAP Connector](/connector) | +| `con` | Connector Online | AD/LDAP Connector is online and working | [Active Directory/LDAP Connector](/connector) | +| `cs` | Code Sent | Passwordless login code has been sent | [Passwordless](/connections/passwordless) | +| `depnote` | Deprecation Notice | | | +| `du` | Deleted User | User has been deleted. | [User Profile](/users/concepts/overview-user-profile) | +| `f` | Failed Login | | | +| `fc` | Failed by Connector | | [Active Directory/LDAP Connector](/connector) | +| `fce` | Failed Change Email | Failed to change user email | [User Profile](/users/concepts/overview-user-profile) | +| `fco` | Failed by CORS | Origin is not in the Allowed Origins list for the specified application | [Applications](/dashboard/reference/settings-application) | +| `fcoa` | Failed cross-origin authentication | | | +| `fcp` | Failed Change Password | | [Changing a User's Password](/connections/database/password-change) | +| `fcph` | Failed Post Change Password Hook | | | +| `fcpn` | Failed Change Phone Number | | [User Profile](/users/concepts/overview-user-profile) | +| `fcpr` | Failed Change Password Request | | [Changing a User's Password](/connections/database/password-change) | +| `fcpro` | Failed Connector Provisioning | Failed to provision a AD/LDAP connector | [Active Directory/LDAP Connector](/connector) | +| `fcu` | Failed Change Username | Failed to change username | [User Profile](/users/concepts/overview-user-profile) | +| `fd` | Failed Delegation | Failed to generate delegation token | [Delegation Tokens](/tokens/delegation) | +| `fdeac` | Failed Device Activation | Failed to activate device. | [Device Authorization Flow](/flows/concepts/device-auth) | +| `fdeaz` | Failed Device Authorization Request | Device authorization request failed. | [Device Authorization Flow](/flows/concepts/device-auth) | +| `fdecc` | User Canceled Device Confirmation | User did not confirm device. | [Device Authorization Flow](/flows/concepts/device-auth) | +| `fdu` | Failed User Deletion | | [User Profile](/users/concepts/overview-user-profile) | +| `feacft` | Failed Exchange | Failed to exchange authorization code for Access Token | [Call API Using the Authorization Code Flow](/flows/guides/auth-code/call-api-auth-code) +| `feccft` | Failed Exchange | Failed exchange of Access Token for a Client Credentials Grant | [Asking for Access Tokens for a Client Credentials Grant](/api-auth/config/asking-for-access-tokens) | +| `fede` | Failed Exchange | Failed to exchange Device Code for Access Token | [Device Authorization Flow](/flows/concepts/device-auth) | +| `fens` | Failed Exchange | Failed exchange for Native Social Login | | +| `feoobft` | Failed Exchange | Failed exchange of Password and OOB Challenge for Access Token | | +| `feotpft` | Failed Exchange | Failed exchange of Password and OTP Challenge for Access Token | | +| `fepft` | Failed Exchange | Failed exchange of Password for Access Token | | +| `fercft` | Failed Exchange | Failed Exchange of Password and MFA Recovery code for Access Token | | +| `fertft` | Failed Exchange | Failed Exchange of Refresh Token for Access Token | | +| `ferrt` | Failed Exchange | Failed Exchange of Rotating Refresh Token | | +| `flo` | Failed Logout | User logout failed | [Logout](/logout) | +| `fn` | Failed Sending Notification | Failed to send email notification | [Emails](/email) | +| `fp` | Failed Login (Incorrect Password) | | | +| `fs` | Failed Signup | | | +| `fsa` | Failed Silent Auth | | | +| `fu` | Failed Login (Invalid Email/Username) | | | +| `fui` | Failed users import | Failed to import users | [User Import/Export](/extensions/user-import-export) | +| `fv` | Failed Verification Email | Failed to send verification email | [Verification Email](/email/custom#verification-email) | +| `fvr` | Failed Verification Email Request | Failed to process verification email request | [Verification Email](/email/custom#verification-email) | +| `gd_auth_failed` | MFA Auth failed | Multi-factor authentication failed. This could happen due to a wrong code entered for SMS/Voice/Email/TOTP factors, or a system failure. | [Multi-factor Authentication](/mfa) | +| `gd_auth_rejected` | MFA Auth rejected | A user rejected a Multi-factor authentication request via push-notification. | [Multi-factor Authentication](/mfa) | +| `gd_auth_succeed` | MFA Auth success | Multi-factor authentication success. | [Multi-factor Authentication](/mfa) | +| `gd_enrollment_complete` | MFA enrollment complete | A first time MFA user has successfully enrolled using one of the factors.| | +| `gd_otp_rate_limit_exceed` | Too many failures | A user, during enrollment or authentication, enters an incorrect code more than the maximum allowed number of times. Ex: A user enrolling in SMS enters the 6-digit code wrong more than 10 times in a row.| | +| `gd_recovery_failed` | Recovery failed | A user enters a wrong recovery code when attempting to authenticate. | [Multi-factor Authentication](/mfa) | +| `gd_recovery_rate_limit_exceed` | Too many failures | A user enters a wrong recovery code too many times. | [Multi-factor Authentication](/mfa) | +| `gd_recovery_succeed` | Recovery success | A user successfully authenticates with a recovery code. | [Multi-factor Authentication](/mfa) | +| `gd_send_pn` | Push notification sent | Push notification for MFA sent successfully sent. | [MFA with Push Notifications](/mfa/concepts/mfa-factors#push-notifications) | +| `gd_send_sms` | SMS sent | SMS for MFA successfully sent. | [Using SMS for MFA](/mfa/concepts/mfa-factors#sms-notifications) | +| `gd_send_sms_failure` | SMS sent failures | Attempt to send SMS for MFA failed. | [Using SMS for MFA](/mfa/concepts/mfa-factors#sms-notifications) | +| `gd_send_voice` | Voice call made | Voice call for MFA successfully made. | [Using Voice for MFA](/mfa/concepts/mfa-factors#voice-notifications) | +| `gd_send_voice_failure` | Voice call failure | Attempt to make Voice call for MFA failed. | [Using Voice for MFA](/mfa/concepts/mfa-factors#voice-notifications) | +| `gd_start_auth` | Second factor started | Second factor authentication event started for MFA. | [Multi-factor Authentication](/mfa) | +| `gd_start_enroll` | Enroll started | Multi-factor authentication enroll has started. | [Multi-factor Authentication](/mfa) | +| `gd_tenant_update` | Guardian tenant update | | [Hosted MFA Page](/universal-login/multifactor-authentication) | +| `gd_unenroll` | Unenroll device account | Device used for second factor authentication has been unenrolled. | [Multi-factor Authentication](/mfa) | +| `gd_update_device_account` | Update device account | Device used for second factor authentication has been updated. | [Multi-factor Authentication](/mfa) | +| `limit_delegation` | Too Many Calls to /delegation | Rate limit exceeded to `/delegation` endpoint | [API Rate Limit Policy](/policies/rate-limits) | +| `limit_mu` | Blocked IP Address | An IP address is blocked with 100 failed login attempts using different usernames, all with incorrect passwords in 24 hours, or 50 sign-up attempts per minute from the same IP address. | [Anomaly Detection](/anomaly-detection) | +| `limit_wc` | Blocked Account | An IP address is blocked with 10 failed login attempts into a single account from the same IP address. | [Anomaly Detection](/anomaly-detection) | +| `mfar` | MFA Required | A user has been prompted for multi-factor authentication. In the case of Adaptive MFA, details regarding the risk assessment are included. | Available in only [Resource Owner Password Flow](/flows/resource-owner-password-flow). | +| `pwd_leak` | Breached password | Someone behind the IP address: `ip` attempted to login with a leaked password. | [Anomaly Detection](/anomaly-detection) | +| `s` | Success Login | Successful login event. | | +| `sapi` | Success API Operation | | | +| `sce` | Success Change Email | | [Emails in Auth0](/email) | +| `scoa` | Success cross-origin authentication | | | +| `scp` | Success Change Password | | | +| `scph` | Success Post Change Password Hook | | | +| `scpn` | Success Change Phone Number | | | +| `scpr` | Success Change Password Request | | | +| `scu` | Success Change Username | | | +| `sd` | Success Delegation | | [Delegation Tokens](/tokens/delegation) | +| `sdu` | Success User Deletion | User successfully deleted | [User Profile](/users/concepts/overview-user-profile) | +| `seacft` | Success Exchange | Successful exchange of authorization code for Access Token | [Call API Using the Authorization Code Flow](/flows/guides/auth-code/call-api-auth-code) | +| `seccft` | Success Exchange | Successful exchange of Access Token for a Client Credentials Grant | [Asking for Access Tokens for a Client Credentials Grant](/api-auth/config/asking-for-access-tokens) | +| `sede` | Success Exchange | Successful exchange of device code for Access Token | [Device Authorization Flow](/flows/concepts/device-auth) | +| `sens` | Success Exchange | Native Social Login | | +| `seoobft` | Success Exchange | Successful exchange of Password and OOB Challenge for Access Token | | +| `seotpft` | Success Exchange | Successful exchange of Password and OTP Challenge for Access Token | | +| `sepft` | Success Exchange | Successful exchange of Password for Access Token | | +| `sercft` | Success Exchange | Successful exchange of Password and MFA Recovery code for Access Token | | +| `sertft` | Success Exchange | Successful exchange of Refresh Token for Access Token | | +| `slo` | Success Logout | User successfully logged out | [Logout](/logout) | +| `ss` | Success Signup | | | +| `ssa` | Success Silent Auth | | | +| `sui` | Success users import | Successfully imported users | [User Import/Export](/extensions/user-import-export) | +| `sv` | Success Verification Email | | | +| `svr` | Success Verification Email Request | | | +| `ublkdu` | User login block released | User block setup by anomaly detection has been released | | +| `w` | Warnings During Login | | | + +# Managed Private Cloud Only + +These events are only generated in the [Managed Private Cloud](https://auth0.com/docs/private-cloud/managed-private-cloud) deployment model of Auth0. + +| **Event Code** | **Event** | **Event Description** | **Additional Info** | +| --- | --- | --- | --- | +| `admin_update_launch` | Auth0 Update Launched | | +| `sys_os_update_end` | Auth0 OS Update Ended | | | +| `sys_os_update_start` | Auth0 OS Update Started | | | +| `sys_update_end` | Auth0 Update Ended | | | +| `sys_update_start` | Auth0 Update Started | | | + +## Keep reading + +* [Administrator and Developer Log Usage Examples](/logs/concepts/logs-admins-devs) +* [View Log Data in the Dashboard](/logs/guides/view-log-data-dashboard) +* [Retrieve Logs Using the Management API](/logs/guides/retrieve-logs-mgmt-api) +* [Anomaly Detection](/anomaly-detection) +* [Log Search Query Syntax](/logs/references/query-syntax) +* [Log Event Filters](/logs/references/log-event-filters) +* [Integrate AWS EventBridge with Auth0](/integrations/aws-eventbridge) diff --git a/articles/logs/references/query-syntax.md b/articles/logs/references/query-syntax.md new file mode 100644 index 0000000000..c8d5bfe1cb --- /dev/null +++ b/articles/logs/references/query-syntax.md @@ -0,0 +1,129 @@ +--- +title: Log Search Query Syntax +description: Describes search query syntax using a subset of the Lucene query syntax to refine Auth0 log searches. +toc: true +topics: + - logs + - log-management + - search + - query-syntax +contentType: + - reference +useCase: + - manage-logs +--- +# Log Search Query Syntax + +When searching for logs, you can create queries using a subset of [Lucene query syntax](http://www.lucenetutorial.com/lucene-query-syntax.html) to refine your search. + +The query string is parsed into a series of terms and operators: + +* A term can be a single word such as `jane` or `smith`. +* A term can be a phrase surrounded by double quotes (`"customer log"`), which will match all words in the phrase in the same order. +* A term without a field name will only match [these selected fields](/logs/query-syntax#fields-searchable-against-bare-terms) fields. +* Multiple terms can be grouped together with parentheses to form sub-queries. +* All search fields are case sensitive. +* Operators (`AND`, `OR`, `NOT`) work on all searchable fields. + +## Searchable fields + +The following list of fields are searchable and case sensitive: + +* `log_id`: the id of the log event +* `date`: The moment when the event occurred. +* `connection`: The connection name related to the event. +* `connection_id`: The connection id related to the event. +* `client_id`: The client id related to the event +* `client_name`: The name of the client related to the event. +* `ip`: The IP address from where the request that caused the log entry originated. +* `user_id`: The user id related to the event. +* `user_name`: The user name related to the event. +* `description`: The description of the event. +* `user_agent`: The user agent that is related to the event. +* `type`: One of the [possible event types](/logs#log-data-event-listing). +* `strategy`: The connection strategy related to the event. +* `strategy_type`: The connection strategy type related to the event. +* `hostname`: the hostname that is being used for the authentication flow. + +## Fields searchable against bare terms + +If a search term is entered without a field name, it will only be searched against the following fields: + +* `user_name` +* `connection` +* `client_name` +* `type` +* `ip` +* `log_id` +* `description` + +## Exact matching + +To find exact matches, use double quotes: `description:"Username invalid"`. + +For example, to find logs with the description `Username invalid`, use `q=description:"Username invalid"`: + +## Wildcards + +Wildcard searches can be run on terms using the asterisk character (`*`) to replace zero or more characters: `user_name:john*`. They can be used for prefix matching, for example `user_name:j*`. For other uses of wildcards (e.g. suffix matching), literals must have 3 characters or more. For example, `name:*usa` is allowed, but `name:*sa` is not. + +The question mark character (`?`), is currently not supported. + +For example, to find all logs for users whose usernames start with `john`, use `q=user_name:john*`: + +## Ranges + +You can use ranges in your log search queries. For inclusive ranges use square brackets: `[min TO max]`, and for exclusive ranges use curly brackets: `{min TO max}`. + +Curly and square brackets can be combined in the same range expression. You can also use wildcards within ranges. + +As an example, to find all logs from December 18, 2018 until the present, use `q=date:[2018-12-18 TO *]`. +If you'd like to search logs from the beginning of your retention period until, but not including, December 19, 2018, use `q=date:[* TO 2018-12-19}`. + +## Example queries + +Below are some examples to show the kinds of queries you can make with the Management API. + +Use Case | Query +---------|------ +Search all logs with connections that contains "Pass" | `connection:*pass*` +Search all logs for users with a user name that contains "fred" | `user_name:*fred*` +Search all logs with user id's matching exactly "123" | `user_id:"123"` +Search for all logs with a type starting with "s" | `type:s*` +Search for user names that start with "jane" and end with "smith" | `user_name:jane*smith` +Search for all logs in December 2018 | `date:[2018-12 TO 2018-01-01}` +Search for all logs from December 10, 2018 forward | `date:[2018-12-10 TO *]` +Search for all logs from January 1, 2019 at 1AM, until, but not including January 1, 2019 at 12:23:45 | `date:[2019-01-01T01:00:00 TO 2019-01-01T12:23:45}` + +## Limitations + +* If you get the error `414 Request-URI Too Large` this means that your query string is larger than the supported length. In this case, refine your search. +* Log fields are not tokenized , so `description:rule` will not match a description with value `Create a rule` nor `Update a rule`. Instead, use `description:*rule`. See [wildcards](#wildcards) and [exact matching](#exact-matching). +* The `.raw` field extension is not supported. Fields match the whole value that is provided and are not tokenized. +* To search for a specific value nested in the `details` field, use the path to the field (i.e., `details.request.channel:"https://manage.auth0.com/"`). Bare searches like `details:"https://manage.auth0.com/"` do not work. + +## Pagination + +When calling the [GET /api/v2/logs](/api/v2#!/Logs/get_logs) or [GET /api/v2/users/{user_id}/logs](/api/v2#!/Users/get_logs_by_user) endpoints using the `include_totals` parameter, the result is a JSON object containing a summary of the results **and** the requested logs. The JSON object looks something like: + +```js +{ + "length": 5, + "limit": 5, + "logs": [...], + "start": 0, + "total": 5 +} +``` + +When searching for logs, the `totals` field tells you how many logs are returned in the page (similar to what the `length` field returns). + +## Keep reading + +* [Administrator and Developer Log Usage Examples](/logs/concepts/logs-admins-devs) +* [View Log Data in the Dashboard](/logs/guides/view-log-data-dashboard) +* [Retrieve Logs Using the Management API](/logs/guides/retrieve-logs-mgmt-api) +* [View Anomaly Detection Events](/anomaly-detection/guides/use-tenant-data-for-anomaly-detection) +* [Log Event Type Codes](/logs/references/log-event-type-codes) +* [Log Event Filters](/logs/references/log-event-filters) +* [Integrate AWS EventBridge with Auth0](/integrations/aws-eventbridge) \ No newline at end of file diff --git a/articles/logs/streams/amazon-eventbridge.md b/articles/logs/streams/amazon-eventbridge.md new file mode 100644 index 0000000000..7c9aa10283 --- /dev/null +++ b/articles/logs/streams/amazon-eventbridge.md @@ -0,0 +1,86 @@ +--- +title: Amazon EventBridge Log Streams +description: Learn how to create an event-driven workflow using Amazon EventBridge to send your tenant logs to the targets of your choice, such as AWS EC2 instances, Lambda functions, Kinesis streams, and ECS tasks. +toc: true +topics: + - integrations + - logs + - streams + - event-streams + - aws + - eventbridge + - amazon +contentType: how-to +--- +# Amazon EventBridge Log Streams + +Amazon EventBridge is a serverless event bus that acts as an intermediary allowing you to send data from your applications to AWS services. You can create an event-driven workflow using EventBridge to send your Auth0 tenant logs to the targets of your choice (e.g., AWS EC2 instances, Lambda functions, Kinesis streams, and ECS tasks). + +## Steps + +To send Auth0 events to Amazon EventBridge, you will need to: + +1. Set up a partner event source (in this case, this is Auth0) +2. Set up a partner event bus that matches incoming events with the routes to which they should be targeted +3. Set up rules to route incoming events to your choice of AWS service +4. Test the integration + +You can send events from Auth0 to AWS once you have [matched your partner event source to the partner event bus](https://docs.aws.amazon.com/eventbridge/latest/userguide/create-partner-event-bus.html). + +### Set up Auth0 as the partner event source + +First, you will need to set up Auth0 for use as the event source in the [Dashboard](${manage_url}). + +1. Log in to the [Auth0 Dashboard](${manage_url}). + +2. Navigate to **Logs > Streams**. + +3. Click **+ Create Stream**. + +4. Select **Amazon EventBridge**, and enter a unique name for your new Amazon EventBridge Event Stream. + +5. Create the Event Source by providing your **AWS Account ID** and **AWS Region**. Note that the region you select must match the region in which your Amazon EventBridge resides. + +6. Click **Save**. Auth0 provides you with an **Event Source Name**. Make sure to save your **Event Source Name** value because you will be providing it to AWS at a later point to complete the integration. + +### Set up event bus in AWS + +1. Go to the [Amazon EventBridge partners tab](https://console.aws.amazon.com/events/home?region=us-east-1#/partners) in your AWS account, and make sure you are in the **AWS Region** where the event source was created. + +2. Paste the **Event Source Name** in the event source search box to find the newly-created Event Source, and click on it to associate it with an Event Bus. +**Note**: The Event Source will remain in pending state until it gets associated with an Event Bus, and all the events sent to that Event Source will be dropped. + +3. Once you click on the Event Source, click **Associate with Event Bus**. + +4. Name the Event Bus the same name as the Event Source. At this point, you can specify permissions for this Event Bus or simply associate it. + +### Create EventBridge rules + +At this point, the events that you send are available on your Event Bus. However, before you can use the data you send to AWS services, you must [create rules](https://docs.aws.amazon.com/eventbridge/latest/userguide/create-event-bus.html) that map those events to specific targets. + +Amazon EventBridge uses rules, which are definitions specifying how you want incoming events routed to the desired targets. Targets are the services, such as EC2 instances, Lambda functions, Kinesis streams, or ECS tasks, that process the event-driven data that they receive. Data received by targets are JSON-formatted. + +A single rule can route to one or more targets (if there are more than one, AWS processes all in parallel). + +To create a rule: + +1. Go to the [EventBridge page](https://console.aws.amazon.com/events/home?region=us-east-1#/), and click **Create rule**. + +2. Provide the name of the Event Bus, and specify your targets. + +### Test integration + +As soon as Auth0 writes the next tenant log, you should see a copy of the log Auth0 has written in JSON format at the target you defined in your EventBridge rule. + +## Delivery attempts and retries + +Auth0 events are delivered to AWS via a streaming mechanism that sends each event as it is triggered in our system. If EventBridge is unable to receive the event, we will retry up to three times to deliver the event; otherwise, we will log the failure, and you will see the failure in the **Health** tab for your log stream. + +## More on Log Streams + +::: next-steps +* [HTTP Event Log Streams](/logs/streams/http-event) +* [Example: Stream Auth0 Log Events to Slack](/logs/streams/http-event-to-slack) +* [Datadog Event Log Streams](/logs/streams/datadog) +* [Azure Event Grid Log Streams](/logs/streams/azure-event-grid) +::: diff --git a/articles/logs/streams/azure-event-grid.md b/articles/logs/streams/azure-event-grid.md new file mode 100644 index 0000000000..ae1f8b63aa --- /dev/null +++ b/articles/logs/streams/azure-event-grid.md @@ -0,0 +1,113 @@ +--- +title: Azure Event Grid Log Streams +description: Learn how to create an event-driven workflow using Azure Event Grid and send your tenant logs anywhere within the Azure ecosystem. +toc: false +topics: + - logs + - streams + - event-streams +contentType: how-to +--- + +# Integrate Azure Event Grid with Auth0 + +Azure Event Grid is a serverless event bus that lets you send event data from any source to any destination. + +You can create event-driven workflows using Event Grid to send your Auth0 tenant logs to targets, such as Azure Functions, Event Hubs, Sentinel, and Logic Apps. + +For a full list of the event type codes that Auth0 supports, see [Log Event Type Codes](/logs/references/log-event-type-codes). + +## Send events from Auth0 to Azure Event Grid + +To send Auth0 events to Azure, you must: + +1. Enable the Event Grid resource provider. +2. Set up an event source (in this case, this is Auth0). +3. Set up an event handler, which is the app or service where the event will be sent. + +To learn more, see [Microsoft's Concepts in Azure Event Grid](https://docs.microsoft.com/en-us/azure/event-grid/concepts). + +### Enable Event Grid resource provider + +If you haven’t previously used Event Grid, you will need to register the Event Grid resource provider. If you've used Event Grid before, skip to the next section. + +In your Azure portal: + +1. Select Subscriptions. +2. Select the subscription you’re using for Event Grid. +3. On the left menu, under **Settings**, select Resource providers. +4. Find `Microsoft.EventGrid`. +5. Select **Register**. +6. Refresh to make sure the status changes to `Registered`. + +### Set up an Auth0 event source + +Use the Auth0 Dashboard to set up Auth0 for use as an event source. + +1. Log in to the [Auth0 Dashboard](${manage_url}). +2. Navigate to **Logs > Streams**. +3. Click **+ Create Stream**. +4. Select **Azure Event Grid**, and enter a unique name for your new stream. +5. On the next screen, provide the following settings for your Event Grid stream: + +| Setting | Description | +|---------|-------------| +| Name | A unique display name to distinguish this integration from other integrations. | +| Azure Subscription ID | The unique alphanumeric string that identifies your Azure subscription. | +| Azure Region | The region in which your Azure subscription is hosted. | +| Resource Group name | The name of the Azure resource group, which allows you to manage all Azure assets within one subscription. | + +6. Click **Save**. + +#### Activate your Auth0 Partner Topic in Azure + +Activating the Auth0 topic in Azure allows events to flow from Auth0 to Azure. + +1. Log in to the [Azure Portal](https://portal.azure.com/). +2. Search `Partner Topics` at the top, and click `Event Grid Partner Topics` under services. +3. Click on the topic that matches the stream you created in your Auth0 Dashboard. +4. Confirm that the `Source` field matches your Auth0 account. +5. Click **Activate**. + +#### Subscribe to your Partner Topic + +Subscribe to an Event Grid partner topic to tell Event Grid which events to send to your event handler. + +1. On the Event Grid partner topic Overview page, select **+ Event Subscription** on the toolbar. +2. On the Create Event Subscription page: + 1. Enter a name for the event subscription. + 2. Select your desired Azure service or WebHook for the Endpoint type. + 3. Follow the instructions for the particular service. + 4. Back on the Create Event Subscription page, select Create. + +To send events to your topic, please follow the instructions in this article. + +### Set up an event handler + +Go to your Azure subscription and spin up a service that is supported as an event handler. For a full list of supported event handlers, see [Microsoft's Event Handlers in Azure Event Grid](https://docs.microsoft.com/en-us/azure/event-grid/event-handlers). + +## Testing + +At this point, your Event Grid workflow should be complete. + +### Verify the integration + +To verify that the integration is working as expected: + +1. Log in to the [Auth0 Dashboard](${manage_url}). +2. Navigate to **Logs > Streams**. +3. Click on your Event Grid stream. +4. Once on the stream, click the **Health** tab. The stream should be active and as long as you don't see any errors, the stream is working. + +## Delivery attempts and retries + +Auth0 events are delivered to your server via a streaming mechanism that sends each event as it is triggered. If your server is unable to receive the event, Auth0 will try to redeliver it up to three times. If still unsuccessful, Auth0 will log the failure to deliver, and you will be able see these failures in the Health tab for your log stream. + +## More on Log Streams + +::: next-steps +* [HTTP Event Log Streams](/logs/streams/http-event) +* [Example: Stream Auth0 Log Events to Slack](/logs/streams/http-event-to-slack) +* [Amazon EventBridge Log Streams](/logs/streams/amazon-eventbridge) +* [Datadog Event Log Streams](/logs/streams/datadog) +::: diff --git a/articles/logs/streams/datadog.md b/articles/logs/streams/datadog.md new file mode 100644 index 0000000000..6cac684506 --- /dev/null +++ b/articles/logs/streams/datadog.md @@ -0,0 +1,96 @@ +--- +title: Datadog Log Streams +description: Learn how to export your log events in near real-time to Datadog. +toc: false +topics: + - logs + - streams + - event-streams +contentType: how-to +--- + +# Datadog Log Streams + +Datadog is a monitoring platform for cloud applications. It brings together data from servers, containers, databases, and third-party services to make your stack entirely observable. You can use it to create monitoring, alerting, and analysis dashboards for Auth0 tenants. + +## Prerequisites + +To send Auth0 events to Datadog, you will need: + +* a `Log Management` plan with Datadog. See [Datadog plans](https://www.datadoghq.com/pricing/). +* a Datadog API Key. See below. +* your Datadog dashboard region. + +## Steps + +To send Auth0 events to Datadog, you will need to: + +1. Copy your API Key from Datadog +2. Set up an Event Stream in Auth0 + +### Copy API Key from Datadog + +1. Log in to the Datadog dashboard. +2. Navigate to **Integrations** > **APIs**. +![Integrations Dashboard](/media/articles/logs/datadog/tutorial-1.png) +3. Expand the API Keys section, and copy the API Key that you would like to use. +![API Keys Section](/media/articles/logs/datadog/tutorial-2.png) + +### Set up Event Stream in Auth0 + +1. Log in to the [Auth0 Dashboard](${manage_url}). +2. Navigate to **Logs > Streams**. +3. Click **+ Create Stream**. +4. Select **Datadog**, and enter a unique name for your new Datadog Event Stream. +5. On the next screen, provide the following settings for your Datadog Event Stream: + +| Setting | Description | +|---------|-------------| +| API Key | The Datadog API key you copied from the Datadog dashboard. | +| Region | If you are in the Datadog EU site (app.datadoghq.eu), the `Region` should be `EU`; otherwise, it should be `US`. | + +![Datadog Settings Form](/media/articles/logs/datadog/tutorial-3.png) + +6. Click **Save**. +7. You're done! When Auth0 writes the next log event, you'll receive a copy of that log event in Datadog with the `source` and `service` set to `auth0`. + +### View logs in Datadog + +1. Navigate to **Logs** > **Livetail**. +2. See Auth0 logs by setting the `source` to `auth0`. +![Datadog Logs Dashboard](/media/articles/logs/datadog/tutorial-4.png) + +## Delivery attempts and retries + +Auth0 events are delivered to your server via a streaming mechanism that sends each event as it is triggered. If your server is unable to receive the event, Auth0 will retry delivering it up to three times. If still unsuccessful, Auth0 will log the failure, and you will see these failure in the **Health** tab for your log stream. + +## Enhancement to log data + +One of the unique values of Datadog as a monitoring tool, specifically when it comes to integrations, is the data enhancement they provide to ensure customers can rely on receiving specific data fields regardless of the system with which they are integrating. As part of this Auth0 Log Streaming integration, Datadog has enhanced our data. The following new fields can be found in our logs when using the Log Streaming integration with Datadog: + +| Fields | Auth0 attribute | +|---------|-------------| +| Official Log date | `data.date` | +| `network.client.ip` | `data.ip` | +| `network.client.geoip` | `data.ip` (parsed) | +| `http.useragent` | `data.user_agent` | +| `http.useragent_details` | `data.user_agent` (parsed) | +| `usr.id` | `data.user_name` | +| `usr.name` | `data.user_name` | +| `usr.email` | `data.details.request.auth.user.email` (when available) | +| `data.type` | `evt.name` | +| `message` | Event description (For a list of descriptions, see [Log Event Type Codes](/logs/references/log-event-type-codes).) | + +To learn more about Datadog transformations, see: + +* For US: [Datadog US Log Pipelines](https://app.datadoghq.com/logs/pipelines) +* For EU: [Datadog EU Log Pipelines](https://app.datadoghq.EU/logs/pipelines) + +## More on Log Streams + +::: next-steps +* [HTTP Event Log Streams](/logs/streams/http-event) +* [Example: Stream Auth0 Log Events to Slack](/logs/streams/http-event-to-slack) +* [Amazon EventBridge Log Streams](/logs/streams/amazon-eventbridge) +* [Azure Event Grid Log Streams](/logs/streams/azure-event-grid) +::: diff --git a/articles/logs/streams/http-event-to-slack.md b/articles/logs/streams/http-event-to-slack.md new file mode 100644 index 0000000000..2b245b2d37 --- /dev/null +++ b/articles/logs/streams/http-event-to-slack.md @@ -0,0 +1,188 @@ +--- +title: Stream Auth0 Log Events to Slack +description: Use the HTTP Event Log Streams to send failed events to Slack. +toc: false +topics: + - logs + - streams + - event-streams + - http-event + - Slack +contentType: how-to +--- + +# Send Auth0 Failed Log Events to Slack + +This guide explains how to use [Auth0 Log Streaming](/logs/streams) to send specific logged events to Slack. The events sent in this guide include all failures (e.g., logins, signups, token exchange) and limits (e.g., rate limits, anomaly detection). + +Using this guide, you will build the following: + +![Stream Auth0 Log Events to Slack](/media/articles/logs/log-stream-to-slack-diagram.png) + +1. Application 1 and 2 both redirect to Auth0 to log in +2. The login for Application 2 succeeds, but the login for Application 1 fails; both events create a distinct log record +3. Both applications receive a response from Auth0 +4. These log events are sent together in a JSON payload to the custom webhook +5. The webhook filters out the successful event +6. The webhook sends the failed event to Slack + +To learn how to adjust the filter used here for different scenarios, see our [Log Event Type Codes](/logs/references/log-event-type-codes) reference. + +## What is Slack + +Slack is a business communication platform that can be extended using custom applications. Many companies, including Auth0, use Slack for general team communication as well as a notification platform. + +## Get started with Slack + +Go to [Slack API Applications](https://api.slack.com/apps), and log in to your Slack account. Follow instructions in the [Incoming Webhooks for Slack](https://slack.com/help/articles/115005265063-Incoming-Webhooks-for-Slack) guide to create a Slack endpoint that will accept the failed log events. Make sure to leave your browser tab open or copy the URL provided as you'll need that later in this guide. + +## Deploy the webhook + +You'll build a simple Express API that provides a single `/api/logs` route accepting POST requests. When any log event happens, it will be sent to this endpoint. If the request is formatted properly, the log events for failures will be parsed and sent to Slack. + + Start with a simple Express application: + +```js +// app.js +require("dotenv").config(); + +const express = require("express"); +const http = require("http"); + +const app = express(); +app.use(express.json()); + +app.post("/api/logs", require("./api/logs")); + +const port = process.env.PORT || 3000; +http.createServer(app).listen(port, () => { + console.log(`Listening on port <%= "${port}" %>`); +}); +``` + +Then add the endpoint middleware: + +```js +// api/logs/index.js +const got = require("got"); + +module.exports = async (req, res, next) => { + const { body, headers } = req; + + if (!body || !Array.isArray(body)) { + return res.sendStatus(400); + } + + if (headers.authorization !== process.env.AUTH0_LOG_STREAM_TOKEN) { + return res.sendStatus(401); + } + + const failedLogs = body.filter((log) => { + return "f" === log.data.type[0] || /limit/.test(log.data.type); + }); + + if (failedLogs.length === 0) { + return res.sendStatus(204); + } + + const reqUrl = process.env.SLACK_WEBHOOK_URL; + const reqOpts = { + json: { + attachments: failedLogs.map((log) => { + return { + pretext: "*Auth0 log alert*", + title: `<%= " ${log.data.description}" %> [type: <%= "${log.data.type}" %>]`, + color: "#ff0000", + title_link: `https://manage.auth0.com/#/logs/<%= "${log.data.log_id}" %>` + }; + }), + }, + }; + + try { + const slackResponse = await got.post(reqUrl, reqOpts); + res.status(slackResponse.statusCode); + return res.end(slackResponse.body); + } catch (error) { + next(error); + } +}; +``` + +Finally, add the NPM package file: + +```json +// package.json +{ + "dependencies": { + "dotenv": "^8.2.0", + "express": "^4.17.1", + "got": "^10.7.0" + }, + "scripts": { + "start": "node app.js", + } +} +``` + +To configure this application, you'll also need the following environment variables: + +- `SLACK_WEBHOOK_URL`: The URL provided by Slack for your incoming webhook application. +- `AUTH0_LOG_STREAM_TOKEN`: Optional, but recommended. A long, random string used to protect the endpoint from unauthorized requests. You will use this value in the Auth0 configuration steps below as well. + +If you are testing this locally or hosting this endpoint yourself, these can be saved in a `.env` file in the application's root directory. For hosting providers like Heroku, Dokku, and similar, consult the platform's documentation for the correct way to deploy these. + +Once configured locally or deployed to your host, you can test the endpoint and its connection to Slack with the following: + +```bash +npm install # If running yourself +added XX packages from XX contributors in XX.XXs + +npm start # If running yourself +Listening on port 3000 + +# Replace the Authorization header below +curl \ + --header "Authorization: AUTH0_LOG_STREAM_TOKEN_VALUE" \ + --header "Content-Type: application/json" \ + --request POST \ + --data '[{"data": {"type": "f", "description": "Test failure", "client_id": "TestClientId", "client_name": "Test Client Name", "log_id": "abc1234567890"}}]' \ + http://localhost:3000/api/logs +ok +``` + +The `ok` above signals that the request was accepted and processed correctly. In Slack, you should see the following message in the channel you configured: + +![Stream Auth0 Log Events to Slack](/media/articles/logs/log-stream-to-slack-message.png) + +## Configure an Auth0 log stream + +The final step is to configure Auth0 to send log events to this webhook using an HTTP event stream. + +To create a new stream poinint to your deployed Express application, follow the instructions in [HTTP Event](/logs/streams/http-event). Use the following field values: + +- **Payload URL**: URL to your deployed webhook like `https://[host domain]/api/logs` +- **Authorization Token**: Value configured above +- **Content Type**: Use "application/json" +- **Content Format**: Use "JSON Array" + +Once this is saved, your log stream is ready to use. To test, you'll need to trigger a failing log event. The simplest way to do that is to attempt to log in with an incorrect email or password. If the stream is configured correctly, you should see a Slack message saying: + +`Wrong email or password. [type: fu]` + +## Troubleshoot + +If you're not seeing the Slack message appear after several seconds, you'll need to walk down the same path a log event would: + +1. Check the Dashboard **Logs > Search** screen to make sure the record is there. +2. Check the **Health** tab for the stream ([delivery attempts and retries](/logs/streams/http-event#delivery-attempts-and-retries)). +3. If the webhook delivery is succeeding, check the logs for your deployed application. + +## More on Log Streams + +::: next-steps +* [HTTP Event Log Streams](/logs/streams/http-event) +* [Amazon EventBridge Log Streams](/logs/streams/amazon-eventbridge) +* [Datadog Event Log Streams](/logs/streams/datadog) +* [Azure Event Grid Log Streams](/logs/streams/azure-event-grid) +::: diff --git a/articles/logs/streams/http-event.md b/articles/logs/streams/http-event.md new file mode 100644 index 0000000000..a12963907c --- /dev/null +++ b/articles/logs/streams/http-event.md @@ -0,0 +1,52 @@ +--- +title: HTTP Event Log Streams +description: HTTP Event Log Streams let you export your events in near real-time to your own server. +toc: false +topics: + - logs + - streams + - event-streams + - http-event +contentType: how-to +--- + +# HTTP Event Log Streams + +HTTP Event Log Streams let you export your log events to the server or target of your choice. When Auth0 creates a log entry for your tenant, a copy is automatically sent to a given URL via an HTTP POST request. + +If you use Amazon Web Services, Auth0 also offers an [AWS EventBridge integration](/logs/streams/amazon-eventbridge). + +See our example [HTTP Event Log Stream example using Slack](/logs/streams/http-event-to-slack). + +## Create an HTTP Event Stream + +1. Log in to the [Auth0 Dashboard](${manage_url}). +2. Navigate to **Logs > Streams**. +3. Click **+ Create Stream**. +4. Select **Custom Webhook** and enter a unique name for your new HTTP Event Stream. +5. On the next screen, provide the following settings for your HTTP Event Stream: + +| Setting | Description | +|---------|-------------| +| Name | A unique display name to distinguish this integration from other integrations | +| Payload URL | The URL where the event payloads are sent as HTTP POST requests. | +| Authorization Token | (Optional) Set in the Authorization header of the request if provided. | +| Content Type | The media type of the payload that will be delivered to the webhook. | + +![Create a new HTTP Event Log Stream](/media/articles/logs/http-event-stream.png) + +6. Click **Save**. +7. You're done! Now when Auth0 writes the next tenant log, you'll receive a copy of that log event as a POST request at the `Payload URL` you provided. + +## Delivery attempts and retries + +Auth0 events are delivered to your server via a streaming mechanism that sends each event as it is triggered in our system. If your server is unable to receive the event, we will retry up to three times to deliver the event; otherwise, we will log the failure to deliver in our system, and you will be able see these failures in the Health tab for your log stream. + +## More on Log Streams + +::: next-steps +* [Example: Stream Auth0 Log Events to Slack](/logs/streams/http-event-to-slack) +* [Amazon EventBridge Log Streams](/logs/streams/amazon-eventbridge) +* [Datadog Event Log Streams](/logs/streams/datadog) +* [Azure Event Grid Log Streams](/logs/streams/azure-event-grid) +::: diff --git a/articles/logs/streams/index.md b/articles/logs/streams/index.md new file mode 100644 index 0000000000..73403ee075 --- /dev/null +++ b/articles/logs/streams/index.md @@ -0,0 +1,52 @@ +--- +title: Log Streams +description: Learn about using Log Streams to export your log events in near real-time. +classes: topic-page +toc: false +topics: + - logs + - streams + - event-streams +contentType: index +--- + +# Log Streams + +Log Streams let you export your log events to a target of your choice given URL or one of our integrations. With Log Streams you can: + +* export logs to a tool or service you already use +* react to events, such as changed passwords or new registrations, with your own business logic by sending log events to custom webhooks +* send events to Amazon EventBridge or Azure Event Grid + +## Log Stream Health + +You can troubleshoot potential issues with your stream by looking in the `Health` tab. + +1. Log in to the [Auth0 Dashboard](${manage_url}). +2. Navigate to **Logs > Streams**. +3. Click on a stream. +4. Select the **Health** tab. + +## Log Stream Status + +| Status | Description | +|---------|-------------| +| Active | Your stream is enabled with us, and we will attempt to deliver the next log events. | +| Paused | You have requested that we stop delivery attempts for the stream. You may click the `Resume Stream` option at any time to change the status back to `Active`. | +| Disabled | We have disabled your stream because of successive errors. You may click the `Restart Stream` option at any time to change the status back to `Active` and re-attempt delivery for this stream. | + +![Pause a Stream](/media/articles/logs/health/pause-a-stream.png) + +## Delivery Errors + +To help diagnose issues with your stream, you can see the last ten errors we encountered while attempting to deliver logs to your stream within the last 5 days. + +![Stream Errors](/media/articles/logs/health/health-errors.png) + +<%= include('../../_includes/_topic-links', { links: [ + 'logs/streams/http-event', + 'logs/streams/http-event-to-slack', + 'logs/streams/amazon-eventbridge', + 'logs/streams/datadog', + 'logs/streams/azure-event-grid' +] }) %> diff --git a/articles/metadata/apis.md b/articles/metadata/apis.md deleted file mode 100644 index a12c7573e3..0000000000 --- a/articles/metadata/apis.md +++ /dev/null @@ -1,262 +0,0 @@ ---- -title: How to Work With User Metadata Using the Auth0 APIs -description: How to create and update metadata using the Auth0 APIs. -crews: crew-2 -toc: true ---- -# How to Create and Update User Metadata With the Auth0 APIs - -In this article, we will cover how you can create and update metadata using the [Authentication](/api/authentication) and [Management](/api/management/v2) APIs. - -## Authentication API - -When you use the Authentication API's [Signup endpoint](/api/authentication?shell#signup), you can create a new Database Connection user and set the `user_metadata` field. - -::: note -When setting the `user_metadata` field using the Authentication API's [Signup endpoint](/api/authentication?javascript#signup), you are limited a maximum of 10 fields and 500 characters. -::: - -## Management API - -Using [Auth0's Management APIv2](/api/management/v2), you can create a user and set both their `app_metadata` and `user_metadata` fields. You can also update these two fields. - -::: note -The Auth0 Management APIv2 token is required to call the Auth0 Management API. Learn more about [how to get a Management APIv2 Token](/api/management/v2/tokens). -::: - -### Set Metadata Fields on Creation - -To create a user with the following profile details: - -```json -{ - "email": "jane.doe@example.com", - "user_metadata": { - "hobby": "surfing" - }, - "app_metadata": { - "plan": "full" - } -} -``` - -You would make the following `POST` call to the [Create User endpoint of the Management API](/api/management/v2#!/Users/post_users), to create the user and set the property values: - -```har -{ - "method": "POST", - "url": "https://${account.namespace}/api/v2/users", - "httpVersion": "HTTP/1.1", - "cookies": [], - "headers": [{ - "name": "Authorization", - "value": "Bearer ABCD" - }, { - "name": "Content-Type", - "value": "application/json" - }], - "queryString": [], - "postData": { - "mimeType": "application/json", - "text": "{\"email\": \"jane.doe@example.com\", \"user_metadata\": {\"hobby\": \"surfing\"}, \"app_metadata\": {\"plan\": \"full\"}}" - }, - "headersSize": -1, - "bodySize": -1, - "comment": "" -} -``` - -### Retrieve User Metadata - -To retrieve a user's metadata make a `GET` request to the [Get User endpoint of the Management API](/api/management/v2#!/Users/get_users_by_id). - -Assuming you created the user as shown above with the following metadata values: - -```json -{ - "email": "jane.doe@example.com", - "user_metadata": { - "hobby": "surfing" - }, - "app_metadata": { - "plan": "full" - } -} -``` - -Make the following `GET` request: - -```har -{ - "method": "GET", - "url": "https://${account.namespace}/api/v2/users/user_id", - "httpVersion": "HTTP/1.1", - "cookies": [], - "headers": [{ - "name": "Authorization", - "value": "Bearer ABCD" - }, { - "name": "Content-Type", - "value": "application/json" - }], - "queryString": [{ - "name": "fields", - "value": "user_metadata", - "comment": "" - }, - { - "name": "include_fields", - "value": "true", - "comment": "" - }], - "headersSize": -1, - "bodySize": -1, - "comment": "" -} -``` - -The response will be as follows: - -```json -{ - "user_metadata": { - "hobby": "surfing" - } -} -``` - -### Update User Metadata - -You can update a user's metadata by making a `PATCH` call to the [Update User endpoint of the Management API](/api/management/v2#!/Users/patch_users_by_id). - -Assuming you created the user as shown above with the following metadata values: - -```json -{ - "email": "jane.doe@example.com", - "user_metadata": { - "hobby": "surfing" - }, - "app_metadata": { - "plan": "full" - } -} -``` - -To update `user_metadata` and add the user's home address as a second-level property: - -```json -{ - "addresses": { - "home": "123 Main Street, Anytown, ST 12345" - } -} -``` - -You would make the following `PATCH` call: - -```har -{ - "method": "PATCH", - "url": "https://${account.namespace}/api/v2/users/user_id", - "httpVersion": "HTTP/1.1", - "cookies": [], - "headers": [{ - "name": "Authorization", - "value": "Bearer ABCD" - }, { - "name": "Content-Type", - "value": "application/json" - }], - "queryString": [], - "postData": { - "mimeType": "application/json", - "text": "{\"user_metadata\": {\"addresses\": {\"home\": \"123 Main Street, Anytown, ST 12345\"}}}" - }, - "headersSize": -1, - "bodySize": -1, - "comment": "" -} -``` - -The user's profile will now appear as follows: - -```json -{ - "email": "jane.doe@example.com", - "user_metadata": { - "hobby": "surfing", - "addresses": { - "home": "123 Main Street, Anytown, ST 12345" - } - }, - "app_metadata": { - "plan": "full" - } -} -``` - -::: warning -When you send a `PATCH` call in which you have set a property's value to `null` (for example, `{user_metadata: {color: null}}`), Auth0 **deletes** the property/value from the database. Also, patching the metadata itself with an empty object removes the metadata completely (see [Deleting](#deleting)). -::: - -#### Merging - -Only properties at the root level are merged into the object. All lower-level properties will be replaced. - -For example, to add a user's work address as an additional inner property, you would have to include the complete contents of the `addresses` property. Since the `addresses` object is a root-level property, it will be merged into the final JSON object representing the user, but its sub-properties will not. - -```json -{ - "user_metadata": { - "addresses": { - "home": "123 Main Street, Anytown, ST 12345", - "work": "100 Industrial Way, Anytown, ST 12345" - } - } -} -``` - -Therefore, the corresponding `PATCH` call to the API would be: - -```har -{ - "method": "PATCH", - "url": "https://YOURACCOUNT.auth0.com/api/v2/users/user_id", - "httpVersion": "HTTP/1.1", - "cookies": [], - "headers": [{ - "name": "Authorization", - "value": "Bearer ABCD" - }, { - "name": "Content-Type", - "value": "application/json" - }], - "queryString": [], - "postData": { - "mimeType": "application/json", - "text": "{\"user_metadata\": {\"addresses\": {\"home\": \"123 Main Street, Anytown, ST 12345\", \"work\": \"100 Industrial Way, Anytown, ST 12345\"}}}" - }, - "headersSize": -1, - "bodySize": -1, - "comment": "" -} -``` - -#### Deleting - -Patching the metadata with an empty object removes the metadata completely. For example, sending this body removes everything in `app_metadata`: - -```json -{ - "app_metadata": {} -} -``` - -Similarly, this clears out `user_metadata`: - -```json -{ - "user_metadata": {} -} -``` diff --git a/articles/metadata/index.md b/articles/metadata/index.md deleted file mode 100644 index 621a114fa3..0000000000 --- a/articles/metadata/index.md +++ /dev/null @@ -1,245 +0,0 @@ ---- -description: Auth0 allows you to store data related to each user that has not come from the identity provider as metadata -crews: crew-2 -toc: true ---- -# Metadata - -Auth0 allows you to store **metadata**, or data related to each user that has not come from the identity provider. There are two kinds of metadata: - -* **user_metadata**: stores user attributes (such as user preferences) that do not impact a user's core functionality; -* **app_metadata**: stores information (such as a user's support plan, security roles, or access control groups) that can impact a user's core functionality, such as how an application functions or what the user can access. - -::: note -An authenticated user can modify data in their profile's `user_metadata`, but not in their `app_metadata`. -::: - -## How to Read, Create, or Edit Metadata - -There are two ways by which you can manage your user metadata: using Rules, or using the Auth0 APIs. - -### Use Rules - -[Rules](/rules) are JavaScript functions executed as part of the Auth0 authentication process (prior to authorization). Using rules, you can read, create, or update user metadata and have such changes affect the results of the authorization process. - -For more information and examples refer to [User Metadata in Rules](/rules/current/metadata-in-rules). - -### Use the Auth0 APIs - -When you use the [Authentication API](/api/authentication), you can use the [Signup](/api/authentication?shell#signup) endpoint, in order to set the `user_metadata` for a user. Note though that this endpoint only works for database connections. - -For an example, refer to [Custom Signup > Using the API](/libraries/custom-signup#using-the-api). - -:::note -You can also use the [GET /userinfo endpoint](/api/authentication#get-user-info) in order to get a user's `user_metadata`. To do so, you first have to [write a Rule to copy `user_metadata` properties to the ID Token](/rules#copy-user-metadata-to-id-token). -::: - -You can use the [Management API](/api/management/v2) in order to retrieve, create, or update both the `user_metadata` and `app_metadata` fields at any point. - -| **Endpoint** | **Description** | -|--|--| -| [Search user by id](/api/management/v2#!/Users/get_users_by_id) | Use this if you want to search for a user based on Id. For an example request see [User Search](/users/search/best-practices#users-by-id). | -| [Search user by email](/api/management/v2#!/Users_By_Email/get_users_by_email) | Use this if you want to search for a user based on email. For an example request see [User Search](/users/search/best-practices#users-by-email).| -| [Get a list of users](/api/management/v2#!/Users/get_users) | Use this if you want to search for a list if users with other search criteria. For an example request see [User Search](/users/search/best-practices#users). See also [Search Metadata](#search-metadata) for a list of restrictions. | -| [Create User](/api/management/v2#!/Users/post_users) | Create a new user and (optionally) set metadata. For a body sample see [POST /api/v2/users](/api/management/v2#!/Users/post_users).| -| [Update User](/api/management/v2#!/Users/patch_users_by_id) | Update a user using a JSON object. For example requests see [PATCH /api/v2/users/{id}](/api/management/v2#!/Users/patch_users_by_id).| - -:::note -For examples and more info you can also refer to [How to Create and Update User Metadata With the Auth0 APIs](/metadata/apis). -::: - -#### Search Metadata - -Beginning **1 September 2017**, new tenants cannot search any of the `app_metadata` fields. - -Only tenants associated with paid subscriptions that were created on/before **31 August 2017** can search the `app_metadata` fields. - -As for `user_metadata`, you can only search for profile-related information, such as -- `name` -- `nickname` -- `given_name` -- `family_name` - -## Metadata Usage - -Suppose the following metadata is stored for a user with the email address `jane.doe@example.com`: - -```json -{ - "emails": "jane.doe@example.com", - "user_metadata": { - "hobby": "surfing" - }, - "app_metadata": { - "plan": "full" - } -} -``` - -::: note -Any valid JSON snippet can be used as metadata. -::: - -To read metadata, simply access the correct property as you would from any JSON object. For example, if you were working with the above example metadata within a [Rule](/rules) or via a call to the [Management API](/metadata/management-api), you could reference specific items from the data set as follows: - -```js -console.log(user.email); // "jane.doe@example.com" -console.log(user.user_metadata.hobby); // "surfing" -console.log(user.app_metadata.plan); // "full" -``` - -::: note -With Management APIv1, all metadata was stored in the `metadata` field. Data stored in this field is now available under `app_metadata`. -::: - -### Rules on Naming Metadata Fields - -The following sections cover best practices when setting the names of your metadata fields. - -#### Avoid Periods and Ellipses - -Metadata field **names** must not contain a dot. For example, use of the following field name would return a Bad Request (400) error: - -```json -{ - "preference.color": "pink" -} -``` - -One way of handling this limitation is to nest attributes: - -```json -{ - "preference": { - "color": "pink" - } -} -``` - -Alternately, you can use any delimiter that is not `.` or `$`. - -However, the usage of the `.` delimiter is acceptable in the data **values** such as in the below example: - -```json -{ - "preference": "light.blue" -} -``` - -#### Avoid Dynamic Field Names - -Do not use dynamic field names. For example, instead of using the following structure: - -```json -"participants": { - "Alice" : { - "role": "sender" - }, - "Bob" : { - "role": "receiver" - } -} -``` - -Use this: - -```json -"participants": [ - { - "name": "Alice", - "role": "sender" - }, - { - "name" : "Bob", - "role": "receiver" - } -] -``` - -## Metadata Restrictions - -There are some restrictions when using metadata of which you should be aware: - -### Field Restrictions - -The following fields may not be stored in the `app_metadata` field: - -* `blocked` -* `clientID` -* `created_at` -* `email` -* `email_verified` -* `global_client_id` -* `globalClientID` -* `identities` -* `lastIP` -* `lastLogin` -* `metadata` -* `user_id` -* `loginsCount` - -### Metadata Size Limits - -Currently, Auth0 limits the total size of your user metadata to **16 MB**. However, when using Rules and/or the Management Dashboard, your metadata limits may be lower. - -When setting the `user_metadata` field with the [Authentication API Signup endpoint](/api/authentication?javascript#signup), your metadata is limited to a maximum of 10 fields and 500 characters. - -## Using Lock to Manage Metadata - -Users of the [Lock](/libraries/lock) widget are able to add new items to `user_metadata`, as well as read `user_metadata` after authentication. - -* For information on adding `user_metadata` on signup, please see [Additional Signup Fields](/libraries/lock/v10/customization#additionalsignupfields-array-) -* When using Lock, you can read the user's `user_metadata` properties the same way you would for any other user profile property. For example, the following code snippet retrieves the value associated with `user_metadata.hobby` and assigns it to an element on the page: - -```js -// Use the accessToken acquired upon authentication to call getUserInfo -lock.getUserInfo(accessToken, function(error, profile) { - if (!error) { - document.getElementById('hobby').textContent = profile.user_metadata.hobby; - } -}); -``` - -::: note -For details on how to use Lock to authenticate users and access their profile information, check out the [Lock documentation](/libraries/lock). -::: - -## Metadata and Custom Databases - -If you are using a [custom database](/connections/database#using-your-own-user-store), the **app_metadata** field should be referred to as **metadata** in the scripts you run to manage your metadata. - -For example, you would *not* use this: - -```json -{ - "emails": "jane.doe@example.com", - "user_metadata": { - "hobby": "surfing" - }, - "app_metadata": { - "plan": "full" - } -} -``` - -Instead, you would use this: - -```json -{ - "emails": "jane.doe@example.com", - "user_metadata": { - "hobby": "surfing" - }, - "metadata": { - "plan": "full" - } -} -``` - -## Keep Reading - -::: next-steps -* [Updating Metadata with Auth0 APIs](/metadata/management-api) -* [User Data Storage Guidance](/user-profile/user-data-storage) -* [Change a User's Picture](/user-profile/user-picture#change-a-user-s-picture) -::: diff --git a/articles/metadata/lock.md b/articles/metadata/lock.md deleted file mode 100644 index 5de01c44e9..0000000000 --- a/articles/metadata/lock.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -description: How to read and update user metadata with Lock. -crews: crew-2 ---- - -# How to use Metadata with Lock Library - -This article describes how you can define and update the user's `user_metadata`, using Auth0's [Lock](/libraries/lock) library. If you are not familiar with `user_metadata`, refer to [User Metadata](/metadata). If you need more details on how to install, initialize and use Lock, refer to [Lock for Web](/libraries/lock). - -## Define User Metadata on Signup - -For information on adding `user_metadata` on signup, see the section on Lock [Additional Signup Fields](/libraries/lock/v10/customization#additionalsignupfields-array-) - -## Read User Metadata - -You can read the user's `user_metadata` properties the same way you would for any user profile property. This example retrieves the value associated with `user_metadata.hobby`: - -```js -lock.getUserInfo(accessToken, function(error, profile) { - if (!error) { - document.getElementById('hobby').textContent = profile.user_metadata.hobby; - } -}); -``` - -::: note -For details on how to initialize `lock` refer to [new Auth0Lock(clientID, domain, options)](https://github.com/auth0/lock#new-auth0lockclientid-domain-options) -::: - -## Update User Metadata - -You can [update the metadata properties](/metadata/apiv2#update-user-metadata) with calls to the Auth0 Management API. To do so, make a `PATCH` call to the [Update a user](/api/management/v2#!/Users/patch_users_by_id) endpoint. - - -Here is a sample request, that adds the user's home address as a second-level property: - -```har -{ - "method": "PATCH", - "url": "https://YOURACCOUNT.auth0.com/api/v2/users/user_id", - "httpVersion": "HTTP/1.1", - "cookies": [], - "headers": [{ - "name": "Authorization", - "value": "Bearer YOUR_TOKEN" - }, { - "name": "Content-Type", - "value": "application/json" - }], - "queryString": [], - "postData": { - "mimeType": "application/json", - "text": "{\"user_metadata\": {\"addresses\": {\"home\": \"123 Main Street, Anytown, ST 12345\"}}}" - }, - "headersSize": -1, - "bodySize": -1, - "comment": "" -} -``` - -::: note -The Auth0 Management APIv2 token is required to call the Auth0 Management API. [Click here to learn more about how to get a Management APIv2 Token.](/api/management/v2/tokens) -::: diff --git a/articles/mfa/_includes/_authenticator-before-start.md b/articles/mfa/_includes/_authenticator-before-start.md new file mode 100644 index 0000000000..89d496c5ea --- /dev/null +++ b/articles/mfa/_includes/_authenticator-before-start.md @@ -0,0 +1,3 @@ +## Prerequisite + +Before you can use the MFA APIs, you'll need to enable the MFA grant type for your application. You can enable the MFA grant by going to [Applications > Your Application > Advanced Settings > Grant Types](${manage_url}/#/applications) and selecting MFA. \ No newline at end of file diff --git a/articles/mfa/_includes/_configure-sns.md b/articles/mfa/_includes/_configure-sns.md new file mode 100644 index 0000000000..75d826d044 --- /dev/null +++ b/articles/mfa/_includes/_configure-sns.md @@ -0,0 +1,3 @@ +## Configure SNS for native apps + +For your native application to receive push notifications from Guardian, you will need to override the default SNS settings. See [Configure Push Notifications for MFA](/mfa/guides/configure-push) for details. \ No newline at end of file diff --git a/articles/mfa/_includes/_enable-push-notifications.md b/articles/mfa/_includes/_enable-push-notifications.md new file mode 100644 index 0000000000..82be4f2aea --- /dev/null +++ b/articles/mfa/_includes/_enable-push-notifications.md @@ -0,0 +1,7 @@ +## Enable Guardian push notifications + +1. To enable Guardian push notifications for your users, go to the [Multi-factor Auth](${manage_url}/#/guardian) section of the Dashboard. + +2. Toggle the **Push Notification** slider to enable it. + +![Enable Push Notifications](/media/articles/mfa/mfa-dashboard.png) \ No newline at end of file diff --git a/articles/mfa/_includes/_get_mfa_token.md b/articles/mfa/_includes/_get_mfa_token.md new file mode 100644 index 0000000000..eda25ae672 --- /dev/null +++ b/articles/mfa/_includes/_get_mfa_token.md @@ -0,0 +1,5 @@ +Depending on when you are triggering enrollment, you can obtain an access token for using the MFA API in different ways: + +- If you are enrolling during authentication, check [Authenticate With Resource Owner Password Grant and MFA](/mfa/guides/mfa-api/authenticate). + +- If you want to let the user enroll a factor at any moment, check [Managing MFA Enrollments](/mfa/guides/mfa-api/manage). diff --git a/articles/mfa/_includes/_get_mfa_token_challenge.md b/articles/mfa/_includes/_get_mfa_token_challenge.md new file mode 100644 index 0000000000..b0d61e66c7 --- /dev/null +++ b/articles/mfa/_includes/_get_mfa_token_challenge.md @@ -0,0 +1 @@ +Get an MFA token following the steps described in the [Authenticate With Resource Owner Password Grant and MFA](/mfa/guides/mfa-api/authenticate) document. \ No newline at end of file diff --git a/articles/mfa/_includes/_recovery_codes.md b/articles/mfa/_includes/_recovery_codes.md new file mode 100644 index 0000000000..e5f6ab8dc8 --- /dev/null +++ b/articles/mfa/_includes/_recovery_codes.md @@ -0,0 +1 @@ +If this is the first time the user is associating an authenticator, you'll notice the response includes `recovery_codes`. Recovery codes are used to access the user's account in the event that they lose access to the account or device used for their second factor authentication. These are one-time usable codes, and new ones are generated as necessary. \ No newline at end of file diff --git a/articles/mfa/_includes/_request_association.md b/articles/mfa/_includes/_request_association.md new file mode 100644 index 0000000000..7d7ce5babc --- /dev/null +++ b/articles/mfa/_includes/_request_association.md @@ -0,0 +1 @@ +Make a `POST` request to the `/mfa/associate` endpoint to enroll the user's authenticator. The Bearer Token required by this endpoint is the MFA token obtained in the previous step. \ No newline at end of file diff --git a/articles/mfa/_includes/_successful_challenge.md b/articles/mfa/_includes/_successful_challenge.md new file mode 100644 index 0000000000..c68b5367db --- /dev/null +++ b/articles/mfa/_includes/_successful_challenge.md @@ -0,0 +1,11 @@ +If the call was successful, you'll receive a response in the below format, containing the Access Token: + +``` +{ + "id_token": "eyJ...i", + "access_token": "eyJ...i", + "expires_in": 600, + "scope": "openid profile", + "token_type": "Bearer" +} +``` diff --git a/articles/mfa/_includes/_successful_confirmation.md b/articles/mfa/_includes/_successful_confirmation.md new file mode 100644 index 0000000000..1159ca96d2 --- /dev/null +++ b/articles/mfa/_includes/_successful_confirmation.md @@ -0,0 +1,15 @@ +If the call was successful, you'll receive a response in the below format, containing the Access Token: + +``` +{ + "id_token": "eyJ...i", + "access_token": "eyJ...i", + "expires_in": 600, + "scope": "openid profile", + "token_type": "Bearer" +} +``` + +At this point, the authenticator is fully associated and ready to be used, and you have the authentication tokens for the user. + +You can check at any point to verify whether an authenticator has been confirmed by calling the [`mfa/authenticators` endpoint](/mfa/guides/mfa-api/manage#list-authenticators). If the authenticator is confirmed, the value returned for `active` is `true`. \ No newline at end of file diff --git a/articles/mfa/_includes/_test-setup.md b/articles/mfa/_includes/_test-setup.md new file mode 100644 index 0000000000..ea25a2a065 --- /dev/null +++ b/articles/mfa/_includes/_test-setup.md @@ -0,0 +1,3 @@ +::: warning +The following steps will add text-message-based multi-factor to the login flow for the tenant in which you're working. We **highly** recommend testing this setup on a [staging or development server](/dev-lifecycle/setting-up-env) before making the changes to your production login flow. +::: \ No newline at end of file diff --git a/articles/mfa/concepts/guardian.md b/articles/mfa/concepts/guardian.md new file mode 100644 index 0000000000..65d97d5a10 --- /dev/null +++ b/articles/mfa/concepts/guardian.md @@ -0,0 +1,96 @@ +--- +title: Auth0 Guardian +description: Understand how Guardian works and how Guardian SDK helps you build your own authenticator and Guardian-like applications. +topics: + - mfa + - guardian + - android + - iOS +contentType: + - concept +useCase: + - customize-mfa +--- +# Auth0 Guardian + +Auth0 multi-factor authentication (MFA) supports these authentication factors: + +* One-time password (OTP) +* SMS +* Voice +* Push +* Duo +* Email + +Auth0 Guardian is a mobile app that can deliver push notifications to a user’s pre-registered device - typically a mobile phone or tablet - from which a user can immediately allow or deny account access via the press of a button. It can also generate one-time passwords if that factor is preferred. + +The push factor is offered with the Guardian mobile app, available for both iOS and Android. In addition, the technology is also available as whitelabelled Guardian SDK which can be used in custom mobile applications to act as second factor push responder. + +Auth0 Guardian is available on ([Google Play](https://play.google.com/store/apps/details?id=com.auth0.guardian) and the [App Store](https://itunes.apple.com/us/app/auth0-guardian/id1093447833?mt=8)). + +::: note +See the documentation for [Apple Push Notification service (APNs)](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html) for details on setting up APNs. +::: + +## How it works + +Instead of integrating with each vendor-specific push notification service, Auth0 push notification is implemented using AWS Simple Notification Service (SNS) which handles the vendor specific integration. + +![Guardian Functionality](/media/articles/mfa/guardian-functionality.png) + +## Guardian and push notifications + +When enabling push, end-users will need to have Auth0 Guardian or a custom application built with the Guardian SDK installed in their device. The app is sent push notifications when the user attempts to authenticate, and the user must respond to it in order to login, ensuring that they not only know their login information but also possess the device set up for MFA. + +End users will be prompted to download Auth0 Guardian when trying to sign up or log in to your application. Once they indicate that they have successfully downloaded the app, a QR code will appear on screen. They will have a short amount of time in which to scan the code with the designated app. Once this is done, they should see a confirmation screen. + +Once this is all set up, when the user attempts to authenticate as normal, their device will receive a push notification via the app, and once they approve the request, they will be logged in. + +
    Guardian Push
    + +## Guardian and One-Time Passwords + +![MFA OTP Signup](/media/articles/mfa/mfa-otp-setup.png) + +Upon signup, they can scan a code and set up the app, upon which it will begin generating one-time codes. + +Afterwards, when logging in to the app, the user can simply check the authenticator app for the current one-time code: + +
    Google Authenticator OTP
    + +And enter the code at the prompt: + +![MFA OTP Login](/media/articles/mfa/mfa-otp-login.png) + +Your users will need to have an OTP Authenticator app installed in their mobile devices. + +## Guardian SDKs + +You can [install the Guardian SDK](/mfa/guides/guardian/install-guardian-sdk), available for [iOS](/mfa/guides/guardian/configure-guardian-ios) and [Android](/mfa/guides/guardian/configure-guardian-android) to build your own whitelabel multi-factor authentication application with complete control over the branding and look-and-feel. + +With the Guardian SDK, you can build your own custom mobile applications that works like Guardian or integrate some Guardian functionalities, such as receiving push notifications in your existing mobile applications. + +A typical scenario could be for a banking app. You can use the Guardian SDK in your existing mobile app to receive and confirm push notifications when someone performs an ATM transaction. + +See [auth0-guardian.js](https://github.com/auth0/auth0-guardian.js) for more information. + +## Migration to Firebase Cloud Messaging + +Auth0’s Guardian SDKs for iOS and Android help you create custom mobile apps with Guardian functionality, providing secure access to multi-factor authentication (MFA) with push notifications. + +The [Android SDK](/mfa/guides/guardian/guardian-android-sdk) library was built to send push notifications using Google Cloud Messaging, which [Google deprecated](https://firebase.googleblog.com/2018/04/time-to-upgrade-from-gcm-to-fcm.html) and replaced with Firebase Cloud Messaging. Google Cloud Messaging will stop working on April 11th 2019. **Note that existing applications should [keep working as-is](https://aws.amazon.com/blogs/messaging-and-targeting/the-end-of-google-cloud-messaging-and-what-it-means-for-your-apps/)**. + +You can learn more about how to migrate from GCM to FCM by following [Google’s documentation](https://developers.google.com/cloud-messaging/android/android-migrate-fcm). + +The main difference between sending notifications to GCM and to FCM is the payload received in the notification. While it was previously possible for customers using the Android SDK to adapt the payload received before calling the SDK method, we have upgraded the library to accept the new payload, making it simpler to adopt FCM. + +The Guardian Android SDK 0.4.0 version is available in Maven Central and includes this change. The sample application was also upgraded, so it can be tested by providing the google-services.json file and a guardian-url. + +## Keep reading + +* [Configure Push Notifications for MFA](/mfa/guides/configure-push) +* [Create Custom Enrollment Tickets](/mfa/guides/guardian/create-enrollment-ticket) +* [Guardian Error Code Reference](/mfa/references/guardian-error-code-reference) +* [Auth0 Management API](/api/management/v2) +* [Getting Started with Apple Push Notification Service](https://docs.aws.amazon.com/sns/latest/dg/mobile-push-apns.html) +* [Getting Started with Firebase Cloud Messaging for Android](https://docs.aws.amazon.com/sns/latest/dg/sns-mobile-application-as-subscriber.html) diff --git a/articles/mfa/concepts/mfa-api.md b/articles/mfa/concepts/mfa-api.md new file mode 100644 index 0000000000..6154ac2805 --- /dev/null +++ b/articles/mfa/concepts/mfa-api.md @@ -0,0 +1,31 @@ +--- +title: Multi-factor Authentication API +description: Overview of available multi-factor authentication APIs +topics: + - mfa + - mfa-api +contentType: + - index +useCase: + - customize-mfa +--- +# Multi-factor Authentication API + +Auth0 provides a built-in Multi-factor Authentication (MFA) enrollment and authentication flow using [Universal Login](/universal-login). + +You will need to use the MFA API in the following scenarios: + +- If you are [authenticating users with the Resource Owner Password Grant](/mfa/guides/mfa-api/authenticate). + +- If you want to build an interface to let users [manage their authentication factors](/mfa/guides/mfa-api/manage). + +<%= include('../_includes/_authenticator-before-start') %> + +## Limitations + +The MFA API is designed to work with SMS, Push via Guardian, Email, and OTP factors. It does not currently support enrolling with Duo or with the legacy 'google-authenticator' factor (Google Authenticator can still be enrolled using the OTP factor). + +## Keep reading + +* [Authenticate With Resource Owner Password Grant and MFA](/mfa/guides/mfa-api/authenticate) +* [Manage Authenticator Factors using the MFA API](/mfa/guides/mfa-api/manage) diff --git a/articles/mfa/concepts/mfa-developer-resources.md b/articles/mfa/concepts/mfa-developer-resources.md new file mode 100644 index 0000000000..735ce8aee0 --- /dev/null +++ b/articles/mfa/concepts/mfa-developer-resources.md @@ -0,0 +1,35 @@ +--- +description: Learn about developer resources such as the Auth0 MFA API and the Guardian SDKs for MFA. +topics: + - mfa + - guardian +contentType: + - index +useCase: + - customize-mfa +--- +# Developer Resources for Multi-factor Authentication + +Using Auth0 SDKs, you can customize your users' multi-factor authentication (MFA) experience and even build applications on top of our multi-factor capabilities. + +## MFA API + +[MFA API](/mfa/concepts/mfa-api) endpoints allow you to enforce MFA when users interact with [the Token endpoints](/api/authentication#get-token), as well enroll and manage MFA factors. + +## Customize the multi-factor authentication page + +Use the following client libraries to customize the look-and-feel of the MFA page so it matches your organization. + +* [Client library for Auth0 MFA](https://github.com/auth0/auth0-guardian.js) +* [Creating a Custom MFA Widget](https://github.com/auth0/auth0-guardian.js/tree/master/example) + +## Manage enrollments + +You can [customise the enrollment](/mfa/guides/guardian/create-enrollment-ticket) process for your users. + +## Build custom mobile applications + +Build custom _white-label_ Guardian-like applications, or add multi-factor functionality into your applications. + +* [Guardian for Android](/mfa/guides/guardian/guardian-android-sdk) +* [Guardian for iOS](/mfa/guides/guardian/guardian-ios-sdk) diff --git a/articles/mfa/concepts/mfa-factors.md b/articles/mfa/concepts/mfa-factors.md new file mode 100644 index 0000000000..26141b8f56 --- /dev/null +++ b/articles/mfa/concepts/mfa-factors.md @@ -0,0 +1,77 @@ +--- +description: Understand how MFA works in Auth0, the authentication factors, policies and use cases. +toc: true +topics: + - mfa +contentType: + - concept +useCase: + - customize-mfa +--- +# Multi-factor Authentication Factors + +Auth0 supports a number of different options when it comes to enabling MFA for protecting user account access. An MFA workflow is typically provided via a separate application that runs on a mobile or tablet device. + +If you don’t want your customers to have to download a separate application, Auth0 also provides an [SDK](/mfa/guides/guardian/install-guardian-sdk) that you can use to build a second factor workflow in your existing mobile device app. + +On the [Dashboard > Multifactor Auth](${manage_url}/#/mfa) page, you can select the factors to use for MFA for your tenant. + +![MFA Dashboard Page](/media/articles/mfa/mfa-dashboard.png) + +Auth0 supports the following factors for implementing MFA. You must enable at least one to use MFA, but you can choose to enable and make available more than one factor if you wish. Available factors are dependent on your subscription plan. + +## Push notifications + +Send users push notifications to a their pre-registered devices - typically a mobile phone or tablet - from which a user can immediately allow or deny account access via the simple press of a button. Push factor is offered with the [Guardian](/mfa/concepts/guardian) mobile app, available for both [iOS](/mfa/guides/guardian/guardian-ios-sdk) and [Android](/mfa/guides/guardian/guardian-android-sdk). + +## SMS notifications + +[Send users a one-time code over SMS](/mfa/guides/configure-phone) which the user is then prompted to enter before they can finish authenticating. + +## Voice notifications + +[Deliver users a one-time code through a voice call](/mfa/guides/configure-phone) which the user is then prompted to enter before they can finish authenticating. + +## One-Time passwords + +[One-Time Password (OTP)](/mfa/guides/configure-otp) allows you to use an Authenticator application in your personal device - such as Google Authenticator - that will generate a one-time password which changes over time and which can be entered as the second factor to validate a user’s account. + +## Email notifications + +You can [use email](/mfa/guides/configure-email) when you want to provide users a way to perform MFA when they don't have their phone to receive an SMS or push notification. + +## Duo Security + +[Duo](/mfa/guides/configure-cisco-duo) is a multi-faceted provider and can only be used if it's the only factor available for the user. Use your Duo account to manage MFA with Auth0. + +## Policies + +Policies determine when a user will be prompted to complete additional steps to prove they own a particular account. Use policies to define your own level of acceptable risk. You can choose between **Never** and **Always**. + +You can achieve more refined multifactor configurations (such as per application, per user, etc.) by using [Rules](/rules/references/use-cases#multi-factor-authentication). + +::: note +Rules affecting MFA take precedence over the policy configuration in the Dashboard. +::: + +## MFA use cases + +There are different ways to manage MFA depending on your environment: + +* B2B: Your customers manage MFA factors for their users. +* B2C: End users manage their own MFA factors via the My MFA Settings Page. +* B2E: You manage MFA factors for your users. + +To learn about the API endpoints you can use to build a user interface that allows users to manage MFA factors, see [Manage Authenticator Factors using the MFA API](/mfa/guides/mfa-api/manage). + +Applications that allow access to different types of resources can require users to authenticate with a stronger authentication mechanism to access sensitive resources. For details, see [Step-Up Authentication](/mfa/concepts/step-up-authentication). + +You can configure a rule in **Dashboard > Rules** to define the conditions that will trigger additional authentication challenges. Use rules to force MFA for users of certain applications, or for users with particular user metadata or IP ranges, among other triggers. + +Add contextual MFA which allows you to define arbitrary conditions that will trigger additional authentication challenges to your customers for increased security, for example, geographic location (geo-fencing), address or type of network used (IP filtering), time of day, day of the week or change in the location or device being used to log in. + +## Keep reading + +* [Enable MFA](/mfa/guides/enable-mfa) +* [Configure Push Notifications for MFA](/mfa/guides/configure-push) +* [Developer Resources for Multi-factor Authentication](/mfa/concepts/mfa-developer-resources) diff --git a/articles/mfa/concepts/step-up-authentication.md b/articles/mfa/concepts/step-up-authentication.md new file mode 100644 index 0000000000..ce09fe0084 --- /dev/null +++ b/articles/mfa/concepts/step-up-authentication.md @@ -0,0 +1,57 @@ +--- +description: Understand how step-up authentication works for APIs and web apps to verify that the user has logged in using MFA and if not, require the user to step-up to access certain resources. +topics: + - mfa + - step-up-authentication +contentType: + - concept +useCase: + - customize-mfa +--- +# Step-up Authentication + +With step-up authentication, applications that allow access to different types of resources can require users to authenticate with a stronger authentication mechanism to access sensitive resources. + +For example, Fabrikam's Intranet requires users to authenticate with their username and password to access customer data. However, a request for access to employee data (which may contain sensitive salary information) triggers a stronger authentication mechanism like multi-factor authentication (MFA). + +You can add step-up authentication to your app with Auth0's extensible multi-factor authentication support. Your app can verify that the user has logged in using multi-factor authentication (MFA) and, if not, require the user to step-up to access certain resources. + +![Step-up flow](/media/articles/mfa/step-up-flow.png) + +## Step-up Authentication for APIs + +When your audience is an API, you can implement step-up authentication with Auth0 using scopes, Access Tokens and [Rules](/rules/references/use-cases#multi-factor-authentication). + +::: note +An Access Token is a credential you can use to access an API. The actions that you can perform to that API are defined by the scopes your Access Token includes. The rules are JavaScript functions you can use to run custom logic when a user authenticates. +::: + +You can use a rule to trigger the step-up authentication mechanism (for example, prompt MFA) whenever the user requests scopes that map to sensitive resources. + +This is best explained with an example. + +A user signs into Fabrikam's web app. The standard login gives to this user the ability to interact with their API and fetch the users account list. This means that the Access Token that the application receives after the user authentication contains a scope like `read:accounts`. + +Now the user wishes to transfer funds from one account to another, which is deemed a high-value transaction. In order to perform this action, the API requires the scope `transfer:funds`. + +The Access Token that the user currently has does not include this scope and the application knows it since it knows the set of scopes it requested in the initial authentication call. + +The solution is that the application performs another authentication call, but this time it requests the required scope. The browser redirects to Auth0 and a rule is used to challenge the user to authenticate with MFA since a high-value scope was requested. + +Once the user successfully authenticates with MFA, a new Access Token which includes the high-value scope is generated and sent. The application will pass the Access Token to the API which will discard it after verification, thereby treating it like a single-use token. + +For details and sample code, see [Step-up Authentication for APIs](/mfa/guides/configure-step-up-apis). + +## Step-up Authentication for Web Apps + +If it is a web app that verifies the authentication level, and not an API, then you do not have an Access Token. In this case you can check if a user has logged in with MFA by reviewing the contents of their [ID Token](/tokens/concepts/id-tokens). You can then configure your application to deny access to pages with sensitive information if the ID Token indicates that the user did not log in with MFA, and use a rule to trigger the step-up authentication mechanism (for example, prompt MFA). + +For example, you might have an employee app that authenticates users with username and password, but if a user wants to access salary information, they have to provide a second factor, using for example a mobile push notification. + +You can implement this by checking the ID Token when the user tries to access that screen. If the claims show that the user has authenticated with MFA already then display the sensitive information. Otherwise, trigger authentication again, and using a rule, prompt the user to authenticate with MFA. + +For details and sample code, see [Step-up Authentication for Web Apps](/mfa/guides/configure-step-up-web-apps). + +## Keep reading + +* [Authentication policy definitions](http://openid.net/specs/openid-provider-authentication-policy-extension-1_0.html#rfc.section.4) diff --git a/articles/mfa/guides/a.json b/articles/mfa/guides/a.json new file mode 100644 index 0000000000..c7a8387871 --- /dev/null +++ b/articles/mfa/guides/a.json @@ -0,0 +1 @@ +{ "message_types": ["sms", "voice"] } \ No newline at end of file diff --git a/articles/mfa/guides/configure-cisco-duo.md b/articles/mfa/guides/configure-cisco-duo.md new file mode 100644 index 0000000000..a47cc6ee98 --- /dev/null +++ b/articles/mfa/guides/configure-cisco-duo.md @@ -0,0 +1,52 @@ +--- +description: Learn how to configure Cisco Duo for MFA. +topics: + - mfa + - duo +contentType: + - how-to +useCase: + - customize-mfa +--- +# Configure Cisco Duo for MFA + +Cisco Duo is a multi-faceted authentication provider and can only be used on your Auth0 tenant if all other factors are disabled. + +## Administrative setup + +Your Duo account can be configured to support push notifications, SMS, OTP, phone callback, and more. See the [Duo documentation](https://duo.com/docs) for more details on Duo setup. + +::: note +Create an integration in Duo Security of type **Web SDK** and use those credentials to fill in the Duo settings in the Auth0 Dashboard as noted below. +::: + +When enabling Duo in the Dashboard, you will need to click on the Duo factor and fill in a few settings fields in order to link your Duo account to Auth0. + +![MFA Duo Settings](/media/articles/mfa/duo-settings.png) + +::: warning +If other factors are enabled alongside Duo, Duo will be unavailable. Duo is only available to end users when it is the **sole** factor enabled. +::: + +## MFA sessions + +Duo does not provide an option for "Remember Me" behavior, so a 30-day MFA session is hard-coded to remember a logged-in user and not prompt them every time they log in. If you wish to force end-users to log in with Duo every time, you may implement this functionality by creating a rule with `allowRememberBrowser: false` instead. + +```js +function (user, context, callback) { + context.multifactor = { + provider: 'any', + allowRememberBrowser: false + }; + + callback(null, user, context); +} +``` + +## End user experience + +The user will see a prompt for the second factor with Duo, listing the options you have enabled in your Duo account. + +![Duo Login](/media/articles/mfa/duo-login.png) + +Your end users can download Duo from [Google Play](https://play.google.com/store/apps/details?id=com.duosecurity.duomobile) or from the [App Store](https://itunes.apple.com/us/app/duo-mobile/id422663827?mt=8) for use as a second factor. diff --git a/articles/mfa/guides/configure-email.md b/articles/mfa/guides/configure-email.md new file mode 100644 index 0000000000..0b8c75500f --- /dev/null +++ b/articles/mfa/guides/configure-email.md @@ -0,0 +1,43 @@ +--- +description: Learn how to configure email as an MFA factor for users who don't have their primary factor available. +topics: + - mfa + - email +contentType: + - how-to +useCase: + - customize-mfa +--- +# Configure Email Notifications for MFA + +Using email as an MFA factor is useful when you want to provide users a way to perform MFA when they don't have their primary factor available (e.g. they don't have their phone to receive an SMS or push notification). + +You can only enable email as an MFA factor if there is already another factor enabled. Email will only be functional as a factor from Universal Login when you have the [New Universal Login Experience](/universal-login/new) enabled. + +Once Email MFA is enabled user will be prompted to complete MFA with the other enabled factor. If they have a **verified email** they will be given the option to select Email, and get an one time code in their email which they can then enter to complete MFA. + +Users do not need to explicitly enroll with email MFA. They will get be able to use it when they have a verified email. This happens when they completed the email verification flow, when the updated the email_verified field using the Management API, or when they logged-in with a connection that provides verified emails (e.g. Google). + +Note that Email is not true multi-factor authentication (MFA) as it does not represent a different factor than the password. It does not represent 'something I have' or 'something I am', but rather just another 'something I know' (the email password). It is also weaker than other factors, in that it's only as secure as the email itself (e.g. is it encrypted end-to-end?). + +## End-user experience + +After the login step, users will be prompted with the most secure enabled factor. If they select 'Try another method', and then pick Email, they will be sent an email with a six-digit code that they will need to enter to complete the authentication flow. + +![Email End User 1](/media/articles/mfa/mfa-email.png) + +## Using the MFA API + +You can explicitly enroll an email for MFA [using the MFA API](/mfa/guides/mfa-api/email). If users have a verified email and one or more explicitly enrolled emails, they'll be able to select which email they want to use to complete MFA when logging-in using Universal Login. + +## Administrative setup + +In order to set up Email, you need to enable the Email factor in the Dashboard. You will only be able to enable it if there is another factor enabled. + +![MFA Email Settings](/media/articles/mfa/email-settings.png) + +[Auth0 provides a test email provider](/email) but it only allows a limited amount of emails, so you should [configure your own email provider](/email/providers). + +## Keep reading + +* [Enroll and Challenge Email Authenticators using the MFA API](/mfa/guides/mfa-api/email) \ No newline at end of file diff --git a/articles/mfa/guides/configure-otp.md b/articles/mfa/guides/configure-otp.md new file mode 100644 index 0000000000..2ac05eb434 --- /dev/null +++ b/articles/mfa/guides/configure-otp.md @@ -0,0 +1,36 @@ +--- +description: Learn how to configure time-based one time passwords for MFA. +topics: + - mfa + - duo +contentType: + - how-to +useCase: + - customize-mfa +--- +# Configure One Time Passwords for MFA + +To use one time passwords as an authentication factor, users need an Authenticator app such as: + +* Authy ([Google Play](https://play.google.com/store/apps/details?id=com.authy.authy) / [App Store](https://itunes.apple.com/us/app/authy/id494168017)). +* Google Authenticator ([Google Play](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2) / [App Store](https://itunes.apple.com/us/app/google-authenticator/id388497605)). +* Auth0 Guardian ([Google Play](https://play.google.com/store/apps/details?id=com.auth0.guardian) / [App Store](https://itunes.apple.com/us/app/auth0-guardian/id1093447833)). +* Microsoft Authenticator ([Google Play](https://play.google.com/store/apps/details?id=com.azure.authenticator) / [App Store](https://itunes.apple.com/us/app/microsoft-authenticator/id983156458)). + +![MFA OTP Signup](/media/articles/mfa/mfa-otp-setup.png) + +Upon signup, they can scan a code and set up the app, upon which it will begin generating one-time codes. + +Afterwards, when logging in to the app, the user can simply check the authenticator app for the current one-time code: + +
    Google Authenticator OTP
    + +And enter the code at the prompt: + +![MFA OTP Login](/media/articles/mfa/mfa-otp-login.png) + +Your users will need to have an OTP Authenticator app installed in their mobile devices. + +## Keep reading + +* [Enroll and Challenge OTP Authenticators using the MFA API](/mfa/guides/mfa-api/otp) \ No newline at end of file diff --git a/articles/mfa/guides/configure-phone.md b/articles/mfa/guides/configure-phone.md new file mode 100644 index 0000000000..9b37a8fdd1 --- /dev/null +++ b/articles/mfa/guides/configure-phone.md @@ -0,0 +1,128 @@ +--- +title: Configure SMS and Voice Notifications for MFA +description: Learn how to configure SMS and Voice notifications for MFA. +topics: + - mfa + - twilio +contentType: + - how-to +useCase: + - customize-mfa +--- +# Configure SMS and Voice Notifications for MFA + +If you use SMS or Voice as an authentication factor, when an end user attempts to authenticate with your application, they are sent a code via SMS or Voice, which they will have to enter to complete the transaction. This implies that they both know their login credentials and are in possession of the phone number that they have registered for Multi-factor Authentication (MFA) use. + +You can configure this factor to send messages through SMS, Voice, or to let the end users choose how they want the code to be delivered. + +::: warning +- Using Voice as an MFA factor is currently a Beta feature. It should not be used in production environments. +- Voice as an MFA factor is not available when using the [Classic Universal Login Experience](/universal-login/classic). +::: + +## End user experience - Voice and SMS + +When Voice and SMS are enabled, users are given the option to enroll by getting the code sent by SMS or Voice: + +![Voice and SMS - End User](/media/articles/mfa/mfa-sms-voice.png) + +When only SMS is enabled, the flow is simpler: + +![SMS - End User](/media/articles/mfa/mfa-sms.png) + +After users are enrolled, the next time they authenticate they will get the Voice or SMS message in their registered phone. + +## Administrative setup + +![MFA Phone Message Settings](/media/articles/mfa/mfa-phone-settings.png) + +### Message Delivery Provider and Method + +To allow users to authenticate with SMS or Voice, you must enable the Phone factor and select your preferred delivery method: + +* **Auth0**: Sends the messages using Auth0's internally-configured SMS delivery provider. It can be used for evaluation and testing purposes, and there is a maximum of 100 messages per tenant during the entire tenant lifetime. New codes are not received after reaching the 100 message limit. You can't use this provider to send Voice messages. + +* **Twilio**: Sends the messages using the [Twilio Programmable SMS API](https://www.twilio.com/sms) for SMS or [Twilio Programmable Voice API](https://www.twilio.com/voice) for Voice. You will need to provide [your own Twilio credentials](#twilio-configuration). Make sure you use Twilio **Live Credentials**, not the **Test Credentials**. The test credentials are not meant to be used to send messages in a production environment. + +* **Custom**: Sends the messages by invoking the [Send Phone Message Hook](/hooks/extensibility-points/send-phone-message). + +You can also choose if you want to give users the option of getting text messages, voice calls, or both. + +### Twilio configuration + +If you choose to deliver SMS via Twilio, follow these steps to configure your SMS factor. + +![MFA Phone Settings](/media/articles/mfa/mfa-phone-twilio.png) + +1. Open an account with Twilio. You will need a [Twilio Account SID](https://www.twilio.com/help/faq/twilio-basics/what-is-an-application-sid) and a [Twilio Auth Token](https://www.twilio.com/help/faq/twilio-basics/what-is-the-auth-token-and-how-can-i-change-it). These are the Twilio API credentials that Auth0 will use to send messages to your users. + + You may also need to enable permissions for your geographic region for [SMS](https://support.twilio.com/hc/en-us/articles/223181108-How-International-SMS-Permissions-work) and [Voice](https://www.twilio.com/console/voice/calls/geo-permissions). If you use Voice, your account needs to have a Twilio phone number enabled to make Voice calls. This can be an external phone number [verified with Twilio](https://support.twilio.com/hc/en-us/articles/223180048-Adding-a-Verified-Phone-Number-or-Caller-ID-with-Twilio) or you can purchase and set up a Twilio Phone Number from within your account. + +2. Configure the connection. Enter your **Twilio Account SID** and **Twilio Auth Token** in the appropriate fields. + +3. Choose your **SMS Source**. + + * If you choose **Use From**, you will need to enter the **From** phone number that users will see as the sender. You may also configure this in Twilio. + + * If you choose **Use Messaging Services**, you will need to enter a [Messaging Service SID](https://www.twilio.com/docs/sms/services/services-send-messages). + + If you are using Voice, you always need to configure 'From' even if you are using 'Messaging Services' for SMS. Make sure the phone number is configured to send both SMS and Voice messages. + +5. Click **Save**. + +### Custom Phone Messaging providers + +Phone Messaging providers not currently integrated with Auth0 can be implemented by using the [Send Phone Message](/hooks/extensibility-points/send-phone-message) Hook. To learn how to do this in your MFA flow, check the examples for different providers below: + +* [Amazon SNS](/mfa/send-phone-message-hook-amazon-sns) +* [Twilio](/mfa/send-phone-message-hook-twilio) +* [Infobip](/mfa/send-phone-message-hook-infobip) +* [TeleSign](/mfa/send-phone-message-hook-telesign) +* [Vonage](/mfa/send-phone-message-hook-vonage) +* [Esendex](/mfa/send-phone-message-hook-esendex) +* [Mitto](/mfa/send-phone-message-hook-mitto) + +## Custom SMS or Voice Notification Templates + +Optionally, you can [customize your SMS or Voice notification templates](/mfa/guides/customize-phone-messages). + +## Using the Management API to configure Voice or SMS + +You can use the Management API to configure which Message Delivery Methods are enabled by using the `/api/v2/guardian/factors/phone/message-types` endpoint. + +The `messages_types` parameter is an array that can have `["sms"]`, `["voice"]`, or `["sms", "voice"]`. You need a [Management API Token](/api/management/v2/tokens) with the `update:guardian_factors` scope as a Bearer Token to call the API: + + ```har + { + "method": "PUT", + "url": "https://${account.namespace}/api/v2/guardian/factors/phone/message-types", + "headers": [ + { "name": "Content-Type", "value": "application/json" }, + { "name": "Authorization", "value": "Bearer MGMT_API_ACCESS_TOKEN" } + ], + "postData": { + "mimeType": "application/json", + "text": "{ \"message_types\": [\"sms\", \"voice\"] }" + } + } +``` + +## Security Considerations + +When using any phone messaging provider, you need to be aware that attackers abusing the signup flow could cause you financial damage. + +Auth0 will limit a single user to sending up to 10 SMS or voice messages per hour. To further protect your account, you can consider: + +- Enabling [Brute Force Protection](/anomaly-detection/references/brute-force-protection-triggers-actions#100-failed-login-attempts-or-50-sign-up-attempts). Auth0 will block an IP if it attempts to do more than 50 signup requests per minute. + +- Enable [Log Streaming](/logs/streams) and create alerts using your favorite monitoring tool, when you see spikes in the number of `gd_send_voice` or `gd_send_voice_failure` [log events](/logs/references/log-event-type-codes). + +Phone Messaging providers have additional protections. If you are using Twilio, make sure you read the [Anti-Fraud Developer Guide](https://www.twilio.com/docs/usage/anti-fraud-developer-guide). We recommend that you consider the following options: + +- Limit the countries that you will send messages for [SMS](https://support.twilio.com/hc/en-us/articles/223181108-How-International-SMS-Permissions-work) and [Voice](https://support.twilio.com/hc/en-us/articles/223180228-International-Voice-Dialing-Geographic-Permissions-Geo-Permissions-and-How-They-Work). This is particularly useful if there are countries with a higher risk of [toll fraud](https://www.twilio.com/learn/voice-and-video/toll-fraud) or more expensive calling rates in which you do not typically do business. + +- Enable Twilio [usage triggers](https://support.twilio.com/hc/en-us/articles/223132387-Protect-your-Twilio-project-from-Fraud-with-Usage-Triggers) to protect your account against fraud and coding mistakes. + +## Keep Reading + +* [Enroll and Challenge SMS and Voice Authenticators using the MFA API](/mfa/guides/mfa-api/phone) diff --git a/articles/mfa/guides/configure-push.md b/articles/mfa/guides/configure-push.md new file mode 100644 index 0000000000..4bed2fc849 --- /dev/null +++ b/articles/mfa/guides/configure-push.md @@ -0,0 +1,42 @@ +--- +description: Learn how to configure push notification using Guardian SDKs for multi-factor authentication. +topics: + - mfa + - guardian-sdk + - push +contentType: + - how-to +useCase: + - configure-push-notifications +--- +# Configure Push Notifications for MFA + +Use a custom app built using the Guardian SDKs for [iOS](/mfa/guides/guardian/guardian-ios-sdk) and [Android](/mfa/guides/guardian/guardian-android-sdk) that relies on vendor-specific push notification services. + +1. [Create an SNS Platform Application](https://console.aws.amazon.com/sns/v3/home?region=us-east-1#/mobile/push-notifications/platform-applications) using AWS Management console and note it’s ARN. + +2. Create an AWS Access Key authorized to create Platform application endpoints. Guardian automatically creates a platform application endpoint with appropriate device token as part of a successful enrollment. + +3. To receive push notifications from Guardian, it's necessary to override Guardian's default SNS settings. + + Go to the [Multi-factor Authentication](${manage_url}/#/guardian) section of the Dashboard. + +4. Toggle **Custom App** option in the **Push via Auth0 Guardian** section and set your AWS Access Key and ARN from the AWS Management Console. + + Name | Description + -----|------------ + AWS Access Key Id | Your AWS Access Key ID. + AWS Secret Access Key | Your AWS Secret Access Key. + AWS Region | Your AWS application's region. + APNS ARN | The Amazon Resource Name for your [Apple Push Notification Service](http://docs.aws.amazon.com/sns/latest/dg/mobile-push-apns.html). + GCM ARN | The Amazon Resource Name for your [Firebase Cloud Messaging Service](https://docs.aws.amazon.com/sns/latest/dg/sns-mobile-application-as-subscriber.html). + +5. Click **SAVE**. + +## Keep reading + +* [Guardian iOS SDK](/mfa/guides/guardian/guardian-ios-sdk) +* [Guardian Android SDK](/mfa/guides/guardian/guardian-android-sdk) +* [Create Custom Enrollment Tickets](/mfa/guides/guardian/create-enrollment-ticket) +* [Guardian Error Code Reference](/mfa/references/guardian-error-code-reference) +* [Enroll and Challenge Push Authenticators using the MFA API](/mfa/guides/mfa-api/push) diff --git a/articles/mfa/guides/configure-step-up-apis.md b/articles/mfa/guides/configure-step-up-apis.md new file mode 100644 index 0000000000..8b5357dc01 --- /dev/null +++ b/articles/mfa/guides/configure-step-up-apis.md @@ -0,0 +1,217 @@ +--- +title: Configure Step-up Authentication for APIs +description: Learn how an API can check if a user has logged in with Multi-factor Authentication by examining their Access Token. +topics: + - mfa + - step-up-authentication + - apis +contentType: + - how-to + - concept +useCase: + - customize-mfa +--- +# Configure Step-up Authentication for APIs + +With step-up authentication, applications that allow access to different types of resources can require users to authenticate with a stronger mechanism to access sensitive information or perform certain transactions. + +For instance, a user of a bankin app may be allowed to transfer money between accounts only after they have confirmed their identity using multi-factor authentication (MFA). + +When your audience is an API, you can implement step-up authentication with Auth0 using scopes, Access Tokens, and [Rules](/rules/references/use-cases#multi-factor-authentication). + +## How it works + +When an application wants to access an API's protected resources, it must provide an Access Token. The resources that it will have access to depend on the permissions that are included in the Access Token. These permissions are defined as **scopes**. + +For example, a banking API may accept two different levels of authorization: view account balance (scope `view:balance`) or transfer funds (scope `transfer:funds`). When an application asks the API to retrieve the user's balance, then the Access Token should contain the `view:balance` scope. To transfer money to another account, the Access Token should contain the `transfer:funds` scope. + +The flow for this example: + +1. The user logs in to the application using username/password authentication. The standard login gives this user the ability to interact with the API and fetch their balance. This means that the Access Token that the app receives after the user authenticates contains the `view:balance` scope. +2. The application sends a request to the API to retrieve the balance, using the Access Token as credentials. +3. The API validates the token and sends the balance info to the application, so the user can view it. +4. Now the user wishes to transfer funds from one account to another, which is deemed a high-value transaction that requires the `transfer:funds` scope. The application sends a request to the API using the same Access Token. +5. The API validates the token and denies access because the token is missing the required `transfer:funds` scope. +6. The application redirects to Auth0, where a rule is used to challenge the user to authenticate with MFA since a high-value scope was requested. Once the user successfully authenticates with MFA, a new Access Token that includes the correct scope is generated and sent to the application as part of the response. +7. The application sends another transfer funds request using the new Access Token, which includes the `transfer:funds` scope this time. +8. The API validates the token, discards it (thereby treating it like a single-use token), and proceeds with the operation. + +## Validate Access Tokens + +Besides checking the scope, the API must perform additional validation on the Access Token. It must also: + +* verify the token's signature, which is used to verify that the sender of the token is who it says it is and to ensure that the message wasn't changed along the way. + +* validate the standard claims: + + | Claim | Description | + | --- | --- | + | `exp` | Token expiration | + | `iss` | Token issuer | + | `aud` | Intended recipient of the token | + +For more information, see [Validate an Access Token: Custom API Access Tokens](/tokens/guides/validate-access-tokens#custom-api-access-tokens). + +## Sample scenario + +In the following scenario, we will learn how to implement the flow described above. + +For this example, we assume that we have already done the following: + +- [Registered an application](/applications). For this example, we'll use a single-page web app. +- [Created a database connection](${manage_url}/#/connections/database). +- [Registered the API](/apis#how-to-configure-an-api-in-auth0). During this process, we should create two scopes: `view:balance` and `transfer:funds`. +- [Enabled Multi-factor Authentication](/mfa). For this example, we'll use push notifications. + +1. Create a rule that challenges the user to authenticate with MFA when the `transfer:funds` scope is requested. Navigate to [Rules](${manage_url}/#/rules), and create a rule that contains the following content: + + ```js + function(user, context, callback) { + + var CLIENTS_WITH_MFA = ['${account.clientId}']; + // run only for the specified clients + if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) { + // ask for MFA only if scope transfer:funds was requested + if (context.request.query.scope.indexOf('transfer:funds') > -1) { + context.multifactor = { + provider: 'any', + allowRememberBrowser: false + }; + } + } + + callback(null, user, context); + } + ``` + + - The `CLIENTS_WITH_MFA` variable holds the Client IDs of all the applications you want to use this rule. (You can remove this (and the `if` statement that follows) if you don't need it.) + + - The `context.request.query.scope` property contains all the scopes for which the authentication request asked. If it includes the value `transfer:funds`, then we ask for MFA by setting the `context.multifactor` property to the appropriate value. In this case, we are asking for MFA using [Push](/mfa/concepts/mfa-factors#push-notifications). + +2. Configure the app to send the appropriate authentication request to the API, depending on whether the user is attempting to perform the high-value transaction of transferring funds. Notice that the only difference between the two authentication requests (with or without MFA) is the scope. + +
    + +
    +
    +
    +        
    +        https://${account.namespace}/authorize?
    +        audience=https://my-banking-api&
    +        scope=openid%20view:balance&
    +        response_type=id_token%20token&
    +        client_id=${account.clientId}&
    +        redirect_uri=${account.callback}&
    +        nonce=NONCE&
    +        state=OPAQUE_VALUE
    +        
    +      
    +
    +
    +
    +        
    +        https://${account.namespace}/authorize?
    +        audience=https://my-banking-api&
    +        scope=openid%20view:balance%20transfer:funds&
    +        response_type=id_token%20token&
    +        client_id=${account.clientId}&
    +        redirect_uri=${account.callback}&
    +        nonce=NONCE&
    +        state=OPAQUE_VALUE
    +        
    +      
    +
    +
    +
    + +| Parameter | Setting | +| --- | --- | +| `audience` | Set to the **Identifier** of your API (find it at [API Settings](${manage_url}/#/apis/)). We set ours to `https://my-banking-api`. | +| `response_type` | Set to `id_token token` so we get both an ID Token and an Access Token in the response. | +| `client_id` | Set to the Client ID of your application (find it at [Application Settings](${manage_url}/#/applications/${account.clientId}/settings)). | +| `redirect_uri` | Set to a URL in your application that Auth0 should redirect back to after authentication (find it at [Application Settings](${manage_url}/#/applications/${account.clientId}/settings)). | +| `nonce` | Set to a secure string value which will be included in the response from Auth0. This is [used to prevent token replay attacks](/api-auth/tutorials/nonce) and is required for `response_type=id_token token`. | +| `state` | Set to an opaque value that Auth0 includes when redirecting back to the application. This value must be used by the application to [prevent CSRF attacks](/protocols/oauth2/oauth-state). | + +3. Configure the API to validate the incoming token according to the steps described in the [Validate Access Tokens](#validate-access-tokens) section and check the authorized permissions. + + In this scenario, we will configure two endpoints for our API: + + - `GET /balance`: to retrieve the current balance + - `POST /transfer`: to transfer funds + + We will use `Node.js` and a number of modules: + + - [express](https://expressjs.com/): adds the Express web application framework. + - [jwks-rsa](https://github.com/auth0/node-jwks-rsa): retrieves RSA signing keys from a **JWKS** (JSON Web Key Set) endpoint. Using `expressJwtSecret`, we can generate a secret provider that will issue the right signing key to `express-jwt` based on the `kid` in the JWT header. + - [express-jwt](https://github.com/auth0/express-jwt): lets you authenticate HTTP requests using JWT tokens in your Node.js applications. It provides several functions that make working with JWTs easier. + - [express-jwt-authz](https://github.com/auth0/express-jwt-authz): checks if the Access Token contains a specific scope. + + Start with installing the dependencies: + + `npm install express express-jwt jwks-rsa express-jwt-authz --save` + + Next, define the API endpoints, create a middleware function to validate the Access Token, and secure the endpoints using that middleware. The code in your `server.js` file should look like the following sample script: + + ```js + // set dependencies + const express = require('express'); + const app = express(); + const jwt = require('express-jwt'); + const jwksRsa = require('jwks-rsa'); + const jwtAuthz = require('express-jwt-authz'); + + // Create middleware for checking the JWT + const checkJwt = jwt({ + // Dynamically provide a signing key based on the kid in the header and the signing keys provided by the JWKS endpoint + secret: jwksRsa.expressJwtSecret({ + cache: true, + rateLimit: true, + jwksRequestsPerMinute: 5, + jwksUri: `https://${account.namespace}/.well-known/jwks.json` + }), + + // Validate the audience and the issuer + audience: 'https://my-banking-api', // replace with your API's audience, available at Dashboard > APIs + issuer: 'https://${account.namespace}/', + algorithms: [ 'RS256' ] // we are using RS256 to sign our tokens + }); + + // create retrieve balance endpoint + app.get('/balance', checkJwt, jwtAuthz(['view:balance']), function (req, res) { + // code that retrieves the user's balance and sends it back to the calling app + res.status(201).send({message: "This is the GET /balance endpoint"}); + }); + + + // create transfer funds endpoint + app.post('/transfer', checkJwt, jwtAuthz(['transfer:funds']), function (req, res) { + // code that transfers funds from one account to another + res.status(201).send({message: "This is the POST /transfer endpoint"}); + }); + + // launch the API Server at localhost:8080 + app.listen(8080); + console.log('Listening on http://localhost:8080'); + ``` + + Each time the API receives a request the following happens: + + 1. The endpoint calls the `checkJwt` middleware. + 2. `express-jwt` decodes the token and passes the request, the header, and the payload to `jwksRsa.expressJwtSecret`. + 3. `jwks-rsa` downloads all signing keys from the JWKS endpoint and checks if one of the signing keys matches the `kid` in the header of the Access Token. If none of the signing keys match the incoming `kid`, an error is thrown. If there is a match, we pass the right signing key to `express-jwt`. + 4. `express-jwt` continues its own logic to validate the signature of the token, the expiration, audience, and the issuer. + 5. `jwtAuthz` checks if the scope that the endpoint requires is part of the Access Token. + +## Keep reading + +* [Access Tokens](/tokens/concepts/access-tokens) +* [Rules Uses Cases](/rules/references/use-cases#multi-factor-authentication) +* [Scopes](/scopes) +* [Validate Access Tokens](/tokens/guides/validate-access-tokens) +* [Step-up Authentication for Web Apps](/mfa/guides/configure-step-up-for-web-apps) diff --git a/articles/mfa/guides/configure-step-up-web-apps.md b/articles/mfa/guides/configure-step-up-web-apps.md new file mode 100644 index 0000000000..af00fbc2ed --- /dev/null +++ b/articles/mfa/guides/configure-step-up-web-apps.md @@ -0,0 +1,167 @@ +--- +title: Configure Step-up Authentication for Web Apps +description: Learn how to check if a user has logged in your web app with Multi-factor Authentication by examining their ID Token. +topics: + - mfa + - step-up-authentication + - web-apps +contentType: + - how-to + - concept +useCase: + - customize-mfa +--- +# Configure Step-up Authentication for Web Apps + +With step-up authentication, applications that allow access to different types of resources can require users to authenticate with a stronger mechanism to access sensitive information or perform certain transactions. + +For instance, a user may be allowed to access views with sensitive data or reset their password only after confirming their identity using multi-factor authentication (MFA). + +To accomplish step-up authentication for your web app, you will create a rule that challenges the user to authenticate with MFA when the web app asks for it, check the ID Token claims for MFA if the user tries to access a restricted page, and then challenge the user if MFA is not included in the claim. + +## How it works + +When a user logs in, you retrieve an [ID Token](/tokens/concepts/id-tokens), which is a JSON Web Token (JWT) that contains information relevant to the user's session in the form of claims. For this scenario, the relevant claim is `amr`, which indicates the authentication method used during login; it **must** be present in the ID Token's payload and **must** contain the value `mfa`. Because it can contain claims other than `mfa`, when validating you must both test for its existence and examine its contents for a value of `mfa`. + +::: panel Authentication Methods Reference +The `amr` claim is a JSON array of strings that indicates the authentication method used during login. Its values may include any of the pre-defined [Authentication Method Reference Values](https://tools.ietf.org/html/rfc8176). For example, the `amr` claim may contains the pre-defined value `mfa`, which indicates that the user has authenticated using MFA. +::: + +If a user attempts to access a restricted page and the token shows that the user has **not** authenticated with MFA, then you can retrigger authentication, which you have configured to trigger MFA using a rule. Once the user provides the second factor, a new ID Token that contains the `amr` claim is generated and sent to the app. + +## Validate ID Tokens for MFA + +1. Retrieve the ID Token. +2. Verify the token's signature, which is used to verify that the sender of the token is who it says it is and to ensure that the message wasn't changed along the way. +3. Validate the following claims: + + | Claim | Description | + | --- | --- | + | `exp` | Token expiration | + | `iss` | Token issuer | + | `aud` | Intended recipient of the token | + | `amr` | If `amr` does not exist in the payload or does not contain the value `mfa`, the user did not log in with MFA. If `amr` exists in the payload and contains the value `mfa`, then the user did log in with MFA. | + + In the example below, you can compare the potential values included in an ID Token's payload when a user has authenticated with MFA versus when they have not. + +
    + +
    +
    +
    +        
    +{
    +    "iss": "https://${account.namespace}/",
    +    "sub": "auth0|1a2b3c4d5e6f7g8h9i",
    +    "aud": "${account.clientId}",
    +    "iat": 1522838054,
    +    "exp": 1522874054,
    +    "acr": "http://schemas.openid.net/pape/policies/2007/06/multi-factor",
    +    "amr": [
    +        "mfa"
    +    ]
    +}
    +        
    +      
    +
    +
    +
    +        
    +{
    +    "iss": "https://${account.namespace}/",
    +    "sub": "auth0|1a2b3c4d5e6f7g8h9i",
    +    "aud": "${account.clientId}",
    +    "iat": 1522838054,
    +    "exp": 1522874054
    +}
    +        
    +      
    +
    +
    +
    + +## Sample scenario + +In the following scenario, a web app authenticates users with username and password. When users want to access a specific screen with sensitive information, such as salary data, they must authenticate with another factor, such as Guardian push notifications. + +For this example, we assume that we have already done the following: + +- [Registered an application](/applications). For this example, we'll use a regular web app. +- [Created a database connection](${manage_url}/#/connections/database). +- [Enabled Multi-factor Authentication](/mfa/guides/enable-mfa) using push notifications. + +1. Create a rule that challenges the user to authenticate with MFA when the web app requests it. Navigate to [Rules](${manage_url}/#/rules), and create a rule that contains the following content: + + ```js + function(user, context, callback) { + + var CLIENTS_WITH_MFA = ['${account.clientId}']; + // run only for the specified clients + if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) { + // ask for MFA only if the web app said so in the authentication request + if (context.request.query.acr_values === 'http://schemas.openid.net/pape/policies/2007/06/multi-factor'){ + context.multifactor = { + provider: 'any', + allowRememberBrowser: false + }; + } + } + + callback(null, user, context); + } + ``` + + - The `CLIENTS_WITH_MFA` variable holds the Client IDs of all the applications you want to use this rule. (You can remove this (and the `if` statement that follows) if you don't need it.) + + - The `context.request.query.acr_values` property contains the context class that the Authorization Server is being requested to use when processing requests from the application. It only exists when the application includes it in the authentication request. In this example, our web app will include it in the authentication request, but only when a user who has not already authenticated ith MFA tries to access salary information. When our web app includes it, it will set a value of `http://schemas.openid.net/pape/policies/2007/06/multi-factor`, which indicates that we want the Authorization Server to require MFA, and the `context.multifactor` property value that we set in our code will specify MFA via [Push notification](/mfa/concepts/mfa-factors#push-notifications). + +2. Configure the app to check that the user has authenticated using MFA when a user tries to acces the restricted salary information page. (When a user has authenticated with MFA, the ID Token claims contain the `amr` claim with a value of `mfa`). If the user has already authenticated with MFA, then the web app will display the restricted page; otherwise, the web app will send a new authentication request that includes the `acr_values` parameter with a value of `http://schemas.openid.net/pape/policies/2007/06/multi-factor`, which will trigger our rule. + + The web app in this scenario uses the [Authorization Code Flow](/flows/concepts/auth-code) to authenticate, so the request is as follows: + + ```text + https://${account.namespace}/authorize? + audience=https://${account.namespace}/userinfo& + scope=openid& + response_type=code& + client_id=${account.clientId}& + redirect_uri=${account.callback}& + state=YOUR_OPAQUE_VALUE& + acr_values=http://schemas.openid.net/pape/policies/2007/06/multi-factor + ``` + + Once the user authenticates with MFA, the web app receives the authorization code, which must be exchanged for the new ID Token, which should now contain the `amr` claim with a value of `mfa`. To learn how to exchange the code for an ID Token, see [Add Login Using the Authorization Code Flow: Request Tokens](/flows/guides/auth-code/add-login-auth-code#request-tokens). + +3. Validate the incoming ID Token using the steps described in the [Validate ID Tokens for MFA](#validate-id-tokens-for-mfa) section. In this scenario, we perform these validations using the [JSON Web Token Sample Code](https://github.com/auth0/node-jsonwebtoken), which verifies the token's signature (`jwt.verify`), decodes the token, checks whether the payload contains `amr`, and if so, logs the results in the console. + + ```js + const AUTH0_CLIENT_SECRET = '${account.clientSecret}'; + const jwt = require('jsonwebtoken') + + jwt.verify(id_token, AUTH0_CLIENT_SECRET, { algorithms: ['HS256'] }, function(err, decoded) { + if (err) { + console.log('invalid token'); + return; + } + + if (Array.isArray(decoded.amr) && decoded.amr.indexOf('mfa') >= 0) { + console.log('You used mfa'); + return; + } + + console.log('you are not using mfa'); + }); + ``` + +## Keep reading + +* [ID Tokens](/tokens/concepts/id-tokens) +* [Rules Use Cases](/rules/references/use-cases#multi-factor-authentication) +* [JSON Web Tokens](/tokens/concepts/jwts) +* [OpenID Connect (OIDC) specification](http://openid.net/specs/openid-connect-core-1_0.html) +* [Configure Step-up Authentication for APIs](/mfa/guides/configure-step-up-apis) diff --git a/articles/mfa/guides/customize-mfa-universal-login.md b/articles/mfa/guides/customize-mfa-universal-login.md new file mode 100644 index 0000000000..876b69c42d --- /dev/null +++ b/articles/mfa/guides/customize-mfa-universal-login.md @@ -0,0 +1,174 @@ +--- +description: Learn how to customize MFA pages with Universal Login branding options. +topics: + - mfa + - custom-mfa +contentType: + - how-to +useCase: + - customize-mfa +--- +# Customize Multi-Factor Authentication + +::: note +These customizations do not apply to Duo, which has its own UI. +::: + +The multi-factor authentication pages that appear to your users can be customized by adjusting the Universal Login branding options in the [Universal Login Settings](${manage_url}/#/login_settings) section. + +If you need further customization, you can also customize [the full HTML content](/universal-login/multifactor-authentication#customize-the-html-for-the-mfa-page) to reflect your organization's particular UX requirements. + +With the New Universal Login Experience, MFA is presented even more simply to the user. Once they have entered their credentials to log in, they are presented with the MFA screen. If they have no MFA factor enrolled, they will be asked to enroll, and if they do, they will be asked to present their MFA credential. + +![MFA with New UL](/media/articles/universal-login/new-ul-mfa1.png) + +Note that in addition to complying with the requested factor, a user can also click the link at the bottom and be taken to a screen which presents all available MFA factors for this application, and select another to enroll or use. + +![MFA with New UL - Select a Factor](/media/articles/universal-login/new-ul-mfa2.png) + +## Customize via Rules + +If you need to customize the multi-factor experience you are offering to your users, you may do so via custom rules configurations for multi-factor authentication. This might be needed, for example, if you wish to trigger MFA for only specific applications, or for specific users based on user metadata or on IP addresses. + +## MFA API + +Additionally, the [MFA API](/mfa/concepts/mfa-api) is available for other customized MFA requirements. + +You can configure a [rule](/rules/references/use-cases#multi-factor-authentication) in [Dashboard > Rules](${manage_url}/#/rules) for custom multi-factor authentication (MFA) processes, which allow you to define the conditions that will trigger additional authentication challenges. Rules can be used to force MFA for users of certain applications, or for users with particular user metadata or IP ranges, among other triggers. + +::: note +The MFA settings defined in rules will always take precedence over the toggles in the Multi-factor Auth section of the Dashboard. +::: + +## `provider` setting + +The `provider` setting is a way to specify whether to force MFA, and which factor to you use. The behavior is different depending if you use the Classic or the New Universal Login experience: + +| Provider | Classic Experience | New Experience | +|----------------------|:-----------------------:|------------------------:| +| any | Push, SMS or OTP using | Push, SMS, Voice, OTP or Email | +| guardian | Push, SMS or OTP using | Push, SMS, OTP or Email | +| google-authenticator | Google Authenticator | Push, SMS, OTP or Email | +| duo | Duo | Duo | + +If you are using the New Experience you can get the behavior of the Classic experience if you enable customization of the MFA login page. + +The `guardian` and `google-authenticator` options are legacy settings that are kept for backwards compatibility reasons, and should not be used moving forward. We recommend using `any`. The 'google-authenticator' option does not let users enroll a recovery code. + +Setting the `provider` to a specific option manually will override the enabled/disabled toggles in the Dashboard. The following rule will prompt the user to enroll for Duo even if other factor are enabled in the Dashboard: + +```js +function (user, context, callback) { + + // Forcing the provider to Duo programmatically + context.multifactor = { + provider: 'duo' + }; + + callback(null, user, context); +} +``` + +## Implement contextual MFA + +The exact requirements for configuring Contextual MFA will vary. Below are sample snippets you might consider using as you customize your specific solution. + +### Customize MFA for select users + +You may customize MFA to run only for users who are authenticating against specific applications in your tenant, or only for users who are marked to use MFA. To enable this behavior you need to have the "Always require Multi-factor Authentication" toggle turned off, and enable MFA using a rule for specific users or applications. + +```js +function (user, context, callback) { + + //var CLIENTS_WITH_MFA = ['REPLACE_WITH_YOUR_CLIENT_ID']; + // run only for the specified applications + // if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) { + // uncomment the following if clause in case you want to request a second factor only from user's that have user_metadata.use_mfa === true + // if (user.user_metadata && user.user_metadata.use_mfa){ + context.multifactor = { + provider: 'any', + allowRememberBrowser: false + }; + // } + //} + + callback(null, user, context); +} +``` + +If you choose to selectively apply MFA, you will need the appropriate `clientID` values, and the code will be executed as part of a [Rule](/rules) whenever a user logs in. + +More specifically, you will uncomment and populate the following line of the rule template above with the appropriate client IDs: + +`var CLIENTS_WITH_MFA = ['REPLACE_WITH_CLIENT_ID'];` + +By setting `allowRememberBrowser: false`, the user will always be prompted for MFA when they login. This prevents the browser cookie from saving the credentials and helps make logins more secure, especially from untrusted machines. + +### Change authentication request frequency + +In some scenarios you may want to avoid prompting the user for MFA each time they log in from the same browser. The default behavior is: + +- The user will be prompted for MFA every 30 days when `provider` is set to `google-authenticator` or `duo` +- The user will be able to decide if they want to skip MFA for the next 30 days when `provider` is set to other values. + +You can alter that behavior by using the `allowRememberBrowser` property: + +```JS +function (user, context, callback) { + + if (conditionIsMet()){ + context.multifactor = { + allowRememberBrowser: false, + provider: 'any' + }; + } + + callback(null, user, context); +} +``` + +Depending on the property value the behavior will be as follows: + +- `true`: when `provider` is set to `google-authenticator` or `duo`, the user will be prompted for MFA once every 30 days. For other provider values, the user will be able to decide if they want to skip MFA for the next 30 days. +- `false`: the user will be prompted for MFA each time they authenticate. + +::: note +These time values are for active users. If a user is inactive for a period of seven days or more, their cookie will expire anyway, and they will be prompted for MFA on their next login attempt, even if `allowRememberBrowser` is `true` and it has not been thirty days since their last MFA prompt. +::: + +In order to let the user skip MFA, a cookie will be stored in the user's browser. If the user has the cookie set but you still want the user to perform MFA, you have these options: + +- Set `allowRememberBrowser` to `false` +- Set `acr_values` to `http://schemas.openid.net/pape/policies/2007/06/multi-factor` when calling the `/authorize` endpoint. + +If you want to require a specific user to be prompted for MFA during their next log in, you can call the [Invalidate Remember Browser API endpoint](https://auth0.com/docs/api/management/v2#!/Users/post_invalidate_remember_browser). This is useful for situations where the user loses a trusted device. + +### Customize MFA for users outside the network + +Assuming that access to the specified network of internal IP addresses is well controlled, you can also have Auth0 request MFA from only users whose requests originate from outside the corporate network: + +```js +function (user, context, callback) { + var ipaddr = require('ipaddr.js'); + var corp_network = "192.168.1.134/26"; + + var current_ip = ipaddr.parse(context.request.ip); + if (!current_ip.match(ipaddr.parseCIDR(corp_network))) { + context.multifactor = { + provider: 'any', + allowRememberBrowser: false + }; + } + + callback(null, user, context); +} +``` + +## Customize MFA with social connections + +If you are using MFA after an authentication with one or more social providers, you need to use your own application `ID` and `Secret` in the connection to the provider's site in place of the default Auth0 development credentials. For instructions on how to get the credentials for each social provider, select your particular from the list at: [Identity Providers](/identityproviders). In production usage, you should always use your own credentials instead of [Auth0 devkeys](/connections/social/devkeys). + +## Keep reading + +* [Resource Owner](/mfa/guides/mfa-api/multifactor-resource-owner-password) +* [Configure Silent Authentication](/api-auth/tutorials/silent-authentication) \ No newline at end of file diff --git a/articles/mfa/guides/customize-phone-messages.md b/articles/mfa/guides/customize-phone-messages.md new file mode 100644 index 0000000000..a33701d54b --- /dev/null +++ b/articles/mfa/guides/customize-phone-messages.md @@ -0,0 +1,54 @@ +--- +description: Customize SMS or Voice Messages +topics: + - mfa + - guardian + - sms +contentType: + - how-to +useCase: + - customize-mfa +--- +# Customize SMS or Voice Messages + +To customize the SMS or Voice messages sent by Auth0 during enrollment or verification, do the following: + +First, go to the [Multi-factor Auth page](${manage_url}/#/mfa), then click on the **Phone** box to configure your Phone Messaging settings. + +![MFA Phone Settings](/media/articles/mfa/mfa-phone-templates.png) + +You have two fields to customize your messages: + +* **Enrollment Template**: the message sent by Auth0 during enrollment. +* **Verification Template**: the message sent by Auth0 during authentication. + +[Liquid](https://github.com/Shopify/liquid/wiki/Liquid-for-Designers) syntax is the supported templating engine to use when accessing user attributes in SMS templates. The following attributes are available: + +* `message_type`: Can be "sms" or "voice", and can be used to indicate which kind of message is being sent. +* `code`: The Enrollment/Verification code. When sending voice messages, this variable will have the value with dots between the digits (e.g. ‘1.2.3.4.5.6’), so it can be pronounced as independent digits by voice messaging providers. +* `locale`: When using the New Universal Login experience or the MFA API, it will have the the [language selected for the login flow](/universal-login/i18n). +* `requestInfo.lang`: The browser Accept-Language header (ie, `es-AR,es;q=0.8`,`en-US,en`, and so on.). It can be used for localization when using the Classic Login Experience. +* `tenant.friendlyName`: The **Friendly Name** set in [Tenant Settings](${manage_url}/#/tenant). +* `pause`: A special variable that can be used when you want to make a pause during a voice message. + +## Examples + +``` +{% if message_type == "voice" %} + {% if locale contains "fr" %} + Bonjour, vous avez demandé à recevoir un code de vérification pour vous enregister avec {{tenant.friendly_name}}. Votre code est: {{pause}} {{code}}. Je répète, votre code est: {{pause}}{{code}}. + {% elsif locale contains "es" %} + Usted ha requerido un código de verificación para inscribirse con {{tenant.friendly_name}}. Su código es: {{pause}}{{code}}. Repito, su código es: {{pause}}{{code}}. + {% else %} + Hello, you requested a verification code to enroll with {{tenant.friendly_name}}. Your code is: {{pause}}{{code}}. I repeat, your code is: {{pause}}{{code}}. + {% endif %} +{% else %} + {% if locale contains "fr" %} + {{code}} est votre code de vérification pour vous enregistrer avec {{tenant.friendly_name}}. + {% elsif locale contains "es" %} + {{code}} es su código para inscribirse con {{tenant.friendly_name}}. + {% else %} + {{code}} is your verification code to enroll with {{tenant.friendly_name}}. + {% endif %} +{% endif %} +``` diff --git a/articles/mfa/guides/enable-mfa.md b/articles/mfa/guides/enable-mfa.md new file mode 100644 index 0000000000..fc86a9e176 --- /dev/null +++ b/articles/mfa/guides/enable-mfa.md @@ -0,0 +1,40 @@ +--- +description: Learn how to enable MFA in the Dashboard. +topics: + - mfa +contentType: + - how-to +useCase: + - enable-mfa-dashboard +--- +# Enable Multi-Factor Authentication + +To enable MFA, you toggle on the factors (such as push notifications or SMS) you choose to enable in the Dashboard on your tenant. Next, you perform any further setup required to configure that factor, and last, you choose whether you wish to force MFA for all users or not. + +You can also customize your MFA flow with Auth0 [Rules](/rules/references/use-cases#multi-factor-authentication), to allow MFA to only be required in specific circumstances or force a particular factor to be used. + +1. To enable the factors you require, go to [Dashboard > Multifactor Auth](${manage_url}/#/mfa). Here you will find a series of toggles for the MFA factors supported by Auth0. + +![MFA Dashboard Page](/media/articles/mfa/mfa-dashboard.png) + +Any or all of these factors can be enabled simultaneously. When logging in the first time, the user will be shown the most secure factor available, but will be allowed to choose another factor to use if you have more than one factor enabled in the Dashboard. The Phone messaging and the Duo factors require further setup. You will have to click on the factor and fill in a few further settings before continuing. + +::: note +Duo will only be available to end-users as a factor if it is the only factor that is enabled. +::: + +2. Under **Policies**, next to **Require Multi-factor Auth**, choose **Always** or **Never**. If set to **Always**, users will be able to use any of the factors enabled in the Dashboard. + +3. Click **Save**. + +4. Configure your [factors](/mfa/concepts/mfa-factors). + +## Keep reading + +* [Configure Push Notifications for MFA](/mfa/guides/configure-push) +* [Configure One Time Passwords for MFA](/mfa/guides/configure-otp) +* [Configure SMS or Voice Notifications for MFA](/mfa/guides/configure-phone) +* [Configure Email Notifications for MFA](/mfa/guides/configure-email) +* [Configure Cisco Duo](/mfa/guides/configure-cisco-duo) +* [Customize SMS or Voice Messages](/mfa/guides/customize-phone-messages) +* [Customize Multi-factor Authentication](/mfa/guides/customize-mfa-universal-login) diff --git a/articles/mfa/guides/guardian/create-enrollment-ticket.md b/articles/mfa/guides/guardian/create-enrollment-ticket.md new file mode 100644 index 0000000000..f50d2e5fef --- /dev/null +++ b/articles/mfa/guides/guardian/create-enrollment-ticket.md @@ -0,0 +1,134 @@ +--- +description: Learn how to create an enrollment ticket from the MFA API. +topics: + - mfa + - step-up-authentication + - api + - custom-enrollment + - tickets +contentType: + - how-to +useCase: + - customize-mfa +--- +# Create Custom Enrollment Tickets + +It is also possible to manage users' enrollments by creating _enrollment tickets_ via the [post_ticket API](/api/management/v2#!/Guardian/post_ticket). + +This API will return an _enrollment ticket_ containing a `ticket_id` and a `ticket_url`, which can be used to enroll a user. + +The `ticket_url` can be delivered to the user (for instance, via email) and used to kick off the enrollment process. + +Alternatively, the ticket can be leveraged inside the [MFA Page](${manage_url}/#/mfa_page) to customize the Auth0 MFA widget's appearance: + +```html + + + + 2nd Factor Authentication + + + + + + + +
    +
    +

    Welcome! {{ userData.email }} enroll your device

    +
    + + +
    +
    +
    +
    + + + + + + +``` + +This custom page displays the Auth0 MFA widget in both enrollment and standard multi-factor authentication (MFA) login scenarios. You can use the ticket variable to check which scenario is in use and control the content accordingly. + +For example, the following code displays a different message depending on whether the user is enrolling or authenticating: + +```html +{% if ticket %} +

    Welcome, {{ userData.email }}, enroll your device below

    +{% else %} +

    Welcome back, {{ userData.email }}, authenticate below

    +{% endif %} +```` + +::: note +The conditional logic around the existence of the `ticket` variable is also used in the initialization of the `Auth0MFAWidget` above. +::: + +## Keep reading + +* [MFA Widget Reference](/mfa/references/mfa-widget-reference) \ No newline at end of file diff --git a/articles/mfa/guides/guardian/guardian-android-sdk.md b/articles/mfa/guides/guardian/guardian-android-sdk.md new file mode 100644 index 0000000000..48f60e38c5 --- /dev/null +++ b/articles/mfa/guides/guardian/guardian-android-sdk.md @@ -0,0 +1,162 @@ +--- +title: Guardian for Android SDK +description: Learn how to install, use and configure options for the Guardian for Android SDK. +topics: + - mfa + - guardian + - android +contentType: + - how-to +useCase: + - customize-mfa +--- +# Guardian for Android SDK + +The [Guardian for Android SDK](https://github.com/auth0/Guardian.Android) helps you create Android apps with Guardian functionality, providing secure access to multi-factor authentication (MFA) with push notifications. With this toolkit you can build your own customized version of the Guardian application that matches the look and feel of your organization. + +## Requirements + +Android API level 15+ is required in order to use the Guardian Android SDK. + +## Install Guardian Android SDK + +Guardian is available both in [Maven Central](http://search.maven.org) and [JCenter](https://bintray.com/bintray/jcenter). + +1. To start using *Guardian* add these lines to your `build.gradle` dependencies file: + + ```gradle + implementation 'com.auth0.android:guardian:0.4.0' + ``` + +::: note +You can check for the latest version on the repository [Releases](https://github.com/auth0/GuardianSDK.Android/releases) tab, in [Maven](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.auth0.android%22%20AND%20a%3A%22guardian%22), or in [JCenter](https://bintray.com/auth0/android/Guardian.Android). +::: + +2. After adding your Gradle dependency, make sure to remember to sync your project with Gradle files. + +<%= include('../../_includes/_enable-push-notifications') %> + +<%= include('../../_includes/_configure-sns') %> + +## Use the SDK + +Guardian is the core of the SDK. You'll need to create an instance of this class for your specific tenant/url. + +```java +Uri url = Uri.parse("https://tenant.guardian.auth0.com/"); + +Guardian guardian = new Guardian.Builder() + .url(url) + .build(); +``` + +or + +```java +String domain = "tenant.guardian.auth0.com"; + +Guardian guardian = new Guardian.Builder() + .domain(domain) + .build(); +``` + +### Enroll + +The link between the second factor (an instance of your app on a device) and an Auth0 account is referred to as an enrollment. + +You can create an enrollment using the `Guardian.enroll` function, but first you'll have to create a new pair of RSA keys for it. The private key will be used to sign the requests to allow or reject a login. The public key will be sent during the enroll process so the server can later verify the request's signature. + +```java +KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); +keyPairGenerator.initialize(2048); // you MUST use at least 2048 bit keys +KeyPair keyPair = keyPairGenerator.generateKeyPair(); +``` + +Next, obtain the enrollment information by scanning the Guardian QR code, and use it to enroll the account: + +```java +Uri enrollmentUriFromQr = ...; // the URI obtained from a Guardian QR code + +CurrentDevice device = new CurrentDevice(context, "fcmToken", "deviceName"); + +Enrollment enrollment = guardian + .enroll(enrollmentUriFromQr, device, keyPair) + .execute(); +``` + +Alternatively, you can execute the request in a background thread: + +```java +guardian + .enroll(enrollmentUriFromQr, device, keyPair) + .start(new Callback { + @Override + void onSuccess(Enrollment enrollment) { + // we have the enrollment data + } + + @Override + void onFailure(Throwable exception) { + // something failed + } + }); +``` + +The `deviceName` and `fcmToken` are data that you must provide: + +- The `deviceName` is the name that you want for the enrollment. It will be displayed to the user when the second factor is required. +- The `fcmToken` is the token for Firebase Cloud Messaging push notification service. See the [docs](https://firebase.google.com/docs/cloud-messaging/android/client#sample-register) for more information about the FCM token. + +### Unenroll + +To disable multi-factor authentication you can delete the enrollment: + +```java +guardian + .delete(enrollment) + .execute(); // or start(new Callback<> ...) +``` + +### Allow a login request + +Once you have the enrollment in place, you'll receive a FCM push notification every time the user needs multi-factor authentication. + +Guardian provides a method to parse the `Map` data inside the [RemoteMessage](https://firebase.google.com/docs/reference/android/com/google/firebase/messaging/RemoteMessage) received from FCM and return a `Notification` instance ready to be used. + +```java +// at the FCM listener you receive a RemoteMessage +@Override +public void onMessageReceived(RemoteMessage message) { + Notification notification = Guardian.parseNotification(message.getData()); + if (notification != null) { + // you received a Guardian notification, handle it + handleGuardianNotification(notification); + return; + } + + /* handle other push notifications you might be using ... */ +} +``` + +Once you have the notification instance, you can approve the authentication request by using the `allow` method. You'll also need the enrollment that you obtained previously. If there are multiple enrollments, be sure to use the one that has the same `id` as the notification (the `enrollmentId` property). + +```java +guardian + .allow(notification, enrollment) + .execute(); // or start(new Callback<> ...) +``` + +### Reject a login request + +To deny an authentication request, use `reject` instead. You can also add an optional reason for the rejection, which will be available in the guardian logs. + +```java +guardian + .reject(notification, enrollment) // or reject(notification, enrollment, reason) + .execute(); // or start(new Callback<> ...) +``` + +## Keep reading + +* [Getting Started with Google Cloud Messaging for Android](https://docs.aws.amazon.com/sns/latest/dg/mobile-push-gcm.html) +* diff --git a/articles/mfa/guides/guardian/guardian-ios-sdk.md b/articles/mfa/guides/guardian/guardian-ios-sdk.md new file mode 100644 index 0000000000..125aa8a0c3 --- /dev/null +++ b/articles/mfa/guides/guardian/guardian-ios-sdk.md @@ -0,0 +1,187 @@ +--- +title: Guardian for iOS SDK +description: Learn how to install, use and configure options for the Guardian for iOS SDK. +topics: + - mfa + - guardian + - ios +contentType: + - how-to +useCase: + - customize-mfa +--- +# Guardian for iOS SDK + +The [Guardian for iOS Software Development Kit](https://github.com/auth0/GuardianSDK.iOS) helps you create iOS apps with Guardian functionality, providing secure access to multi-factor authentication (MFA) with push notifications. With this toolkit you can build your own customized version of the Guardian application that matches the look and feel of your organization. + +For more general information on MFA, see [multi-factor authentication](/mfa). + +## Requirements + +The Guardian iOS SDK requires iOS 9.3+ and Swift 3. + +## Install Guardian iOS SDK + +### CocoaPods + +Guardian.swift is available through [CocoaPods](http://cocoapods.org). +To install it, simply add the following line to your Podfile: + +```ruby +pod "Guardian" +``` + +### Carthage + +In your Cartfile add this line + +``` +github "auth0/Guardian.swift" +``` + +<%= include('../../_includes/_enable-push-notifications') %> + +<%= include('../../_includes/_configure-sns') %> + +## Using the SDK + +`Guardian` is the core of the SDK. To get things going you'll have to import the library: + +```swift +import Guardian +``` + +Then you'll need the Auth0 Guarduan domain for your account: + +```swift +let domain = "{YOUR_ACCOUNT_NAME}.guardian.auth0.com" +``` + +### Enroll + +An enrollment is a link between the second factor and an Auth0 account. When an account is enrolled you'll need it to provide the second factor required to verify the identity. + +For an enrollment you need the following things, besides your Guardian Domain: + +- Enrollment Uri: The value encoded in the QR Code scanned from Guardian Web Widget or in your enrollment ticket sent to you, for example, by email. +- APNS Token: Apple APNS token for the device and **MUST** be a `String`containing the 64 bytes (expressed in hexadecimal format) +- Key Pair: A RSA (Private/Public) key pair used to assert your identity with Auth0 Guardian + +::: note +In case your app is not yet using push notifications or you're not familiar with it, you should check their [docs](https://developer.apple.com/go/?id=push-notifications). +::: + +After your have all of them, you can enroll your device: + +```swift +Guardian + .enroll(forDomain: "{YOUR_GUARDIAN_DOMAIN}", + usingUri: "{ENROLLMENT_URI}", + notificationToken: "{APNS_TOKEN}", + keyPair: keyPair) + .start { result in + switch result { + case .success(let enrollment): + // success, we have the enrollment data available + case .failure(let cause): + // something failed, check cause to see what went wrong + } + } +``` + +On success you'll obtain the enrollment information, that should be secured stored in your application. This information includes the enrollment identifier, and the token for Guardian API associated to your device for updating or deleting your enrollment. + +#### RSA key pair + +Guardian.swift provides a convenience class to generate an RSA key pair and store it in iOS Keychain. + +```swift +let rsaKeyPair = RSAKeyPair.new( + usingPublicTag: "com.auth0.guardian.enroll.public", + privateTag: "com.auth0.guardian.enroll.private" + ) +``` + +::: note +The tags should be unique since it's the identifier of each key inside iOS Keychain. +::: + +::: note +Since the keys are already secured stored inside iOS Keychain, you olny need to store the identifiers +::: + +### Allow a login request + +Once you have the enrollment in place, you will receive a push notification every time the user has to validate their identity with MFA. + +Guardian provides a method to parse the data received from APNs and return a `Notification` instance ready to be used. + +```swift +if let notification = Guardian.notification(from: notificationPayload) { + // we have received a Guardian push notification +} +``` + +Once you have the notification instance, you can easily allow the authentication request by using +the `allow` method. You'll also need the enrollment that you obtained previously. +In case you have more than one enrollment, you'll have to find the one that has the same `id` as the +notification (the `enrollmentId` property). + +```swift +Guardian + .authentication(forDomain: "{YOUR_GUARDIAN_DOMAIN}", andEnrollment: enrollment) + .allow(notification: notification) + .start { result in + switch result { + case .success: + // the auth request was successfully allowed + case .failure(let cause): + // something failed, check cause to see what went wrong + } + } +``` + +### Reject a login request + +To deny an authentication request call `reject` instead. You can also send an optional reject reason if +you want. The reject reason will be available in the guardian logs. + +```swift +Guardian + .authentication(forDomain: "{YOUR_GUARDIAN_DOMAIN}", andEnrollment: enrollment) + .reject(notification: notification) + // or reject(notification: notification, withReason: "hacked") + .start { result in + switch result { + case .success: + // the auth request was successfully rejected + case .failure(let cause): + // something failed, check cause to see what went wrong + } + } +``` + +### Unenroll + +If you want to delete an enrollment -for example if you want to disable MFA- you can make the +following request: + +```swift +Guardian + .api(forDomain: "{YOUR_GUARDIAN_DOMAIN}") + .device(forEnrollmentId: "{USER_ENROLLMENT_ID}", token: "{ENROLLMENT_DEVICE_TOKEN}") + .delete() + .start { result in + switch result { + case .success: + // success, the enrollment was deleted + case .failure(let cause): + // something failed, check cause to see what went wrong + } + } +``` + +## Keep reading + +* [Configure Push Notifications for MFA](/mfa/guides/configure-push) +* [Getting Started with Apple Push Notification Service](https://docs.aws.amazon.com/sns/latest/dg/mobile-push-apns.html) diff --git a/articles/mfa/guides/guardian/install-guardian-sdk.md b/articles/mfa/guides/guardian/install-guardian-sdk.md new file mode 100644 index 0000000000..a1fe64bcfc --- /dev/null +++ b/articles/mfa/guides/guardian/install-guardian-sdk.md @@ -0,0 +1,221 @@ +--- +description: Learn how to install, use and configure options for the Guardian SDKs. +topics: + - mfa + - guardian + - ios +contentType: + - how-to +useCase: + - customize-mfa +--- +# Install Guardian SDK + +The Guardian SDK provides a UI-less client for Guardian. + +```text +npm install auth0-guardian-js +``` + +## Source files + +* [Full Version](https://cdn.auth0.com/js/guardian-js/1.3.3/guardian-js.js) +* [Minified Version](https://cdn.auth0.com/js/guardian-js/1.3.3/guardian-js.min.js) + +## Configure Guardian + +```js +var auth0GuardianJS = require('auth0-guardian-js')({ + // For US tenants: https://{name}.guardian.auth0.com + // For AU tenants: https://{name}.au.guardian.auth0.com + // For EU tenants: https://{name}.eu.guardian.auth0.com + serviceUrl: "https://{{ userData.tenant }}.guardian.auth0.com", + requestToken: "{{ requestToken }}", // or ticket: "{{ ticket }}" - see below + + issuer: { + // The issuer name to show in OTP Generator apps + label: "{{ userData.tenantFriendlyName }}", + name: "{{ userData.tenant }}", + }, + + // The account label to show in OTP Generator apps + accountLabel: "{{ userData.friendlyUserId }}", + + // Optional, for debugging purpose only, + // ID that allows to associate a group of requests + // together as belonging to the same "transaction" (in a wide sense) + globalTrackingId: "{{ globalTrackingId }}" +}); +``` + +Use of `requestToken` or `ticket` depends on the authentication method. Ticket corresponds to a previously generated [enrollment ticket](/mfa/guides/guardian/create-enrollment-ticket). + +## Enroll devices + +Enrolling devices consists of the following steps: + +1. Start the transaction. +2. (optional) Chck if the user is already enrolled. You cannot enroll twice. +3. Send the information needed to enroll. +4. Confirm enrollment. +5. Show recovery code. + +Some steps can be omitted depending on the method, we provide the same interface for all methods so you can write uniform code. Some of the methods end up completing the authentication, whereas some others need an extra authentication step. You can know that by listening to the `enrollment-complete` event. + +```js +function enroll(transaction, method) { + if (transaction.isEnrolled()) { + console.log('You are already enrolled'); + return; + } + + var enrollData = {}; + + if (method === 'sms') { + enrollData.phoneNumber = prompt('Phone number'); // Collect phone number + } + + return transaction.enroll(method, enrollData, function (err, otpEnrollment) { + if (err) { + console.error(err); + return; + } + + var uri = otpEnrollment.getUri(); + if (uri) { + showQR(uri); + } + + var confirmData = {}; + if (method === 'otp' || method === 'sms') { + confirmData.otpCode = prompt('Otp code'); // Collect verification otp + } + + otpEnrollment.confirm(confirmData); + }); +} + +auth0GuardianJS.start(function(err, transaction) { + if (err) { + console.error(err); + return; + } + + transaction.on('error', function(error) { + console.error(error); + }); + + transaction.on('timeout', function() { + console.log('Timeout'); + }); + + transaction.on('enrollment-complete', function(payload) { + if (payload.recoveryCode) { + alert('Recovery code is ' + payload.recoveryCode); + } + + if (payload.authRequired) { + showAuthenticationFor(transaction, payload.enrollment); + return; + } + }); + + transaction.on('auth-response', function(payload) { + if (payload.recoveryCode) { + alert('The new recovery code is ' + payload.recoveryCode); + } + + if (!payload.accepted) { + alert('Authentication has been rejected'); + return; + } + + auth0GuardianJS.formPostHelper('{{ postActionURL }}', { signature: payload.signature }); + }); + + var availableEnrollmentMethods = transaction.getAvailableEnrollmentMethods(); + + method = prompt('What method do you want to use, select one of ' + + availableEnrollmentMethods.join(', ')); + + enroll(transaction, method) // For sms +}); +``` + +## Authenticate + +To authenticate with a method you need to execute the following steps: + +1. Start the transaction. +2. (optional) Check if the user is already enrolled. You need to be enrolled to authenticate. +3. Request the auth (the push notification / sms). Request is a noop for OTP. +4. Verify the otp (`.verify` is a noop for push) + +Some steps can be omitted depending on the method, we provide the same interface for all methods so you can write uniform code. After the factor is verified or the push accepted you will receive an `auth-response` event with the payload to send to the server, you can use the `auth0GuardianJS.formPostHelper('{{ postActionURL }}', payload)` to post back the message to the server. + +You may also receive `auth-rejected` if the push notification was received. + +```js +function authenticate(method) { + auth0GuardianJS.start(function (err, transaction) { + if (err) { + console.error(err); + return; + } + + if (!transaction.isEnrolled()) { + console.log('You are not enrolled'); + return; + } + + transaction.on('error', function(error) { + console.error(error); + }); + + transaction.on('timeout', function() { + console.log('Timeout'); + }); + + transaction.on('auth-response', function(payload) { + if (payload.recoveryCode) { + alert('The new recovery code is ' + payload.recoveryCode); + } + + if (!payload.accepted) { + alert('Authentication has been rejected'); + return; + } + + auth0GuardianJS.formPostHelper('{{ postActionURL }}', { signature: payload.signature }); + }); + + var enrollment = transaction.getEnrollments()[0]; + + if (enrollment.getAvailableAuthenticatorTypes().length === 0) { + alert('Somethings went wrong, seems that there is no authenticators'); + return; + } + + transaction.requestAuth(enrollment, { method: method } function(err, auth) { + if (err) { + console.error(err); + return; + } + + var data = {}; + if (method === 'sms' || method === 'otp') { + data.otpCode = prompt('Otp code'); + } else if (method === 'recovery-code') { + data.recoveryCode = prompt('Recovery code'); + } + + return auth.verify(data); + }); + }); +} +``` + +## Keep reading + +* [Full Guardian API](https://github.com/auth0/auth0-guardian.js#full-api) +* [Guarding SDK Error Code Reference](/mfa/references/guardian-error-code-reference) diff --git a/articles/mfa/guides/import-user-mfa.md b/articles/mfa/guides/import-user-mfa.md new file mode 100644 index 0000000000..963de16bd9 --- /dev/null +++ b/articles/mfa/guides/import-user-mfa.md @@ -0,0 +1,163 @@ +--- +description: Import MFA enrollments for your existing users. +topics: + - mfa +contentType: + - how-to +useCase: + - import-mfa +--- +# Import Multi-Factor Authenticators + +You can import a user's MFA enrollments with [automatic migration](/users/guides/configure-automatic-migration) and [bulk user imports](/users/guides/bulk-user-imports). The supported enrollment types are: + +* Email: for [email](/mfa/concepts/mfa-factors#email-notifications) verification. +* Phone: for [SMS](/mfa/concepts/mfa-factors#sms-notifications) or [Voice](/mfa/concepts/mfa-factors#voice-notifications) verification. +* TOTP: for [One-Time Passwords (OTP)](/mfa/concepts/mfa-factors#one-time-passwords) used with authenticator applications, such as Google Authenticator. + +Importing MFA enrollments provides a seamless user experience, since users won't have to re-enroll after migration. + +::: warning +Please note that the classic login experience does not support factor selection for users with multiple factors. If you plan to import users with multiple registered factors, consider using the [universal login](/universal-login) experience. + +::: + +## Schema + +The schema applies to MFA factors for both of the aforementioned workflows. + +```json +{ + "type": "array", + "items": { + "type": "object", + "properties": { + "totp": { + "type": "object", + "properties": { + "secret": { + "type": "string", + "pattern": "^[A-Z2-7]+$", + "description": "The OTP secret is used for MFA authentication with Google Authenticator type apps. It must be supplied in un-padded Base32 encoding, such as: JBTWY3DPEHPK3PNP" + }, + }, + "additionalProperties": false, + "required": ["secret"], + }, + "phone": { + "type": "object", + "properties": { + "value": { + "type": "string", + "pattern": "^\\+[0-9]{1,15}$", + "description": "The phone number for SMS or Voice MFA. The phone number should include a country code and begin with +, such as: +12125550001" + }, + }, + "additionalProperties": false, + "required": ["value"], + }, + "email": { + "type": "object", + "properties": { + "value": { + "type": "string", + "format": "email", + "description": "The email address for MFA" + }, + }, + "additionalProperties": false, + "required": ["value"], + }, + }, + "maxProperties": 1, + "additionalProperties": false, + }, + "minItems": 1, + "maxItems": 10 +} +``` + +## Bulk User Import + +To begin, prepare a `users.json` file as described [here](/users/guides/bulk-user-imports). Be sure to include any existing MFA enrollments for each user. Next, start a bulk user import (described in more detail [here](/users/guides/bulk-user-imports#request-bulk-user-import)). You can _update_ the factors of any existing users by enabling the `upsert` option in your initial request. + +Once the import job completes, check the response for any errors. If any of the users' MFA factors failed to import, you will see errors such as: + +```json +{ + "code": "MFA_FACTORS_FAILED", + "message": "Unable to import factors" +} +``` + +When using the `upsert` option, any non-MFA related updates to existing users will have been applied to the user's profile. For example, the following error summary shows the user's `picture` attribute was successfully set to `http://example.org/jdoe.png`, however we were unable to import the provided MFA factors. In cases like this it is safe to retry the import for failed users. + +```json +[ + { + "user": { + "email": "antoinette@contoso.com", + "picture": "http://example.org/jdoe.png", + "mfa_factors": [ + { + "totp": { + "secret": "2PRXZWZAYYDAWCD" + } + }, + { + "phone": { + "value": "+15551112233" + } + }, + { + "email": { + "value": "antoinette@antoinette.biz" + } + } + ] + }, + "errors": [ + { + "code": "MFA_FACTORS_FAILED", + "message": "Unable to import factors" + } + ] + } +] +``` + +## Automatic Migration + +MFA enrollments can also be imported during an [automatic migration](/connections/database/custom-db/overview-custom-db-connections#automatic-migration-scenario). This can be accomplished by providing any existing enrollments in the `mfa_factors` field of the user that is provided to the callback at the end of your custom DB [login script](/connections/database/custom-db/templates/login). + +Any failures will appear in your tenant logs as failed logins, and will be distinguishable from other failures by their description: `Unable to import MFA factors`. For instance: + +```json +{ + "_id": "5e9df3b29ebabe00571c04a7", + "date": "2020-04-20T19:10:42.916Z", + "type": "fu", + "description": "Unable to import MFA factors.", + "connection": "Username-Password-Authentication", + "connection_id": "con_mMkvaycgzgCS0p0z", + "client_id": "aCbTAJNi5HbsjPJtRpSP6BIoLPOrSj2Cgg", + "client_name": "All Applications", + "ip": "10.12.13.1", + "client_ip": null, + "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36", + "details": { + "error": { + "message": "Unable to import MFA factors." + } + }, + "user_name": "test@test.io", + "strategy": "auth0", + "strategy_type": "database" +} +``` + +## Recovery Codes + +Auth0 does not provide a way to import Recovery Codes. When the users's MFA factors are imported, they won't have a recovery code. + +If you want to provide users for a recovery code, you can check if they have one enrolled, and if not, use the [recovery code regeneration](/api/management/v2#!/Users/post_recovery_code_regeneration) API endpoint to generate a new one. diff --git a/articles/mfa/guides/mfa-api/authenticate.md b/articles/mfa/guides/mfa-api/authenticate.md new file mode 100644 index 0000000000..219932f6e9 --- /dev/null +++ b/articles/mfa/guides/mfa-api/authenticate.md @@ -0,0 +1,137 @@ +--- +title: Authenticate With Resource Owner Password Grant and MFA +description: Authenticate With Resource Owner Password Grant and MFA +topics: + - mfa + - mfa-api + - mfa-authenticators + - otp +contentType: + - how-to + - reference +useCase: + - customize-mfa +--- +# Authenticate With Resource Owner Password Grant and MFA + +This guide explains how to use the MFA API to complete the authentication flow using [Resource Owner Password Grant](/api-auth/tutorials/password-grant) when MFA is enabled. + +<%= include('../../_includes/_authenticator-before-start') %> + +## 1. Authenticate the User + +When you use the Resource Owner Password Grant to authenticate, you call the `/oauth/token` endpoint with the user's username/password: + +```har +{ +"method": "POST", +"url": "https://${account.namespace}/oauth/token", +"headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } +], +"postData": { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "password" + }, + { + "name": "username", + "value": "user@example.com" + }, + { + "name": "password", + "value": "pwd" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "client_secret", + "value": "YOUR_CLIENT_SECRET" + }, + { + "name": "audience", + "value": "https://someapi.com/api" + }, + { + "name": "scope", + "value": "openid profile read:sample" + } + ] +} +} +``` + +When MFA is enabled, the response will include an `mfa_required` error and a `mfa_token`. + +```json +{ + "error": "mfa_required", + "error_description": "Multifactor authentication required", + "mfa_token": "Fe26...Ha" +} +``` + +## 2. Retrieve the Enrolled Authenticators + +After getting the error above, you need to find out if the user has an MFA factor enrolled or not. Call [`/mfa/authenticators`](/mfa/guides/mfa-api/manage#list-authenticators) endpoint, using the MFA token obtained in the previous step. + +```har +{ + "method": "GET", + "url": "https://${account.namespace}/mfa/authenticators", + "headers": [ + { "name": "Authorization", "value": "Bearer MFA_TOKEN" }, + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ] +} +``` + +You will get an array with the available authenticators. The array will be empty if the user did not enroll any factor. + +```json +[ + { + "id": "recovery-code|dev_O4KYL4FtcLAVRsCl", + "authenticator_type": "recovery-code", + "active": true + }, + { + "id": "email|dev_NU1Ofuw3Cw0XCt5x", + "authenticator_type": "oob", + "active": true, + "oob_channels": "email", + "name": "email@address.com" + } +] +``` + +## 3. Enroll an MFA Factor + +If the user is not enrolled in MFA, use the MFA token obtained earlier, and enroll it using the `/mfa/associate` endpoint. The documents linked below explain how to implement this flow depending on the authentication factor: + +- [Enrolling with SMS or Voice](/mfa/guides/mfa-api/phone#enrolling-with-sms-or-voice) +- [Enrolling with OTP](/mfa/guides/mfa-api/otp#enrolling-with-otp) +- [Enrolling with Push](/mfa/guides/mfa-api/push#enrolling-with-push) +- [Enrolling with Email](/mfa/guides/mfa-api/email#enrolling-with-email) + +## 4. Challenge the User with MFA + +If the user is already enrolled in MFA, you need to challenge the user with one of the existing factors. Use the `authenticator_id` returned by the `/mfa/authenticators` endpoint when calling the `/mfa/challenge` endpoint. + +After the challenge is completed, call `/oauth/token` again to finalize the authentication flow and get the authentication tokens. + +The documents linked below explain how to implement this flow depending on the authentication factor: + +- [Challenging with SMS](/mfa/guides/mfa-api/phone#challenging-with-sms-or-voice) +- [Challenging with OTP](/mfa/guides/mfa-api/otp#challenging-with-otp) +- [Challenging with Push](/mfa/guides/mfa-api/push#challenging-with-push) +- [Challenging with Email](/mfa/guides/mfa-api/email#challenging-with-email) +- [Challenging with Recovery Code](/mfa/guides/mfa-api/recovery-code) + +## Keep reading + +* [Managing MFA Enrollments](/mfa/guides/mfa-api/manage) diff --git a/articles/mfa/guides/mfa-api/email.md b/articles/mfa/guides/mfa-api/email.md new file mode 100644 index 0000000000..4cd4ba8dbb --- /dev/null +++ b/articles/mfa/guides/mfa-api/email.md @@ -0,0 +1,208 @@ +--- +title: Enroll and Challenge Email Authenticators +description: Build your own MFA flows using email as a factor. +topics: + - mfa + - mfa-api + - mfa-authenticators + - email +contentType: + - how-to + - reference +useCase: + - customize-mfa +--- +# Enroll and Challenge Email Authenticators + +Auth0 provides a built-in MFA enrollment and authentication flow using [Universal Login](/universal-login). However, if you want to create your own user interface, you can use the MFA API to accomplish it. + +This guide will explain how to enroll and challenge users with Email using the MFA API. Make sure that Email is [enabled as factor](/mfa/guides/configure-email) in the Dashboard or using the [Management API](/api/management/v2#!/Guardian/put_factors_by_name). + + +::: note +When Email is enabled as factor, all users with verified emails will be able to use them to complete MFA. + +Email authenticators are not supported when using the Classic Universal Login experience. +::: + +<%= include('../../_includes/_authenticator-before-start') %> + +## Enrolling with Email + +If you want to enable users enroll additional emails, in addition of the verified email in their primary identity, you need to complete the following steps. + +### 1. Get the MFA token + +<%= include('../../_includes/_get_mfa_token') %> + +### 2. Enroll the Authenticator + +To enroll with Email, you need to use the following parameters: + +- `authentication_types` = `[oob]` +- `oob_channels` = `[email]` +- `email` = `email@address.com`, the user's email address. + + ```har + { + "method": "POST", + "url": "https://${account.namespace}/mfa/associate", + "headers": [{ + "name": "Authorization", + "value": "Bearer MFA_TOKEN" + }], + "postData": { + "mimeType": "application/json", + "text": "{ \"authenticator_types\": [\"oob\"], \"oob_channels\": [\"email\"], \"email\" : \"email@address.com\" }" + } + } + ``` + + If successful, you'll receive a response like this: + + ```json + { + "authenticator_type": "oob", + "binding_method": "prompt", + "oob_code" : "Fe26..nWE", + "oob_channel": "email", + "recovery_codes": [ "N3BGPZZWJ85JLCNPZBDW6QXC" ] + } + ``` + +If you get a `User is already enrolled error`, the user already has an MFA factor enrolled. Before associating another factor with the user, you need to challenge the user with the existing factor. + +#### Recovery Codes + +<%= include('../../_includes/_recovery_codes') %> + +### 3. Confirm the email enrollment + +The user should receive an email containing the 6-digit code, which they can provide to the application. + +To complete enrollment of the email authenticator make a `POST` request to the `oauth/token` endpoint. You need to include the `oob_code` returned in the previous response, and the `binding_code` with the value received in the email message. + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "postData": { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "http://auth0.com/oauth/grant-type/mfa-oob" + }, + { + "name": "mfa_token", + "value": "MFA_TOKEN" + }, + { + "name": "oob_code", + "value": "OOB_CODE" + }, + { + "name": "binding_code", + "value": "USER_EMAIL_OTP_CODE" + }, + { + "name": "client_id", + "value": "${account.clientId}" + } + ] + } +} +``` + +For more information on how to customize the email that users get, check [Customizing Your Emails](/email/templates). + +<%= include('../../_includes/_successful_confirmation') %> + +## Challenging with Email + +To challenge a user with Email, follow the steps detailed below. + +### 1. Get the MFA token + +<%= include('../../_includes/_get_mfa_token_challenge') %> + +### 2. Challenge the user with Email + +To challenge the user you first need to obtain the id of the authenticator you want to challenge using the [`/mfa/enrollments`](/mfa/guides/mfa-api/manage#list-authenticators) endpoint. + +To trigger an email challenge, `POST` to the to `mfa/challenge` endpoint, using the corresponding `authenticator_id` ID and the `mfa_token`. + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/mfa/challenge", + "postData": { + "mimeType": "application/json", + "text": "{ \"client_id\": \"YOUR_CLIENT_ID\", \"client_secret\": \"YOUR_CLIENT_SECRET\", \"challenge_type\": \"oob\", \"authenticator_id\": \"email|dev_NU1Ofuw3Cw0XCt5x\", \"mfa_token\": \"MFA_TOKEN\" }" + } +} +``` + +### 3. Complete authentication using the received code + +If successful, you'll get the following response, and the user will get an email message containing the six-digit code: + +```json +{ + "challenge_type": "oob", + "oob_code": "abcd1234...", + "binding_method": "prompt" +} +``` + +Your application needs to prompt the user for the code, and send it as part of the request, in the `binding_code` parameter, in the following call to the `/oauth/token` endpoint: + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData": { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "http://auth0.com/oauth/grant-type/mfa-oob" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "client_secret", + "value": "CLIENT_SECRET" + }, + { + "name": "mfa_token", + "value": "MFA_TOKEN" + }, + { + "name": "oob_code", + "value": "OOB_CODE" + }, + { + "name": "binding_code", + "value": "USER_EMAIL_OTP_CODE" + } + ] + } +} +``` + +<%= include('../../_includes/_successful_challenge') %> + +## Keep Reading + +* [Configure Email Notifications for MFA](/mfa/guides/configure-email) +* [Managing MFA Enrollments](/mfa/guides/mfa-api/manage) +* [Enroll and Challenge Push Authenticators](/mfa/guides/mfa-api/push) +* [Enroll and Challenge OTP Authenticators](/mfa/guides/mfa-api/otp) +* [Enroll and Challenge SMS Authenticators](/mfa/guides/mfa-api/sms) +* [Challenge a Recovery Code](/mfa/guides/mfa-api/recovery-code) diff --git a/articles/mfa/guides/mfa-api/manage.md b/articles/mfa/guides/mfa-api/manage.md new file mode 100644 index 0000000000..128406fe8a --- /dev/null +++ b/articles/mfa/guides/mfa-api/manage.md @@ -0,0 +1,149 @@ +--- +title: Manage Authenticator Factors using the MFA API +description: Learn how to manage your MFA authenticators +topics: + - mfa + - mfa-api + - mfa-authenticators +contentType: + - how-to + - reference +useCase: + - customize-mfa +--- +# Manage Authenticator Factors using the MFA API + +Auth0 provides several API endpoints to help you manage the authenticators you're using with an application for multi-factor authentication (MFA). + +You can use these endpoints to build a complete user interface for letting users manage their authenticator factors. + +<%= include('../../_includes/_authenticator-before-start') %> + +## Getting an MFA API Access Token + +In order to call the MFA API to manage enrollments, you first need to obtain an Access Token for the MFA API. + +If you want to use the MFA API as part of an authentication flow, you can follow the steps detailed in the [Authenticate With Resource Owner Password Grant and MFA](/mfa/guides/mfa-api/authenticate) document. + +If you are building a user interface to manage authentication factors, you'll need to obtain a token you can use for the MFA API at any moment, not only during authentication: + +* If you are using [Universal Login](/universal-login), redirect to the `/authorize` endpoint, specifying the `https://${account.namespace}/mfa/` audience, before using calling the MFA API. +* If you are using the Resource Owner Password Grant, you have two options: + * Ask for the `https://${account.namespace}/mfa/` audience when logging-in, and use a [Refresh Token](/tokens/concepts/refresh-tokens) to refresh it later. + * If you need to list and delete authenticators, ask the user to [authenticate again](/mfa/guides/mfa-api/authenticate) with `/oauth/token`, specifying the `https://${account.namespace}/mfa/` audience. Users will need to complete MFA before being able to list/delete the authentication factors. + * If you only need to list authenticators, ask the user to [authenticate again](/mfa/guides/mfa-api/authenticate) using `/oauth/token`, with username/password. The endpoint will return an `mfa_required` error, and an `mfa_token` you can use to list authenticators. Users will need to provide their password to see their authenticators. + +When you request a token for the MFA audience, you can request the following scopes: + +* `enroll`: needed to enroll a new authenticator +* `read:authenticators`: needed to list existing authenticators +* `remove:authenticators`: needed to delete an authenticator + +## List Authenticators + +To get the list of the authenticators for a user, you can call the `/mfa/authenticators` endpoint: + +```har +{ + "method": "GET", + "url": "https://${account.namespace}/mfa/authenticators", + "headers": [{ + "name": "Authorization", + "value": "Bearer MFA_TOKEN" + }] +} +``` + +You should receive information about the authenticator type(s) in the response: + +```json +[ + { + "authenticator_type": "recovery-code", + "id": "recovery-code|dev_IsBj5j3H12VAdOIj", + "active": true + }, + { + "authenticator_type": "otp", + "id": "totp|dev_nELLU4PFUiTW6iWs", + "active": true, + }, + { + "authenticator_type": "oob", + "oob_channels": "sms", + "id": "sms|dev_sEe99pcpN0xp0yOO", + "name": "+1123XXXXX", + "active": true + } +] +``` + +For the purposes of building an user interface for end users to manage their factors, you should ignore authenticators that have `active` = `false`. Those authenticators are not confirmed by users, so they can't be used to challenge for MFA. + +::: note +- When a user enrolls with Push, Auth0 creates an OTP enrollment. You will see both when listing enrollments. +- If both SMS and Voice are enabled, when a user enrolls with either SMS or Voice, Auth0 will automatically create two authenticators for the phone number, one for `sms` and another for `voice`. +- When Email MFA is enabled, all verified emails will be listed as authenticators. +- When a user enrolls any factor Auth0 creates a recovery code that will be listed as an authenticator. +::: + +## Enroll Authenticators + +The documents below explain how to enroll with different factors: + +* [Enrolling with SMS or Voice](/mfa/guides/mfa-api/phone#enrolling-with-sms-or-voice) +* [Enrolling with OTP](/mfa/guides/mfa-api/otp#enrolling-with-otp) +* [Enrolling with Push](/mfa/guides/mfa-api/push#enrolling-with-push) +* [Enrolling with Email](/mfa/guides/mfa-api/email#enrolling-with-email) + +You can also [use the Universal Login flow](/mfa/guides/guardian/create-enrollment-ticket) for enrolling users at any moment. + +## Delete Authenticators + +To delete an associated authenticator, send a `DELETE` request to the `/mfa/authenticators/AUTHENTICATOR_ID` endpoint. You can get the `ID` when listing authenticators. + +```har +{ + "method": "DELETE", + "url": "https://${account.namespace}/mfa/authenticators/AUTHENTICATOR_ID", + "headers": [{ + "name": "Authorization", + "value": "Bearer MFA_TOKEN" + }] +} +``` + +If the authenticator was deleted, a 204 response is returned. + +:::note +- When you enroll a Push authenticator, Auth0 also enrolls an OTP one. If you delete any of them, the other one will be also deleted. +- If both SMS and Voice are enabled, when a user enrolls with either SMS or Voice, Auth0 will automatically create two authenticators for the phone number, one for `sms` and another for `voice`. When you delete one, the other will also be deleted. +- If Email MFA is enabled, all verified emails will be listed as authenticators, but you can't delete them. You can only delete email authenticators that were enrolled explicitly. +::: + +## Delete a Recovery Code + +To delete a Recovery Code, you need to use Management API's `/api/v2/users/USER_ID/recovery-code-regeneration` endpoint. You previously need to get a [Management API Access Token](/api/management/v2/tokens). + +```har +{ + "method": "DELETE", + "url": "https://${account.namespace}/api/v2/users/USER_ID/recovery-code-regeneration", + "headers": [{ + "name": "Authorization", + "value": "Bearer MANAGEMENT_API_TOKEN" + }] +} +``` + +You will get a new recovery code that the end user will need to capture: + +```json +{ + "recovery_code": "FA45S1Z87MYARX9RG6EVMAPE" +} +``` + +## Keep reading + +* [Authenticate With Resource Owner Password Grant and MFA](/mfa/guides/mfa-api/authenticate) diff --git a/articles/mfa/guides/mfa-api/multifactor-resource-owner-password.md b/articles/mfa/guides/mfa-api/multifactor-resource-owner-password.md new file mode 100644 index 0000000000..61398e8c4b --- /dev/null +++ b/articles/mfa/guides/mfa-api/multifactor-resource-owner-password.md @@ -0,0 +1,347 @@ +--- +title: Multi-factor Authentication and Resource Owner Password +description: How to use Multi-factor Authentication with Resource Owner Password Grant. +toc: true +topics: + - api-authentication + - oidc + - mfa + - resource-owner-password +contentType: tutorial +useCase: + - secure-api + - call-api +--- +# Multi-factor Authentication and the Resource Owner Password Grant + +Highly-trusted applications can use the [Resource Owner Password Grant](/api-auth/grant/password) to access an API. The flow typically involves prompting the user for username and password as credentials to be submitted to Auth0. In some scenarios, however, stronger authentication may be required. This document outlines using multi-factor authentication (MFA) with the [Resource Owner Password Grant](/api-auth/grant/password). + +## Prerequisites + +Before you continue, make sure that you've met the following prerequisites: + +1. MFA is enabled on the [Auth0 dashboard](${manage_url}). [Duo Security](/mfa/guides/configure-cisco-duo) is __not__ supported as a factor with this flow. + +1. An Application is configured to execute the Resource Owner Password Grant (either [password](/api-auth/tutorials/password-grant) or [password-realm](/api-auth/tutorials/password-grant#realm-support) grant types). For details on how to implement this, refer to [Execute the Resource Owner Password Grant](/api-auth/tutorials/password-grant). + +1. End users are enrolled in MFA. + +## Initiate Multi-factor Authentication + +The flow starts by collecting end-user credentials and sending them to Auth0, as described in [Resource Owner Password Grant](/api-auth/grant/password). Both [password](/api-auth/tutorials/password-grant) and [password-realm](/api-auth/tutorials/password-grant#realm-support) flows are available. + +1. The user enters their credentials into the Application. + +2. The Application forwards the credentials to Auth0. + +3. Auth0 validates the credentials and executes any applicable [rules](/rules). + +4. If any rule triggers MFA for the current user, an error code of `mfa_required` is returned. The error will additionally contain an `mfa_token` property. + + ```json + HTTP/1.1 403 Forbidden + Content-Type: application/json + { + "error": "mfa_required", + "error_description": "Multi-factor authentication required", + "mfa_token": "eyJ0eXAiOiJKV1QiLCJhbGci....D3QCiQ" + } + ``` + +5. The Application will then make a request to the [MFA challenge](/api/authentication#resource-owner-password-and-mfa) endpoint, specifying the challenge types it supports. Valid challenge types are: [OTP](#challenge-type-otp), [OOB with binding method `prompt`](#challenge-type-oob-and-binding-method-prompt), and [OOB with no binding method](#challenge-type-oob-with-no-binding-method). If you already know that `otp` is supported by the end-user and you don't want to request a different factor, you can skip this and the next steps an go directly to [Challenge Type `OTP`](#challenge-type-otp) below. + +6. Auth0 sends a response containing the `challenge_type` derived from the types supported by the Application and the specific user. Additionally, extra information, such as `binding_method` may be included to assist in resolving the challenge and displaying the correct UI to the user. + +The supported challenge types are: + +- `otp`: A one-time password generated by an app setup with a seed or by token generation hardware. This mechanism does not require an extra channel to prove possession of the device; you can get it directly from the app / hardware device. + +- `oob`: The proof of possession of the device here is done 'out of band' via a side channel. There are several different channels, including push notification-based authenticators, SMS, and Voice based authenticators. Depending on the channel and the authenticator chosen at enrollment, you may need to provide a `binding_code` used to bind the side channel and the channel used for authentication. + +To execute MFA, follow the next steps according to the challenge type you will use: + +- [OTP](#challenge-type-otp): for this challenge type, your application must prompt the end-user for an OTP code and continue the flow using the __mfa-otp__ grant type. + +- [OOB and binding method `prompt`](#challenge-type-oob-and-binding-method-prompt): the challenge will be sent through a side channel (such as SMS or Voice), and your application will need to prompt the user for the `binding_code` that was included as part of the challenge sent, as well as the `oob_code` received as response to this request to prove possession of the device. + +- [OOB with no binding method](#challenge-type-oob-with-no-binding-method): in this case, the proof of possession will be driven entirely in a side channel (such as a push notification-based authenticator). The response will include an `oob_code` that the Application will use to periodically check for the resolution of the transaction. Continue the flow using the __mfa-oob__ grant type. + +## Execute Multi-factor Authentication + +The following sections cover how to execute MFA based on the challenge type used. + +### Challenge Type: `OTP` + +![Resource Owner MFA OTP](/media/articles/api-auth/challenge-type-otp.png) + +For this type of challenge, the Application must get an one-time password (`otp`) code from a OTP Generator app, such as Google Authenticator or Microsoft Authenticator. + +::: note +If you already know that the user supports OTP, then steps 5 and 6 above of the [Initiate Multi-factor Authentication](#initiate-multifactor-authentication) section are optional. +::: + +7. The Application prompts the end user to enter an OTP code. + +8. The end user enters their OTP into the Application. + +9. The Application forwards the OTP code to Auth0 using [grant_type=http://auth0.com/oauth/grant-type/mfa-otp](/api/authentication#resource-owner-password) and includes the `mfa_token` obtained in step 4 above. + +10. Auth0 validates the provided OTP and returns the Access Token and the Refresh Token. + +11. The Application can use the Access Token to call the API on behalf of the end user. + +### Challenge Type: `OOB` with Binding Method `prompt` + +![Resource Owner MFA OOB Prompt](/media/articles/api-auth/challenge-type-oob-with-binding-method.png) + +This challenge type, together with `prompt` binding method, indicates that the challenge will be delivered to the user using a side channel (such as SMS or Voice) and that a `binding_code` is needed to bind the side channel to the one being authenticated. The binding code is sent as part of the challenge message and it is usually an OTP-like code composed of 6 numeric digits. + +7. The Application prompts the user for the `binding_code` and stores the `oob_code` from step 6 for future use. + +8. The end user receives the challenge on the side channel and enters the `binding_code` into the Application. + +9. The Application forwards the `binding_code` to Auth0 using [grant_type=http://auth0.com/oauth/grant-type/mfa-oob](/api/authentication#resource-owner-password) and includes the `mfa_token` (from step 4) and `oob_code` (from step 6). + +10. Auth0 validates the `binding_code` and `oob_code` and returns the Access Token and the Refresh Token. + +11. The Application can use the Access Token to call the API on behalf of the end user. + +### Challenge Type: `OOB` with No Binding Method + +![Resource Owner MFA OOB](/media/articles/api-auth/challenge-type-oob-no-binding-method.png) + +In this scenario, the challenge will be sent using a side channel, however, there is no need for a `binding_code`. Currently, the only mechanism supported for this scenario is Push Notification with the Guardian Provider. + +7. The Application asks the user to accept the delivered challenge and keeps the `oob_code` from step 6 for future use. + +8. The Application polls Auth0 using [grant_type=http://auth0.com/oauth/grant-type/mfa-oob](/api/authentication#resource-owner-password) and includes the `mfa_token` (from step 4) and `oob_code` (from step 6). + +9. Auth0 validates the provided `oob_code`, the `mfa_token` and returns: + - `authorization_pending` error: if the challenge has not been accepted nor rejected. + - `slow_down` error: if the polling is too frequent. + - an `access_token` and a `refresh_token`: if the challenge has been accepted; polling should be stopped at this point. + - `invalid_grant` error: if the challenge has been rejected; polling should be stopped at this point. + +10. The Application can use the Access Token to call the API on behalf of the end user. + +## Using Recovery Codes + +::: note +This flow is not available when the user uses provider = `google-authenticator` or provider = `duo`. +::: + +![Resource Owner MFA Recovery](/media/articles/api-auth/recovery-code.png) + +Some providers support using a recovery code to login in case the enrolled device is not available, or if lack of connectivity prevents receiving an OTP code or push notification. + +Using a recovery code is similar to using an OTP code to login. The main difference is that a new recovery code will be generated, and that the application must display this new recovery code to the user for secure storage. + +Steps 1-4 are the same as above. + +5. End user chooses to use the recovery code. + +6. The Application prompts the end user to enter recovery code. + +7. The end user enters their recovery code into the Application. + +8. The Application forwards the recovery code to Auth0 using [grant_type=http://auth0.com/oauth/grant-type/mfa-otp](/api/authentication#resource-owner-password) and includes the `mfa_token` from step 4. + +9. Auth0 validates the recovery code and returns the Access Token and the Refresh Token. + +10. The Application can use the Access Token to call the API on behalf of the end user. + +## Samples + +The following are sample implementations involving MFA. + +### Resource Owner Password Grant Request + +```javascript +var request = require("request"); + +var options = { method: 'POST', + url: 'https://${account.namespace}/oauth/token', + headers: { 'content-type': 'application/x-www-form-urlencoded' }, + form: + { grant_type: 'password', + username: 'USERNAME', + password: 'PASSWORD', + audience: 'API_IDENTIFIER', + scope: 'SCOPE', + client_id: '${account.clientId}', + client_secret: 'YOUR_CLIENT_SECRET' } + }; + +request(options, function (error, response, body) { + if (error) throw new Error(error); + + if (body.error === 'mfa_required') { + // Show mfa flow and give user option to go to the recovery flow (if supported) + + if (/* MFA Recovery is requested*/) { + const recovery_code = // Prompt for recovery code + mfaRecovery(body.mfa_token, recovery_code) // See MFA Recovery grant + } else { + mfaChallenge(body.mfa_token) + } + } +}); +``` + +### Challenge Request + +```javascript +function mfaChallenge(mfa_token) { + var options = { method: 'POST', + url: 'https://${account.namespace}/mfa/challenge', + headers: { 'content-type': 'application/json' }, + body: + { mfa_token: mfa_token, + challenge_type: 'oob otp', // Supported challenge types, space separated + client_id: '${account.clientId}', + client_secret: 'YOUR_CLIENT_SECRET' }, + json: true }; + + request(options, function (error, response, body) { + if (error) throw new Error(error); + + if (body.challenge_type === 'otp') { + const otp = // Prompt for otp code (see MFA OTP grant request) + mfaOTP(mfa_token, otp) + } else if (body.challenge_type === 'oob') { + if (body.binding_method === 'prompt') { + const binding_code = // Prompt for binding code (see MFA OOB with binding code grant request) + mfaOOB(mfa_token, body.oob_code, binding_code) + } else if (!body.binding_method) { + // Ask the user to accept the challenge and start polling (see MFA OOB without binding code grant request) + mfaOOB(mfa_token, body.oob_code) + } else { + console.error('Unsupported binding_method'); + } + } else { + console.error('Something went wrong'); + } + }); +} +``` + +### MFA OTP Grant Request + +```javascript +function mfaOTP(mfa_token, otp) { + var options = { method: 'POST', + url: 'https://${account.namespace}/oauth/token', + headers: { 'content-type': 'application/x-www-form-urlencoded' }, + form: + { mfa_token: mfa_token, + otp: otp, + grant_type: 'http://auth0.com/oauth/grant-type/mfa-otp', + client_id: '${account.clientId}', + client_secret: 'YOUR_CLIENT_SECRET' } + }; + + request(options, function (error, response, body) { + if (error) throw new Error(error); + + if (response.statusCode === 200) { + // The tokens returned depend on the scopes requested on the password grant request + console.log(body.access_token, body.id_token, body.refresh_token); + } else if (body.error === 'invalid_grant') { + // Invalid otp code + console.error('Invalid otp'); + } else { + console.error('Something went wrong'); + } + }); +} +``` + +### MFA OOB Grant Request + +```javascript +function mfaOOB(mfa_token, oob_code, /* optional */ binding_code) { + makeOOBGrantRequest(mfa_token, oob_code, binding_code, function(error, result) { + if (error) { throw error; } + + if (result.state === 'authorization_pending') { + // Poll every 10 seconds + setTimeout(() => makeOOBGrantRequest(mfa_token, oob_code, binding_code), 10000); + } else if (result.state === 'authorized') { + console.log(result.body.access_token, result.body.id_token, result.body.refresh_token); + } else { + console.error('You are not authorized') + } + }); +} + +function makeOOBGrantRequest(mfa_token, oob_code, /* optional */ binding_code, cb) { + var options = { method: 'POST', + url: 'https://${account.namespace}/oauth/token', + headers: { 'content-type': 'application/x-www-form-urlencoded' }, + form: + { mfa_token: mfa_token, + oob_code: oob_code, + binding_code: binding_code, // Only when binding_method = prompt + grant_type: 'http://auth0.com/oauth/grant-type/mfa-oob', + client_id: '${account.clientId}', + client_secret: 'YOUR_CLIENT_SECRET' } + }; + + request(options, function (error, response, body) { + if (error) { return cb(error); } + + if (response.statusCode === 200) { + // The tokens returned depend on the scopes requested on the password grant request + cb(null, { state: 'authorized', body }); + } else if (body.error === 'invalid_grant') { + // Invalid otp code + cb(null, { state: 'not_authorized' }); + } else if (body.error === 'authorization_pending') { + cb(null, { state: 'authorization_pending' }); + } else if (body.error === 'slow_down') { + // You are polling too fast, slow down the polling rate, + // You may want to check rate-limiting headers to manage your polling rate + setTimeout(() => cb({ state: 'authorization_pending' }), 20000); + } else { + cb(new Error('Something went wrong')) + } + }); +} +``` + +### MFA Recovery Grant Request + +```javascript +function mfaRecovery(mfa_token, recovery_code) { + var options = { method: 'POST', + url: 'https://${account.namespace}/oauth/token', + headers: { 'content-type': 'application/x-www-form-urlencoded' }, + form: + { mfa_token: mfa_token, + recovery_code: recovery_code, + grant_type: 'http://auth0.com/oauth/grant-type/mfa-recovery-code', + client_id: '${account.clientId}', + client_secret: 'YOUR_CLIENT_SECRET' } + }; + + request(options, function (error, response, body) { + if (error) throw new Error(error); + + if (response.statusCode === 200) { + console.log('Please store this new recovery code safely -- the previous code will no longer work.', body.recovery_code) + + // The tokens returned depend on the scopes requested on the password grant request + console.log(body.access_token, body.id_token, body.refresh_token); + } else if (body.error === 'invalid_grant') { + // Invalid recovery code + console.error('Invalid recovery_code'); + } else { + console.error('Something went wrong'); + } + }); +} +``` + +## MFA API + +See [MFA API](/mfa/concepts/mfa-api) for detailed information about Auth0's MFA API endpoints. diff --git a/articles/mfa/guides/mfa-api/otp.md b/articles/mfa/guides/mfa-api/otp.md new file mode 100644 index 0000000000..f2efd0e81a --- /dev/null +++ b/articles/mfa/guides/mfa-api/otp.md @@ -0,0 +1,221 @@ +--- +title: Enroll and Challenge OTP Authenticators +description: Build your own MFA flows using OTP as a factor. +topics: + - mfa + - mfa-api + - mfa-authenticators + - otp +contentType: + - how-to + - reference +useCase: + - customize-mfa +--- +# Enroll and Challenge OTP Authenticators + +Auth0 provides a built-in MFA enrollment and authentication flow using [Universal Login](/universal-login). However, if you want to create your own user interface, you can use the MFA API to accomplish it. + +This guide explains how to enroll and challenge users with OTP using the MFA API. First, make sure that OTP is [enabled as factor](/mfa/guides/configure-otp) in the Dashboard or using the [Management API](/api/management/v2#!/Guardian/put_factors_by_name). + +<%= include('../../_includes/_authenticator-before-start') %> + +## Enrolling with OTP + +### 1. Get the MFA Token + +<%= include('../../_includes/_get_mfa_token') %> + +### 2. Enroll the Authenticator + +<%= include('../../_includes/_request_association') %> + +To enroll with OTP you need to set the `authenticator_types` parameter to `[otp]`. + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/mfa/associate", + "headers": [ + { "name": "Authorization", "value": "Bearer MFA_TOKEN" }, + { "name": "Content-Type", "value": "application/json" } + ], + "postData": { + "mimeType": "application/json", + "text": "{ \"authenticator_types\": [\"otp\"] }" + } +} +``` + +If successful, you'll receive a response like this: + +```json +{ + "authenticator_type": "otp", + "secret": "EN...S", + "barcode_uri": "otpauth://totp/tenant:user?secret=...&issuer=tenant&algorithm=SHA1&digits=6&period=30", + "recovery_codes": [ "N3B...XC"] +} +``` + +If you get a `User is already enrolled error`, the user already has an MFA factor enrolled. Before associating another factor with the user, you need to challenge the user with the existing factor. + +#### Recovery Codes + +<%= include('../../_includes/_recovery_codes') %> + +### 3. Confirm the OTP enrollment + +To confirm the enrollment, the end user will need to enter the secret obtained in the previous step in an OTP generator application like Google Authenticator. They can enter the secret by scanning a QR code with the `barcode_uri` or by typing the `secret` code manually in that OTP application. You should provide users a way to get the `secret` as text in case they cannot scan the QR code (e.g. if they are enrolling from a mobile device, or using a desktop OTP application). + +After the users enter the secret, the OTP application will display a 6-digit code, that the user should enter in your application. The application should then make a `POST` request to the `oauth/token` endpoint, including that `otp` value. + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData": { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "http://auth0.com/oauth/grant-type/mfa-otp" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "mfa_token", + "value": "MFA_TOKEN" + }, + { + "name": "client_secret", + "value": "YOUR_CLIENT_SECRET" + }, + { + "name": "otp", + "value": "USER_OTP_CODE" + } + ] + } +} +``` + +<%= include('../../_includes/_successful_confirmation') %> + +## Challenging with OTP + +To challenge a user with OTP, follow the steps detailed below. + +### 1. Get the MFA token + +<%= include('../../_includes/_get_mfa_token_challenge') %> + +### 2. Retrieve the enrolled authenticators + +To be able to challenge the user, you need the `authenticator_id` for the factor you want to challenge. You can list all enrolled authenticators by using the `/mfa/authenticators` endpoint: + +```har +{ + "method": "GET", + "url": "https://${account.namespace}/mfa/authenticators", + "headers": [ + { "name": "Authorization", "value": "Bearer MFA_TOKEN" }, + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ] +} +``` + +You will get a list of authenticators with the format below: + +```json +[ + { + "id": "recovery-code|dev_qpOkGUOxBpw6R16t", + "authenticator_type": "recovery-code", + "active": true + }, + { + "id": "totp|dev_6NWz8awwC8brh2dN", + "authenticator_type": "otp", + "active": true + } +] +``` + +### 3. Challenge the user with OTP + +To trigger an OTP challenge, `POST` to the to `mfa/challenge` endpoint, using the corresponding `authenticator_id` ID and the `mfa_token`. + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/mfa/challenge", + "postData": { + "mimeType": "application/json", + "text": "{ \"client_id\": \"YOUR_CLIENT_ID\", \"challenge_type\": \"otp\", \"mfa_token\": \"MFA_TOKEN\", \"authenticator_id\" : \"totp|dev_6NWz8awwC8brh2dN\" }" + } +} +``` + +### 4. Complete authentication using the received code + +If successful, you'll receive the following response: + +```json +{ + "challenge_type": "otp" +} +``` + +The user will collect a one-time password, which you will then collect from them. You can the verify the code and get authentication tokens using the `/oauth/token` endpoint, specifying the one-time password in the `otp` parameter: + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData": { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "http://auth0.com/oauth/grant-type/mfa-otp" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "client_secret", + "value": "YOUR_CLIENT_SECRET" + }, + { + "name": "mfa_token", + "value": "MFA_TOKEN" + }, + { + "name": "otp", + "value": "USER_OTP_CODE" + } + ] + } +} +``` + +<%= include('../../_includes/_successful_challenge') %> + +## Keep Reading + +* [Configure One-Time Passwords for MFA](/mfa/guides/configure-otp) +* [Managing MFA Enrollments](/mfa/guides/mfa-api/manage) +* [Enroll and Challenge Push Authenticators](/mfa/guides/mfa-api/push) +* [Enroll and Challenge SMS or Voice Authenticators](/mfa/guides/mfa-api/phone) +* [Enroll and Challenge Email Authenticators](/mfa/guides/mfa-api/email) +* [Challenge a Recovery Code](/mfa/guides/mfa-api/recovery-code) diff --git a/articles/mfa/guides/mfa-api/phone.md b/articles/mfa/guides/mfa-api/phone.md new file mode 100644 index 0000000000..02ec707bba --- /dev/null +++ b/articles/mfa/guides/mfa-api/phone.md @@ -0,0 +1,256 @@ +--- +title: Enroll and Challenge SMS or Voice Authenticators +description: Build your own MFA flows using SMS or Voice as a factor. +topics: + - mfa + - mfa-api + - mfa-authenticators + - sms +contentType: + - how-to + - reference +useCase: + - customize-mfa +--- +# Enroll and Challenge SMS or Voice Authenticators + +Auth0 provides a built-in MFA enrollment and authentication flow using [Universal Login](/universal-login). However, if you want to create your own user interface, you can use the MFA API to accomplish it. + +::: warning +Voice MFA is currently a Beta feature. It should not be used in production environments. +::: + +This guide explains how to enroll and challenge users with SMS or a voice call using the MFA API. First, make sure that Phone is [enabled as factor](/mfa/guides/configure-phone) in the Dashboard or using the [Management API](/api/management/v2#!/Guardian/put_factors_by_name). + +<%= include('../../_includes/_authenticator-before-start') %> + +## Enrolling with SMS or Voice + +### 1. Get the MFA token + +<%= include('../../_includes/_get_mfa_token') %> + +### 2. Enroll the Authenticator + +<%= include('../../_includes/_request_association') %> + +When a user enrolls with Voice or SMS, they are actually enrolling a phone number that can be challenged either with SMS or Voice. + +You need to specify the parameters below to call the endpoint. The `oob_channels` parameter indicates how you want to send the code to the user (SMS or Voice): + +- `authentication_types` = `[oob]` +- `oob_channels` = `[sms]` or `[voice]`. +- `phone_number` = `+11...9`, the phone number [E.164 format](https://en.wikipedia.org/wiki/E.164) + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/mfa/associate", + "headers": [ + { "name": "Authorization", "value": "Bearer MFA_TOKEN" }, + { "name": "Content-Type", "value": "application/json" } + ], + "postData": { + "mimeType": "application/json", + "text": "{ \"authenticator_types\": [\"oob\"], \"oob_channels\": [\"sms\"], \"phone_number\": \"+11...9\" }" + } +} +``` + +If successful, you'll receive a response like the one below: + +```json +{ + "authenticator_type": "oob", + "binding_method": "prompt", + "recovery_codes": [ "N3BGPZZWJ85JLCNPZBDW6QXC" ], + "oob_channels": "sms", + "oob_code": "ata6daXAiOi..." +} +``` + +If you get a `User is already enrolled error`, it is because the user already has an MFA factor enrolled. Before associating it with another factor, you need to challenge the user with the existing one. + +#### Recovery Codes + +<%= include('../../_includes/_recovery_codes') %> + +### 3. Confirm the SMS or Voice enrollment + +Users should receive an message with a 6-digit code that they need to provide to the application. + +To complete enrollment, make a `POST` request to the `oauth/token` endpoint. You need to include the `oob_code` returned in the previous response, and the `binding_code` with the value received in the message. + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Authorization", "value": "Bearer MFA_TOKEN" }, + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData": { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "http://auth0.com/oauth/grant-type/mfa-oob" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "client_secret", + "value": "YOUR_CLIENT_SECRET" + }, + { + "name": "mfa_token", + "value": "MFA_TOKEN" + }, + { + "name": "oob_code", + "value": "OOB_CODE" + }, + { + "name": "binding_code", + "value": "USER_OTP_CODE" + } + ] + } +} +``` + +<%= include('../../_includes/_successful_confirmation') %> + +## Challenging with SMS or Voice + +To challenge a user with SMS or Voice, follow the steps detailed below. + +### 1. Get the MFA token + +<%= include('../../_includes/_get_mfa_token_challenge') %> + +### 2. Retrieve the enrolled authenticators + +To be able to challenge the user, you need the `authenticator_id` for the factor you want to challenge. You can list all enrolled authenticators by using the `/mfa/authenticators` endpoint: + +```har +{ + "method": "GET", + "url": "https://${account.namespace}/mfa/authenticators", + "headers": [ + { "name": "Authorization", "value": "Bearer MFA_TOKEN" }, + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ] +} +``` + +You will get a list of authenticators with the format below: + +```json +[ + { + "id": "recovery-code|dev_O4KYL4FtcLAVRsCl", + "authenticator_type": "recovery-code", + "active": true + }, + { + "id": "sms|dev_NU1Ofuw3Cw0XCt5x", + "authenticator_type": "oob", + "active": true, + "oob_channels": "sms", + "name": "XXXXXXXX8730" + }, + { + "id": "voice|dev_NU1Ofuw3Cw0XCt5x", + "authenticator_type": "oob", + "active": true, + "oob_channels": "voice", + "name": "XXXXXXXX8730" + } +] +``` + +Note that you have two authenticators with different `authenticator_id` for Voice or SMS. + +### 3. Challenge the user with SMS or Voice + +To trigger the challenge, `POST` to the to `mfa/challenge` endpoint, using the corresponding `authenticator_id` and the MFA Access Token. + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/mfa/challenge", + "postData": { + "mimeType": "application/json", + "text": "{ \"client_id\": \"YOUR_CLIENT_ID\", \"client_secret\": \"YOUR_CLIENT_SECRET\", \"challenge_type\": \"oob\", \"authenticator_id\": \"sms|dev_NU1Ofuw3Cw0XCt5x\", \"mfa_token\": \"MFA_TOKEN\" }" + } +} +``` + +### 4. Complete authentication using the received code + +If successful, you'll receive the following response, and the user will get a message containing the required six-digit code: + +```json +{ + "challenge_type": "oob", + "oob_code": "asdae35fdt5...", + "binding_method": "prompt" +} +``` + +Your application needs to prompt the user for 6-digit code sent in the message, and should be set in the `binding_code` parameter. + +You can then verify the code and get the authentication tokens using the `/oauth/token` endpoint, using the `binding_code` and the `oob_code` returned by the previous call: + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData": { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "http://auth0.com/oauth/grant-type/mfa-oob" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "client_secret", + "value": "YOUR_CLIENT_SECRET" + }, + { + "name": "mfa_token", + "value": "MFA_TOKEN" + }, + { + "name": "oob_code", + "value": "OOB_CODE" + }, + { + "name": "binding_code", + "value": "USER_OTP_CODE" + } + ] + } +} +``` + +<%= include('../../_includes/_successful_challenge') %> + +## Keep reading + +* [Configure SMS or Voice Notifications for MFA](/mfa/guides/configure-phone) +* [Managing MFA Enrollments](/mfa/guides/mfa-api/manage) +* [Enroll and Challenge Push Authenticators](/mfa/guides/mfa-api/push) +* [Enroll and Challenge OTP Authenticators](/mfa/guides/mfa-api/otp) +* [Enroll and Challenge Email Authenticators](/mfa/guides/mfa-api/email) +* [Challenge a Recovery Code](/mfa/guides/mfa-api/recovery-code) diff --git a/articles/mfa/guides/mfa-api/push.md b/articles/mfa/guides/mfa-api/push.md new file mode 100644 index 0000000000..d2d0902bdd --- /dev/null +++ b/articles/mfa/guides/mfa-api/push.md @@ -0,0 +1,250 @@ +--- +title: Enroll and Challenge Push Authenticators +description: Build your own MFA flows using Push as a factor. +topics: + - mfa + - mfa-api + - mfa-authenticators +contentType: + - how-to + - reference +useCase: + - customize-mfa +--- +# Enroll and Challenge Push using Guardian + +Auth0 provides a built-in MFA enrollment and authentication flow using [Universal Login](/universal-login). However, if you want to create your own user interface, you can use the MFA API to accomplish it. + +This guide explains to enroll and challenge users using Push Notifications with the Guardian Application or SDK, using the MFA API. First, make sure that Push is [enabled as factor](/mfa/guides/configure-push) in the Dashboard or using the [Management API](/api/management/v2#!/Guardian/put_factors_by_name). + +<%= include('../../_includes/_authenticator-before-start') %> + +## Enrolling with Push + +### 1. Get the MFA token + +<%= include('../../_includes/_get_mfa_token') %> + +### 2. Enroll the Authenticator + +<%= include('../../_includes/_request_association') %> + +To enroll with Push, you need to use the following parameters: + +- `authentication_types` = `[oob]` +- `oob_channels` = `[auth0]` + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/mfa/associate", + "headers": [ + { "name": "Authorization", "value": "Bearer MFA_TOKEN" }, + { "name": "Content-Type", "value": "application/json" } + ], + "postData": { + "mimeType": "application/json", + "text": "{ \"authenticator_types\": [\"oob\"], \"oob_channels\": [\"auth0\"] }" + } +} +``` + +If successful, you'll receive a response like the one below: + +```json +{ + "authenticator_type": "oob", + "barcode_uri": "otpauth://totp/tenant:user?enrollment_tx_id=qfjn2eiNYSjU3xID7dBYeCBSrdREWJPY&base_url=tenan", + "recovery_codes": [ + "ALKE6EJZ4853BJYLM2DM2WU7" + ], + "oob_channels": "auth0", + "oob_code": "Fe26.2...SYAg" +} +``` + +If you get a `User is already enrolled error`, the user already has an MFA factor enrolled. Before associating another factor with the user, you need to challenge the user with the existing factor. + +#### Recovery Codes + +<%= include('../../_includes/_recovery_codes') %> + +### 3. Confirm the Push enrollment + +To confirm the enrollment, the end user will need to scan the a QR code with the `barcode_uri` in the Guardian App. Once that is done the Guardian App will notify Auth0 that the user enrolled successfully. To know if that happened, you need to poll the `/oauth/token` endpoint with the `oob_code` returned by the `/associate` call: + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Authorization", "value": "Bearer MFA_TOKEN" }, + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData": { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "http://auth0.com/oauth/grant-type/mfa-oob" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "client_secret", + "value": "YOUR_CLIENT_SECRET" + }, + { + "name": "mfa_token", + "value": "MFA_TOKEN" + }, + { + "name": "oob_code", + "value": "OOB_CODE" + } + ] + } +} +``` + +If the user did has not scanned the code, it will return an `authorization_pending` response, indicating you need to call `oauth_token` again in a few seconds: + +```json +{ + "error": "authorization_pending", + "error_description": "Authorization pending: please repeat the request in a few seconds." +} +``` + +<%= include('../../_includes/_successful_confirmation') %> + +## Challenging with Push + +To challenge a user with Push, follow the steps detailed below. + +### 1. Get the MFA token + +<%= include('../../_includes/_get_mfa_token_challenge') %> + +### 2. Retrieve the enrolled authenticators + +To be able to challenge the user, you need the `authenticator_id` for the factor you want to challenge. You can list all enrolled authenticators by using the `/mfa/authenticators` endpoint: + +```har +{ + "method": "GET", + "url": "https://${account.namespace}/mfa/authenticators", + "headers": [ + { "name": "Authorization", "value": "Bearer MFA_TOKEN" }, + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ] +} +``` + +You will get a list of authenticators with the format below: + +```json +[ + { + "id": "recovery-code|dev_Ahb2Tb0ujX3w7ilC", + "authenticator_type": "recovery-code", + "active": true + }, + { + "id": "push|dev_ZUla9SQ6tAIHSz6y", + "authenticator_type": "oob", + "active": true, + "oob_channels": "auth0", + "name": "user's device name" + }, + { + "id": "totp|dev_gJ6Y6vpSrjnKeT67", + "authenticator_type": "otp", + "active": true + } +] +``` + +Note that when users enroll with Push, they also get enrolled in OTP, as Guardian supports [challenging with OTP](/mfa/guides/mfa-api/otp/#challenging-with-otp) for scenarios where the user does not have connectivity. + +### 3. Challenge the user with Push + +To trigger an Push challenge, `POST` to the to `mfa/challenge` endpoint, using the corresponding `authenticator_id` ID and the `mfa_token`. + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/mfa/challenge", + "postData": { + "mimeType": "application/json", + "text": "{ \"client_id\": \"YOUR_CLIENT_ID\", \"client_secret\": \"YOUR_CLIENT_SECRET\", \"challenge_type\": \"oob\", \"authenticator_id\": \"push|dev_ZUla9SQ6tAIHSz6y\", \"mfa_token\": \"MFA_TOKEN\" }" + } +} +``` + +### 4. Complete authentication using the received code + +If successful, you'll receive the following response, and the user will get an Push notification: + +```json +{ + "challenge_type": "oob", + "oob_code": "Fe26...jGco" +} + +``` + +Your application needs to start polling the `/oauth/token` endpoint until the user accepts the Push notification. If the endpoint returns ` + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData": { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "http://auth0.com/oauth/grant-type/mfa-oob" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "client_secret", + "value": "YOUR_CLIENT_SECRET" + }, + { + "name": "mfa_token", + "value": "MFA_TOKEN" + }, + { + "name": "oob_code", + "value": "OOB_CODE" + } + ] + } +} +``` + +This call can return one of the following results: + +- `authorization_pending` error: if the challenge has not been accepted nor rejected. +- `slow_down` error: if the polling is too frequent. +- an `access_token` and a `refresh_token`: if the challenge has been accepted; polling should be stopped at this point. +- `invalid_grant` error: if the challenge has been rejected; polling should be stopped at this point. + +## Keep Reading + +* [Configure Push Notifications for MFA](/mfa/guides/configure-push) +* [Managing MFA Enrollments](/mfa/guides/mfa-api/manage) +* [Enroll and Challenge SMS Authenticators](/mfa/guides/mfa-api/sms) +* [Enroll and Challenge OTP Authenticators](/mfa/guides/mfa-api/otp) +* [Enroll and Challenge Email Authenticators](/mfa/guides/mfa-api/email) +* [Challenge a Recovery Code](/mfa/guides/mfa-api/recovery-code) diff --git a/articles/mfa/guides/mfa-api/recovery-code.md b/articles/mfa/guides/mfa-api/recovery-code.md new file mode 100644 index 0000000000..038abaefc1 --- /dev/null +++ b/articles/mfa/guides/mfa-api/recovery-code.md @@ -0,0 +1,91 @@ +--- +description: Use the MFA API to challenge users who lose access to their device or account using recovery codes. +topics: + - mfa + - mfa-api + - mfa-authenticators + - recovery-codes +contentType: + - how-to + - reference +useCase: + - customize-mfa +--- +# Challenge with Recovery Codes + +Auth0 automatically generates recovery codes when users enroll with MFA. These codes can be used when users lost access to the device or account they used to enroll MFA. + +This guide explains how to enable users to authenticate using a recovery code using the MFA API. + +## 1. Prompt the user for the recovery code + +When the user enrolls with MFA, Auth0 generates a recovery code, that the user should capture. That value should be entered in the application for the user to authenticate. + +::: note +Auth0 does not generate recovery codes for DUO and for the legacy `google-authenticator` factor. +::: + +## 2. Authenticate using the Recovery Code + +Call the `/oauth/token` endpoint with the recovery code to authenticate and generate a new recovery code. You need to specify the following parameters: + +- `grant_type` : `http://auth0.com/oauth/grant-type/mfa-recovery-code` +- `recovery_code` : the recovery code provided by the user + +```har +{ + "method": "POST", + "url": "https://${account.namespace}/oauth/token", + "headers": [ + { "name": "Content-Type", "value": "application/x-www-form-urlencoded" } + ], + "postData": { + "mimeType": "application/x-www-form-urlencoded", + "params": [ + { + "name": "grant_type", + "value": "http://auth0.com/oauth/grant-type/mfa-recovery-code" + }, + { + "name": "client_id", + "value": "${account.clientId}" + }, + { + "name": "client_secret", + "value": "YOUR_CLIENT_SECRET" + }, + { + "name": "mfa_token", + "value": "MFA_TOKEN" + }, + { + "name": "recovery_code", + "value": "RECOVERY_CODE" + } + ] + } +} +``` + +### 3. Ask the user to capture the new Recovery Code + +If the call is successful, you'll get the authentication tokens and a new recovery code: + +```json +{ + "access_token": "O3...H4", + "id_token": "eyJh...w", + "scope": "openid profile", + "expires_in": 86400, + "recovery_code": "K6LGLV3RSH3VERMKET8L7QKU", + "token_type": "Bearer" +} +``` + +You should let the user know that a new recovery code was generated and ask them to capture it. + +* [Managing MFA Enrollments](/mfa/guides/mfa-api/manage) +* [Enroll and Challenge Push Authenticators](/mfa/guides/mfa-api/push) +* [Enroll and Challenge OTP Authenticators](/mfa/guides/mfa-api/otp) +* [Enroll and Challenge SMS Authenticators](/mfa/guides/mfa-api/sms) +* [Enroll and Challenge Email Authenticators](/mfa/guides/mfa-api/email) diff --git a/articles/mfa/guides/reset-user-mfa.md b/articles/mfa/guides/reset-user-mfa.md new file mode 100644 index 0000000000..fde72fc781 --- /dev/null +++ b/articles/mfa/guides/reset-user-mfa.md @@ -0,0 +1,52 @@ +--- +description: Learn how to reset a user's MFA in case they lose their mobile device and do not have a recovery code. +topics: + - mfa + - user-management +contentType: + - how-to +useCase: + - customize-mfa +--- +# Reset User's MFA + +If a user has lost their mobile device, they can use their recovery code to log in. If they do not have a recovery code, they will need their tenant administrator to reset their multi-factor authentication (MFA). + +This action is equivalent to removing or deleting the user's MFA registration. The MFA settings associated with their user will be removed, which allows them to set up MFA as if they were a new user on their next login attempt. + +::: note +If you need to reset an admin's MFA as opposed to an end user's MFA, please contact [Auth0 Support](https://auth0.com/docs/support). +::: + +## Reset MFA in the Dashboard + +1. Go to [Dashboard > Users & Roles > Users](${manage_url}/#/users). +2. Click on the user whose MFA you want to reset. +3. Click on the **Actions** button on the top right of the screen. +4. Select **Reset Multi-factor** from the dropdown. + + Admins will also see a **Reset MFA** link at the bottom of the **Multi-Factor Authentication** tab of the **User Details** page if the user is already enrolled in MFA. Both these methods function the same way. + +5. There will be a pop up box to confirm your decision. Click **YES, RESET IT** to reset the user's MFA. + +The next time the user logs in, they will need to setup their MFA just like a new user. + +## Reset MFA using the Management API + +As an admin, you can also use the Management API to delete a user's MFA enrollment using `DELETE /api/v2/guardian/enrollments/{id}`. This requires getting the enrollment ID first with a `GET` to the same endpoint. If the user has more than one enrollment, you will need to repeat the process for each enrollment. + +## Recovery codes + +With most MFA factors, the end user will be given a recovery code upon signup, which should be noted and kept secret. If they do not have their device or are otherwise temporarily unable to use their normal MFA process, the user can log in by entering this code after their username and password. + +![MFA Recovery Code](/media/articles/mfa/recovery-code.png) + +::: note +If a recovery code is used, a new recovery code will be provided at that time. +::: + +If a user uninstalls then later re-installs Guardian, they may be prompted to enter their recovery code. If the recovery code has been lost, the user can perform a new installation of the app by disabling automatic restoration of their Guardian backup. To do so, the user will need to uninstall Guardian, temporarily disable automatic restoration of backups within their device settings (steps to do so will vary according to the device), then re-install the app. They will then need to add their MFA account(s) to the app as if performing a first-time setup. If automatic backups or automatic restoration are not enabled on the user's device, re-installation of the app will not prompt for a recovery code and the user will be required to add their MFA account(s) as in a first-time setup. + +## Keep reading + +* [Reset Auth0 Account Password](/support/reset-account-password) diff --git a/articles/mfa/index.md b/articles/mfa/index.md new file mode 100644 index 0000000000..a31faa4646 --- /dev/null +++ b/articles/mfa/index.md @@ -0,0 +1,31 @@ +--- +title: Multi-factor Authentication +description: Understand how MFA works in Auth0. +classes: topic-page +topics: + - mfa +contentType: + - index +useCase: + - customize-mfa +--- +# Multi-factor Authentication + +Multi-factor Authentication (MFA) provides a method to verify a user's identity by requiring them to provide more than one piece of identifying information. This ensures that only valid users can access their accounts even if they use a username and password that may have been compromised from a different application. + +To enable MFA, go to [Dashboard > Multifactor Auth](${manage_url}/#/guardian) and toggle on the factors you want to enable on your tenant, such as push notifications or SMS. Next, perform any further setup required to configure that factor, then choose whether you wish to force MFA for all users or not. You can also customize your MFA flow with Auth0 [Rules](/rules/references/use-cases#multi-factor-authentication) to allow MFA to only be required in specific circumstances or force a particular factor to be used. + +See the following sections for more details: + +<%= include('../_includes/_topic-links', { links: [ + 'mfa/concepts/mfa-factors', + 'mfa/guides/enable-mfa', + 'mfa/concepts/guardian', + 'mfa/guides/customize-mfa-universal-login', + 'mfa/guides/reset-user-mfa', + 'mfa/guides/import-user-mfa', + 'mfa/concepts/mfa-developer-resources', + 'mfa/concepts/step-up-authentication', + 'mfa/references/troubleshoot-mfa' +] }) %> + diff --git a/articles/mfa/references/guardian-error-code-reference.md b/articles/mfa/references/guardian-error-code-reference.md new file mode 100644 index 0000000000..696d3e70de --- /dev/null +++ b/articles/mfa/references/guardian-error-code-reference.md @@ -0,0 +1,49 @@ +--- +title: Guardian Error Code Reference +description: Lists Guardian error codes and descriptions. +topics: + - guardian +contentType: + - reference +useCase: + - customize-mfa +--- +# Guardian Error Code Reference + +Use the error codes to display informative messages and to distinguish between recoverable and unrecoverable errors. + +| Error Code | Description | +| -- | -- | +| `invalid_token` | Invalid request or transaction token +| `insufficient_scope` | You don't have enought grants to perform the requested operation +| `invalid_bearer_format` | The bearer put in authentication header was not valid +| `enrollment_conflict` | There is another enrollment for the same user. You cannot enroll twice. +| `tenant_not_found` | The tenant associated cannot be found. Should not normally happen at least that you delete the tenant +| `login_transaction_not_found` | The mfa auth transaction is not active or has already expired +| `error_sending_push_notification` | Push notification delivery failed +| `push_notification_wrong_credentials` | Push notification delivery failed because of wrong credentials +| `invalid_otp` | Provided otp code was not valid +| `invalid_recovery_code` | Provided recovery code was not valid +| `invalid_body` | Body validation failed. Bad request. +| `invalid_query_string` | Query string validation failed. Bad request. +| `enrollment_transaction_not_found` | The mfa enrollment transaction is not active or has expired +| `invalid_phone_number` | The provided phone number is invalid +| `error_sending_sms` | SMS Delivery error +| `feature_disabled` | The requested feature is currently globally not available (contact the provider) +| `feature_disabled_by_admin` | The requested feature is currently disabled by your admin +| `pn_endpoint_disabled` | We were unable to deliver the push notification after retrying many times. Try removing you account for the device and adding it again. +| `too_many_sms` | You have exeed the amount of SMSs assigned to your user +| `too_many_pn` | You have exeed the amount of push notifications assigned to your user +| `too_many_sms_per_tenant` | You have exeed the amount of SMSs assigned to your tenant +| `too_many_pn_per_tenant` | You have exeed the amount of push notifications assigned to your tenant +| `field_required` | A field is required to perform the operation (this errors has a field attribute with a code for the field: `otpCode`, `recoveryCode`) +| `method_not_found` | You have requested a method that is currently not supported (should not happen) +| `no_method_available` | There is currently no method to enroll (all of them are disabled) +| `enrollment_method_disabled` | The specified enrollment method is disabled, this error has also a .method field +| `auth_method_disabled` | The specified authentication method is disabled, this error has also a .method field +| `invalid_otp_format` | OTP format validation error +| `invalid_recovery_code_format` | Recovery code format validation error +| `transaction_expired` | The transaction has already expired +| `already_enrolled` | You are already enrolled, cannot enroll again +| `not_enrolled` | You not enrolled. Must enroll first +| `invalid_enrollment` | The enrollment provided to transaction#requestAuth method is not valid or is null/undefined diff --git a/articles/mfa/references/language-dictionary.md b/articles/mfa/references/language-dictionary.md new file mode 100644 index 0000000000..614f9d1c5f --- /dev/null +++ b/articles/mfa/references/language-dictionary.md @@ -0,0 +1,231 @@ +--- +description: Describes the MFA hosted page configuration options for customizing the theme properties of the MFA pages. +topics: + - mfa + - hosted-pages +contentType: reference +useCase: customize-hosted-pages +--- +# MFA Theme Language Dictionary + +## defaultLocation + +```js +return new Auth0MFAWidget({ + +... + + defaultLocation : ['United Kingdom', 'GB', '+44'], + +... + +}) +``` + +## languageDictionary + +The `languageDictionary` can be used to override the text for many areas of the MFA process on Universal Login Classic Experience. You do this with the following format: + +``` +languageDictionary: + optionsCategory: + option: value +``` + +Here is an example, modifying the `headerText` attribute in `smsEnrollmentConfirm`: + +```js +return new Auth0MFAWidget({ + +... + + languageDictionary:{ // Use the Language Dictionary option + smsEnrollmentConfirm:{ // Indicate which category/section you are modifying + headerText: "Some custom text - In order to confirm enrollment we need to confirm your phone. Please enter the received code." // Provide the new value for the specific attribute you wish to modify + } + } + +... + +}) +``` + +See below for a list of available categories and options. + +### languageDictionary options + +```js +defaults: { + iddleHelpUrl: '#', + rememberBrowserCheckbox: 'Remember this browser', + title: 'Login to {tenantName}' +}, + +downloadApp: { + headerText: 'Download Auth0 Guardian for free:', + pushEnrollmentAction: 'I\'ve already downloaded it', + smsAndTotpEnrollmentActions: 'I\'d rather use SMS or Google Authenticator', + pushAndTotpEnrollmentActions: 'I\'d rather use Guardian or Google Authenticator', + pushAndSmsEnrollmentActions: 'I\'d rather use Guardian or SMS', + totpEnrollmentActions: 'I\'d rather use Google Authenticator', + smsEnrollmentActions: 'I\'d rather use SMS', + pushEnrollmentActions: 'I\'d rather use Guardian', + iosLabel: 'App Store', + iosUrl: 'https://itunes.apple.com/us/app/auth0-guardian/id1093447833?ls=1&mt=8', + iosImg: '', + androidLabel: 'Google Play', + androidUrl: 'https://play.google.com/store/apps/details?id=com.auth0.guardian', + androidImg: '' +}, + +pushAuth: { + pushSent: { + useTotpFallback: 'If you haven\'t received the notification,

    just enter the code manually.' + }, + + pushTimeout: { + resendAction: 'Resend push notification', + timeoutText: 'Didn\'t receive the push notification?', + useRecoveryCode: 'Lost your device? Use the recovery code', + useTotpFallback: 'Enter the code manually' + } +}, + +totpAuth: { + codePlaceholder: 'Enter the 6-digit code', + headerText: 'Get a verification code from the Google Authenticator (or similar) app:', + useRecoveryCode: 'Lost your device? Use the recovery code' +}, + +smsAuth: { + codePlaceholder: 'Enter the 6-digit code', + headerText: 'Enter the 6-digit code we\'ve just sent to your phone.', + useRecoveryCode: 'Lost your device? Use the recovery code' +}, + +guardianTotpAuth: { + codePlaceholder: 'Enter the 6-digit code', + headerText: 'Get a verification code from the Auth0 Guardian app.' +}, + +recoveryCodeAuth: { + codePlaceholder: 'Enter your code here', + headerText: 'We will generate a new recovery code
    once you\'ve logged in:' +}, + +pushEnrollment: { + headerText: 'Scan this code with Auth0 Guardian:' +}, + +enrollmentCongrats: { + congrats: 'Congratulations, you are all set.
    In the future when logging in you\'ll want your device handy.', + continueButtonText: 'Continue' +}, + +reportRecoveryCode: { + headerText: 'In the event that you need to login without your device you\'ll need a recovery code. Take a note and keep this somewhere safe:', + confirmationLabel: 'I have safely recorded this code' +}, + +generalError: { + errorsRecoveryHelp: { + default: 'Looks like something went wrong.
    Please try logging in again from the application.', + + globalTransactionExpired: 'The login was not successful.
    Please try again.', + + // Auth0 Server Errors + guardianInvalidNonce: 'Please try logging in again from the application.', + guardianInvalidToken: 'Please try logging in again from the application.', + invalidLoginTokenStatus: 'Please try logging in again from the application.', + loginTokenInvalidSignature: 'Please try logging in again from the application.', + loginTokenTransactionExpired: 'Please try logging in again from the application.' + } +}, + +smsEnrollmentConfirm: { + codePlaceholder: 'Enter the 6-digit code', + headerText: 'In order to confirm enrollment we need to confirm your phone. Please enter the received code.' +}, + +totpEnrollment: { + codePlaceholder: 'Enter your passcode here', + headerText: 'Scan this QR code with Google Authenticator (or similar) app:' +}, + +totpEnrollmentCode: { + codePlaceholder: 'Enter your passcode here', + headerText: 'Manually enter the following code into your preferred authenticator app and then enter the provided one-time code below.', + copyCodeButton: 'Copy code' +}, + +smsEnrollmentAddPhoneNumber: { + headerText: 'Please enter your phone
    in order to enroll.', + phoneNumberLabel: 'A code will be sent to this number:', + phoneNumberPlaceholder: 'Your phone number' + // countryCodes: { 'US': 'Translation of United States', ... '': '' } +}, + +authCongrats: { + congrats: 'We have verified your identity. Redirecting...', + congratsNoRedirect: 'We have verified your identity.', + continueButtonText: 'Continue' +}, + +errorMessages: { + alreadyEnrolled: 'You are already enrolled, cannot enroll again', + authMethodDisabled: 'The specified authentication method is disabled', + connectionError: 'Looks like we cannot contact our server. Please check your internet connection and retry.', + default: 'Looks like something went wrong. Please retry.', + defaultRequest: 'Looks like we found a problem contacting our server. Please retry.', + enrollmentConflict: 'Seems that you have already enrolled. Try logging in again from the application.', + enrollmentMethodDisabled: 'The specified enrollment method is disabled', + enrollmentNotFound: 'We couldn\'t find your enrollment. You\'ve probably started enrollment from another device. Finish it there or try logging in again from the application.', + enrollmentTransactionNotFound: 'The mfa enrollment transaction is not active or has expired. Please try again.', + errorSendingPushNotification: 'We found an error sending your notification. Please try again.', + errorSendingPushNotificationManualFallback: 'We could not send the push. Please enter the code manually.', + errorSendingSms: 'We found an error sending your code. Please try again in a few seconds.', + errorSendingSmsManualFallback: 'We could not send the sms. Please try the recovery code.', + featureDisabled: 'This module is currently disabled.', + featureDisabledByAdmin: 'This module was disabled by the admin.', + fieldRequired: 'Please fill out required field.', + globalTransactionExpired: 'Your login attempt has timed out.', + guardianInvalidNonce: 'There was a problem authenticating your request origin. Have you started too many parallel logins?', + guardianInvalidToken: 'There was a problem validating authentication request format.', + insufficientScope: 'Seems that you are not authorized to perform this action.', + invalidBearerFormat: 'Seems that you are not authorized to perform this action.', + invalidLoginTokenStatus: 'Unexpected state validating your request.', + invalidOtp: 'Seems that your code is not valid, please check and retry.', + invalidOtpFormat: 'OTP Code must have 6 numeric characters', + invalidPhoneNumber: 'Seems that your phone number is not valid. Please check and retry.', + invalidRecoveryCode: 'Seems that your recovery code is not valid. Please check and try again.', + invalidRecoveryCodeFormat: 'Recovery code must have 24 alphanumeric characters', + invalidToken: 'Seems that you are not authorized to perform this action.', + loginRejected: 'Auth has been rejected. Try again.', + loginTokenInvalidSignature: 'We cannot verify who seems to be the issuer for this request', + loginTokenTransactionExpired: 'Your authentication request is expired. Is your connection slow?', + loginTransactionNotFound: 'Seems that your device has taken too long to login. Please try again.', + noMethodAvailable: 'There is currently no authentication method available.', + noPublicKeyAvailable: 'We cannot verify your identity. Contact tenant admin.', + pnEndpointDisabled: 'Seems that we cannot deliver messages to your cell phone. Please try again.', + pushNotificationNotConfigured: 'Seems that enrollment was not finished. Please try logging in again from the application.', + pushNotificationWrongCredentials: 'Seems that your device credentials are outdated. Please re-enroll your device or wait for them to be updated.', + smsNotConfigured: 'You cannot use this module because you\'ve enrolled with a different one.', + socketError: 'We cannot connect to real time channel.', + // tenant_not_found | The tenant associated cannot be found. Should not normally happen at least that you delete the tenant + tooManyPn: 'You have exceeded the amount of push notifications per minute. Please wait and try again.', + tooManyPnPerTenant: 'There are too many push requests right now. Wait a few minutes and try again.', + tooManySms: 'You have exceeded the amount of SMSs per hour. Wait a few minutes and try again.', + tooManySmsPerTenant: 'There are too many SMSs right now. Wait a few minutes and try again.' + // | transaction_expired | The transaction has already expired | +}, + +successMessages: { + auth: 'We have successfully verified your identity. Redirecting...', + pushSent: 'We\'ve sent a push to: {enrollmentName}', + smsSent: 'We\'ve sent an sms to: {phoneNumber}' +}, + +infoMessages: { + iddle: 'Can we help you?

    Click here to learn more' +} +``` diff --git a/articles/mfa/references/mfa-widget-reference.md b/articles/mfa/references/mfa-widget-reference.md new file mode 100644 index 0000000000..edcdd1dce7 --- /dev/null +++ b/articles/mfa/references/mfa-widget-reference.md @@ -0,0 +1,59 @@ +--- +description: Describes the MFA Widget theme options for customizing the theme properties of the MFA pages. +topics: + - mfa + - hosted-pages +contentType: reference +useCase: customize-hosted-pages +--- +# MFA Widget Theme Options + +When using your own HTML, it uses the Auth0 MFA Widget, which has the following limitations: +- It does not support MFA with Email. +- If users enrolled more than one factor, they cannot select which one to use, the MFA widget will ask them to login with the most secure factor. +- It does not use Universal Login's [internationalization](/universal-login/i18n) features + +There are a few theming options for the MFA Widget, namespaced under the `theme` property. + +## icon + +The value for `icon` is the URL for an image that will be used in the MFA Widget header, which defaults to the Auth0 logo. It has a recommended max height of `58px` for a better user experience. + +```js +return new Auth0MFAWidget({ + +... + + theme: { + icon: 'https://example.com/assets/logo.png' + }, + +... + +}) +``` + +## primaryColor + +The `primaryColor` property defines the primary color of the MFA Widget. This option is useful when providing a custom `icon`, to ensure all colors go well together with the `icon`'s color palette. Defaults to `#ea5323`. + +```js +return new Auth0MFAWidget({ + +... + + theme: { + icon: 'https://example.com/assets/logo.png', + primaryColor: 'blue' + }, + +... + +}) +``` + +## Keep reading + +* [auth0-guardian.js](https://github.com/auth0/auth0-guardian.js) +* [Widget Example Using auth0-guardian.js](https://github.com/auth0/auth0-guardian.js/tree/master/example) +* [Multi-factor Authentication with Classic Universal Login](/universal-login/multifactor-authentication) diff --git a/articles/mfa/references/troubleshoot-mfa.md b/articles/mfa/references/troubleshoot-mfa.md new file mode 100644 index 0000000000..be1bb19a8e --- /dev/null +++ b/articles/mfa/references/troubleshoot-mfa.md @@ -0,0 +1,63 @@ +--- +description: Describes basic troubleshooting of MFA issues for end-users. +topics: + - mfa +contentType: + - reference +useCase: + - customize-mfa +--- +# Troubleshoot Multi-Factor Authentication + +This guide serves as a troubleshooting reference if you have end-users unable to log in with multi-factor authentication (MFA). + +## Generic issues + +### If you do not have your mobile device, or your mobile device is turned off + +If you have lost your device, you can finish authentication using the recovery code provided when you first signed up. + +1. Enter your email and password to log in, and click the **Use the recovery code** link. +2. Enter your recovery code. + +If you no longer have your recovery code, you will not be able to log in. Contact your system administrator for help accessing your account. + +### If you forget your password + +If you have forgotten your password, click the **Don't remember your password?** link located underneath the email and password fields. Then, enter your email address to receive an email containing a link you can use to reset your password. + +### If your transaction expires + +When logging in via MFA, there is a five-minute maximum between providing your first and second factors. You can see how much time has elapsed since you logged in using the first factor by checking the timestamp on the messages provided. + +If more than five minutes has elapsed, you will need to log in again and obtain a new code or notification. + +If you are requesting SMS or Voice messages, make sure you are not [exceeding rate limits](#sms-rate-limits). + +### If you need to remove or delete MFA from a user in your tenant + +If you need to remove, delete, or reset MFA for a user, you should [reset MFA](/mfa/guides/reset-user-mfa). + +## Phone messaging-related issues + +### SMS message rate limits + +If a user attempts to send more than ten SMS or Voice messages within one hour, they will see an error message saying so. + +When they exceed your messaging limit, they'll need to wait at least an hour after they sent the first message before sending another. They will receive an additional attempt after the passage of each additional hour. + +## Rejected Codes + +If the 6-digit code in the Guardian or the Google Authenticator app are being rejected for sign in (often with the message `Incorrect Code`), first check that you are selecting the right application from the list in your authenticator app. If you've verified that you're selecting the correct application, make sure that your mobile device's clock settings are correct. One-time passwords are generated using Coordinated Universal Time (UTC), so your device's time must be correct for your code to work. + +To check your clock settings: + +* **Android Devices** - Go **Settings** > **Date & Time**. Make sure that the box next to **Automatic** is checked. + +* **iOS Devices** - Go to **Settings** > **General** > **Date & Time**. Enable **Set Automatically**. If this setting was already enabled, you can disable it for a moment, then re-enable. + +## Duo-related issues + +For questions or issues specifically regarding Duo, [see Duo's documentation](https://guide.duo.com). + +Android, then tap "Settings." Scroll down to the bottom of the Settings menu, then tap "Date & Time." Tap the box next to "Automatic" to un-check it. diff --git a/articles/mfa/send-phone-message-hook-amazon-sns.md b/articles/mfa/send-phone-message-hook-amazon-sns.md new file mode 100644 index 0000000000..e5ad994552 --- /dev/null +++ b/articles/mfa/send-phone-message-hook-amazon-sns.md @@ -0,0 +1,152 @@ +--- +title: Configure a Custom SMS Provider for MFA using Amazon SNS +description: Learn how to configure a Custom SMS Provider for multifactor authentication (MFA) using Amazon SNS. +topics: + - mfa + - sms + - custom-sms-provider +contentType: + - how-to +useCase: + - customize-mfa +--- +# Configure a Custom SMS Provider for MFA using Amazon SNS + +This guide explains how to send Multi-factor Authentication (MFA) text messages using the Amazon Simple Notification Service (SNS). + +<%= include('./_includes/_test-setup') %> + +## What is Amazon SNS? + +Amazon Simple Notification Service (SNS) is a pub/sub messaging service that enables Auth0 to deliver multi-factor verification via text messages. To learn more, see [Amazon's SNS Overview](https://aws.amazon.com/sns). + +## Prerequisites + +Before you begin this tutorial, please: + +* Sign up for an [Amazon Web Services](https://portal.aws.amazon.com/billing/signup#/start). +* Capture your Amazon Web Service region. +* Create a new Amazon IAM User with the `AmazonSNSFullAccess` role. +* Capture the user's access key and secret key details. + +## Steps + +To configure a custom SMS provider for MFA using Amazon SNS, you will: + +1. [Create a Send Phone Message Hook](#create-a-send-phone-message-hook) +2. [Configure Hook Secrets](#configure-hook-secrets) +3. [Add the AWS SNS call](#add-the-aws-sns-call) +4. [Add the AWS SDK NPM package](#add-the-aws-sdk-npm-package) +5. [Test your Hook implementation](#test-your-hook-implementation) +6. [Activate the custom SMS factor](#activate-the-custom-sms-factor) +7. [Test the MFA flow](#test-the-mfa-flow) + +Optional: [Troubleshoot](#troubleshoot) + +### Create a Send Phone Message Hook + +You will need to create a [Send Phone Message](/hooks/extensibility-points/send-phone-message) Hook, which will hold the code and secrets of your custom implementation. + +::: note +You can only have **one** Send Phone Message Hook active at a time. +::: + +### Configure Hook secrets + +Add three [Hook Secrets](/hooks/secrets/create) with keys `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_REGION`, with the corresponding values from your Amazon account. + +### Add the AWS SNS call + +To make the call to AWS SNS, add the appropriate code to the Hook. + +Copy the code block below and [edit](/hooks/update) the Send Phone Message Hook code to include it. This function will run each time a user requires MFA, calling AWS SNS to send a verification code via SMS. + +```js +// Load the SDK +var AWS = require("aws-sdk"); + +/** +@param {string} recipient - phone number +@param {string} text - message body +@param {object} context - additional authorization context +@param {string} context.factor_type - 'first' or 'second' +@param {string} context.message_type - 'sms' or 'voice' +@param {string} context.action - 'enrollment' or 'authentication' +@param {string} context.language - language used by login flow +@param {string} context.code - one-time password +@param {string} context.ip - ip address +@param {string} context.user_agent - user agent making the authentication request +@param {string} context.client_id - to send different messages depending on the client id +@param {string} context.name - to include it in the SMS message +@param {object} context.client_metadata - metadata from client +@param {object} context.user - To customize messages for the user +@param {function} cb - function (error, response) +*/ +module.exports = function(recipient, text, context, cb) { + process.env.AWS_ACCESS_KEY_ID = context.webtask.secrets.AWS_ACCESS_KEY_ID; + process.env.AWS_SECRET_ACCESS_KEY = context.webtask.secrets.AWS_SECRET_ACCESS_KEY; + process.env.AWS_REGION = context.webtask.secrets.AWS_REGION; + + var params = { Message: text, PhoneNumber: recipient }; + + var publishTextPromise = new AWS.SNS({ apiVersion: "2010-03-31" }) + .publish(params) + .promise(); + + publishTextPromise + .then(function() { + cb(null, {}); + }) + .catch(function(err) { + cb(err); + }); +}; +``` + +### Add the AWS SDK NPM package + +The Hook uses the [AWS SDK for JavaScript in Node.js](https://aws.amazon.com/sdk-for-node-js/), so you'll need to include this package in your Hook. + +1. Click the **Settings** icon again, and select **NPM Modules**. + +2. Search for `aws-sdk` and add the module that appears. + +### Test your Hook implementation + +Click the **Run** icon on the top right to test the Hook. Edit the parameters to specify the phone number to receive the SMS, and click the **Run** button. + +### Activate the custom SMS factor + +The Hook is now ready to send MFA codes via the Vonage SMS API. The last steps are to configure the SMS Factor to use the custom code and test the MFA flow. + +1. Navigate to the [Multifactor Auth](${manage_url}/#/mfa) page in the [Auth0 Dashboard](${manage_url}/), and click the **SMS** factor box. + +2. In the modal that appears, select **Custom** for the **SMS Delivery Provider**, then make any adjustments you'd like to the templates. Click **Save** when complete, and close the modal. + +3. Enable the SMS factor using the toggle switch. + +### Test the MFA flow + +Trigger an MFA flow and double check that everything works as intended. If you do not receive the SMS, please take a look at the [Hook Logs](/hooks/view-logs). + +## Troubleshoot + +If you do not receive the SMS, please look at the logs for clues and ensure that: + +- The Hook is active and the SMS configuration is set to use `Custom`. +- You have configured the Hook Secrets as per Step 2. +- The configured Hook Secrets are the same ones you created in the Amazon Web Services portal. +- Your Amazon Web Services user has access to the `AmazonSNSFullAccess` role. +- Your Amazon Web Services account is active (not suspended). +- Your phone number is formatted using the [E.164 format](https://en.wikipedia.org/wiki/E.164). + +## Additional providers + +::: next-steps +* [Configure a Custom SMS Provider for MFA using Twilio](/mfa/send-phone-message-hook-twilio) +* [Configure a Custom SMS Provider for MFA using Infobip](/mfa/send-phone-message-hook-infobip) +* [Configure a Custom SMS Provider for MFA using TeleSign](/mfa/send-phone-message-hook-telesign) +* [Configure a Custom SMS Provider for MFA using Vonage](/mfa/send-phone-message-hook-vonage) +* [Configure a Custom SMS Provider for MFA using Esendex](/mfa/send-phone-message-hook-esendex) +* [Configure a Custom SMS Provider for MFA using Mitto](/mfa/send-phone-message-hook-mitto) +::: diff --git a/articles/mfa/send-phone-message-hook-esendex.md b/articles/mfa/send-phone-message-hook-esendex.md new file mode 100644 index 0000000000..8292c86b70 --- /dev/null +++ b/articles/mfa/send-phone-message-hook-esendex.md @@ -0,0 +1,150 @@ +--- +title: Configure a Custom SMS Provider for MFA using Esendex +description: Learn how to configure a Custom SMS Provider for multifactor authentication (MFA) using Esendex. +topics: + - mfa + - sms + - custom-sms-provider +contentType: + - how-to +useCase: + - customize-mfa +--- +# Configure a Custom SMS Provider for MFA using Esendex + +This guide explains how to send Multi-factor Authentication (MFA) text messages using Esendex and the Send Phone Message Hook. + +<%= include('./_includes/_test-setup') %> + +## What is Esendex? + +Esendex provides an SMS messaging service that can be used by Auth0 to deliver multi-factor verification via text messages. + +## Prequisites + +Before you begin this tutorial, please: + +- [Sign up with Esendex](https://www.esendex.co.uk/#freetrialformblock) and complete your profile and confirmation steps. Once this is complete, you should be able to access the SMS API. Here, you can try out the API with a test number. + +## Steps + +To configure a custom SMS provider for MFA using Esendex, you will: + +1. [Create a Send Phone Message Hook](#create-a-send-phone-message-hook) +2. [Configure Hook Secrets](#configure-hook-secrets) +3. [Add the Esendex call](#add-the-esendex-call) +4. [Test your Hook implementation](#test-your-hook-implementation) +5. [Activate the custom SMS factor](#activate-the-custom-sms-factor) +6. [Test the MFA flow](#test-the-mfa-flow) + +### Create a Send Phone Message Hook + +You will need to create a [Send Phone Message](/hooks/extensibility-points/send-phone-message) Hook, which will hold the code and secrets of your custom implementation. + +::: note +You can only have **one** Send Phone Message Hook active at a time. +::: + +### Configure Hook Secrets + +You're going to store the values needed from Esendex in [Hook Secrets](/hooks/secrets). This way, the values are secure and can be used easily in your function. + +[Add Hook Secrets](/hooks/secrets/create) with the following settings: + +* `ESENDEX_ACCOUNT` - Esendex Account (from the [Esendex Dashboard](https://admin.esendex.com/accounts)) +* `ESENDEX_USERNAME` - Esendex Username +* `ESENDEX_PASSWORD` - Esendex Password + +### Add the Esendex call + +To make the call to Esendex, add the appropriate code to the Hook. + +Copy the code block below and [edit](/hooks/update) the Send Phone Message Hook code to include it. This function will run each time a user requires MFA, calling Esendex to send a verification code via SMS. You can learn more about the Esendex API in [Esendex's API documentation](https://developers.esendex.com/api-reference#smsapis). + +```js +/** +@param {string} recipient - phone number +@param {string} text - message body +@param {object} context - additional authorization context +@param {string} context.factor_type - 'first' or 'second' +@param {string} context.message_type - 'sms' or 'voice' +@param {string} context.action - 'enrollment' or 'authentication' +@param {string} context.language - language used by login flow +@param {string} context.code - one time password +@param {string} context.ip - ip address +@param {string} context.user_agent - user agent making the authentication request +@param {string} context.client_id - to send different messages depending on the client id +@param {string} context.name - to include it in the SMS message +@param {object} context.client_metadata - metadata from client +@param {object} context.user - To customize messages for the user +@param {function} cb - function (error, response) +*/ +module.exports = function(recipient, text, context, cb) { + const axios = require('axios').default; + + const instance = axios.create({ + baseURL: "https://api.esendex.com/", + headers: { + "Content-Type": "application/json", + "Accept-Encoding": "gzip, deflate, br", + "Accept": "application/json" + }, + }); + instance({ + method: 'post', + auth: { + username: context.webtask.secrets.ESENDEX_USERNAME, + password: context.webtask.secrets.ESENDEX_PASSWORD + }, + url: '/v1.0/messagedispatcher', + data: JSON.stringify({ + accountreference: context.webtask.secrets.ESENDEX_ACCOUNT, + messages: [{ to: recipient, body: text }] + }) + }) + .then((response) => { + cb(null, {}); + }) + .catch((error) => { + cb(error); + }); +}; +``` + +### Test your Hook implementation + +Click the **Run** icon on the top right to test the Hook. Edit the parameters to specify the phone number to receive the SMS, and click the **Run** button. + +### Activate the custom SMS factor + +The Hook is now ready to send MFA codes. The last steps are to configure the SMS Factor to use the custom code and test the MFA flow. + +1. Navigate to the [Multifactor Auth](${manage_url}/#/mfa) page in the [Auth0 Dashboard](${manage_url}/), and click the **SMS** factor box. + +2. In the modal that appears, select **Custom** for the **SMS Delivery Provider**, then make any adjustments you'd like to the templates. Click **Save** when complete, and close the modal. + +3. Enable the SMS factor using the toggle switch. + +### Test the MFA flow + +Trigger an MFA flow and double check that everything works as intended. If you do not receive the SMS, please take a look at the [Hook Logs](/hooks/view-logs). + +## Troubleshoot + +If you do not receive the SMS, please look at the logs for clues and make sure that: + +- The Hook is active and the SMS configuration is set to use 'Custom'. +- You have configured the Hook Secrets as per Step 2. +- The configured Hook Secrets are the same ones you got from Esendex. +- Your phone number is formatted using the [E.164 format](https://en.wikipedia.org/wiki/E.164). + +## Additional providers + +::: next-steps +* [Configure a Custom SMS Provider for MFA using Amazon SNS](/mfa/send-phone-message-hook-amazon-sns) +* [Configure a Custom SMS Provider for MFA using TeleSign](/mfa/send-phone-message-hook-twilio) +* [Configure a Custom SMS Provider for MFA using Infobip](/mfa/send-phone-message-hook-infobip) +* [Configure a Custom SMS Provider for MFA using TeleSign](/mfa/send-phone-message-hook-telesign) +* [Configure a Custom SMS Provider for MFA using Vonage](/mfa/send-phone-message-hook-vonage) +* [Configure a Custom SMS Provider for MFA using Mitto](/mfa/send-phone-message-hook-mitto) +::: diff --git a/articles/mfa/send-phone-message-hook-infobip.md b/articles/mfa/send-phone-message-hook-infobip.md new file mode 100644 index 0000000000..7922543369 --- /dev/null +++ b/articles/mfa/send-phone-message-hook-infobip.md @@ -0,0 +1,156 @@ +--- +title: Configure a Custom SMS Provider for MFA using Infobip +description: Learn how to configure a Custom SMS Provider for multifactor authentication (MFA) using Infobip. +topics: + - mfa + - sms + - custom-sms-provider +contentType: + - how-to +useCase: + - customize-mfa +--- +# Configure a Custom SMS Provider for MFA using Infobip + +This guide explains how to send Multi-factor Authentication (MFA) text messages using Infohip. + +<%= include('./_includes/_test-setup') %> + +## What is Infobip? + +Infobip SMS is a messaging platform that enables Auth0 to deliver multi-factor verification via text messages. To learn more, see [Infobip's SMS Overview](https://www.infobip.com/products/sms). + +## Prerequisites + +Before you begin this tutorial, please: + +* Log in to the [Infobip Portal](https://portal.infobip.com/) or [sign up for a free trial](https://www.infobip.com/signup). +* Create and capture a new API Key on the [Infobip API Keys](https://portal.infobip.com/.settings/accounts/api-keys) page. + +## Steps + +To configure a custom SMS provider for MFA using Infobip, you will: + +1. [Create a Send Phone Message Hook](#create-a-send-phone-message-hook) +2. [Configure Hook Secrets](#configure-hook-secrets) +3. [Add the Infobip call](#add-the-infobip-call) +4. [Test your Hook implementation](#test-your-hook-implementation) +5. [Activate the custom SMS factor](#activate-the-custom-sms-factor) +6. [Test the MFA flow](#test-the-mfa-flow) + +Optional: [Troubleshoot](#troubleshoot) + +### Create a Send Phone Message Hook + +You will need to create a [Send Phone Message](/hooks/extensibility-points/send-phone-message) Hook, which will hold the code and secrets of your custom implementation. + +::: note +You can only have **one** Send Phone Message Hook active at a time. +::: + +### Configure Hook Secrets + +You're going to store the value needed from the Infobip portal in a [Hook Secret](/hooks/secrets). This way, the values are secure and can be used easily in your function. + +[Add a Hook Secret](/hooks/secrets/create) with the following settings. You can find the value for the secret on the [Infobip API Keys](https://portal.infobip.com/.settings/accounts/api-keys) page. + +* `INFOBIP_API_KEY` - Infobip API key + +### Add the Infobip call + +To make the call to Infobip, add the appropriate code to the Hook. + +Copy the code block below and [edit](/hooks/update) the Send Phone Message Hook code to include it. This function will run each time a user requires MFA, calling Infobip to send a verification code via SMS. + +```js +/** +@param {string} recipient - phone number +@param {string} text - message body +@param {object} context - additional authorization context +@param {string} context.factor_type - 'first' or 'second' +@param {string} context.message_type - 'sms' or 'voice' +@param {string} context.action - 'enrollment' or 'authentication' +@param {string} context.language - language used by login flow +@param {string} context.code - one time password +@param {string} context.ip - ip address +@param {string} context.user_agent - user agent making the authentication request +@param {string} context.client_id - to send different messages depending on the client id +@param {string} context.name - to include it in the SMS message +@param {object} context.client_metadata - metadata from client +@param {object} context.user - To customize messages for the user +@param {function} cb - function (error, response) +*/ +module.exports = function(recipient, text, context, cb) { + + const axios = require('axios').default; + const API_KEY = context.webtask.secrets.API_KEY;; + const BASE_URL = 'https://2622w.api.infobip.com'; + const instance = axios.create({ + baseURL: BASE_URL, + headers: { + 'Authorization': 'App ' + API_KEY, + 'Accept': 'application/json', + 'Content-Type': 'application/json' + }, + }); + instance({ + method: 'post', + url: '/sms/2/text/advanced', + data: { + "messages": [ + { + "destinations": [ + { "to": recipient } + ], + "text": text + } + ] + } + }) + .then((response) => { + cb(null, {}); + }) + .catch((error) => { + cb(error); + }); + +}; +``` + +### Test your Hook implementation + +Click the **Run** icon on the top right to test the Hook. Edit the parameters to specify the phone number to receive the SMS, and click the **Run** button. + +### Activate the custom SMS factor + +The Hook is now ready to send MFA codes via Infobip. The last steps are to configure the SMS Factor to use the custom code and test the MFA flow. + +1. Navigate to the [Multifactor Auth](${manage_url}/#/mfa) page in the [Auth0 Dashboard](${manage_url}/), and click the **SMS** factor box. + +2. In the modal that appears, select **Custom** for the **SMS Delivery Provider**, then make any adjustments you'd like to the templates. Click **Save** when complete, and close the modal. + +3. Enable the SMS factor using the toggle switch. + +### Test the MFA flow + +Trigger an MFA flow and double check that everything works as intended. If you do not receive the SMS, please take a look at the [Hook Logs](/hooks/view-logs). + +## Troubleshoot + +If you do not receive the SMS, please look at the logs for clues and make sure that: + +- The Hook is active and the SMS configuration is set to use 'Custom'. +- You have configured the Hook Secrets as per Step 2. +- The configured Hook Secrets are the same ones you created in the Infobip portal. +- Your phone number is formatted using the [E.164 format](https://en.wikipedia.org/wiki/E.164). + +## Additional providers + +::: next-steps +* [Configure a Custom SMS Provider for MFA using Amazon SNS](/mfa/send-phone-message-hook-amazon-sns) +* [Configure a Custom SMS Provider for MFA using Twilio](/mfa/send-phone-message-hook-twilio) +* [Configure a Custom SMS Provider for MFA using TeleSign](/mfa/send-phone-message-hook-telesign) +* [Configure a Custom SMS Provider for MFA using Vonage](/mfa/send-phone-message-hook-vonage) +* [Configure a Custom SMS Provider for MFA using Esendex](/mfa/send-phone-message-hook-esendex) +* [Configure a Custom SMS Provider for MFA using Mitto](/mfa/send-phone-message-hook-mitto) +::: diff --git a/articles/mfa/send-phone-message-hook-mitto.md b/articles/mfa/send-phone-message-hook-mitto.md new file mode 100644 index 0000000000..3398326f20 --- /dev/null +++ b/articles/mfa/send-phone-message-hook-mitto.md @@ -0,0 +1,142 @@ +--- +title: Configure a Custom SMS Provider for MFA using Mitto +description: Learn how to configure a Custom SMS Provider for multifactor authentication (MFA) using Mitto. +topics: + - mfa + - sms + - custom-sms-provider +contentType: + - how-to +useCase: + - customize-mfa +--- +# Configure a Custom SMS Provider for MFA using Mitto + +This guide explains how to send Multi-factor Authentication (MFA) text messages using Mitto and the Send Phone Message Hook. + +<%= include('./_includes/_test-setup') %> + +## What is Mitto? + +Mitto provides an SMS messaging service that can be used by Auth0 to deliver multi-factor verification via text messages. + +## Prequisites + +Before you begin this tutorial, please [create an account with Mitto](https://info.mitto.ch/mitto-auth0). You will get an API Key and a Sender ID that you can then use to invoke Mitto's APIs. + +## Steps + +To configure a custom SMS provider for MFA using Mitto, you will: + +1. [Create a Send Phone Message Hook](#create-a-send-phone-message-hook) +2. [Configure Hook Secrets](#configure-hook-secrets) +3. [Add the Mitto call](#add-the-mitto-call) +4. [Test your Hook implementation](#test-your-hook-implementation) +5. [Activate the custom SMS factor](#activate-the-custom-sms-factor) +6. [Test the MFA flow](#test-the-mfa-flow) + +### Create a Send Phone Message Hook + +You will need to create a [Send Phone Message](/hooks/extensibility-points/send-phone-message) Hook, which will hold the code and secrets of your custom implementation. + +::: note +You can only have **one** Send Phone Message Hook active at a time. +::: + +### Configure Hook Secrets + +You're going to store the values needed from Mitto in [Hook Secrets](/hooks/secrets). This way, the values are secure and can be used easily in your function. + +[Add Hook Secrets](/hooks/secrets/create) with the following settings: + +* `MITTO_API_KEY` - The API Key provided by Mitto + +### Add the Mitto call + +To make the call to Mitto, add the appropriate code to the Hook. + +Copy the code block below and [edit](/hooks/update) the Send Phone Message Hook code to include it. This function will run each time a user requires MFA, calling Mitto to send a verification code via SMS. You can learn more about the Mitto API in [Mitto's API documentation](https://info.mitto.ch/hubfs/Developer%20Guides/Mitto%20SMS%20API%202.0%20Developer%20Guide%20v2.5.pdf). + +```js +/** +@param {string} recipient - phone number +@param {string} text - message body +@param {object} context - additional authorization context +@param {string} context.factor_type - 'first' or 'second' +@param {string} context.message_type - 'sms' or 'voice' +@param {string} context.action - 'enrollment' or 'authentication' +@param {string} context.language - language used by login flow +@param {string} context.code - one time password +@param {string} context.ip - ip address +@param {string} context.user_agent - user agent making the authentication request +@param {string} context.client_id - to send different messages depending on the client id +@param {string} context.name - to include it in the SMS message +@param {object} context.client_metadata - metadata from client +@param {object} context.user - To customize messages for the user +@param {function} cb - function (error, response) +*/ +module.exports = function(recipient, text, context, cb) { + const axios = require('axios').default; + + const instance = axios.create({ + baseURL: "https://rest.mittoapi.com/", + headers: { + "Content-Type": "application/json", + "X-Mitto-API-Key": context.webtask.secrets.MITTO_API_KEY + }, + }); + instance({ + method: 'post', + url: '/sms.json', + data: JSON.stringify({ + to: recipient, + from: "Mitto SMS", // The Mitto Sender ID + text: text + }) + }) + .then((response) => { + cb(null, {}); + }) + .catch((error) => { + cb(error); + }); +}; +``` + +### Test your Hook implementation + +Click the **Run** icon on the top right to test the Hook. Edit the parameters to specify the phone number to receive the SMS, and click the **Run** button. + +### Activate the custom SMS factor + +The Hook is now ready to send MFA codes. The last steps are to configure the SMS Factor to use the custom code and test the MFA flow. + +1. Navigate to the [Multifactor Auth](${manage_url}/#/mfa) page in the [Auth0 Dashboard](${manage_url}/), and click the **SMS** factor box. + +2. In the modal that appears, select **Custom** for the **SMS Delivery Provider**, then make any adjustments you'd like to the templates. Click **Save** when complete, and close the modal. + +3. Enable the SMS factor using the toggle switch. + +### Test the MFA flow + +Trigger an MFA flow and double check that everything works as intended. If you do not receive the SMS, please take a look at the [Hook Logs](/hooks/view-logs). + +## Troubleshoot + +If you do not receive the SMS, please look at the logs for clues and make sure that: + +- The Hook is active and the SMS configuration is set to use 'Custom'. +- You have configured the Hook Secrets as per Step 2. +- The configured Hook Secrets are the same ones you got from Mitto. +- Your phone number is formatted using the [E.164 format](https://en.wikipedia.org/wiki/E.164). + +## Additional providers + +::: next-steps +* [Configure a Custom SMS Provider for MFA using Amazon SNS](/mfa/send-phone-message-hook-amazon-sns) +* [Configure a Custom SMS Provider for MFA using TeleSign](/mfa/send-phone-message-hook-twilio) +* [Configure a Custom SMS Provider for MFA using Infobip](/mfa/send-phone-message-hook-infobip) +* [Configure a Custom SMS Provider for MFA using TeleSign](/mfa/send-phone-message-hook-telesign) +* [Configure a Custom SMS Provider for MFA using Vonage](/mfa/send-phone-message-hook-vonage) +* [Configure a Custom SMS Provider for MFA using Esendex](/mfa/send-phone-message-hook-esendex) +::: diff --git a/articles/mfa/send-phone-message-hook-telesign.md b/articles/mfa/send-phone-message-hook-telesign.md new file mode 100644 index 0000000000..1d13504eaa --- /dev/null +++ b/articles/mfa/send-phone-message-hook-telesign.md @@ -0,0 +1,207 @@ +--- +title: Configure a Custom SMS Provider for MFA using TeleSign +description: Learn how to configure a Custom SMS Provider for multifactor authentication (MFA) using TeleSign. +topics: + - mfa + - sms + - custom-sms-provider +contentType: + - how-to +useCase: + - customize-mfa +--- +# Configure a Custom SMS Provider for MFA using TeleSign + +This guide explains how to send Multi-factor Authentication (MFA) text messages using Telesign. + +<%= include('./_includes/_test-setup') %> + +## What is Telesign? + +Telesign provides two different APIs, both of which may be used alongside Auth0 to deliver multi-factor verification via text messages: + +* [TeleSign SMS](https://www.telesign.com/products/sms-api): Allows you to build and manage SMS communications and security verification processes. +* [TeleSign SMS Verify](https://www.telesign.com/products/sms-verify): Helps you manage the SMS verification process and is available in the Enterprise plan. + +## Prerequisites + +Before you begin this tutorial, please: + +* Log in to your TeleSign portal (either the [TeleSign Enterprise Portal](https://teleportal.telesign.com) or the [TeleSign Standard Portal](https://portal.telesign.com/)). +* Capture the Customer ID and API Keys from your TeleSign account. + +## Steps + +To configure a custom SMS provider for MFA using Telesign, you will: + +1. [Create a Send Phone Message Hook](#create-a-send-phone-message-hook) +2. [Configure Hook Secrets](#configure-hook-secrets) +3. [Add the Telesign call](#add-the-telesign-call) +4. [Test your Hook implementation](#test-your-hook-implementation) +5. [Activate the custom SMS factor](#activate-the-custom-sms-factor) +6. [Test the MFA flow](#test-the-mfa-flow) + +Optional: [Troubleshoot](#troubleshoot) + +### Create a Send Phone Message Hook + +You will need to create a [Send Phone Message](/hooks/extensibility-points/send-phone-message) Hook, which will hold the code and secrets of your custom implementation. + +::: note +You can only have **one** Send Phone Message Hook active at a time. +::: + +### Configure Hook Secrets + +You're going to store the values needed from the Telesign portal in [Hook Secrets](/hooks/secrets). This way, the values are secure and can be used easily in your function. + +[Add Hook Secrets](/hooks/secrets/create) with the following settings. You can find the values for the secrets in your Telesign portal. + +* `TELESIGN_CUSTOMER_ID`: Telesign Customer ID +* `TELESIGN_API_KEY`: Telesign API Key + +### Add the Telesign call + +To make the call to Telesign, add the appropriate code to the Hook. + +Copy the appropriate code block below and [edit](/hooks/update) the Send Phone Message Hook code to include it. This function will run each time a user requires MFA, calling Telesign to send a verification code via SMS. + +#### SMS API + +If you are calling the SMS API, use the following code: + +```js +/** +@param {string} recipient - phone number +@param {string} text - message body +@param {object} context - additional authorization context +@param {string} context.factor_type - 'first' or 'second' +@param {string} context.message_type - 'sms' or 'voice' +@param {string} context.action - 'enrollment' or 'authentication' +@param {string} context.language - language used by login flow +@param {string} context.code - one time password +@param {string} context.ip - ip address +@param {string} context.user_agent - user agent making the authentication request +@param {string} context.client_id - to send different messages depending on the client id +@param {string} context.name - to include it in the SMS message +@param {object} context.client_metadata - metadata from client +@param {object} context.user - To customize messages for the user +@param {function} cb - function (error, response) +*/ +module.exports = function (recipient, text, context, cb) { + + const axios = require('axios').default; + const querystring = require('querystring'); + + const customerId = context.webtask.secrets.TELESIGN_CUSTOMER_ID; + const restApiKey = context.webtask.secrets.TELESIGN_REST_API_KEY; + + const instance = axios.create({ + // If you are using the standard TeleSign plan the URL should be https://rest-api.telesign.com/ + baseURL: "https://rest-ww.telesign.com", + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + }); + + instance({ + method: 'post', + auth: { + username: customerId, + password: restApiKey + }, + url: '/v1/messaging', + data: querystring.stringify({ + phone_number: recipient, + message_type: 'ARN', + message: text + }) + }) + .then((response) => { + cb(null, {}); + + }) + .catch((error) => { + cb(error); + }); +} +``` + +#### SMS Verify API + +If you are calling the SMS Verify API, use the following code: + +```js +module.exports = function(recipient, text, context, cb) { + + const axios = require('axios').default; + const querystring = require('querystring'); + + const customerId = context.webtask.secrets.TELESIGN_CUSTOMER_ID; + const restApiKey = context.webtask.secrets.TELESIGN_API_KEY; + + const instance = axios.create({ + baseURL: "https://rest-ww.telesign.com", + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + }); + + instance({ + method: 'post', + auth: { + username: customerId, + password: restApiKey + }, + url: '/v1/verify/sms', + data: querystring.stringify({ + phone_number: recipient, + template: text + }) + }) + .then((response) => { + cb(null, {}); + }) + .catch((error) => { + cb(error); + }); +} +``` + +### Test your Hook implementation + +Click the **Run** icon on the top right to test the Hook. Edit the parameters to specify the phone number to receive the SMS, and click the **Run** button. + +### Activate the custom SMS factor + +The Hook is now ready to send MFA codes via the Telesign. The last steps are to configure the SMS Factor to use the custom code and test the MFA flow. + +1. Navigate to the [Multifactor Auth](${manage_url}/#/mfa) page in the [Auth0 Dashboard](${manage_url}/), and click the **SMS** factor box. + +2. In the modal that appears, select **Custom** for the **SMS Delivery Provider**, then make any adjustments you'd like to the templates. Click **Save** when complete, and close the modal. + +3. Enable the SMS factor using the toggle switch. + +### Test the MFA flow + +Trigger an MFA flow and double check that everything works as intended. If you do not receive the SMS, please take a look at the [Hook Logs](/hooks/view-logs). + +## Troubleshoot + +If you do not receive the SMS, please look at the logs for clues and make sure that: + +- The Hook is active and the SMS configuration is set to use 'Custom'. +- You have configured the Hook Secrets as per Step 2. +- The configured Hook Secrets are the same ones provided in the TeleSign portal. +- Your phone number is formatted using the [E.164 format](https://en.wikipedia.org/wiki/E.164). + +## Additional providers + +::: next-steps +* [Configure a Custom SMS Provider for MFA using Amazon SNS](/mfa/send-phone-message-hook-amazon-sns) +* [Configure a Custom SMS Provider for MFA using Twilio](/mfa/send-phone-message-hook-twilio) +* [Configure a Custom SMS Provider for MFA using Infobip](/mfa/send-phone-message-hook-infobip) +* [Configure a Custom SMS Provider for MFA using Vonage](/mfa/send-phone-message-hook-vonage) +* [Configure a Custom SMS Provider for MFA using Esendex](/mfa/send-phone-message-hook-esendex) +* [Configure a Custom SMS Provider for MFA using Mitto](/mfa/send-phone-message-hook-mitto) +::: diff --git a/articles/mfa/send-phone-message-hook-twilio.md b/articles/mfa/send-phone-message-hook-twilio.md new file mode 100644 index 0000000000..6abffb4b49 --- /dev/null +++ b/articles/mfa/send-phone-message-hook-twilio.md @@ -0,0 +1,211 @@ +--- +title: Configure a Custom SMS Provider for MFA using Twilio +description: Learn how to configure a Custom SMS Provider for multifactor authentication (MFA) using Twilio. +topics: + - mfa + - sms + - custom-sms-provider +contentType: + - how-to +useCase: + - customize-mfa +--- +# Configure a Custom SMS Provider for MFA using Twilio + +This guide explains how to send Multi-factor Authentication (MFA) text messages using Twilio and the Send Phone Message Hook. + +Auth0 has built-in support for sending messages through Twilio. However, you may want to add specific logic before sending a message or want to send a different message depending on the user or the application. In this case, you would configure SMS MFA to use a Send Phone Message Hook. + +<%= include('./_includes/_test-setup') %> + +## What is Twilio? + +Twilio provides an SMS messaging service which can be used by Auth0 to deliver multi-factor verification via text messages. It provides two different APIs: + + - [Programmable SMS](https://www.twilio.com/sms) is a flexible API designed to fully automate SMS communications. + - [Verify](https://www.twilio.com/verify) is an API designed to send one-time codes while hiding the complexity of SMS delivery. + +## Prerequisites + +Before you begin this tutorial, please: + +* Sign up for a [Twilio](https://www.twilio.com/try-twilio) account. +* Create a new Messaging Service in the [Programmable SMS console](https://www.twilio.com/console/sms/services) or in the [Verify console](https://www.twilio.com/console/verify/services) depending on the API you want to use. +* If you use Programmable SMS, you need to add a phone number that is enabled for SMS to your service and capture the number. +* If use the Verify API, you need to make sure that the Twilio Verify Service is configured to accept a custom code. At the time of writing, you need to contact Twilio support to get it enabled. +* Capture the Account SID and Authorization Token by clicking *Show API Credentials* in the [Twilio SMS Dashboard](https://www.twilio.com/console/sms/dashboard) + +## Steps + +To configure a custom SMS provider for MFA using Twilio, you will: + +1. [Create a Send Phone Message Hook](#create-a-send-phone-message-hook) +2. [Configure Hook Secrets](#configure-hook-secrets) +3. [Add the Twilio call](#add-the-twilio-call) +4. [Add the Twilio Node JS Helper NPM package](#add-the-twilio-node-js-helper-npm-package) +5. [Test your Hook implementation](#test-your-hook-implementation) +6. [Activate the custom SMS factor](#activate-the-custom-sms-factor) +7. [Test the MFA flow](#test-the-mfa-flow) + +### Create a Send Phone Message Hook + +You will need to create a [Send Phone Message](/hooks/extensibility-points/send-phone-message) Hook, which will hold the code and secrets of your custom implementation. + +::: note +You can only have **one** Send Phone Message Hook active at a time. +::: + +### Configure Hook Secrets + +You're going to store the values needed from the Twilio SMS Dashboard in [Hook Secrets](/hooks/secrets). This way, the values are secure and can be used easily in your function. + +[Add Hook Secrets](/hooks/secrets/create) with the following settings. You can find the values for the secrets in your [Twilio SMS Dashboard](https://www.twilio.com/console/sms/dashboard). + +* `TWILIO_ACCOUNT_SID`: Twilio Account SID +* `TWILIO_AUTH_TOKEN`: Twilio Authorization token +* `TWILIO_PHONE_NUMBER`: Twilio "from" sending number + +### Add the Twilio call + +To make the call to Twilio, add the appropriate code to the Hook. + +[Edit](/hooks/update) the Send Phone Message Hook code and copy of the code snippets below, depending on the API you want to use. This function will run each time a user requires MFA, calling Twilio to send a verification code via SMS. + +To use the Programmable SMS API, use the code below. + +```js +/** +@param {string} recipient - phone number +@param {string} text - message body +@param {object} context - additional authorization context +@param {string} context.factor_type - 'first' or 'second' +@param {string} context.message_type - 'sms' or 'voice' +@param {string} context.action - 'enrollment' or 'authentication' +@param {string} context.language - language used by login flow +@param {string} context.code - one time password +@param {string} context.ip - ip address +@param {string} context.user_agent - user agent making the authentication request +@param {string} context.client_id - to send different messages depending on the client id +@param {string} context.name - to include it in the SMS message +@param {object} context.client_metadata - metadata from client +@param {object} context.user - To customize messages for the user +@param {function} cb - function (error, response) +*/ +module.exports = function(recipient, text, context, cb) { + + const accountSid = context.webtask.secrets.TWILIO_ACCOUNT_SID; + const authToken = context.webtask.secrets.TWILIO_AUTH_TOKEN; + const fromPhoneNumber = context.webtask.secrets.TWILIO_PHONE_NUMBER; + + const client = require('twilio')(accountSid, authToken); + + if (context.message_type === "sms") { + client.messages + .create({ + body: text, + from: fromPhoneNumber, + to: recipient + }) + .then(function() { + cb(null, {}); + }) + .catch(function(err) { + cb(err); + }); + } + else { + const sayInCall = ` + + Hello, your code is {{code}}. + ` + client.calls + .create({ + twiml: sayInCall, + to: recipient, + from: fromPhoneNumber, + timeout: 30, + }) + .then(function() { + cb(null, {}) + ) + .catch(function(err) { + cb(err) + } + }; + } +}; +``` + +To use the Verify API, use the code below. + +```js +module.exports = function(recipient, text, context, cb) { + + const accountSid = context.webtask.secrets.TWILIO_ACCOUNT_SID; + const authToken = context.webtask.secrets.TWILIO_AUTH_TOKEN; + const fromPhoneNumber = context.webtask.secrets.TWILIO_PHONE_NUMBER; + + const client = require('twilio')(accountSid, authToken); + + client.verify.services(accountSid) + .verifications + .create({ + to: recipient, + channel: 'sms', + customCode: context.code + }) + .then(function() { + cb(null, {}); + }) + .catch(function(err) { + cb(err); + }); +}; +``` + +### Add the Twilio Node JS Helper NPM package + +The Hook uses the [Twilio Node.JS Helper Library](https://github.com/twilio/twilio-node), so you'll need to include this package in your Hook. + +1. Click the **Settings** icon again, and select **NPM Modules**. + +2. Search for `twilio-node` and add the module that appears. + +### Test your Hook implementation + +Click the **Run** icon on the top right to test the Hook. Edit the parameters to specify the phone number to receive the SMS, and click the **Run** button. + +### Activate the custom SMS factor + +The Hook is now ready to send MFA codes via Twilio. The last steps are to configure the SMS Factor to use the custom code and test the MFA flow. + +1. Navigate to the [Multifactor Auth](${manage_url}/#/mfa) page in the [Auth0 Dashboard](${manage_url}/), and click the **SMS** factor box. + +2. In the modal that appears, select **Custom** for the **SMS Delivery Provider**, then make any adjustments you'd like to the templates. Click **Save** when complete, and close the modal. + +3. Enable the SMS factor using the toggle switch. + +### Test the MFA flow + +Trigger an MFA flow and double check that everything works as intended. If you do not receive the SMS, please take a look at the [Hook Logs](/hooks/view-logs). + +## Troubleshoot + +If you do not receive the SMS, please look at the logs for clues and make sure that: + +- The Hook is active and the SMS configuration is set to use 'Custom'. +- You have configured the Hook Secrets as per Step 2. +- The configured Hook Secrets are the same ones you created in the Twilio SMS Dashboard. +- Your are sending the messages from a phone number that is linked to your Twilio account. +- Your phone number is formatted using the [E.164 format](https://en.wikipedia.org/wiki/E.164). + +## Additional providers + +::: next-steps +* [Configure a Custom SMS Provider for MFA using Amazon SNS](/mfa/send-phone-message-hook-amazon-sns) +* [Configure a Custom SMS Provider for MFA using Infobip](/mfa/send-phone-message-hook-infobip) +* [Configure a Custom SMS Provider for MFA using TeleSign](/mfa/send-phone-message-hook-telesign) +* [Configure a Custom SMS Provider for MFA using Vonage](/mfa/send-phone-message-hook-vonage) +* [Configure a Custom SMS Provider for MFA using Esendex](/mfa/send-phone-message-hook-esendex) +* [Configure a Custom SMS Provider for MFA using Mitto](/mfa/send-phone-message-hook-mitto) +::: diff --git a/articles/mfa/send-phone-message-hook-vonage.md b/articles/mfa/send-phone-message-hook-vonage.md new file mode 100644 index 0000000000..98a46e1a78 --- /dev/null +++ b/articles/mfa/send-phone-message-hook-vonage.md @@ -0,0 +1,172 @@ +--- +description: Configure a Custom SMS Provider for MFA using Vonage +topics: + - mfa + - sms + - custom-sms-provider +contentType: + - how-to +useCase: + - customize-mfa +--- +# Configure a Custom SMS Provider for MFA using Vonage + +This guide explains how to send Multi-factor Authentication (MFA) text messages using the Vonage (previously Nexmo) SMS API. + +<%= include('./_includes/_test-setup') %> + +## What is Vonage? + +Vonage provides an SMS API which can be used by Auth0 to deliver multi-factor verification via text messages. To learn more, see [Vonage's SMS API Overview](https://www.vonage.com/communications-apis/sms/). + +## Get Started with Vonage + +First, [sign up with Vonage](https://dashboard.nexmo.com/sign-up) and complete your profile and confirmation steps. Once done, you should be able to access the [SMS API screen of the Vonage dashboard](https://dashboard.nexmo.com/getting-started/sms). Here, you can try out the API with a test number. + +![Vonage Dashboard Test SMS API](/media/articles/mfa/01-guide-vonage-dashboard-sms-api-test.png) + +Once you've successfully tested the SMS API and can receive a text message, you're ready to integrate with Auth0. + +## Steps + +To configure a custom SMS provider for MFA using Vonage, you will: + +1. [Create a Send Phone Message Hook](#create-a-send-phone-message-hook) +2. [Configure Hook Secrets](#configure-hook-secrets) +3. [Include the nexmo module](#include-the-nexmo-module) +4. [Add the Vonage API Call](#add-the-vonage-api-call) +5. [Test your Hook implementation](#test-your-hook-implementation) +6. [Activate the custom SMS factor](#activate-the-custom-sms-factor) +7. [Test the MFA flow](#test-the-mfa-flow) + +Optional: [Troubleshoot](#troubleshoot) + +### Create a Send Phone Message Hook + +You're going to use a Hook in the Auth0 dashboard to send the text message when MFA is required. To do that, you need the API information for your Vonage account and a simple Node function to send the message. + +1. Navigate to the [Hooks screen](${manage_url}/#/hooks) in the Auth0 Dashboard, scroll down to **Send Phone Message**, and click **Create New Hook**. + +![Auth0 Dashboard: Add New Hook](/media/articles/mfa/02-guide-auth0-add-new-hook.png) + +2. Give the Hook a name, click **Create**, then click the **Edit Hook** button to configure secrets and add the Vonage API call. + +![Auth0 dashboard edit SMS hook](/media/articles/mfa/03-guide-auth0-edit-new-sms-hook.png) + +### Configure Hook Secrets + +You're going to store each of the values needed from the Vonage dashboard in a [Hook Secret](/hooks/secrets). This way, the values are secure and can be used easily in your function. + +Click the **Settings** icon (wrench) on the top left and select **Secrets**, then click **Add Secret**, and add the following secrets. You can find the values for all three of these secrets in the [Getting Started Guide](https://dashboard.nexmo.com/getting-started-guide) in the Vonage dashboard. + +* `VONAGE_API_KEY`: Vonage API key +* `VONAGE_API_SECRET`: Vonage API secret +* `VONAGE_FROM_NUMBER`: Vonage "from" sending number + +![Auth0 Dashboard: Add Hook Secret](/media/articles/mfa/04-guide-auth0-add-hook-secrets.png) + +### Include the nexmo module + +The Hook uses the [Nexmo Client Library for Node.js](https://aws.amazon.com/sdk-for-node-js/), so you'll need to include this package in your Hook. + +Next, you'll need to include the `nexmo` module in your hook. + +1. Click the **Settings** icon again, and select **NPM Modules**. + +2. Search for `nexmo` and add the module that appears. + +![Auth0 Dashboard: Add Hook Module](/media/articles/mfa/05-guide-auth0-add-nexmo-module.png) + +## Add the Vonage API call + +To make the call to the Vonage API, add the appropriate code to the Hook. + +Copy the code block below and paste it into the Hooks code editor. This function will run each time a user requires MFA, calling the Vonage API to send a verification code via SMS. + +```js +module.exports = function(toNumber, text, context, cb) { + const Nexmo = require('nexmo'); + const nexmo = new Nexmo({ + apiKey: context.webtask.secrets.VONAGE_API_KEY, + apiSecret: context.webtask.secrets.VONAGE_API_SECRET, + }); + + const fromNumber = context.webtask.secrets.VONAGE_FROM_NUMBER; + toNumber = toNumber.replace(/\D/g, ''); + + nexmo.message.sendSms(fromNumber, toNumber, text, (err, responseData) => { + if (err) { + return cb(err); + } + + const firstMsg = responseData.messages[0]; + if (firstMsg['status'] !== '0') { + return cb(new Error('Message failed: ' + firstMsg['error-text'])); + } + + return cb(null, {}); + }); +}; +``` + +### Test your Hook implementation + +Click the **Runner** button to try the completed Hook. Make sure to change the `recipient` value in the body to your test number from the Vonage API. + +You should receive a test text message, and the webtask should complete successfully. + +![Auth0 Dashboard: Run SMS Hook](/media/articles/mfa/06-guide-auth0-run-sms-hook.png) + +### Activate the custom SMS factor + +The Hook is now ready to send MFA codes via the Vonage SMS API. The last steps are to configure the SMS Factor to use the custom code and test the MFA flow. + +1. Navigate to the [Multifactor Auth](${manage_url}/#/mfa) page in the [Auth0 Dashboard](${manage_url}/), and click the **SMS** factor box. + +2. In the modal that appears, select **Custom** for the **SMS Delivery Provider**, then make any adjustments you'd like to the templates. Click **Save** when complete, and close the modal. + +3. Enable the SMS factor using the toggle switch. + +![Auth0 Dashboard: Activate SMS Factor](/media/articles/mfa/07-guide-auth0-activate-sms-factor.png) + +::: note +To use the SMS factor, your tenant needs to have MFA enabled globally or required for specific contexts using Rules. To learn how to enable the MFA feature itself, see the following docs: + +- [Enable Multi-Factor Authentication](/mfa/guides/enable-mfa) +- [Customize Multi-Factor Authentication](/mfa/guides/customize-mfa-universal-login) +::: + +### Test the MFA flow + +You can now test your authentication flow to see the Vonage API in action. + +![Test MFA SMS verification](/media/articles/mfa/08-guide-test-sms-verification.png) + +## Troubleshoot + +If something was misconfigured in Vonage, the Hook, or the SMS Factor, you may see an error message on the login form when trying this factor out for the first time. + +![Auth0 Universal Login MFA SMS Error](/media/articles/mfa/09-guide-login-sms-error-message.png) + +The best place to start debugging this issue is the [Logs screen](${manage_url}/#/logs) in the Auth0 dashboard. Look for a failed SMS log entry: + +![Auth0 Logs: Error Sending MFA SMS](/media/articles/mfa/10-guide-auth0-log-sms-error.png) + +To learn which event types to search, see our [Log Event Type Code list](/logs/references/log-event-type-codes). Otherwise, use the **Filter** control to find `MFA` errors. + +Once you find a log entry of interest, scroll down in the **Raw** tab to see an error message explaining what went wrong: + +![Auth0 Logs: Error Sending MFA SMS Details](/media/articles/mfa/11-guide-auth0-log-sms-error-details.png) + +If this does not solve your issue, the next step would be to check the [Vonage SMS API logs](https://dashboard.nexmo.com/sms) for a sent message and check its status. If there is no record of the message with Vonage, then the API call likely failed and the problem is in the Hook code. + +## Additional providers + +::: next-steps +* [Configure a Custom SMS Provider for MFA using Amazon SNS](/mfa/send-phone-message-hook-amazon-sns) +* [Configure a Custom SMS Provider for MFA using Twilio](/mfa/send-phone-message-hook-twilio) +* [Configure a Custom SMS Provider for MFA using Infobip](/mfa/send-phone-message-hook-infobip) +* [Configure a Custom SMS Provider for MFA using TeleSign](/mfa/send-phone-message-hook-telesign) +* [Configure a Custom SMS Provider for MFA using Esendex](/mfa/send-phone-message-hook-esendex) +* [Configure a Custom SMS Provider for MFA using Mitto](/mfa/send-phone-message-hook-mitto) +::: diff --git a/articles/microsites/add-login/add-login-native-mobile-app.md b/articles/microsites/add-login/add-login-native-mobile-app.md new file mode 100644 index 0000000000..13eb995054 --- /dev/null +++ b/articles/microsites/add-login/add-login-native-mobile-app.md @@ -0,0 +1,83 @@ +--- +title: Add Login to Your Native/Mobile App +description: Everything you need to know to implement login for a native/mobile app +ctaText: Go to Quickstart +ctaLink: /docs/quickstart/native +public: false +template: microsite +topics: + - authentication + - oauth2 + - mobile-apps + - desktop-apps + - native-apps +useCase: + - add-login +--- + +Using Auth0 in your applications means that you will be "outsourcing" the authentication process to a centralized login page in the same way that Gmail, YouTube, and any other Google property redirects to accounts.google.com whenever a user signs in. + +Your user will authenticate, and Auth0 will generate an ID Token that will be passed back to your application. + +## How it works + +In a native/mobile application, the default experience will open a SafariViewController in iOS or a Custom Chrome Tab in Android.  + +1. The user clicks your "login" button or link, and our SDK redirects the user to your Auth0 Authorization Server. +2. The user authenticates with Auth0 using one of your configured login options (e.g., username/password, social identity provider, SAML). +3. Your app requests the user's ID Token. +4. Auth0 responds with the user's ID Token. + +For security in native/mobile devices, Auth0 uses the [Authorization Code Flow with Proof Key for Code Exchange (PKCE)](/flows/concepts/auth-code-pkce). + +Flow Overview for Native/Mobile Apps + +## Implementation overview + +::: steps + 1.

    Configure the sign-in methods

    Auth0 supports a wide range of authentication methods: regular username/password (users can be stored in Auth0 or your own database), social (i.e., Google, Facebook, and 50+ other providers), passwordless (email magic link, email code, and phone code), and enterprise (e.g., SAML-based, ADFS, Ping, Okta).

    Go to the dashboard and turn on the methods you want to allow; they will automatically show up in the login/sign-up page. By default, email/password and Google are enabled. + + 2.

    Customize the sign-in UI (optional)

    The default experience is demonstrated in the image below and can be completely customized in the dashboard, from changing the logo and primary colors to completely overriding it with your own login screen.

    Default Login Screen for Native/Mobile Apps + + 3.

    Use the Auth0 SDK to trigger the flow

    The SDK will take care of the details of opening the SafariViewController or Chrome Custom Tab, parsing the response back from Auth0, and validating the ID Token.

    Your app can store the Access Token and a Refresh Token used to renew the Access Token without asking the user to re-enter their credentials. Follow one of our Native/Mobile Quickstarts to get started with the integration. + +::: + +## Alternative: Use Embedded Login + +While we strongly recommend that you use our hosted universal login page, if you prefer to embed your own login pages within your native/mobile app, you can implement our login widget (Lock UI) directly into your app with our: + +* [iOS Lock UI Component library](/libraries/lock-ios/v2) +* [Android Lock UI Component library](/libraries/lock-android/v2) + +:::: further-reading + +::: guides + * [Auth0 Mobile/Native App Quickstarts](/quickstart/native) + * [Add login using the Authorization Code Flow with PKCE](/flows/guides/auth-code-pkce/add-login-auth-code-pkce) + * [Add Facebook Login to Native Apps](/connections/nativesocial/facebook) + * [Add Sign In with Apple to Native iOS Apps](/connections/nativesocial/apple) + * [Embedded Passwordless Login in Native Applications](/connections/passwordless/embedded-login-native) + * [Customize the universal login page](/universal-login) + * [Token Storage](/tokens/concepts/token-storage) +::: + +::: references + * [SDKs](/libraries) + * [Identity Providers supported by Auth0](/connections) +::: + +::: concepts + * [Universal vs. Embedded Login](/guides/login/universal-vs-embedded) + * [ID Tokens](/tokens/concepts/id-tokens) + * [Access Tokens](/tokens/access-token) +::: + +:::: + +::: whats-next + * Auth0 offers many ways to personalize your user's login experience and customize tokens using [rules](/rules) and [hooks](/hooks). + * Most native/mobile apps access APIs to retrieve data, which can also be done using Auth0. Learn how to call your API from your app: [Call Your API from Your Native/Mobile App](/microsites/call-api/call-api-native-mobile-app). + * If you are building your own API and you want to secure the endpoints using Auth0, see [Protect Your API](/microsites/protect-api/protect-api). +::: + diff --git a/articles/microsites/add-login/add-login-regular-web-app.md b/articles/microsites/add-login/add-login-regular-web-app.md new file mode 100644 index 0000000000..fcab4a04bb --- /dev/null +++ b/articles/microsites/add-login/add-login-regular-web-app.md @@ -0,0 +1,72 @@ +--- +title: Add Login to Your Regular Web App +description: Everything you need to know to implement login for a regular web app +ctaText: Go to Quickstart +ctaLink: /docs/quickstart/webapp +public: false +template: microsite +topics: + - authentication + - oauth2 + - regular-web-apps + - server-side +useCase: + - add-login +--- + +Using Auth0 in your applications means that you will be "outsourcing" the authentication process to a centralized login page in the same way that Gmail, YouTube, and any other Google property redirects to accounts.google.com whenever a user signs in. + +Your user will authenticate, and Auth0 will generate an ID Token that will be passed back to your application. + +## How it works + +In a regular web application:  + +1. The user clicks your "login" button or link, and our SDK redirects the user to your Auth0 Authorization Server. +3. The user authenticates with Auth0 using one of your configured login options (e.g., username/password, social identity provider, SAML). +3. Your app requests the user's ID Token. +4. Auth0 responds with the user's ID Token. + +For security in server-side web apps, Auth0 uses the [Authorization Code Flow](/flows/concepts/auth-code). + +Flow Overview for Regular Web Apps + +## Implementation overview + +::: steps + 1.

    Configure the sign-in methods

    Auth0 supports a wide range of authentication methods: regular username/password (users can be stored in Auth0 or your own database), social (i.e., Google, Facebook, and 50+ other providers), passwordless (email magic link, email code, and phone code), and enterprise (e.g., SAML-based, ADFS, Ping, Okta).

    Go to the dashboard and turn on the methods you want to allow; they will automatically show up in the login/sign-up page. By default, email/password and Google are enabled. + + 2.

    Customize the sign-in UI (optional)

    The default experience is demonstrated in the image below and can be completely customized in the dashboard, from changing the logo and primary colors to completely overriding it with your own login screen.

    Default Login Screen for Native/Mobile Apps + + 3.

    Use an SDK for your chosen platform to trigger the flow

    An open-source OpenID Connect (OIDC) SDK for your chosen platform can redirect to the Auth0 Universal Login page and handle the response, validating the ID Token.

    Your app can store the ID Token. Follow one of our Regular Web App Quickstarts to get started with the integration. +::: + +:::: further-reading + +::: guides + * [Auth0 Regular Web App Quickstarts](/quickstart/webapp) + * [Add login using the Authorization Code Flow](/flows/guides/auth-code/add-login-auth-code) + * [Customize the universal login page](/universal-login) + * [Token Storage](/tokens/concepts/token-storage) +::: + +::: references + * [SDKs](/libraries) + * [Identity Providers supported by Auth0](/connections) +::: + +::: concepts + * [Universal vs. Embedded Login](/guides/login/universal-vs-embedded) + * [ID Tokens](/tokens/concepts/id-tokens) + * [Access Tokens](/tokens/concepts/access-tokens) +::: + +:::: + +::: whats-next + * Auth0 offers many ways to personalize your user's login experience and customize tokens using [rules](/rules) and [hooks](/hooks). + * Most regular web apps access APIs to retrieve data, which can also be done using Auth0. Learn how to call your API from your app: [Call Your API from Your Regular Web App](/microsites/call-api/call-api-regular-web-app). + * If you are building your own API and you want to secure the endpoints using Auth0, see [Protect Your API](/microsites/protect-api/protect-api). +::: + + diff --git a/articles/microsites/add-login/add-login-single-page-app.md b/articles/microsites/add-login/add-login-single-page-app.md new file mode 100644 index 0000000000..7a63e2d626 --- /dev/null +++ b/articles/microsites/add-login/add-login-single-page-app.md @@ -0,0 +1,72 @@ +--- +title: Add Login to Your Single-Page App +description: Everything you need to know to implement login for a single-page app (SPA) +ctaText: Go to Quickstart +ctaLink: /docs/quickstart/spa +public: false +template: microsite +topics: + - authentication + - oauth2 + - single-page-apps + - client-side +useCase: + - add-login +--- + +Using Auth0 in your applications means that you will be "outsourcing" the authentication process to a centralized login page in the same way that Gmail, YouTube, and any other Google property redirects to accounts.google.com whenever a user signs in. + +Your user will authenticate, and Auth0 will generate an ID Token that will be passed back to your application. + +## How it works + +In a single-page application (SPA):  + +1. The user clicks your "login" button or link, and our SDK redirects the user to your Auth0 Authorization Server. +2. The user authenticates with Auth0 using one of your configured login options (e.g., username/password, social identity provider, SAML). +3. Your app requests the user's ID Token. +4. Auth0 responds with the user's ID Token. + +For security in SPAs, Auth0 uses the [Authorization Code Flow with PKCE](/flows/concepts/auth-code-pkce). + +Flow Overview for Single-Page Apps with Auth Code Flow with PKCE + +## Implementation overview + +::: steps + 1.

    Configure the sign-in methods

    Auth0 supports a wide range of authentication methods: regular username/password (users can be stored in Auth0 or your own database), social (i.e., Google, Facebook, and 50+ other providers), passwordless (email magic link, email code, and phone code), and enterprise (e.g., SAML-based, ADFS, Ping, Okta).

    Go to the dashboard and turn on the methods you want to allow; they will automatically show up in the login/sign-up page. By default, email/password and Google are enabled. + + 2.

    Customize the sign-in UI (optional)

    The default experience is demonstrated in the image below and can be completely customized in the dashboard, from changing the logo and primary colors to completely overriding it with your own login screen.

    Default Login Screen for Native/Mobile Apps + + 3.

    Use the Auth0 SDK to trigger the flow

    The SDK will take care of the details of redirecting to Auth0, parsing the response back, and validating the ID Token.

    Your app can keep the ID Token in memory.

    The easiest way to implement the Authorization Code Flow with PKCE is to follow our Single-Page App Quickstarts. You can also use our Auth0 Single-Page App SDK. +::: + +:::: further-reading + +::: guides + * [Auth0 Single-Page App Quickstarts](/quickstart/spa) + * [Add login using the Authorization Code Flow with PKCE](/flows/guides/auth-code-pkce/add-login-auth-code-pkce) + * [Add login using the Implicit Flow](/flows/guides/implicit/add-login-implicit) + * [Customize the universal login page](/universal-login) + * [Token Storage](/tokens/concepts/token-storage) +::: + +::: references + * [SDKs](/libraries) + * [Identity Providers supported by Auth0](/connections) +::: + +::: concepts + * [Universal vs. Embedded Login](/guides/login/universal-vs-embedded) + * [ID Tokens](/tokens/concepts/id-tokens) + * [Access Tokens](/tokens/concepts/access-tokens) +::: + +:::: + +::: whats-next + * Auth0 offers many ways to personalize your user's login experience and customize tokens using [rules](/rules) and [hooks](/hooks). + * Many single-page apps access APIs to retrieve data, which can also be done using Auth0. Learn how to call your API from your app: [Call Your API from Your Single-Page App](/microsites/call-api/call-api-single-page-app). + * If you are building your own API and you want to secure the endpoints using Auth0, see [Protect Your API](/microsites/protect-api/protect-api). +::: + diff --git a/articles/microsites/call-api/call-api-device.md b/articles/microsites/call-api/call-api-device.md new file mode 100644 index 0000000000..c6e23b60fc --- /dev/null +++ b/articles/microsites/call-api/call-api-device.md @@ -0,0 +1,80 @@ +--- +title: Call Your API from an Input-Constrained Device +description: Everything you need to know to call your API from your input-constrained device. For use with native apps. +public: false +template: microsite +topics: + - authorization + - oauth2 + - device + - mobile-apps + - desktop-apps + - native-apps +useCase: + - call-api +--- + +Using Auth0 in your applications means that you will be "outsourcing" the authentication process to a centralized login page in the same way that Gmail, YouTube, and any other Google property redirects to accounts.google.com whenever a user signs in. + +With input-constrained devices, however, rather than immediately authenticating the user, the device asks the user to go to a link on their computer or smartphone to authenticate. This avoids a poor user experience for devices that do not have an easy way to enter text. If you’ve ever signed in to your Netflix account on a device like a Roku, you’ve already encountered this workflow. + +Your user will authenticate on their computer or smartphone, and Auth0 will generate an Access Token that will be passed back to your device application. The Access Token can then be used to call your API. + +This flow can be used with native applications only. + +## How it works + +When your app needs to fetch user data from your API: + +1. If the device is not already authorized, your device app calls your Auth0 Authorization Server to retrieve a device code. +2. Auth0 responds with a URL and user code that your device app can use when asking the user to visit a specific URL on their laptop or smartphone and provide an activation code. +3. Your device app begins to poll your Auth0 Authorization Server for an Access Token. +4. The user authenticates with Auth0 on its computer or smartphone using one of your configured login options (e.g., username/password, social identity provider, SAML). +5. Auth0 responds to your device app with an Access Token. +6. The Access Token can be used to call your API and retrieve requested data. + +For devices, Auth0 uses the [Device Authorization Flow](/flows/concepts/device-auth). + +Flow Overview for Device Apps + +## Implementation overview + +::: steps + 1.

    Configure your API

    Once you have created your API, you will need to authorize your device's application and configure any scopes that applications can request during authorization. + + 2.

    Get an Access Token

    Your device requests an Access Token from your Auth0 Authorization Server using the Device Authorization Flow. + + 3.

    Call your API

    When your device calls your API, it includes the retrieved Access Token in the HTTP Authorization header. +::: + + +To implement the Device Authorization Flow, you can follow our tutorial: [Call Your API Using the Device Authorization Flow](/flows/guides/device-auth/call-api-device-auth). + +:::: further-reading + +::: guides + * [Auth0 Backend/API Quickstarts](/quickstart/backend) + * [Call Your API Using the Device Authorization Flow](/flows/guides/device-auth/call-api-device-auth) + * [Change scopes and add custom claims to tokens using hooks](/api-auth/tutorials/client-credentials/customize-with-hooks) + * [Token Storage](/tokens/concepts/token-storage) +::: + +::: references + * [SDKs](/libraries) + * [Auth0 Authentication API](/api/authentication) + * [OAuth 2.0](/protocols/oauth2) +::: + +::: concepts + * [Access Tokens](/tokens/concepts/access-tokens) +::: + +:::: + +::: whats-next + * The device authorization flow works for native apps. Learn how to [Add Login to Your Native/Mobile App](/microsites/add-login/add-login-native-mobile-app) + * Auth0 offers many ways to personalize your user's login experience and customize tokens using [rules](/rules) and [hooks](/hooks).[;] + " + * If you are building your own API and you want to secure the endpoints using Auth0, see [Protect Your API](/microsites/protect-api/protect-api). + * Learn more about the ways Auth0 can help you [manage user profiles](/microsites/manage-users/manage-users-and-user-profiles) and [maintain custom user data](/microsites/manage-users/define-maintain-custom-user-data). +::: diff --git a/articles/microsites/call-api/call-api-m2m-app.md b/articles/microsites/call-api/call-api-m2m-app.md new file mode 100644 index 0000000000..5f8d1154f5 --- /dev/null +++ b/articles/microsites/call-api/call-api-m2m-app.md @@ -0,0 +1,72 @@ +--- +title: Call Your API from a Machine-to-Machine App +description: Everything you need to know to call your API from your machine-to-machine (M2M) app +ctaText: Go to Quickstart +ctaLink: /docs/quickstart/backend +public: false +template: microsite +topics: + - authentication + - oauth2 + - m2m +useCase: + - call-api +--- + +Using Auth0 in your applications means that you will be "outsourcing" the authentication process to a centralized login page in the same way that Gmail, YouTube, and any other Google property redirects to accounts.google.com whenever a user signs in. + +With machine-to-machine (M2M) apps, however, the system authenticates and authorizes the app rather than a user. + +## How it works + +When your app needs to fetch user data from your API: + +1. Your M2M application authenticates with your Auth0 Authorization Server. +2. Auth0 responds with an Access Token. +3. The Access Token can be used to call your API and retrieve requested data. + +For M2M applications, Auth0 uses the [Client Credentials Flow](/flows/concepts/client-credentials). + +Flow Overview for Machine-to-Machine Apps + +## Implementation overview + +::: steps + 1.

    Configure your API

    Once you have created your API, you will need to authorize your M2M application and configure any scopes that applications can request during authorization. + + 2.

    Get an Access Token

    Your app requests an Access Token from your Auth0 Authorization Server using the Client Credentials Flow. + + 3.

    Call your API

    When your app calls your API, it includes the retrieved Access Token in the HTTP Authorization header. +::: + + +To implement the Client Credentials Flow, [follow our Backend/API Quickstarts](/quickstart/backend). The "Calling your API" section shows the required steps. + +Or, to use our API endpoints, you can follow our tutorial: [Call Your API Using the Client Credentials Flow](/flows/guides/client-credentials/call-api-client-credentials). + +:::: further-reading + +::: guides + * [Auth0 Backend/API Quickstarts](/quickstart/backend) + * [Call Your API Using the Client Credentials Flow](/flows/guides/client-credentials/call-api-client-credentials) + * [Change scopes and add custom claims to tokens using hooks](/api-auth/tutorials/client-credentials/customize-with-hooks) + * [Token Storage](/tokens/concepts/token-storage) +::: + +::: references + * [SDKs](/libraries) + * [Auth0 Authentication API](/api/authentication) + * [OAuth 2.0](/protocols/oauth2) +::: + +::: concepts + * [Access Tokens](/tokens/concepts/access-tokens) +::: + +:::: + +::: whats-next + * Auth0 offers many ways to personalize your user's login experience and customize tokens using [rules](/rules) and [hooks](/hooks). + * If you are building your own API and you want to secure the endpoints using Auth0, see [Protect Your API](/microsites/protect-api/protect-api). + * Learn more about the ways Auth0 can help you [manage user profiles](/microsites/manage-users/manage-users-and-user-profiles) and [maintain custom user data](/microsites/manage-users/define-maintain-custom-user-data). +::: diff --git a/articles/microsites/call-api/call-api-native-mobile-app.md b/articles/microsites/call-api/call-api-native-mobile-app.md new file mode 100644 index 0000000000..d5442b350d --- /dev/null +++ b/articles/microsites/call-api/call-api-native-mobile-app.md @@ -0,0 +1,87 @@ +--- +title: Call Your API from Your Native/Mobile App +description: Everything you need to know to call your API from your native/mobile app +ctaText: Go to Quickstart +ctaLink: /docs/quickstart/native +public: false +template: microsite +topics: + - authentication + - oauth2 + - mobile-apps + - desktop-apps + - native-apps +useCase: + - call-api +--- + +Using Auth0 in your applications means that you will be "outsourcing" the authentication process to a centralized login page in the same way that Gmail, YouTube, and any other Google property redirects to accounts.google.com whenever a user signs in. + +Your user will authenticate, and Auth0 will generate an ID Token and Access Token that will be passed back to your application. The Access Token can then be used to call your API. + +## How it works + +In a native/mobile application, the default experience will open a SafariViewController in iOS or a Custom Chrome Tab in Android.  + +When your app needs to fetch user data from your API: + +1. If the user is not already authenticated, our SDK redirects the user to your Auth0 Authorization Server. +2. The user authenticates with Auth0 using one of your configured login options (e.g., username/password, social identity provider, SAML). +3. Your app requests an ID Token, Access Token, and Refresh Token. +4. Auth0 responds with the requested tokens. +5. The Access Token can be used to call your API and retrieve requested data. + +For security in native/mobile devices, Auth0 uses the [Authorization Code Flow with Proof Key for Code Exchange (PKCE)](/flows/concepts/auth-code-pkce). + +Flow Overview for Native/Mobile Apps + +## Implementation overview + +::: steps + 1.

    Configure your API

    Once you have created your API, you will need to configure any scopes that applications can request during authorization. + + 2.

    Get an Access Token

    Your app requests an Access Token (and optionally, a Refresh Token) from your Auth0 Authorization Server using the Authorization Code Flow with PKCE. + + 3.

    Call your API

    When your app calls your API, it includes the retrieved Access Token in the HTTP Authorization header. + + 4.

    Refresh your Access Token

    When the Access Token expires you can use the Refresh Token to get a new one from your Auth0 Authorization Server. + +::: + + +The easiest way to implement the Authorization Code Flow with PKCE is to [follow our Mobile/Native Quickstarts](/quickstart/native). + +You can also use our mobile SDKs: + +* [Auth0 Swift SDK](/libraries/auth0-swift) +* [Auth0 Android SDK](/libraries/auth0-android) + +Finally, to use our API endpoints, you can follow our tutorial: [Call Your API Using the Authorization Code Flow with PKCE](/flows/guides/auth-code-pkce/call-api-auth-code-pkce). + +:::: further-reading + +::: guides + * [Auth0 Mobile/Native App Quickstarts](/quickstart/native) + * [Call Your API Using the Authorization Code Flow with PKCE](/flows/guides/auth-code-pkce/call-api-auth-code-pkce) + * [Change scopes and add custom claims to tokens using hooks](/api-auth/tutorials/client-credentials/customize-with-hooks) + * [Token Storage](/tokens/concepts/token-storage) +::: + +::: references + * [SDKs](/libraries) + * [Auth0 Authentication API](/api/authentication) + * [OAuth 2.0](/protocols/oauth2) +::: + +::: concepts + * [Access Tokens](/tokens/concepts/access-tokens) +::: + +:::: + +::: whats-next + * Auth0 offers many ways to personalize your user's login experience and customize tokens using [rules](/rules) and [hooks](/hooks). + * If you are building your own API and you want to secure the endpoints using Auth0, see [Protect Your API](/microsites/protect-api/protect-api). + * If you would like to make your native/mobile app work with input-constrained devices, see [Call Your API from an Input-Constrained Device](/microsites/call-api/call-api-device). + * If you need to add login to your own native/mobile app, learn how at: [Add Login to Your Native/Mobile App](/microsites/add-login/add-login-native-mobile-app). +::: diff --git a/articles/microsites/call-api/call-api-regular-web-app.md b/articles/microsites/call-api/call-api-regular-web-app.md new file mode 100644 index 0000000000..a13e6cdd73 --- /dev/null +++ b/articles/microsites/call-api/call-api-regular-web-app.md @@ -0,0 +1,78 @@ +--- +title: Call Your API from Your Regular Web App +description: Everything you need to know to call your API from your regular web app +ctaText: Go to Quickstart +ctaLink: /docs/quickstart/webapp +public: false +template: microsite +topics: + - authentication + - oauth2 + - regular-web-apps + - server-side-apps +useCase: + - call-api +--- + +Using Auth0 in your applications means that you will be "outsourcing" the authentication process to a centralized login page in the same way that Gmail, YouTube, and any other Google property redirects to accounts.google.com whenever a user signs in. + +Your user will authenticate, and Auth0 will generate an ID Token and Access Token that will be passed back to your application. The Access Token can then be used to call your API and extract attributes for that user (such as name, email, role, or a custom attribute) + +## How it works + +When your app needs to fetch user data from your API: + +1. If the user is not already authenticated, our SDK redirects the user to your Auth0 Authorization Server. +2. The user authenticates with Auth0 using one of your configured login options (e.g., username/password, social identity provider, SAML). +3. Your app requests an ID Token, Access Token, and Refresh Token. +4. Auth0 responds with the requested tokens. +5. The Access Token can be used to call your API and retrieve requested data. + +For server-side web apps, Auth0 uses the [Authorization Code Flow](/flows/concepts/auth-code). + +Flow Overview for Regular Web Apps + +## Implementation overview + +::: steps + 1.

    Configure your API

    Once you have created your API, you will need to configure any scopes that applications can request during authorization. + + 2.

    Get an Access Token

    Your app requests an Access Token (and optionally, a Refresh Token) from your Auth0 Authorization Server using the Authorization Code Flow. + + 3.

    Call your API

    When your app calls your API, it includes the retrieved Access Token in the HTTP Authorization header. + + 4.

    Refresh your Access Token

    When the Access Token expires you can use the Refresh Token to get a new one from your Auth0 Authorization Server. + +::: + + +The easiest way to implement the Authorization Code Flow is to [follow our Regular Web App Quickstarts](/quickstart/webapp). + +Or, to use our API endpoints, you can follow our tutorial: [Call Your API Using the Authorization Code Flow](/authorization/flows/call-your-api-using-the-authorization-code-flow). + +:::: further-reading + +::: guides + * [Auth0 Regular Web App Quickstarts](/quickstart/webapp) + * [Call Your API Using the Authorization Code Flow](/authorization/flows/call-your-api-using-the-authorization-code-flow) + * [Change scopes and add custom claims to tokens using hooks](/api-auth/tutorials/client-credentials/customize-with-hooks) + * [Token Storage](/tokens/concepts/token-storage) +::: + +::: references + * [SDKs](/libraries) + * [Auth0 Authentication API](/api/authentication) + * [OAuth 2.0](/protocols/oauth2) +::: + +::: concepts + * [Access Tokens](/tokens/concepts/access-tokens) +::: + +:::: + +::: whats-next + * Auth0 offers many ways to personalize your user's login experience and customize tokens using [rules](/rules) and [hooks](/hooks). + * If you are building your own API and you want to secure the endpoints using Auth0, see [Protect Your API](/microsites/protect-api/protect-api). + * If you need to add login to your own regular web app, learn how at: [Add Login to Your Regular Web App](/microsites/add-login/add-login-regular-web-app). +::: diff --git a/articles/microsites/call-api/call-api-single-page-app.md b/articles/microsites/call-api/call-api-single-page-app.md new file mode 100644 index 0000000000..edaf4ea6e8 --- /dev/null +++ b/articles/microsites/call-api/call-api-single-page-app.md @@ -0,0 +1,74 @@ +--- +title: Call Your API from Your Single-Page App +description: Everything you need to know to call your API from your single-page app (SPA) +ctaText: Go to Quickstart +ctaLink: /docs/quickstart/spa +public: false +template: microsite +topics: + - authentication + - oauth2 + - single-page-apps + - client-side-apps +useCase: + - call-api +--- + +Using Auth0 in your applications means that you will be "outsourcing" the authentication process to a centralized login page in the same way that Gmail, YouTube, and any other Google property redirects to accounts.google.com whenever a user signs in. + +Your user will authenticate, and Auth0 will generate an ID Token and Access Token that will be passed back to your application. The Access Token can then be used to call your API. + +## How it works + +When your app needs to fetch user data from your API: + +1. If the user is not already authenticated, our SDK redirects the user to your Auth0 Authorization Server. +2. The user authenticates with Auth0 using one of your configured login options (e.g., username/password, social identity provider, SAML). +3. Your app requests an ID Token and Access Token. +4. Auth0 responds with the requested tokens. +5. The Access Token can be used to call your API and retrieve requested data. + +For single-page apps, Auth0 uses the [Authorization Code Flow with PKCE](/flows/concepts/auth-code-pkce). + +Flow Overview for Single-Page Apps with Auth Code Flow with PKCE + +## Implementation overview + +::: steps + 1.

    Configure your API

    Once you have created your API, you will need to configure any scopes that applications can request during authorization. + + 2.

    Get an Access Token

    Your app requests an Access Token from your Auth0 Authorization Server using the Authorization Code Flow with PKCE. + + 3.

    Call your API

    When your app calls your API, it includes the retrieved Access Token in the HTTP Authorization header. +::: + +The easiest way to implement the Authorization Code Flow with PKCE is to [follow our Single-Page App Quickstarts](/quickstart/spa). You can also use our [Auth0 Single-Page App SDK](/libraries/auth0-spa-js). + +Finally, to use our API endpoints, you can follow our tutorial: [Call Your API Using the Authorization Code Flow with PKCE](/flows/guides/auth-code-pkce/call-api-auth-code-pkce). + +:::: further-reading + +::: guides + * [Auth0 Single-Page App Quickstarts](/quickstart/spa) + * [Call Your API Using the Authorization Code Flow with PKCE](/flows/guides/auth-code-pkce/call-api-auth-code-pkce) + * [Change scopes and add custom claims to tokens using hooks](/api-auth/tutorials/client-credentials/customize-with-hooks) + * [Token Storage](/tokens/concepts/token-storage) +::: + +::: references + * [SDKs](/libraries) + * [Auth0 Authentication API](/api/authentication) + * [OAuth 2.0](/protocols/oauth2) +::: + +::: concepts + * [Access Tokens](/tokens/concepts/access-tokens) +::: + +:::: + +::: whats-next + * Auth0 offers many ways to personalize your user's login experience and customize tokens using [rules](/rules) and [hooks](/hooks). + * If you are building your own API and you want to secure the endpoints using Auth0, see [Protect Your API](/microsites/protect-api/protect-api). + * If you need to add login to your own single-page app, learn how at: [Add Login to Your Single-Page App](/microsites/add-login/add-login-single-page-app). +::: diff --git a/articles/microsites/manage-users/define-maintain-custom-user-data.md b/articles/microsites/manage-users/define-maintain-custom-user-data.md new file mode 100644 index 0000000000..64c9a50e4c --- /dev/null +++ b/articles/microsites/manage-users/define-maintain-custom-user-data.md @@ -0,0 +1,81 @@ +--- +title: Define and Maintain Custom User Data +description: An introduction to how Auth0 helps you manage user metadata and custom profile information +contentType: microsite +topics: + - users + - user-management + - define-user-data +useCase: manage-users +template: microsite +v2: True +--- + +After you have set up your [user profiles](/microsites/manage-users/manage-users-and-user-profiles), Auth0 can help you define custom user data using the [metadata](/users/concepts/overview-user-metadata) within the user profiles. + +## How it works + +There are two kinds of metadata in Auth0: + +* **`user_metadata`** stores user attributes (such as preferences) that do not impact users' core functionality. An authenticated user can modify this type of data. +* **`app_metadata`** stores information (such as users' support plans, security roles, and access control groups) that can impact users' core functionality. For example, how an application functions or what the user can access. A user cannot modify this type of data. + +For example, suppose the following metadata is stored for a use with the email address `jane.doe@example.com`: + +```json +{ + "emails": "jane.doe@example.com", + "user_metadata": { + "hobby": "surfing" + }, + "app_metadata": { + "plan": "full" + } +} +``` +To read metadata, simply access the correct property as you would from any JSON object. For example, if you were working with the above example metadata within a Rule or via a call to the Management API, you could reference specific items from the data set as follows: + +```js +console.log(user.email); // "jane.doe@example.com" +console.log(user.user_metadata.hobby); // "surfing" +console.log(user.app_metadata.plan); // "full" +``` + +## Customize and maintain user data + +There are a few different ways you can customize the user metadata: + +* Use [Rules](/rules), which execute after a user has been authenticated, to augment the user profile during the authentication transaction, and optionally persist those changes back to Auth0. + +* Use the `GET/userinfo` endpoint to get a user's `user-metadata`, however you must first write a Rule to [copy metadata properties to the ID Token](/rules/current#copy-user-metadata-to-id-token). + +* If you have a database connection, use the [Authentication API](/api/authentication) with the [Signup](/api/authentication?shell#signup) endpoint to set the `user-metadata` for a user. For an example, refer to [Custom Signup > Using the API](/libraries/custom-signup#using-the-api). + +* You can use the [Management API](/api/management/v2) to create, retrieve, or update both the `user-metadata` and `app-metadata` fields. + +After you have customized the user metadata, you can manage and store data related to each of your users that doesn't originate from identity providers in the Auth0 data store or your own custom database. + +:::: further-reading +::: concepts + * [User Management](/users) + * [User Profiles](/users/concepts/overview-user-profile) + * [Metadata](/users/concepts/overview-user-metadata) + * [Normalized User Profiles](/users/normalized/auth0) +::: + +::: guides + * [Manage User Metadata](/users/guides/manage-user-metadata) + * [User Metadata in Rules](/rules/current/metadata-in-rules) + ::: + +::: references + * [User Data Storage Best Practices](/users/references/user-data-storage-best-practices) + * [User Data Storage Scenario](/users/references/user-data-storage-scenario) + * [Authorization Extension](/extensions/authorization-extension/v2) +::: +:::: + +::: whats-next +* Learn more about the tools available to [manage users and user profiles](/microsites/manage-users/manage-users-and-user-profiles). +* If you are building your own API and you want to secure the endpoints using Auth0, see [Protect Your API](/microsites/protect-api/protect-api). + ::: diff --git a/articles/microsites/manage-users/manage-users-and-user-profiles.md b/articles/microsites/manage-users/manage-users-and-user-profiles.md new file mode 100644 index 0000000000..5e564f2bc4 --- /dev/null +++ b/articles/microsites/manage-users/manage-users-and-user-profiles.md @@ -0,0 +1,71 @@ +--- +title: Manage Users and User Profiles +description: An introduction to how Auth0 helps you manage users and their profile information +contentType: microsite +public: false +topics: + - users + - user-management +useCase: manage-users +template: microsite +v2: true +--- + +Auth0 stores user profiles for your application in a hosted cloud database. User profile information can come from your users directly or from any number of other external sources including Social Identity Providers, Enterprise connections like SAML, or custom sources like Active Directory. Auth0 refers to all user profile attribute sources as connections because Auth0 *connects* to them to authenticate the user. + +You can manage and store custom user attributes such as favorite color or phone number along with the standard profile information. Using our Rules engine you can modify or enhance the user profiles. + +## How it works + +Within the Auth0 database: + +1. Auth0 creates a user profile for each unique user of your applications. +2. Auth0 fills that profile with information provided by the user directly or from their chosen connection. +3. If the information is sourced from a connection, Auth0 refreshes that data each time the user authenticates. +4. Each connection may return a set of attributes about the user, and each provider may use different names for the same attribute, such as surname, last name, and family name. To handle such differences, Auth0 applies a Normalized User Profile, which returns a basic set of information using specific attribute names. + +Manage Users and User Profiles + +## Manage user identities and profile information + +There are several ways you can modify information in a user profile or an ID Token. + +* **Scopes**: The authentication flows supported by Auth0 include an optional parameter that allows you to specify a scope. This controls the user profile information (claims) included in the ID Token (JWT). + +* **Management Dashboard**: On the dashboard administrators can manually edit portions of the user profile for a particular user. This mechanism can be used to alter the user_metadata and app_metadata portions of the user profile. + +* **Management API**: Provides access to read, update, and delete user profiles stored in the Auth0 database. + +* **Custom database scripts**: If a custom database is used as the connection, you can write scripts to implement lifecycle events such as create, login, verify, delete and change password. Auth0 provides templates for these scripts that you can modify for the particular database and schema. + +* **Rules**: Rules execute after a user has been authenticated. Use Rules to augment the user profile during the authentication transaction, and optionally persist those changes back to Auth0. + +:::: further-reading +::: concepts + * [User Management](/users) + * [User Profiles](/users/concepts/overview-user-profile) + * [Metadata](/users/concepts/overview-user-metadata) + * [Normalized User Profiles](/users/normalized) + ::: + +::: guides + * [Scopes](/scopes) + * [Manage Users Using the Dashboard](/users/guides/manage-users-using-the-dashboard) + * [Manage Users Using the Management API](/users/guides/manage-users-using-the-management-api) + * [Update User Profiles Using Your Database](/users/guides/update-user-profiles-using-your-database) + * [Custom Database Script Templates](/connections/database/custom-db/templates) + * [User Metadata in Rules](/rules/current/metadata-in-rules) +::: + +::: references + * [User Profile Structure](/users/references/user-profile-structure) + * [User Data Storage Best Practices](/best-practices/user-data-storage-best-practices) + * [User Data Storage Scenario](/users/references/user-data-storage-scenario) + * [Identity Providers Supported](/identityproviders) + ::: +:::: + +::: whats-next +* Learn about the tools available to [define and maintain custom user data](/microsites/manage-users/define-maintain-custom-user-data). +* If you are building your own API and you want to secure the endpoints using Auth0, see [Protect Your API](/microsites/protect-api/protect-api). + ::: diff --git a/articles/microsites/protect-api/protect-api.md b/articles/microsites/protect-api/protect-api.md new file mode 100644 index 0000000000..647d41f77d --- /dev/null +++ b/articles/microsites/protect-api/protect-api.md @@ -0,0 +1,68 @@ +--- +title: Protect Your API +description: Everything you need to know to protect your API +template: microsite +topics: + - authentication + - oauth2 + - apis +useCase: + - secure-api +public: false +--- + +Using Auth0 to protect your API means that you will be "outsourcing" the authentication process to a centralized service that will help you ensure only approved applications can access your data. The calling application will authenticate the user, and Auth0 will generate tokens that can be passed to your API. Auth0 can also help you verify the tokens you receive from the applications that call your API. + +## How it works + +Your API will receive a request including an Access Token:  + +1. An app authenticates a user with Auth0. +2. Auth0 responds with the user's ID Token and Access Token. +3. The app calls your API, passing along the Access Token. +4. Your API validates the Access Token. +5. Your API responds with the requested information. + +Flow Overview for Protect API + +## Implementation overview + +::: steps + 1.

    Configure your API

    Auth0 supports access from various application types. If you expect a machine-to-machine (M2M) app to call your API, go to the dashboard and authorize them to request Access Tokens.
    You can also allow your API to skip user consent for your own apps and identify your API's scopes. If you're building a public-facing API, you'll need to let external callers know which of these scopes are available to them and provide guidance on how they can call your API. + + 2.

    Use a JWT validation library to validate tokens

    The library will take care of the details of parsing and validating the received tokens. This consists of a series of steps, and if any of these fails, then you must reject the application's request. Follow one of our Backend/API Quickstarts to get started. + + 3.

    Respond to the request

    Once your token has been successfully validated, respond to the calling application with their requested data. + +::: + + +:::: further-reading + +::: guides + * [Configure an API](/apis#how-to-configure-an-api-in-auth0) + * [Auth0 Backend/API Quickstarts](/quickstart/backend) + * [Validate an Access Token for custom APIs](/tokens/guides/validate-access-tokens) +::: + +::: references + * [OAuth 2.0](/protocols/oauth2) + * [Auth0 Authentication API](/api/authentication) +::: + +::: concepts + * [Tokens](/tokens) + * [Access Tokens](/tokens/concepts/access-tokens) + * [Scopes](/scopes) + * [Dynamic client registration](/api-auth/dynamic-client-registration) +::: + +:::: + +::: whats-next + * Auth0 offers many ways to personalize your user's login experience and customize tokens using [rules](/rules) and [hooks](/hooks). + * Learn how to call your API from your app: [Call Your API from My Native/Mobile App](/microsites/call-api/call-api-native-mobile-app), [Call Your API from My Regular Web App](/microsites/call-api/call-api-regular-web-app), [Call Your API from Your Single-Page App](/microsites/call-api/call-api-single-page-app), or [Call Your API from a M2M App](/microsites/call-api/call-api-m2m-app). + * If you are building your own application and you want to log users in using Auth0, learn to add login to your app: [Add Login to Your Native/Mobile App](/microsites/add-login/add-login-native-mobile-app), [Add Login to Your Regular Web App](/microsites/add-login/add-login-regular-web-app), or [Add Login to Your Single-Page App](/microsites/add-login/add-login-single-page-app). +::: + + diff --git a/articles/migrations/guides/_forced-logouts.md b/articles/migrations/guides/_forced-logouts.md new file mode 100644 index 0000000000..91bbc59482 --- /dev/null +++ b/articles/migrations/guides/_forced-logouts.md @@ -0,0 +1,3 @@ +::: warning +When a user's `/oauth/ro` based access token has expired, Auth0 **forces them to reauthenticate** (forced logout required) because the `/oauth/ro` refresh token cannot be used to call `/oauth/token` for a new Access Token. All currently logged in user's must log in again during an `/oauth/ro` to `/oauth/token` migration. +::: diff --git a/articles/migrations/guides/_get-token-auth0js.md b/articles/migrations/guides/_get-token-auth0js.md index 1f5b71c5ea..52d002f06e 100644 --- a/articles/migrations/guides/_get-token-auth0js.md +++ b/articles/migrations/guides/_get-token-auth0js.md @@ -9,7 +9,7 @@
             
    -// get an ID token
    +// get an ID Token
     var webAuth = new auth0.WebAuth({
       clientID: '${account.clientId}',
       domain: '${account.namespace}',
    @@ -34,12 +34,12 @@ var auth0Manage = new auth0.Management({
         
             
    -// get an access token
    +// get an Access Token
     var webAuth = new auth0.WebAuth({
       clientID: '${account.clientId}',
       domain: '${account.namespace}',
       redirectUri: '${account.callback}',
    -  audience: 'https://${account.namespace}/api/v2/˜',
    +  audience: 'https://${account.namespace}/api/v2/',
       scope: '${scope}',
       responseType: 'token id_token'
     });
    @@ -53,11 +53,11 @@ var auth0Manage = new auth0.Management({
           
         
    -
    \ No newline at end of file + diff --git a/articles/migrations/guides/_get-token-authorize.md b/articles/migrations/guides/_get-token-authorize.md index fbb0e1a09a..304e3c93b9 100644 --- a/articles/migrations/guides/_get-token-authorize.md +++ b/articles/migrations/guides/_get-token-authorize.md @@ -14,7 +14,7 @@ https://${account.namespace}/authorize? &response_type=id_token &client_id=${account.clientId} &redirect_uri=${account.callback} - &nonce=CRYPTOGRAPHIC_NONCE + &nonce=NONCE &state=OPAQUE_VALUE @@ -28,7 +28,7 @@ https://${account.namespace}/authorize? &response_type=token%20id_token &client_id=${account.clientId} &redirect_uri=${account.callback} - &nonce=CRYPTOGRAPHIC_NONCE + &nonce=NONCE &state=OPAQUE_VALUE @@ -36,9 +36,9 @@ https://${account.namespace}/authorize? -In order to get an Access Token that can access the Management API: +To get an Access Token that can access the Management API: - We set the `audience` to `https://${account.namespace}/api/v2/` -- We asked for the scope `${scope}` +- We asked for the scope `${scope}` - We set the `response_type` to `id_token token` so Auth0 will sent us both an ID Token and an Access Token If we decode the Access Token and review its contents we can see the following: diff --git a/articles/migrations/guides/account-linking.md b/articles/migrations/guides/account-linking.md index 24760b1f95..c56e1766b1 100644 --- a/articles/migrations/guides/account-linking.md +++ b/articles/migrations/guides/account-linking.md @@ -1,20 +1,21 @@ --- -title: Migration Guide: Account Linking and ID Tokens description: Auth0 is deprecating the usage of ID Tokens in the Account Linking process. This article will help you migrate your solution from the old implementation to the new one. toc: true +topics: + - account-linking + - migrations +contentType: + - concept + - how-to +useCase: + - manage-accounts --- -# Migration Guide: Account Linking and ID Tokens +# Migration Guide: Account Linking with Access Tokens vs. ID Tokens -This guide is part of the [Deprecating the usage of ID Tokens on the Auth0 Management API](/migrations#deprecating-the-usage-of-id-tokens-on-the-auth0-management-api) migration, and focuses on the [account linking process](/link-accounts). +This guide is part of the [Deprecating the usage of ID Tokens on the Auth0 Management API](/migrations#deprecating-the-usage-of-id-tokens-on-the-auth0-management-api) migration, and focuses on the [account linking process](/users/concepts/overview-user-account-linking). -For some use cases you could use [ID Tokens](/tokens/id-token) to [link and unlink user accounts](/link-accounts). This functionality is being deprecated. You will have to use [Access Tokens](/tokens/access-token) in all cases. - -The functionality is available and affected users are encouraged to migrate. However the ability to use ID Tokens will **not** be disabled in the foreseeable future so the mandatory opt-in date for this migration remains open. When this changes, customers will be notified beforehand. - -This article will help you migrate your implementation. First, we will see which use cases are affected. We will continue with reviewing how you can use [scopes](/scopes) to get tokens with different access rights, and how you can use them in the account linking process. - -## Summary of changes +For some use cases you could use [ID Tokens](/tokens/concepts/id-tokens) to link and unlink user accounts. This functionality is being deprecated. You will have to use Access Tokens in all cases. The changes in account linking are: @@ -25,9 +26,13 @@ The changes in account linking are: - The ID Token must be signed using `RS256` (you can set this value at *Dashboard > Clients > Client Settings > Advanced Settings > OAuth*) - The claim `aud` of the ID Token, must identify the client, and be the same value with the `azp` claim of the Access Token -The change in the unlinking of accounts is that you can no longer use an ID Token at the `Authorization` header. An Access Token must be used instead. +The change in the unlinking of accounts is that you can no longer use an ID Token at the `Authorization` header. An Access Token must be used instead. See [#security-considerations] below for details. + +::: warning +This migration is specifically targeted to mitigate a possible security vulnerability. Auth0 strongly recommendeds that you update your code as soon as possible. +::: -## Does this affect me? +## Are you affected? There are several ways you can link and unlink accounts. Some change, some remain the same, and a new variation is introduced. In the following matrix you can see a list of the use cases and their status based on this migration. @@ -76,23 +81,23 @@ There are several ways you can link and unlink accounts. Some change, some remai Link current user accounts with Auth0.js - You unlink user accounts with the Unlink a user identity endpoint of the Management API, and you send the primary account's ID Token in the Authorization header + You unlink user accounts with the Unlink a user identity endpoint of the Management API, and you send the primary account's ID Token in the Authorization header
    Affected
    How to unlink accounts - You unlink user accounts with the Unlink a user identity endpoint of the Management API, and you send an Access Token in the Authorization header + You unlink user accounts with the Unlink a user identity endpoint of the Management API, and you send an Access Token in the Authorization header
    No change
    N/A -## How to link accounts +## Link user accounts In order to link accounts you can either call directly the [Link a user account](/api/management/v2#!/Users/post_identities) endpoint of the Management API, or use the [Auth0.js library](/auth0js#user-management). -### Link current user accounts with the API +### Link current user accounts with the Management API A common use case is to allow the logged-in user to link their various accounts using your app. @@ -103,7 +108,7 @@ With this migration, you must get an Access Token (which must contain the `updat First, you must get an Access Token with the `update:current_user_identities` scope. ::: note -In the example that follows, we use the [Implicit Grant](/api-auth/tutorials/implicit-grant), the recommended OAuth 2.0 flow for client-side apps). You can get Access Tokens though for any application type (see [How to get an Access Token](/tokens/access-token#how-to-get-an-access-token)). +In the example that follows, we use the [Implicit Flow](/flows/guides/implicit/call-api-implicit), the recommended OAuth 2.0 flow for client-side apps). You can get Access Tokens though for any application type (see [Get Access Tokens](/tokens/get-access-tokens). ::: <%= include('./_get-token-authorize.md', { scope: 'update:current_user_identities', idPrevious: 'authZ-id-token', idCurrent: 'authZ-access-token' }) %> @@ -144,7 +149,7 @@ First, you must get an Access Token with the `update:current_user_identities` sc <%= include('./_get-token-auth0js.md', { scope: 'update:current_user_identities' }) %> -### Link any user account with the API +### Link any user account with the Management API If you get an Access Token for account linking, that contains the `update:users` scope, and send the secondary account's `user_id` and `provider` in the request, then you don't have to make any changes. @@ -174,7 +179,7 @@ However, this migration does introduce an alternative to this. You still use an - The secondary account's ID Token must be signed with `RS256` - The `aud` claim in the secondary account's ID Token must identify the client, and hold the same value with the `azp` claim of the Access Token used to make the request. -## How to unlink accounts +## Unlink user accounts If you use ID Tokens in order to unlink accounts, then you must update your implementation to use Access Tokens. @@ -184,7 +189,7 @@ Use the sample script that follows as a guide. On the **Legacy (ID Token)** pane <%= include('./_get-token-authorize.md', { scope: 'update:current_user_identities', idPrevious: 'unlink-id-token', idCurrent: 'unlink-access-token' }) %> -Once you have the Access Token, you can call the [Unlink a user identity](/api/management/v2#!/Users/delete_provider_by_user_id) endpoint of the Management API, using it in the `Authorization` header. +Once you have the Access Token, you can call the [Unlink a user identity](/api/management/v2#!/Users/delete_user_identity_by_user_id) endpoint of the Management API, using it in the `Authorization` header.
    @@ -213,11 +218,29 @@ Authorization: 'Bearer ACCESS_TOKEN'
    +## Security considerations + +We have identified a weakness in a particular account linking flow that could allow it to be misused in specific circumstances. We have found no evidence that this has been used maliciously but have decided to deprecate the flow to prevent that ever happening. + +Therefore, Auth0 requires customers using the affected account linking flow to migrate to a more secure implementation before October 19th, 2018. Migration paths are provided in this guide, which should not result in any lost functionality. + +On October 19th, 2018 or anytime after, the affected account linking flow will be disabled and customers using it will experience run-time errors. + +### What's the impact + +You are impacted if you call the [/api/v2/users/{USER_ID}/identities](/api/management/v2#!/Users/post_identities) endpoint using a token (ID or Access Token) with the scope `update:current_user_identities` in the Authorization header and include the secondary account's `user_id` in the payload. + +No other use cases are impacted. + +## Next steps + +You should review all your calls to the account linking endpoint ([/api/v2/users/{USER_ID}/identities](/api/management/v2#!/Users/post_identities)) and update those that make use of the vulnerable flow described above. You can update your calls to either of the following: + +1. **Client-side / user-initiated linking scenarios** -- For client-side linking scenarios, make the call to the [/api/v2/users/{USER_ID}/identities](/api/management/v2#!/Users/post_identities) using an Access Token with the `update:current_user_identities` scope, and provide the ID Token of the secondary account in the payload (`link_with`). This ID Token must be obtained through an OAuth/OIDC-conformant flow. See [Link User Accounts Initiated by Users Scenario](/users/references/link-accounts-user-initiated-scenario) for more details. +2. **Server-side linking scenarios** -- For server-side linking scenarios, make the call to the [/api/v2/users/{USER_ID}/identities](/api/management/v2#!/Users/post_identities) endpoint using an Access Token with the `update:users` scope and provide the `user_id` of the secondary account in the payload. See [Link User Accounts Server-Side Scenario](/users/references/link-accounts-server-side-scenario) for details. + ## Keep reading -:::next-steps -- [Link User Accounts](/link-accounts) -- [Account Linking Using Server Side Code](/link-accounts/suggested-linking) -- [Account Linking Using Client Side Code](/link-accounts/user-initiated-linking) -- [Migration Guide: Management API and ID Tokens](/migrations/guides/calling-api-with-idtokens) -::: +- [Link User Accounts](/users/guides/link-user-accounts) +* [Suggested Account Linking - Server-Side Implementation](/users/references/link-accounts-server-side-scenario) +* [User Initiated Account Linking - Client-Side Implementation](/users/references/link-accounts-client-side-scenario) diff --git a/articles/migrations/guides/calling-api-with-idtokens.md b/articles/migrations/guides/calling-api-with-idtokens.md index e2990d61ff..471a05cdc5 100644 --- a/articles/migrations/guides/calling-api-with-idtokens.md +++ b/articles/migrations/guides/calling-api-with-idtokens.md @@ -2,19 +2,30 @@ title: "Migration Guide: Management API and ID Tokens" description: Auth0 is deprecating the usage of ID Tokens as credentials for the Management API. This article will help you migrate your solution from the old implementation to the new one. toc: true +topics: + - migrations + - management-api + - id-tokens + - tokens +contentType: + - concept + - how-to + - reference +useCase: + - manage-accounts --- # Migration Guide: Management API and ID Tokens -For some use cases you could use [ID Tokens](/tokens/id-token) in order to call some of the [Users](/api/management/v2#!/Users/get_users_by_id) and [Device Credentials](/api/management/v2#!/Device_Credentials/get_device_credentials) endpoints of the Management API. +For some use cases you could use [ID Tokens](/tokens/concepts/id-tokens) in order to call some of the [Users](/api/management/v2#!/Users/get_users_by_id) and [Device Credentials](/api/management/v2#!/Device_Credentials/get_device_credentials) endpoints of the Management API. -This functionality is being deprecated. You will have to use proper [Access Tokens](/tokens/access-token) in order to access any of the endpoints of the [Management API](/api/management/v2). +This functionality is being deprecated. You will have to use proper [Access Tokens](/tokens/access-token) in order to access any of the endpoints of the [Management API](/api/management/v2). Make sure the `Allow ID Tokens for Management API v2 Authentication` toggle is turned off after completing the migration to Access Tokens. The grace period for this migration started on **March 31, 2018** and at the moment is open-ended. This means that you will still be able to use ID Tokens to access these endpoints. When a mandatory opt-in date is set for this migration customers will be notified beforehand. -However, customers are encouraged to migrate to Access Tokens. This article will help you with that. +Customers are encouraged to migrate to Access Tokens. This guide will help you with that. -First, we will see which use cases are affected. We will continue with reviewing how you can use [scopes](/scopes) to get tokens with different access rights, and then see all the ways you can use to get an Access Token. Finally, we will review the changes introduced in the [Account Linking](/link-accounts) process. +First, we will see which use cases are affected. We will continue with reviewing how you can use [scopes](/scopes) to get tokens with different access rights, and then see all the ways you can use to get an Access Token. Finally, we will review the changes introduced in the [User Account Linking](/users/concepts/overview-user-account-linking) process. ## Does this affect me? @@ -23,13 +34,15 @@ If you use ID Tokens to call any of the following endpoints, then you are affect | **Endpoint** | **Use Case** | |-|-| | [GET /api/v2/users/{id}](/api/management/v2#!/Users/get_users_by_id) | Retrieve a user's information | -| [GET /api/v2/users/{id}/enrollments](/api/management/v2#!/Users/get_enrollments) | Retrieve all [Guardian](/multifactor-authentication/guardian) MFA enrollments for a user | +| [GET /api/v2/users/{id}/enrollments](/api/management/v2#!/Users/get_enrollments) | Retrieve all [Guardian](/mfa/concepts/guardian) MFA enrollments for a user | | [PATCH /api/v2/users/{id}](/api/management/v2#!/Users/patch_users_by_id) | Update a user's information | -| [DELETE /api/v2/users/{id}/multifactor/{provider}](/api/management/v2#!/Users/delete_multifactor_by_provider) | Delete the [multifactor](/multifactor-authentication) provider settings for a user | +| [DELETE /api/v2/users/{id}/multifactor/{provider}](/api/management/v2#!/Users/delete_multifactor_by_provider) | Delete the MFA provider settings for a user | | [POST /api/v2/device-credentials](/api/management/v2#!/Device_Credentials/post_device_credentials) | Create a public key for a device | | [DELETE /api/v2/device-credentials/{id}](/api/management/v2#!/Device_Credentials/delete_device_credentials_by_id) | Delete a device credential | -| [POST/api/v2/users/{id}/identities](/api/management/v2#!/Users/post_identities) | [Link user accounts](/link-accounts) from various identity providers | -| [DELETE /api/v2/users/{id}/identities/{provider}/{user_id}](/api/management/v2#!/Users/delete_provider_by_user_id) | [Unlink user accounts](/link-accounts#unlinking-accounts) | +| [POST/api/v2/users/{id}/identities](/api/management/v2#!/Users/post_identities) | [Link user accounts](/users/guides/link-user-accounts) from various identity providers | +| [DELETE /api/v2/users/{id}/identities/{provider}/{user_id}](/api/management/v2#!/Users/delete_user_identity_by_user_id) | [Unlink user accounts](/users/guides/unlink-user-accounts) | + +These endpoints can now accept regular [Access Tokens](/tokens/concepts/access-tokens). Note that the last two endpoints are used for Account Linking. To review these changes, see [Changes in Account Linking](#changes-in-account-linking). @@ -37,14 +50,14 @@ Note that the last two endpoints are used for Account Linking. To review these c ## Changes in scopes -The actions you can perform with the Management API depend on the [scopes](/scopes#api-scopes) that your Access Token contains. With this migration you can either get a "limited" Access Token that can update only the logged-in user's data, or an Access Token that can update the data of any user. In the following matrix you can see the scopes that your token needs to have per case and per endpoint. +The actions you can perform with the Management API depend on the [scopes](/scopes/current/api-scopes) that your Access Token contains. With this migration you can either get a "limited" Access Token that can update only the logged-in user's data, or an Access Token that can update the data of any user. In the following matrix you can see the scopes that your token needs to have per case and per endpoint. | **Endpoint** | **Scope for current user** | **Scope for any user** | |-|-|-| | [GET /api/v2/users/{id}](/api/management/v2#!/Users/get_users_by_id) | `read:current_user` | `read:users` | | [GET /api/v2/users/{id}/enrollments](/api/management/v2#!/Users/get_enrollments) | `read:current_user` | `read:users` | | [POST/api/v2/users/{id}/identities](/api/management/v2#!/Users/post_identities) | `update:current_user_identities` | `update:users` | -| [DELETE /api/v2/users/{id}/identities/{provider}/{user_id}](/api/management/v2#!/Users/delete_provider_by_user_id) | `update:current_user_identities` | `update:users` | +| [DELETE /api/v2/users/{id}/identities/{provider}/{user_id}](/api/management/v2#!/Users/delete_user_identity_by_user_id) | `update:current_user_identities` | `update:users` | | [PATCH /api/v2/users/{id}](/api/management/v2#!/Users/patch_users_by_id) | `update:current_user_metadata` | `update:users` | | [PATCH /api/v2/users/{id}](/api/management/v2#!/Users/patch_users_by_id) | `create:current_user_metadata` | `update:users` | | [DELETE /api/v2/users/{id}/multifactor/{provider}](/api/management/v2#!/Users/delete_multifactor_by_provider) | `delete:current_user_metadata` | `update:users` | @@ -62,13 +75,13 @@ The Access Tokens used to access the Management API **must hold only one value a In this section we will see the changes that are introduced in how you get a token for the aforementioned endpoints. We will see sample scripts side-by-side so you can identify the changes. There are several variations on how you authenticate a user and get tokens, depending on the technology and the [OAuth 2.0 flow you use to authenticate](/api-auth/which-oauth-flow-to-use): -- Using the [Authorization endpoint](/api/authentication#authorize-client). This is where you redirect your users to login or sign up. You get your tokens from this endpoint if you authenticate users from a [single-page app](/api/authentication#implicit-grant) (running on the browser). -- Using the [Token endpoint](/api/authentication#get-token).You get your tokens from this endpoint if you authenticate users from a [web app](/api/authentication#authorization-code) (running on a server), a [mobile app](/api/authentication#authorization-code-pkce-), a [server process](/api/authentication#client-credentials), or a [highly trusted app](/api/authentication#resource-owner-password). +- Using the [Authorization endpoint](/api/authentication#authorize-application). This is where you redirect your users to login or sign up. You get your tokens from this endpoint if you authenticate users from a [single-page app](/api/authentication#implicit-grant) (running on the browser). +- Using the [Token endpoint](/api/authentication#get-token). You get your tokens from this endpoint if you authenticate users from a [web app](/api/authentication#authorization-code) (running on a server), a [mobile app](/api/authentication#authorization-code-pkce-), a [server process](/api/authentication#client-credentials), or a [highly trusted app](/api/authentication#resource-owner-password). - Using [Lock](/libraries/lock/v11#cross-origin-authentication) or [auth0.js](/libraries/auth0js/v9#configure-your-auth0-application-for-embedded-login) embedded in your application. In this case you are using [cross-origin authentication](/cross-origin-authentication) (used to authenticate users when the requests come from different domains). ### The Authorization endpoint -In this section we will use an example to showcase the differences in how you get a token with the [Authorization endpoint](/api/authentication#authorize-client). Keep in mind though that no matter which endpoint you want to migrate, the changes are the same, the only thing that differs is the [scopes](#changes-in-scopes) you will specify in the request. +In this section we will use an example to showcase the differences in how you get a token with the [Authorization endpoint](/api/authentication#authorize-application). Keep in mind though that no matter which endpoint you want to migrate, the changes are the same, the only thing that differs is the [scopes](#changes-in-scopes) you will specify in the request. In the example below, we want to use the [GET User by ID endpoint](/api/management/v2#!/Users/get_users_by_id) to retrieve the full profile information of the logged-in user. To do so, first we will authenticate our user (using the [Implicit grant](/api/authentication?http#implicit-grant)) and retrieve the token(s). @@ -109,7 +122,7 @@ On the `Legacy (ID Token)` script you can see an implementation of the old appro
             
     POST https://${account.namespace}/oauth/token
    -Content-Type: application/json
    +Content-Type: application/x-www-form-urlencoded
     {
       "grant_type": "password",
       "username": "USERNAME",
    @@ -125,7 +138,7 @@ Content-Type: application/json
           
             
     POST https://${account.namespace}/oauth/token
    -Content-Type: application/json
    +Content-Type: application/x-www-form-urlencoded
     {
       "grant_type": "password",
       "username": "USERNAME",
    @@ -180,7 +193,5 @@ For a detailed overview of these changes and migration steps per use case, see [
     
     ## Keep reading
     
    -:::next-steps
    -- [How to get an Access Token](/tokens/access-token#how-to-get-an-access-token)
    +- [Get Access Tokens](/tokens/guides/get-access-tokens)
     - [Migration Guide: Account Linking and ID Tokens](/migrations/guides/account-linking)
    -:::
    \ No newline at end of file
    diff --git a/articles/migrations/guides/clickjacking-protection.md b/articles/migrations/guides/clickjacking-protection.md
    new file mode 100644
    index 0000000000..877e705f0c
    --- /dev/null
    +++ b/articles/migrations/guides/clickjacking-protection.md
    @@ -0,0 +1,27 @@
    +---
    +title: Migration Guide: Enabling Clickjacking Protection for Universal Login
    +description: Auth0 is adding a way to prevent the Universal Login pages to be embedded in an iframe.
    +toc: true
    +topics:
    +  - universal-login
    +  - migrations
    +contentType:
    +  - concept
    +  - how-to
    +---
    +# Migration Guide: Enabling Clickjacking Protection
    +
    +Clickjacking is an attack that tricks a user into clicking a web page element which is invisible or disguised as another element. This is done by loading content in an iframe and rendering elements on top of it. In the context of the Universal Login pages, an attacker could trick the user into clicking a 'Login', or 'Reset Password' button.
    +
    +This can be prevented by setting the following HTTP headers:
    +
    +```
    +X-Frame-Options: deny
    +Content-Security-Policy: frame-ancestors 'none'
    +```
    +
    +Even if the potential attack does not entail significant risk, it's a good security practice to add the headers. It is also detected by security scanners, so reports from penetration testers might mention the lack of these headers.
    +
    +In a case where you are rendering the login page in an iframe, adding these headers could be a breaking change. Instead of adding these headers for all customers, therefore, Auth0 has added an opt-in for these headers which we strongly recommend you to enable.
    +
    +You can do this by navigating to [Tenant Settings > Advanced Settings](${manage_url}/#/tenant/advanced), scrolling to 'Migrations', and turning OFF the 'Disable clickjacking protection for Classic Universal Login' setting. This action is not required if you are using the [New Universal Login Experience](/universal-login/new) as those headers are always set.
    diff --git a/articles/migrations/guides/extensibility-node12.md b/articles/migrations/guides/extensibility-node12.md
    new file mode 100644
    index 0000000000..2ef5c6f878
    --- /dev/null
    +++ b/articles/migrations/guides/extensibility-node12.md
    @@ -0,0 +1,191 @@
    +---
    +title: "Migration Guide: Extensibility and Node 12"
    +description: Learn about the Auth0 features affected by the Node.js v8 to Node.js v12 migration and review our recommendations for ensuring a smooth migration process.
    +toc: true
    +topics:
    +  - migrations
    +  - extensibility
    +  - nodejs
    +  - rules
    +  - hooks
    +  - custom-db
    +  - custom-social-connections
    +  - extensions
    +contentType:
    +  - concept
    +  - how-to
    +useCase:
    +  - manage-accounts
    +  - migrate
    +---
    +# Migration Guide: Extensibility and Node 12
    +
    +On December 31, 2019, [Node.js v8 went out of long-term support (LTS)](https://github.com/nodejs/Release#release-schedule), which means that the Node.js development team no longer back-ports critical security fixes to this version. This _could_ expose your extensibility code to security vulnerabilities.
    +
    +As such, Auth0 is migrating from Node 8 to Node 12.
    +
    +In this document, we:
    +
    +* Provide recommendations on how you can ensure a smooth migration for your environment
    +* Detail the specific modules affected
    +
    +## Summary of the migration
    +
    +The Webtask runtime powering the following Auth0 features use Node 8:
    +
    +* Rules
    +* Hooks
    +* Custom database connections
    +* Custom social connections
    +* Extensions
    +
    +If you do not use any of the extensibility features mentioned above, you are not affected by this migration.
    +
    +## Verified extensions
    +
    +As part of this migration, the Auth0 development team has performed extensive testing to proactively detect any breaking changes.
    +
    +Verified extensions for Node 12 include:
    +
    +* Realtime Webtask Logs
    +* Deploy extensions (Github, Gitlab, etc.)
    +* Deploy CLI
    +
    +Still, there may be behavioral changes as a result of this migration, so we have provided a migration switch that allows you to control the migration of your environment to the new Webtask runtime using Node 12.
    +
    +## Enable the Node 12 runtime
    +
    +Node 12 can be enabled through the new Extensibility panel on the [Advanced Tenant Settings](${manage_url}/#/tenant/advanced) page of the Dashboard.
    +
    +![Runtime toggle](/media/articles/migrations/node-runtime1.png)
    +
    +![Runtime toggle options](/media/articles/migrations/node-runtime2.png)
    +
    +::: warning
    +Changing the runtime may break your existing Rules, Hooks, and Custom Database/Social Connections. We recommend that you first switch your development tenant to the Node 12 runtime, test your setup, and switch your production tenant only when you have identified there are no breaking changes.
    +:::
    +
    +## Whitelist the new URLs
    +
    +The [Delegated Administration Extension](/extensions/delegated-admin) and the [Single Sign-on (SSO) Dashboard Extension](/extensions/sso-dashboard) require whitelisting the URLs used to access extensions and custom webtasks. When you upgrade to Node 12, the URLs you use to access extensions and custom webtasks will change. This is a breaking change for these extensions.
    +
    +If you use any of these extensions, **you must whitelist the new URLs** both as Allowed Callback and as Allowed Logout URLs.
    +
    +The region portion of the URL will change from 8 to 12. If you access an extension using the URL `https://${account.tenant}.us8.webtask.io/dummy-extension-url`, when you upgrade to Node 12 the URL will be `https://${account.tenant}.us12.webtask.io/dummy-extension-url`.
    +
    +To do so, go to [Dashboard > Applications > Settings](${manage_url}/#/applications/${account.clientId}/settings), and add the URL to the fields **Allowed Callback URLs** and **Allowed Logout URLs**.
    +
    +The execution URLs will also change for custom webtasks in your Auth0 container. You must update any external applications that call those webtasks.
    +
    +### Authorization Extension Changes
    +
    +If you use the Authorization Extension, it generates an `auth0-authorization-extension` rule. Republishing this rule from within the Authorization Extension will update the URLs automatically.
    +
    +To ensure a clean upgrade:
    +
    +1. Ensure you have upgraded to the latest version of the Authorization Extension from the "Installed Extensions" tab. If the upgrade button is present, click to upgrade. If the button is not present, you are already on the latest version of the extension.
    +2. Open the Authorization Extension configuration page.
    +3. To update the URL in the rule, publish the rule again by clicking the "Publish Rule" button.
    +4. Test to make sure everything is still working.
    +5. If you see an "Invalid API Key" error after updating, use the "Rotate" button to generate a new API key.
    +
    +![Authorization Extension Configuration](/media/articles/migrations/node-auth-ext-config.png)
    +
    +![Authorization Extension Buttons](/media/articles/migrations/node-auth-ext-buttons.png)
    +
    +### Delegated Administration URLs
    +
    +If you use the Delegated Administration Extension, the matrix that follows contains the updated URLs you must configure after you migrate to Node 12. The URL varies based on your location.
    +
    +| Location | Allowed Callback URL for Node 12 | Allowed Logout URL for Node 12 |
    +| --- | --- | --- |
    +| USA | `https://${account.tenant}.us12.webtask.io/auth0-delegated-admin/login` | `https://${account.tenant}.us12.webtask.io/auth0-delegated-admin` |
    +| Europe | `https://${account.tenant}.eu12.webtask.io/auth0-delegated-admin/login` | `https://${account.tenant}.eu12.webtask.io/auth0-delegated-admin` |
    +| Australia | `https://${account.tenant}.au12.webtask.io/auth0-delegated-admin/login` | `https://${account.tenant}.au12.webtask.io/auth0-delegated-admin` |
    +
    +For example, if you are located in the USA and you use the Delegated Administration, you should update the following fields in your application's settings:
    +- **Allowed Callback URLs**: `https://${account.tenant}.us12.webtask.io/auth0-delegated-admin/login`
    +- **Allowed Logout URLs**: `https://${account.tenant}.us12.webtask.io/auth0-delegated-admin`
    +
    +### SSO Dashboard URLs
    +
    +The matrix that follows contains the updated URLs you must configure after you migrate to Node 12. The URL varies based on your location.
    +
    +The login URL for **Admins**:
    +
    +| Location | Allowed Callback URL |
    +| --- | --- |
    +| USA | `https://${account.tenant}.us12.webtask.io/auth0-sso-dashboard/admins/login` |
    +| Europe | `https://${account.tenant}.eu12.webtask.io/auth0-sso-dashboard/admins/login` |
    +| Australia | `https://${account.tenant}.au12.webtask.io/auth0-sso-dashboard/admins/login` |
    +
    +The login URL for **Users**:
    +
    +| Location | Allowed Callback URL |
    +| --- | --- |
    +| USA | `https://${account.tenant}.us12.webtask.io/auth0-sso-dashboard/login` |
    +| Europe | `https://${account.tenant}.eu12.webtask.io/auth0-sso-dashboard/login` |
    +| Australia | `https://${account.tenant}.au12.webtask.io/auth0-sso-dashboard/login` |
    +
    +### All Extensions
    +
    +Most extensions use the `PUBLIC_WT_URL` hidden secret for authorization. This secret depends on the runtime version and does not update automatically.
    +
    +To update it, you need to save the extension's settings (no changes are necessary). To do so, after switching the runtime to `Node 12`, you need to open the extension's settings in the extensions dashboard (gear icon) and hit `Save`. After that, the extensions gallery will update the `PUBLIC_WT_URL` secret accordingly based on the selected runtime.
    +
    +If you do not update the `PUBLIC_WT_URL` hidden secret, you will receive the following error:
    +
    +![Misconfiguration or Service Outage Error](/media/articles/migrations/node-hidden-secret-error.png)
    +
    +## How to ensure a stable migration
    +
    +As part of the process of introducing Node 12 in our Webtask runtime, we ran a number of tests to determine which modules are not forward-compatible from Node 8 to 12. Most customers _should_ be able to upgrade to Node 12 without any issues.
    +
    +With that said, before you migrate, we highly recommend testing all of your:
    +
    +* Rules
    +* Hooks
    +* Custom Database Connections/Scripts
    +* Custom Social Connections
    +* Extensions
    +
    +Furthermore, we recommend that the testing be done in your development tenant and migrating your production tenant only if you see no issues in development.
    +
    +You can query the Management API for your Rules, Hooks, Custom Database scripts, and Custom Social Connections. This will make it easier for you to move items from your production tenant to development tenant for testing purposes.
    +
    +Please see our documentation on the [Connections](/api/management/v2#!/Connections), [Rules](/api/management/v2#!/Rules/get_rules), and [Hooks](/api/management/v2/#!/Hooks/get_hooks) endpoints for additional information on this process.
    +
    +When using the [Connections](/api/management/v2#!/Connections) endpoints in the Management API, Custom Database Scripts can be retrieved or updated using `options.customScripts`.
    +
    +Similarly, you can find Custom Social Connections in `options.scripts.fetchUserProfile`.
    +
    +## Affected modules
    +
    +If you are using the following built-in modules (that is, modules that you did not explicitly require), please be aware that some versions were updated to work with Node 12. The following table summarizes the changes.
    +
    +| Module name | Old version | New version |
    +| - | - | - |
    +| couchbase | ~2.5.1 | 2.6.10 |
    +| bcrypt | 1.0.3 | 3.0.8 |
    +
    +These new versions should remain backwards compatible with their previous versions.
    +
    +### Pinned modules
    +
    +If you have manually pinned modules, you may need to manually update them so that your code runs with Node 12.
    +
    +For example, you must change
    +
    +`var bcrypt = require(‘bcrypt@1.0.3’);`
    +
    +to
    +
    +`var bcrypt = require(‘bcrypt’);`
    +
    +or, if the module must be pinned to a specific version:
    +
    +`var bcrypt = require(‘bcrypt@3.0.8’);`
    +
    +### Notes for Node 10 and Node 12 changes
    +
    +For additional information, please consult Node.js's [Node 10 release notes](https://nodejs.org/fr/blog/release/v10.0.0/) and [Introducing Node.js 12](https://medium.com/@nodejs/introducing-node-js-12-76c41a1b3f3f).
    diff --git a/articles/migrations/guides/extensibility-node8.md b/articles/migrations/guides/extensibility-node8.md
    deleted file mode 100644
    index 9b7110f12b..0000000000
    --- a/articles/migrations/guides/extensibility-node8.md
    +++ /dev/null
    @@ -1,181 +0,0 @@
    ----
    -title: "Migration Guide: Extensibility and Node 8"
    -description: This article covers the Auth0 features/modules affected, as well as our recommendations to ensure a smooth migration process.
    -toc: true
    ----
    -# Migration Guide: Extensibility and Node 8
    -
    -Beginning April 30, 2018, [Node.js v4 will be going out of long-term support (LTS)](https://github.com/nodejs/Release#release-schedule), which means that the Node.js development team will no longer be back-porting critical security fixes to this version and this _could_ expose your extensibility code to security vulnerabilities.
    -
    -As such, Auth0 will be migrating from Node 4 to Node 8.
    -
    -We will **NOT** be shutting down the Node 4 runtime after the April 30 LTS deadline. Your extensibility code will continue to run on Node 4, if you choose not to upgrade to Node 8 at this time. After April 30, you will assume the risk of potential security issues if you choose to continue with Node 4.
    -
    -In this document, we:
    -
    -* Provide recommendations on how you can ensure a smooth migration for your environment
    -* Detail the specific modules effected
    -
    -## Summary of the migration
    -
    -The Webtask runtime powering the following Auth0 features utilize Node 4:
    -
    -* Rules
    -* Hooks
    -* Custom database connections
    -* Custom social connections
    -* Extensions
    -
    -If you do not use any of the extensibility features mentioned above, you are not affected by this migration. **Additionally, your tenant will automatically be upgraded to use the Node 8 runtime on April 30, 2018.** This will ensure that any future extensibility code you author will be running on a secure runtime.
    -
    -Due to the end of long-term support (LTS) for Node 4, we will be migrating the Webtask runtime to use Node 8. As part of this migration, the Auth0 development team has performed extensive testing to detect any breaking changes proactively.
    -
    -However, there may be behavioral changes as a result of this migration. As such, we have provided a migration switch that allows you to control the migration of your environment to the new Webtask runtime using Node 8.
    -
    -### Important Dates
    -
    -* **2018 April 17**: The Webtask runtime using Node 8 becomes available to Auth0 customers
    -* **2018 April 23**: All official Auth0 Extensions will be updated to run on Node 8 and available for you to upgrade in the **Installed Extensions** tab of the [Extensions page](${manage_url}/#/extensions)
    -* **2018 April 30**: [Node 4 is no longer under long-term support (LTS)](https://github.com/nodejs/Release#release-schedule)
    -* **2018 April 30**: Tenants with NO Extensibility code will be automatically be upgraded to use Node 8
    -
    -## How to enable the Node 8 runtime
    -
    -Node 8 can be enabled through the new Extensibility panel on the [Advanced Tenant Settings](${manage_url}/#/tenant/advanced) page of the Dashboard.
    -
    -![Runtime toggle](/media/articles/migrations/node-runtime1.png)
    -
    -![Runtime toggle options](/media/articles/migrations/node-runtime2.png)
    -
    -::: warning
    -Changing the runtime may break your existing Rules, Hooks, and Custom Database/Social Connections. We recommend that you first switch your development tenant to the Node 8 runtime, test your setup, and switch your production tenant only when you have identified there are no breaking changes.
    -:::
    -
    -## Whitelist the new URLs
    -
    -When you upgrade to Node 8, the URLs you use to access our extensions, change. The change is an `8` that is appened before the `webtask.io` part. So if you accessed an extension using the URL `https://${account.tenant}.us.webtask.io/dummy-extension-url`, when you upgrade to Node 8 the URL will be `https://${account.tenant}.us8.webtask.io/dummy-extension-url`.
    -
    -This is a breaking change for some extensions, that require whitelisting the URLs in order to properly work.
    -
    -The affected extensions are the [Delegated Administration Extension](/extensions/delegated-admin) and the [Single Sign-On (SSO) Dashboard](/extensions/sso-dashboard). If you use either, **you must whitelist the new URLs** both as Allowed Callback and as Allowed Logout URLs.
    -
    -To do so, go to [Dashboard > Applications > Settings](${manage_url}/#/applications/${account.clientId}/settings), and add the URL to the fields **Allowed Callback URLs** and **Allowed Logout URLs**.
    -
    -### Delegated Administration URLs
    -
    -The matrix that follows contains the updated URLs you must configure after you migrate to Node 8. The URL varies based on your location.
    -
    -| Location | Allowed Callback URL for Node 8 | Allowed Logout URL for Node 8 |
    -| --- | --- | --- |
    -| USA | `https://${account.tenant}.us8.webtask.io/auth0-delegated-admin/login` | `https://${account.tenant}.us8.webtask.io/auth0-delegated-admin` |
    -| Europe | `https://${account.tenant}.eu8.webtask.io/auth0-delegated-admin/login` | `https://${account.tenant}.eu8.webtask.io/auth0-delegated-admin` |
    -| Australia | `https://${account.tenant}.au8.webtask.io/auth0-delegated-admin/login` | `https://${account.tenant}.au8.webtask.io/auth0-delegated-admin` |
    -
    -For example, if you are located in the USA and you use the Delegated Administration, you should update the following fields in your application's settings: 
    -- **Allowed Callback URLs**: `https://${account.tenant}.us8.webtask.io/auth0-delegated-admin/login`
    -- **Allowed Logout URLs**: `https://${account.tenant}.us8.webtask.io/auth0-delegated-admin`
    -
    -### SSO Dashboard URLs
    -
    -The matrix that follows contains the updated URLs you must configure after you migrate to Node 8. The URL varies based on your location.
    -
    -The login URL for **Admins**:
    -
    -| Location | Allowed Callback URL |
    -| --- | --- |
    -| USA | `https://${account.tenant}.us8.webtask.io/auth0-sso-dashboard/admins/login` |
    -| Europe | `https://${account.tenant}.eu8.webtask.io/auth0-sso-dashboard/admins/login` |
    -| Australia | `https://${account.tenant}.au8.webtask.io/auth0-sso-dashboard/admins/login` |
    -
    -The login URL for **Users**:
    -
    -| Location | Allowed Callback URL |
    -| --- | --- |
    -| USA | `https://${account.tenant}.us8.webtask.io/auth0-sso-dashboard/login` |
    -| Europe | `https://${account.tenant}.eu8.webtask.io/auth0-sso-dashboard/login` |
    -| Australia | `https://${account.tenant}.au8.webtask.io/auth0-sso-dashboard/login` |
    -
    -## How to ensure a stable migration
    -
    -As part of the process of introducing Node 8 in our Webtask runtime, we ran a number of tests to determine which modules are not forward-compatible from Node 4 to 8. Most customers _should_ be able to upgrade to Node 8 without any issues.
    -
    -With that said, before you migrate, we highly recommend testing all of your:
    -
    -* Rules
    -* Hooks
    -* Custom Database Connections/Scripts
    -* Custom Social Connections
    -* Extensions
    -
    -Furthermore, we recommend that the testing be done in your development tenant and migrating your production tenant only if you see no issues in development. 
    -
    -You can query the Management API for your Rules, Custom Database scripts, and Custom Social Connections. This will make it easier for you to move items from your production tenant to development tenant for testing purposes.
    -
    -Please see our documentation on the [Connections](/api/management/v2#!/Connections) and [Rules](/api/management/v2#!/Rules/get_rules) endpoints for additional information on this process.
    -
    -When using the [Connections](/api/management/v2#!/Connections) endpoints in the Management API, Custom Database Scripts can be retrieved or updated using `options.customScripts`.
    -
    -Similarly, you can find Custom Social Connections in `options.scripts.fetchUserProfile`.
    -
    -You will need to manually copy over any Hooks-related code that you use since they cannot be accessed via the Management API.
    -
    -### Migration assistance
    -
    -We have created a [migration assistant](https://github.com/auth0/webtask-migration-assistant) to help ease the copying of code between production and development tenants.
    -
    -Please be sure to test each script *individually* with its associated **Try** button. You may, however, test all rules simultaneously with the **Try All Rules With** button.
    -
    -In addition, test _logging in_ using the development tenant to ensure that all of the following items that you have set up work as expected:
    -
    -* Rules
    -* Hooks
    -* Database Connections
    -* Custom Social Connections
    -* Extensions
    -
    -## Affected modules
    -
    -If you are using the following built-in modules (that is, modules that you did not explicitly require), please be aware that some versions were updated to work with Node 8. The following table summarizes the changes.
    -
    -| Module name | Old version | New version |
    -| - | - | - |
    -| azure-storage | ~0.4.1 | ~2.2.1 |
    -| couchbase | ~1.2.1 | ~2.3.5 |
    -| jsonwebtoken | ~0.4.1^* | ~7.4.1 (w/ compatibility shim) |
    -| knex | ~0.6.3 | ~0.13.0 |
    -| mongo-getdb | ~1.2.0^* | ^2.2.0 |
    -| mongodb | ~1.3.15^* | ^2.2.0 |
    -| mysql | 2.0.0-alpha8^* | ^2.0.0 |
    -| node-cassandra-cql | ^0.4.4 | ^0.5.0 |
    -| request | ~2.27.0 | ~2.81.0 |
    -| pg | ^4.3.0^* | ^4.5.7 |
    -| bcrypt | ~0.8.5^* | ~0.8.7 |
    -| xml2json | ~0.10.0^* | ~0.11.2 |
    -
    -^* These versions are no longer supported due to incompatibility with Node 8.
    -
    -### Pinned modules
    -
    -If you have manually pinned modules, you may need to manually update them so that your code runs with Node 8.
    -
    -For example, you must change
    -
    -`var mysql = require(‘mysql@2.0.0-alpha8’);`
    -
    -to
    -
    -`var mysql = require(‘mysql’);`
    -
    -or, if the module must be pinned to a specific version:
    -
    -`var mysql = require(‘mysql@2.0.0’);`
    -
    -### Behavioral and syntactic changes
    -
    -Some of the behavioral and syntactic changes in modules were not forward-compatible with Node 8.
    -
    -For example, the default encoding of the `crypto` module was changed from `binary` to `utf8`, and the use of `new Buffer()` has been deprecated in favor of `Buffer.from()`.
    -
    -Please consult Node.js' migration nodes for [v4 to v6](https://github.com/nodejs/node/wiki/Breaking-changes-between-v4-LTS-and-v6-LTS) and [v6 to v8](https://github.com/nodejs/node/wiki/Breaking-changes-between-v6-LTS-and-v8-LTS) for additional information.
    -
    -**To ensure that your Auth0 implementation functions as intended, please be sure to migrate to the Node 8 runtime before April 30 2018.**
    diff --git a/articles/migrations/guides/facebook-graph-api-deprecation.md b/articles/migrations/guides/facebook-graph-api-deprecation.md
    new file mode 100644
    index 0000000000..39159f0b6e
    --- /dev/null
    +++ b/articles/migrations/guides/facebook-graph-api-deprecation.md
    @@ -0,0 +1,120 @@
    +---
    +title: Changes to Facebook Graph API
    +description: The latest version of the Facebook Graph API changes what permissions and fields can be requested.
    +toc: true
    +contentType:
    +  - how-to
    +useCase:
    +  - add-login
    +  - migrate
    +---
    +
    +# Changes to Facebook Login and Graph API
    + 
    +The latest version of the Facebook Graph API changes what permissions and fields can be requested. We've updated Facebook Connections to reflect these changes and tweaked the connection interface for clarity.
    +
    +::: note
    +[Facebook Login Changelog: Recent Changes to Facebook Login](https://developers.facebook.com/docs/facebook-login/changelog#2018-07-02)
    +:::
    +
    +This update may not require changes to your code or configuration, but your application might receive additional profile data if the existing permissions allow it. But keep in mind that:
    +
    +* If your Facebook connection is configured to request one of the removed permissions, your Access Token will not get them in scope.
    +* If your Facebook application is marked as "development" then you may still see an error temporarily while trying the connection.
    +* If you add new permissions to the connection, end users will be prompted for consent next time they log in. See the Facebook documentation for how to handle actions for users that don't have a specific permission.
    + 
    +## Facebook Login Permissions
    + 
    +[Facebook Login permissions](https://developers.facebook.com/docs/facebook-login/permissions) are requested by your application when a user logs in using Facebook. If the user is logging in for the first time or if the permissions have changed, they will be shown a consent window in Facebook showing the new permissions requested. Once those permissions are granted, your application can then act on behalf of that user with a Facebook access token.
    + 
    +The Facebook Connection interface has been updated to show both the regular name as well as the machine name for all permissions displayed. This makes it easier to find the permissions you need and map that to any code you might be running using these permission names.
    +
    +![Facebook Connection Permissions](/media/articles/connections/social/facebook/facebook-connection-permissions.png)
    + 
    +### Permissions added
    + 
    +The following permissions were added to the Facebook connection interface:
    +
    +- business_management
    +- groups_access_member_info
    +- leads_retrieval
    +- pages_manage_instant_articles
    +- publish_to_groups
    +- publish_to_groups
    +- user_age_range
    +- user_gender
    +- user_link
    + 
    +### Permissions removed
    + 
    +The following permissions were removed from the Facebook connection interface:
    + 
    +- read_custom_friendlists
    +- rsvp_event
    +- user_about_me
    +- user_actions-books
    +- user_actions-fitness
    +- user_actions-music
    +- user_actions-news
    +- user_actions-video
    +- user_education_history
    +- user_games_activity
    +- user_relationship_details
    +- user_relationships
    +- user_religion_politics
    +- user_website
    +- user_work_history
    + 
    +### Permissions moved to deprecated
    + 
    +The following permissions were moved to the **Deprecated** section and should not be used with the latest version of the Graph API:
    + 
    +- publish_actions
    +- user_managed_groups
    + 
    +## Facebook Graph API Fields
    + 
    +The [Facebook Graph API](https://developers.facebook.com/docs/graph-api/reference/v3.2/user) is used after a user logs in to retrieve profile data for the Auth0 user. The user data permissions requested determine what information is retrieved from the Graph API. The fields that are returned depend on the permissions requested and the existence of those fields in the Facebook user profile.
    + 
    +This change upgraded the Graph API from v2.8 to v3.2 and will ask for the following user data fields on login:
    + 
    +- address (added)
    +- age_range
    +- birthday
    +- context
    +- cover
    +- currency (added)
    +- devices
    +- email
    +- favorite_athletes
    +- favorite_teams
    +- first_name
    +- gender
    +- hometown
    +- id
    +- inspirational_people
    +- install_type (added)
    +- installed
    +- is_verified
    +- languages
    +- last_name
    +- link
    +- locale
    +- location
    +- meeting_for (added)
    +- middle_name
    +- name
    +- name_format
    +- picture
    +- public_key (added)
    +- quotes
    +- security_settings (added)
    +- short_name (added)
    +- significant_other
    +- sports (added)
    +- third_party_id
    +- timezone
    +- updated_time
    +- verified
    +- video_upload_limits (added)
    +- viewer_can_send_gift (added)
    diff --git a/articles/migrations/guides/facebook-social-context.md b/articles/migrations/guides/facebook-social-context.md
    new file mode 100644
    index 0000000000..d3a06f3de5
    --- /dev/null
    +++ b/articles/migrations/guides/facebook-social-context.md
    @@ -0,0 +1,32 @@
    +---
    +title: 'Context' Facebook Field Deprecation
    +public: false
    +description: Facebook is removing access to the 'social context' field from their profile
    +contentType:
    +  - how-to
    +useCase:
    +  - add-login
    +  - migrate
    +---
    +# 'Context' Facebook Field Deprecation
    +
    +On **July 30th 00:00 UTC**, Facebook connections that request the `context` field will fail, so Auth0 will stop requesting it for all connections at that time.
    +
    +On April 30th [Facebook deprecated]( https://developers.facebook.com/docs/graph-api/changelog/4-30-2019-endpoint-deprecations) the use of the ‘Social Context’ field for new applications. Auth0 continued to request that field by default for Facebook connections created before April 30th 2019. You can make sure the field is not requested before July 30th by unchecking the ‘Social context’ field in the User Data connection section:
    + 
    +![facebook context](/media/articles/migrations/facebook-context.png)
    + 
    +Once you uncheck ‘Social context’, the profile data will not include the context field. The field has the following content:
    + 
    +```
    +"context": {
    +  "mutual_likes": {"data": [],"summary": {"total_count": 0}},
    +  "id": "dXNlcl9...UZD"
    +}
    +```
    + 
    +**Do I need to take any action?**
    + 
    +If you are not using the ‘context’ field in the Facebook profile returned by Auth0 in your application, then your application will keep working without changes. Otherwise, you will need to adjust your application code so it does not rely on it.
    + 
    +If you want to make sure your application is not affected on July 30th we recommend you to uncheck the ‘Social context’ field in the Facebook connection properties.
    diff --git a/articles/migrations/guides/google_cloud_messaging.md b/articles/migrations/guides/google_cloud_messaging.md
    new file mode 100644
    index 0000000000..3b8e862174
    --- /dev/null
    +++ b/articles/migrations/guides/google_cloud_messaging.md
    @@ -0,0 +1,27 @@
    +---
    +title: Google Cloud Messaging Deprecation
    +description: This article describes how you can migrate your applications based on the Android Guardian SDK to Firebase Cloud Messaging
    +public: false
    +contentType:
    +  - concept
    +  - how-to
    +useCase:
    +  - customize-mfa
    +  - migrate
    +---
    +# Migration to Firebase Cloud Messaging
    +
    +Auth0’s Guardian SDKs for iOS and Android helps you create custom Mobile apps with Guardian functionality, providing secure access to multi-factor authentication (MFA) with push notifications. 
    +
    +The Android SDK library was built to send Push Notifications using Google Cloud Messaging, which [Google deprecated](https://firebase.googleblog.com/2018/04/time-to-upgrade-from-gcm-to-fcm.html) and replaced with Firebase Cloud Messaging. Google Cloud Messaging will stop working on April 11th 2019. **Note that existing applications should [keep working as-is](https://aws.amazon.com/blogs/messaging-and-targeting/the-end-of-google-cloud-messaging-and-what-it-means-for-your-apps/)**.
    +
    +You can learn more about how to migrate from GCM to FCM check [Google’s documentation](https://developers.google.com/cloud-messaging/android/android-migrate-fcm).
    +
    +The main difference between how you send notifications to GCM and FCM is in the payload received in the notification. While it was possible for existing customers using the Android SDK to adapt the payload received before calling the SDK method, we have upgraded the library so it accepts the new payload, making it simpler to adopt FCM. More details [here](https://github.com/auth0/Guardian.Android/pull/84).
    +
    +The Guardian Android SDK 0.4.0 version is already available in Maven Central and includes this change. The sample application was also upgraded, so it can be tested by providing the google-services.json file and a guardian-url. 
    +
    +You can check the updated documentation for the [Guardian Android SDK](/mfa/guides/guardian/guardian-android-sdk).
    +
    +
    +
    diff --git a/articles/migrations/guides/instagram-deprecation.md b/articles/migrations/guides/instagram-deprecation.md
    new file mode 100644
    index 0000000000..d801742b37
    --- /dev/null
    +++ b/articles/migrations/guides/instagram-deprecation.md
    @@ -0,0 +1,40 @@
    +---
    +title: Instagram Connection Deprecation
    +description: Instagram is deprecating their Authentication API
    +toc: true
    +contentType:
    +  - how-to
    +useCase:
    +  - add-login
    +  - migrate
    +---
    +# Instagram Connection Deprecation
    +
    +Facebook [announced](https://developers.facebook.com/blog/post/2019/10/15/launch-instagram-basic-display-api/) that on March 31th, 2020, they will turn off the Instagram legacy APIs in favor of a new set of APIs:
    +
    +- The [Instagram Graph API](https://developers.facebook.com/docs/instagram-api) which is designed for Instagram Professional Accounts, not for end-user authentication.
    +- The [The Instagram Basic Display API](https://developers.facebook.com/docs/instagram-basic-display-api), which is an OAuth2 API, and enables you to grant access to your basic Instagram account data to a third-party app.
    +
    +Even if it is a common industry practice to use OAuth2 as an authentication API, Facebook is explicitly forbidding using it as such, requiring applications to implement Facebook Login for authentication. Facebook will not approve applications that use the Instagram Basic Display API for authentication.
    +
    +In order to let existing users continue to access your application, you will need to ask users that are authenticating using Instagram to authenticate in a different way, and use [Account Linking](/link-accounts) to link the new identity with the old one. 
    +
    +An example flow would be:
    +
    +- The user authenticates with Instagram.
    +- The application tells the user that they won't be able to authenticate with Instagram anymore, and that they should do it in a different way.
    +- The application lists the options the user has for authentication, for example:
    +    - Facebook
    +    - Username and Password
    +- After the user authenticates in a different way, you link the accounts using [Account Linking](/link-accounts).
    +
    +## Why can't Auth0 use the Instagram Basic Display OAuth endpoint
    +
    +While we could replace our current implementation and use the [Instagram Basic Display OAuth flow](https://developers.facebook.com/docs/instagram-basic-display-api/guides/getting-access-tokens-and-permissions), this would not be accepted by Facebook's policies. You would need to create an Instagram application in Facebook and, in that app, there's a notification saying:
    +
    +> Note that Basic Display is not an authentication tool. Data returned by the API cannot be used to authenticate your app users or log them into your app. If your app uses API data to authenticate users, it will be rejected during App Review. If you need an authentication solution, use Facebook Login instead.
    +
    +This means that even if Auth0 implemented this flow, your Instagram application would not be approved by Facebook.
    +
    +If you need to access Instagram data, you will need to authenticate your user in other way (for example, using Facebook Login or username/password), and implement the Instagram OAuth flow in your application.
    +
    diff --git a/articles/migrations/guides/legacy-lock-api-deprecation.md b/articles/migrations/guides/legacy-lock-api-deprecation.md
    index f6a86ad95e..5398d83618 100644
    --- a/articles/migrations/guides/legacy-lock-api-deprecation.md
    +++ b/articles/migrations/guides/legacy-lock-api-deprecation.md
    @@ -2,12 +2,19 @@
     title: Legacy Lock API Deprecation
     description: This article covers the Legacy Lock API deprecation and gives direction as to migration paths and changes required.
     toc: true
    +public: false
    +contentType:
    +  - concept
    +  - how-to
    +useCase:
    +  - add-login
    +  - migrate
     ---
     # Legacy Lock API Deprecation
     
    -On April 4, 2018, Auth0 [publicly disclosed a vulnerability](https://auth0.com/blog/managing-and-mitigating-security-vulnerabilities-at-auth0/). That vulnerability resulted in the deprecation of two endpoints in the Auth0 API, and the libraries and SDKs which used those endpoints. Due to this vulnerability, those endpoints (and thus, the deprecated versions of the libraries) will be removed from service on **July 16, 2018**.
    +On April 4, 2018, Auth0 publicly disclosed a vulnerability. That vulnerability resulted in the deprecation of two endpoints in the Auth0 API, and the libraries and SDKs which used those endpoints. These endpoints were disabled on **July 16, 2018**, beginning a [brief grace period](https://community.auth0.com/t/soft-removal-of-legacy-lock-api/12949) in which usage of the endpoints could be re-enabled on a per-tenant basis until a migration could be completed. The endpoints have been removed from service as of **August 6, 2018**.
     
    -The purpose of this guide is to help you to select the best migration path for your application(s) if you are impacted by the deprecation notice. 
    +The purpose of this guide is to help you to select the best migration path for your application(s) if you are impacted by the deprecation. 
     
     ## Am I affected?
     
    @@ -21,7 +28,7 @@ If you do not use the above libraries and do not specifically call the above end
     
     ### If you already use Universal Login / Hosted Login Page
     
    -Applications which log users in via Universal Login through an Auth0 hosted page are not _required_ to update the version of Lock or Auth0.js that they use _inside_ that login page (if you have customized your login page in the [Dashboard](${manage_url}/#/login_page). However, the use of the newest library versions is strongly recommended, even in the Universal Login Page. For those who have not customized their login page, the Lock v11 widget is already in use and no further action is required.
    +Applications which log users in via Universal Login through an Auth0-hosted page are not _required_ to update the version of Lock or Auth0.js that they use _inside_ that login page (if you have customized your login page in the [Dashboard](${manage_url}/#/login_page). However, the use of the newest library versions is strongly recommended, even in the Universal Login Page. For those who have not customized their login page, the Lock v11 widget is already in use and no further action is required.
     
     ### If you use embedded login
     
    @@ -29,7 +36,7 @@ Embedded login with Lock v11 and Auth0.js v9 now rely entirely on [cross-origin
     
     This cross-origin authentication protocol relies on cookies, which will be considered third-party cookies if the domain of the application and Auth0 tenant do not match. Unfortunately, some browsers block third-party cookies, and even if supported, many users may have manually disabled third-party cookies in their browsers. 
     
    -Because of these [cross-origin authentication issues](/cross-origin-authentication#limitations-of-cross-origin-authentication), there are only two general implementations that can be recommended. 
    +Because of these [cross-origin authentication issues](/cross-origin-authentication#limitations), there are only two general implementations that can be recommended. 
     
     1. [Migrate to Universal Login](#1-migrate-to-universal-login). Universal Login will work with or without [custom domains](/custom-domains), and will work from most application types as well. It requires the least application code to implement and is the most secure option. 
     
    @@ -37,11 +44,13 @@ Because of these [cross-origin authentication issues](/cross-origin-authenticati
         * Only one custom domain can be applied per Auth0 tenant, so all applications on the tenant will use the same custom domain (they will need to use the same top-level domain as well).
         * This option may not be viable for customers who are not eligible to use custom domains, or who choose not to do so. In those cases, Universal Login is the best approach.
     
    +<%= include('../../_includes/_embedded_login_warning') %>
    +
     If neither of these recommendations (Universal Login or embedded + custom domains) seem to work for your situation, please visit our [Support Center](${env.DOMAIN_URL_SUPPORT}) and file a support ticket or a community post for further guidance.
     
     ## What do I do?
     
    -All applications _must_ stop using the deprecated endpoints / library versions prior to **July 16, 2018**, when they will be removed from service and those applications will cease to work correctly. There are two options for migration:
    +All applications _must_ stop using the deprecated endpoints / library versions, as they have been removed from service as of August 6, 2018. Applications using those endpoints will no longer function correctly. There are two options for migration:
     
     ### 1. Migrate to Universal Login
     
    @@ -50,11 +59,11 @@ Universal Login is **strongly** recommended for most use cases because it [offer
     * Developed, hosted and maintained by Auth0 (less maintenance required by your team).
     * Provides a single place to make changes.
     * More secure because credentials are collected and verified within the same domain. This reduces exposure of static credentials to multiple applications as well as the possibility of CSRF and man-in-the-middle attacks.
    -* Provides reliable Single Sign On functionality without relying on third-party cookies or restricting the domain of applications.
    +* Provides reliable Single Sign-on (SSO) functionality without relying on third-party cookies or restricting the domain of applications.
     * Fully customizable in terms of colors, text, logos, buttons as well as [custom domain](/custom-domains).
     * Provides proper cache control to avoid browsers caching old versions.
     * Can leverage either the [Lock Widget](/libraries/lock) or [Auth0.js SDK](/libraries/auth0js) for flexibility in appearance and function.
    -* Works with any type of Auth0 connection as well as [multifactor authentication](/multifactor-authentication).
    +* Works with any type of Auth0 connection as well as multi-factor authentication (MFA).
     
     #### Universal Login migration guides
     
    @@ -66,9 +75,9 @@ Universal Login is **strongly** recommended for most use cases because it [offer
         

  • - Migrate Single Page Apps with Embedded Lock to Universal Login + Migrate Single-Page Apps with Embedded Lock to Universal Login

    - This document provides instruction for single page apps which have embedded login (via the Lock widget) to migrate to Universal Login. + This document provides instruction for single-page apps which have embedded login (via the Lock widget) to migrate to Universal Login.

  • @@ -86,12 +95,6 @@ Embedded login (embedding Lock or a custom authentication UI) should be used onl #### Embedded login migration guides -Continued use of embedded login will require the use of [custom domains](/custom-domains) in order to prevent cross-origin authentication issues. The custom domains documentation includes important information on the use of custom domains, how to set them up, and what configuration is required for more intricate use cases, such as custom domains with SAML. +Continued use of embedded login will require the use of [custom domains](/custom-domains) in order to prevent cross-origin authentication issues. The custom domains documentation includes important information on the use of custom domains, how to set them up, and what configuration is required for more intricate use cases, such as custom domains with SAML. ## Other considerations @@ -110,82 +113,63 @@ A few specific items are changing with the new versions / endpoints. If you use * [How to check for an existing session](#session-management) * [How to log users out](#how-to-log-users-out) -### How to get user info +## How to get user info Once a user has been authenticated, an application may wish to retrieve information about a user. The recommended way to do this now is via the [/userinfo](/api/authentication#get-user-info) endpoint. If you are using Auth0.js v8 or v9 and using the [userInfo()](/libraries/auth0js/v9#extract-the-authresult-and-get-user-info) method, you already have made this change. For customers who are using the [/tokeninfo](/api/authentication#get-token-info) endpoint, this endpoint is being replaced with the /userinfo endpoint. Customers should migrate to use the /userinfo endpoint instead of /tokeninfo. The /userinfo endpoint is the only one that will be maintained going forward and is the only endpoint for user information that is supported with the [custom domains](/custom-domains) feature. -As explained in the /userinfo endpoint docs entry, /userinfo obtains information using the Management API and therefore requires an [Access Token](/tokens/access-token#how-to-get-an-access-token) (obtained during login) instead of the [ID Token](/tokens/id-token) used by /tokeninfo. +As explained in the /userinfo endpoint docs entry, /userinfo obtains information using the Management API and therefore requires an Access Token (obtained during login) instead of the [ID Token](/tokens/concepts/id-tokens) used by /tokeninfo. -Note also that the [/userinfo response](/api-auth/tutorials/adoption/scope-custom-claims) may vary based on scopes requested and the value of the [OIDC Conformant](/api-auth/tutorials/adoption/oidc-conformant) setting in the [Dashboard](${manage_url}) under **Applications > (Your Application) > Settings > Advanced Settings**. In that case, application code might need adjusted to handle the slightly altered response format. +Note also that the [/userinfo response](/api-auth/tutorials/adoption/scope-custom-claims) may vary based on scopes requested and the value of the [OIDC Conformant](/api-auth/tutorials/adoption/oidc-conformant) setting in the [Dashboard](${manage_url}) under **Applications > (Your Application) > Settings > Advanced Settings**. In that case, application code might need adjusted to handle the slightly altered response format. ### Session management -#### Single Page Applications +#### Single-Page Applications -If a user navigates to a new page in a Single Page Application, your application may wish to check if a user already has an existing session. In order to do this, you may have directly called the /ssodata endpoint or utilized the `getSSOData()` function in auth0.js v8 or prior. The /ssodata endpoint is deprecated and will be removed from service on **July 16, 2018**. The `getSSOData()` function will continue to work, but will behave differently, and in most cases, can be replaced with use of `checkSession()`. +If a user navigates to a new page in a Single-Page Application, your application may wish to check if a user already has an existing session. In order to do this, you may have directly called the /ssodata endpoint or utilized the `getSSOData()` function in Auth0.js v8 or prior. The /ssodata endpoint is deprecated and was removed from service on **August 6, 2018**. The `getSSOData()` function will continue to work, but will behave differently, and in most cases, can be replaced with use of `checkSession()`. ::: note -The `getSSOData()` and `checkSession()` functions should only be used from a Single Page Application +The `getSSOData()` and `checkSession()` functions should only be used from a Single-Page Application ::: -##### checkSession +##### checkSession() * The Auth0.js `checkSession()` function can be used to check whether or not a user has an existing session in Auth0. * Invoking the `checkSession()` function will trigger an /authorize call, which will in turn result in the execution of [rules](/rules). * The new `checkSession()` function is more lightweight and should be used as a replacement for `getSSOData()` unless `getSSOData()` features are needed. -##### getSSOData +##### getSSOData() -* The Auth0.js v9 `getSSOData()` function will continue to work, but it now [behaves differently than in the past](/libraries/auth0js/v9/migration-v8-v9#review-calls-to-getssodata-). +* The Auth0.js v9 `getSSOData()` function will continue to work, but it now behaves differently than in the past. * In Auth0.js v9, `getSSOData()` will check if a user has an existing session and perform a further check to determine if the user is the same one as in the last interactive authentication transaction. This supports Lock’s feature of showing the last logged-in user to facilitate subsequent logins. -* Invoking the `getSSOData()` function will now trigger a call to the [/authorize](/api/authentication#authorize-client) endpoint, which will in turn result in the execution of [rules](/rules). +* Invoking the `getSSOData()` function will now trigger a call to the [/authorize](/api/authentication#authorize-application) endpoint, which will in turn result in the execution of [rules](/rules). ##### Polling for an existing session -In some multi-application scenarios, where a user logging out of one application needs to be logged out of other applications, an application may have been set up to periodically poll Auth0 using `getSSOData()` to see if a session existed, and if not, log the user out of the application. +<%= include('../../_includes/_checksession_polling') %> -Instead of doing this, applications should now use `checkSession()` instead of `getSSOData()`. The `getSSOData()` function performs more work behind the scenes than is needed for this purpose and applications that are not switched to `checkSession()` will suffer a needless performance penalty. - -The poll interval between checks to `checkSession()` should be at least 15 minutes between calls to avoid any issues in the future with rate limiting of this call. +This was previously done with `getSSOData()`. The `getSSOData()` function performs more work behind the scenes than is needed for this purpose and applications that are not switched to `checkSession()` will suffer a needless performance penalty. #### Web applications -In "web applications", the backend typically has a session for the user. Over time, the application session may expire, in which case the application should renew the session. The application backend should invoke a call to the [/authorize](/api/authentication#authorize-client) endpoint to get a new token. If the Authorization Server (Auth0 in this case) still has a session for the user, the user will not have to re-enter their credentials to log in again. If Auth0 no longer has a session for the user, the user has to log in again. +In "web applications", the backend typically has a session for the user. Over time, the application session may expire, in which case the application should renew the session. The application backend should invoke a call to the [/authorize](/api/authentication#authorize-application) endpoint to get a new token. If the Authorization Server (Auth0 in this case) still has a session for the user, the user will not have to re-enter their credentials to log in again. If Auth0 no longer has a session for the user, the user has to log in again. -Customers with web applications which call the API from their backend should use this approach. Specifically, they should [call /oauth/token](/tokens/refresh-token/current#use-a-refresh-token) to renew their token. +Customers with web applications which call the API from their backend should use this approach. Specifically, they should [call /oauth/token](/tokens/guides/use-refresh-tokens) to renew their token. ### How to log users out The deprecation does not require any changes for [logout](/logout), but if a custom domain has been configured and is used when invoking authentication, the /logout endpoint should be invoked using the custom domain as well. -## Troubleshooting - -### How to tell if you have deprecated usage - -Please take a look at the [Deprecation Error Reference](/articles/errors/deprecation-errors) to assist with verifying that your application does, or does not, use deprecated features. +### Using Lock with AD/LDAP and Kerberos -### How to test whether you are ready before the removal of service date +If your application is using Lock in embedded mode with the goal of detecting IP ranges with AD/LDAP + Kerberos, this will no longer work. -Auth0 has provided a toggle in the tenant settings in the [Dashboard](${manage_url}) to allow customers to turn off the legacy endpoints manually for their tenant ahead of the deprecation deadline of July 16, 2018. Navigate to the tenant settings screen, **Advanced** tab and scroll down to the block of migration toggles. +The solution for the Kerberos case is to [migrate to Universal Login](#1-migrate-to-universal-login). Lock will no longer attempt to detect an IP range by itself when embedded in an application. However, when using Universal Login with Lock inside your hosted login page, it will use the /user/ssodata endpoint (which still works from within the login page), and that endpoint will still return “true” when the user is in the Kerberos IP range. That means that using Universal Login you can: -Turn off the **Legacy Lock API** toggle to stop your tenant from being able to use those endpoints. This toggle allows you to test the removal of the deprecated endpoints with the ability to turn them back on if you encounter issues. +* Use `getSSOData()` to achieve an automatic login +* Use Lock and get the **Use Windows Authentication** button (log in with Kerberos). -::: note -Tenants created after Dec 27, 2017 were not allowed to begin usage of these deprecated features, and therefore do not have the Legacy Lock API toggle. -::: - -### Bookmarking the login page - -Bookmarking the Universal Login page is not supported. If a user bookmarks the login page and attempts to initiate authentication by going directly to the bookmarked URL instead of starting from the application, the following error message will be shown: `Password login is disabled for clients using externally hosted login pages with oidc_conformant flag set`. - -### Fingerprinting error - -For any customers who have not quite finished migrating away from the above deprecated features, Auth0 has [implemented a temporary solution](/cross-origin-authentication/fingerprinting) to help mitigate the severity of the issues with the deprecated endpoints. This solution relies on "fingerprinting" checks on the successive calls in an authentication transaction. - -If any authentication requests are being rejected by the fingerprinting solution, they can be identified with the following query against logs: - -Description: "Unable to verify transaction consistency" +## Troubleshooting -Customers who have any transactions rejected by the fingerprinting checks should complete their upgrades to resolve the issue. +See [Check Deprecation Errors](/troubleshoot/guides/check-deprecation-errors) for more information on deprecation-related errors. diff --git a/articles/migrations/guides/linkedin-api-deprecation.md b/articles/migrations/guides/linkedin-api-deprecation.md new file mode 100644 index 0000000000..011ba33906 --- /dev/null +++ b/articles/migrations/guides/linkedin-api-deprecation.md @@ -0,0 +1,54 @@ +--- +title: Migration to LinkedIn API V2 +description: This article covers the LinkedIn API deprecation and how to update your Auth0 LinkedIn Connection. +toc: true +public: false +contentType: + - how-to +useCase: + - add-login + - migrate +--- + +# Migration to LinkedIn API V2 + +In December 2018, LinkedIn [deprecated version 1.0 of their sign-in API](https://engineering.linkedin.com/blog/2018/12/developer-program-updates). The final shutdown date we set for March 1st, 2019 then moved to May 1st, 2019. In June 2019, the current status is that "Applications requesting Version 1.0 APIs may experience issues as we begin to remove services." + +LinkedIn replaced the sign-in API with [version 2.0, which has some key differences](https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq?context=linkedin/consumer/context). + +We've added the option to set the LinkedIn API version for LinkedIn Connections. You can change the API version for a LinkedIn Connection through the Auth0 Dashboard by selecting a **Strategy Version** under the connection's settings. + +![New LinkedIn Connection Settings](/media/articles/connections/social/linkedin/linkedin-connection-new.png) + +Auth0 will not automatically migrate all connections to Version 2 until Version 1 stops working completely. We strongly recommend that you update your connection settings to Version 2. You may need to update your application code to accommodate these API changes. + +## What's changed? + +There are changes in the user attributes you can request. + +For version 1.0 we exposed these attributes: + +| **Auth0 Attribute**| **Linkedin Scope**| +|----------------|---------------| +| Profile| r_basicprofile| +| Full Profile | r_fullprofile| +| Network | r_network| +| Email | r_emailaddress| + +For version 2.0 we expose these options: + +| **Auth0 Attribute**| **Linkedin Scope**| +|----------------|---------------| +|Profile| r_liteprofile| +|Basic Profile| r_basicprofile| +|Email| r_emailaddress| + +As you can see version 2.0: + +* Adds support for the `r_liteprofile` scope +* Removes support for the `r_fullprofile` and `r_network` scopes +* Supports the `r_basicprofile` scope only for clients that are part of [LinkedIn’s Developer Enterprise](https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq#what-are-the-main-differences-with-the-new-sign-in-with-linkedin) services. + +::: note +Not all applications registered with LinkedIn can access their new API. For more details, check [Microsoft’s documentation](https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq#does-my-developer-application-have-access-to-the-linkedin-v2-api). +::: diff --git a/articles/migrations/guides/liveid-api-deprecation.md b/articles/migrations/guides/liveid-api-deprecation.md new file mode 100644 index 0000000000..bdf60569cf --- /dev/null +++ b/articles/migrations/guides/liveid-api-deprecation.md @@ -0,0 +1,118 @@ +--- +title: Microsoft Account Migration +description: This article covers the Live Connect + SDK deprecation and how to update your Auth0 Microsoft Account Connection. +toc: true +public: false +contentType: + - how-to +useCase: + - add-login + - migrate +--- + +# Microsoft Account Migration to Azure AD (personal accounts) + Microsoft Graph + +In October 2017, Microsoft announced the [deprecation of the Live Connect API and Live SDK](https://developer.microsoft.com/en-us/office/blogs/outlook-rest-api-v1-0-office-365-discovery-and-live-connect-api-deprecation). This is a Microsoft deprecation that will affect Auth0 users using the Microsoft social connection. The change implies switching how Auth0 interacts with the Microsoft authentication APIs, and it might imply changes in customers application's code. + +The change implies switching: + +- From the Live Connect API to the Azure Active Directory v2 and OIDC protocol for Microsoft Account authentication +- From the Live SDK to Microsoft Graph to be able to get other resources including user profiles, contacts, files, etc + +Note that even though Azure AD is used, this connection type will only accept personal accounts. For work or school accounts you should use the enterprise Azure AD connection type. + +You can decide if Auth0 uses Live Connect + Live SDK or Azure AD + Microsoft Graph using the 'Strategy Version' field in the Microsoft Account connection settings page. + +![New Microsoft Connection Settings](/media/articles/connections/social/microsoft-account/microsoft-account-azureid.png) + +You need to switch to 'Azure AD (personal accounts)' to ensure your applications will keep working after Microsoft decommissions the API. + +**Microsoft Application Registration** + +Depending on when you created your Live SDK application, it might or not support Azure Active Directory v2. If it's not supported, you will need to create a different application and update your Client ID and Client Secret in the Auth0 Microsoft connection settings. As a rule, if your Client ID looks like `00000000400FFF55`, you'll need to create a new application. + +For more information, check [Microsoft's documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-registration-portal). + + +**User Profile** + +Microsoft Graph provides different user profile information compared to the Live Connect and Live SDK user profile. In particular, some of the user profile fields that were previously available are not available anymore: + + +***OIDC Profile*** + +| Field | Live SDK | Microsoft Graph | +|--------|---------------|------------------| +| picture | Returned a URL for the user picture | Auth0 will build a URL that will return a default picture for the user based on their initials | +| locale | Returned a string in the format en_US | Not available | + +***Raw Profile*** + +The raw user profile that can be obtained calling the [Get User By Id Endpoint](https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id) has several differences when using Live SDK or Microsoft Graph. + +The JSON below shows the fields that are in the Live SDK profile but are not present, or are different, in the Microsoft Graph one: + +```js +{ + "locale": "en_ZA", + "work": [], + "emails": [ + "john.doe@windowslive.com" + ], + "addresses": { + "personal": { + "street": null, + "street_2": null, + "city": null, + "state": null, + "postal_code": null, + "region": null + }, + "business": { + "street": null, + "street_2": null, + "city": null, + "state": null, + "postal_code": null, + "region": null + } + }, + "phones": { + "personal": null, + "business": null, + "mobile": null + }, + "nickname": "john.doe@windowslive.com", + ] +} +``` + +This other one shows the fields that are in the Microsoft Graph profile but are not present, or are different, in the Live SDK one one: + +```js +{ + "strategy_version": 2, + "displayName": "John Doe", + "userPrincipalName": "john.doe@windowslive.com", + "businessPhones": [], + "nickname": "john.doe", +} +``` + +Key differences are: + +- `strategy_version` has the value `1` when the user last logged-in with Live Connect, or `2` when they last logged in with Azure AD. +- `nickname` has a different format. +- `locale`, `work`, `emails` array, `addresses`, `phones` are present in Live SDK but not in Microsoft Graph. +- `displayName`, `userPrincipalName`, `businessPhones` array are present in Microsoft Graph but not in Live SDK. + +If a user that has previously logged in with Live Connect logs in with AzureAD, the profiles will be merged. The new profile will have both the content of the Live ID profile plus the fields from the Microsoft Graph profile. + +The `strategy_version` will be set to '2' for users that last logged in with Azure AD, to '1' for users that logged in with Live Connect recently, and will not be present for users that did not login recently. You can use this field to better interpret the profile content. + +Note that the `user_id` field will be the same regardless of the API used to connect with Microsoft, even if you had to create another application to use Azure Active Directory v2. + +**Permissions** + +Auth0 lets you select which permissions you want to ask from the Microsoft Graph APIs. The ones that Live SDK and Microsoft Graph support might provide similar functionality, but the data returned by them and their format may be completely different. See [Migrating from Live SDK - Permissions](https://docs.microsoft.com/en-us/onedrive/developer/rest-api/concepts/migrating-from-live-sdk?view=odsp-graph-online#permissions) to understand what changes are required in your code. + diff --git a/articles/migrations/guides/management-api-v1-v2.md b/articles/migrations/guides/management-api-v1-v2.md new file mode 100644 index 0000000000..65ea5d6bfb --- /dev/null +++ b/articles/migrations/guides/management-api-v1-v2.md @@ -0,0 +1,108 @@ +--- +title: Migrate from Management API v1 to v2 +description: Learn how to migrate from Auth0 Management API v1 to v2. +topics: + - management api +contentType: + - concept + - how-to +useCase: + - management api +--- +# Migrate from Management API v1 to v2 + +Auth0’s Management API v1 was deprecated in 2016 and replaced with the [Auth0 Management API v2](/api/management/v2/). Management API v1 will reach its End Of Life in the Public Cloud on **July 13th, 2020**. Requests will begin failing with a `410` HTTP status code on or after that date. Management API v1 will be included in the Private Cloud until the November 2020 monthly release, which is the first release that will not include Management API v1. + +## Key Dates + +The following are key dates for this migration: + +| Date | Public Cloud | Private Cloud | +|------|--------------|---------------| +| Jan 13, 2020 | Initial Public Announcement | N/A | +| May 21, 2020 | N/A | Initial Public Announcement | +| July 13, 2020 | End of Life for Management API v1 | N/A | +| November 2020 | N/A | Support removed from release for Mgmt API V1 | + +## Am I affected by the migration? + +Affected tenants are those who meet all of the following criteria: + +* Created before January 2, 2020 +* Actively making requests to Auth0 endpoints directly under the `/api/` path from your application. + +The following tenants are NOT affected: + +* Created after January 2, 2020 +* Exclusively using the Auth0 Management API v2 endpoints +* Using the Authentication API exclusively, the Authentication API is not affected by this deprecation. + +## How can I check to see if I've migrated all my requests? + +Deprecation Notices will be recorded in your Tenant Logs for requests that will fail at API v1’s End of Life. You can search for relevant Deprecation Notices in your tenant logs with the following query: + +``` +type:depnote AND description:*APIv1* +``` + +::: note +**Private Cloud Customers** + +- You must be running release [2003](https://auth0.com/releases/2003) or later to see Deprecation Notices. + +- If searching tenant logs from the Dashboard, search for `type:depnote`. Searching by `description` is not currently supported in the tenant logs search available in the Dashboard. If you [export your logs to an external service](/extensions#logs-export), you can leverage it to query for APIv1 Deprecation Notices using a combination of `type` and `description`. +::: + +![Management API Version 1 Log Query](/media/articles/migrations/apiv1-log-query.png) + +To help identify the Application making requests, logs will include the `client_id` used to make the request. You can also find the endpoint being used in the logs `details.path` field. + +Note that our current SDKs all use Management API v2. If you're seeing API v1 activity from an Application that is leveraging an older SDK, you should upgrade to the latest version. + +![Management API Versiion 1 Log Example](/media/articles/migrations/apiv1-log-example.png) + +::: note +Auth0 generates only one log for each `client_id` and `details.path` combination every 60 minutes. No matter how many calls you make to the deprecated endpoints, you will still see a single log per hour for *each* deprecated endpoint an application calls. + +If you implement changes to your requests, you'll need to allow 60 minutes to elapse before you can conclusively determine that the lack of new `depnote` logs means the deprecated endpoints have been removed from your code. +::: + +## What’s changing? + +For a complete list of breaking changes associated with this deprecation, see [Management API v2 Changes](/api/management/v2/changes). + +## How do I migrate? + +After replacing all calls to the Management API v1 with their [Management API v2 replacements](/api/management/v2/changes), you should confirm you are no longer seeing Deprecation Notices in your Tenant Logs and **disable the Management API v1 for your tenant.** + +You can disable API v1 by going **Tenant Settings** > **Advanced** > **Migration** in the [Auth0 Dashboard](http://manage.auth0.com/). This will simulate the expected behavior after the End of Life date, causing calls to API v1 to fail with a `410` HTTP status code. You will be able to re-enable API v1 any time before the End of Life date. + +By migrating your requests to API v2 and disabling API v1 as soon as possible, you will ensure that your systems will continue to operate uninterrupted after the **July 13th, 2020** End of Life date, at which time the option to enable API v1 will be removed. + +![Toggle Management API Version](/media/articles/migrations/apiv1-toggle.png) + +::: note +Note that tenants created after January 2, 2020 will not have access to API v1. If you need API v1 enabled on a tenant for testing your migration, please open a ticket in our [Support Center](https://support.auth0.com/tickets). +::: + +If you need help with the migration, contact us using the [Support Center](https://support.auth0.com/) or our [Community Site](https://community.auth0.com/c/auth0-community/Migrations). + +## Auth0 AD/LDAP Connector Health Monitor extension + +The [Auth0 AD/LDAP Connector Health Monitor](/extensions/adldap-connector) extension v1 uses the API v1 `GET /api/connections/{connection-name}` and `GET /api/connections/{connection-name}/socket` endpoints. + +Please upgrade to the latest version of the extension before disabling API v1 support. + +## SharePoint Integration Custom Claims Provider + +The Custom Claims Provider of the [Auth0 SharePoint Integration](https://auth0.com/docs/integrations/sharepoint) leverages three API v1 endpoints : `/api/enterpriseconnections/users`, `/api/socialconnections/users`, and `/api/connections`. + +If you are calling these endpoints from the SharePoint integration, they will continue to work after the API v1 End of Life date. You may continue see `depnote` tenant logs for this activity. If the `client_id` in the tenant log is a SharePoint application, you can disregard this warning. + +If you are calling these endpoints directly from your code, you will need to migrate those calls off of API v1. + +## Keep reading + +* [Complete list of changes](/api/management/v2/changes) +* [Management APIv1 documentation](/api/management/v1) +* [Management APIv2 documentation](/api/management/v2) diff --git a/articles/migrations/guides/migration-oauthro-oauthtoken-pwdless.md b/articles/migrations/guides/migration-oauthro-oauthtoken-pwdless.md new file mode 100644 index 0000000000..2af6b0ea4e --- /dev/null +++ b/articles/migrations/guides/migration-oauthro-oauthtoken-pwdless.md @@ -0,0 +1,121 @@ +--- +title: Migration Guide for Resource Owner Passwordless Authentication +description: Learn how to migrate your Passwordless API calls and responses from /oauth/ro to /oauth/token +toc: true +contentType: + - concept +useCase: + - secure-an-api + - migrate +--- +# Migration Guide for Resource Owner Passwordless Credentials Exchange + +Support for Resource Owner Password was added to [/oauth/token](/api/authentication#authorization-code). Usage of the [/oauth/ro](/api/authentication#resource-owner) endpoint was deprecated on July 08, 2017. This endpoint was used to exchange an OTP received by the end-user by email or SMS with for an `id_token` and an `access_token`. + +We have implemented a new API that replaces `oauth/ro` for this use case, and we recommend customers to migrate to the new implementation. + +## Does this affect me ? + +This change affects you if you use the resource owner passwordless credentials exchange and call `/oauth/ro` directly without the use of any Auth0 libraries or SDKs. + +<%= include('./_forced-logouts.md') %> + +## Changes to requests + +Previously, the payload of a request to `/oauth/ro` looked similar to this: + +```json +{ + "grant_type": "password", + "client_id": "123", + "username": "alice", + "password": "A3ddj3w", + "connection": "my-database-connection", + "scope": "openid email favorite_color offline_access", + "device": "my-device-name" +} +``` + +These are the changes for the new implementation: + +* The endpoint to execute token exchanges is now `/oauth/token` +* [Auth0's own grant type](/api-auth/tutorials/password-grant#realm-support) is used to authenticate users from a specific connection (or `realm`). +* Auth0 supports the [standard OIDC scopes](/scopes/current/oidc-scopes), along with the scopes which you have defined in your [custom API](/api-auth/apis). +* A scope that does not fit in one of these categories, such as the above `favorite_color`, is no longer a valid scope. +* The `device` parameter is removed. +* The `audience` parameter is optional. + +Here is an example of the payload of a request to `/oauth/token`: + +```json +{ + "grant_type" : "http://auth0.com/oauth/grant-type/passwordless/otp", + "client_id": "YOUR_CLIENT_ID", + "client_secret": "YOUR_CLIENT_SECRET", // only for web apps, native apps don’t have a client secret + "username": "", // or "" + "otp": "CODE", + "realm": "email", // or "sms" + "audience" : "your-api-audience", // in case you need an access token for a specific API + "scopes": "openid profile email" // whatever scopes you need +} +``` + +* The grant type is specified here as `http://auth0.com/oauth/grant-type/passwordless/otp` +* The parameters `client_id` and `username` are unchanged. +* The `client_secret` needs to be specified for confidential clients (e.g. regular web apps). +* The one-time password needs to be sent in the `otp` parameter instead of the `password` parameter. +* The `realm` is used to identify the connection, and replaces the `connection` parameter from previous calls. +* The `scope` parameter is mostly the same, but does not accept non-OIDC values. +* The `audience` parameter can be added, indicating the API audience the token will be intended for. + +## Changes to responses + +Responses from `/oauth/ro` were similar in format to the following: + +```json +{ + "access_token": "SlAV32hkKG", + "token_type": "Bearer", + "refresh_token": "8xLOxBtZp8", + "expires_in": 3600, + "id_token": "eyJ..." +} +``` + +* The returned Access Token is valid for calling the [/userinfo endpoint](/api/authentication#get-user-info) (provided that the API specified by the `audience` param uses RS256 as [signing algorithm](/tokens/concepts/signing-algorithms)) and optionally the [custom API](/api-auth/apis) if one was specified. +* The ID Token will be forcibly signed using RS256 if requested by a [public client](/clients/client-types#public-clients). +* A Refresh Token will be returned only if the `offline_access` scope was granted and the API has **Allow offline access** set. + +Here is an example of the response from `/oauth/token`: + +```json +{ + "access_token": "eyJ...", + "token_type": "Bearer", + "refresh_token": "8xLOxBtZp8", + "expires_in": 3600, + "id_token": "eyJ..." +} +``` + +## Code changes when using the SDKs + +If your application uses the Auth0 native libraries for Android or iOS, be sure that the version of the library you are including is at least the minimum listed below (or higher). Also, be sure to set the 'OIDC Conformant' flag to `true` when configuring the libraries. + +|Library|Minimum Version| +|---|---| +|[Android SDK](/libraries/auth0-android/passwordless)|1.2| +|[Lock Android](/libraries/lock-android/passwordless)|2.17| +|[Swift SDK](/libraries/auth0-swift/passwordless)|1.20.0| +|[Lock iOS](/libraries/lock-ios/passwordless)|2.14.0| + +## Verifying your migration + +Once you have migrated your codebase, if you would like to be sure that your applications are no longer calling the legacy endpoint. + +You can verify whether you are still using the deprecated endpoint by checking the [tenant logs](${manage_url}/#/logs), filtering by "Deprecation Notice" and check for logs saying "oauth/ro passwordless: This feature is being deprecated". You can also perform this search directly with the following query: `type:depnote AND description:*passwordless*`. + +Once you made sure your applications are not calling the endpoint, you can go to the [Dashboard](${manage_url}/#/tenant/advanced) under **Tenant Settings > Advanced** then scroll down to **Migrations** and toggle off the Legacy `/oauth/ro` Endpoint switch. Turning off this switch will disable the deprecated endpoint for your tenant, preventing it from being used at all. + +![Legacy Migration Toggles](/media/articles/libraries/lock/migration-toggles.png) + diff --git a/articles/migrations/guides/migration-oauthro-oauthtoken.md b/articles/migrations/guides/migration-oauthro-oauthtoken.md index 57a477eb0f..cf4d290c1f 100644 --- a/articles/migrations/guides/migration-oauthro-oauthtoken.md +++ b/articles/migrations/guides/migration-oauthro-oauthtoken.md @@ -2,14 +2,21 @@ title: Migration Guide for Resource Owner Password Credentials Exchange description: Learn how to migrate your API calls and responses from /oauth/ro to /oauth/token toc: true +contentType: + - concept +useCase: + - secure-an-api + - migrate --- # Migration Guide for Resource Owner Password Credentials Exchange -Support for Resource Owner Password was added to [oauth/token](/api/authentication#authorization-code) and usage of the [oauth/ro](/api/authentication#resource-owner) endpoint will be deprecated at some point in the future. +Support for Resource Owner Password was added to [oauth/token](/api/authentication#authorization-code). Usage of the [oauth/ro](/api/authentication#resource-owner) endpoint was deprecated on July 08, 2017. ## Does this affect me ? -This guide is for users who use the resource owner password credentials exchange, and call /oauth/ro directly, without the use of any Auth0 libraries or SDKs. The major Auth0 libraries such as [Lock](/libraries/lock) or [Auth0.js](/libraries/auth0js) have already been updated to stop using /oauth/ro internally. If you use the `lock-passwordless` library, you can now use [Passwordless Mode](/libraries/lock/v11#passwordless) in Lock v11 instead. +This change affects you if you use the resource owner password credentials exchange, and call `/oauth/ro` directly, without the use of any Auth0 libraries or SDKs. The major Auth0 libraries such as [Lock](/libraries/lock) or [Auth0.js](/libraries/auth0js) have already been updated to stop using /oauth/ro internally. If you use the `lock-passwordless` library, you can now use [Passwordless Mode](/libraries/lock/v11#passwordless) in Lock v11 instead. + +<%= include('./_forced-logouts.md') %> ## Changes to requests @@ -29,10 +36,10 @@ Previously, the payload of a request to /oauth/ro looked similar to this: * The endpoint to execute token exchanges is now /oauth/token * [Auth0's own grant type](/api-auth/tutorials/password-grant#realm-support) is used to authenticate users from a specific connection (or `realm`). -* Auth0 supports the [standard OIDC scopes](/scopes/current#openid-connect-scopes), along with the scopes which you have defined in your [custom API](/api-auth/apis). +* Auth0 supports the [standard OIDC scopes](/scopes/current/oidc-scopes), along with the scopes which you have defined in your [custom API](/api-auth/apis). * A scope that doesn't fit in one of these categories, such as the above `favorite_color`, is no longer a valid scope. * The `device` parameter is removed. -* The `audience` parameter is optional. +* The `audience` parameter is optional. Here is an example of the payload of a request to /oauth/token: @@ -68,9 +75,9 @@ Responses from `oauth/ro` were similar in format to the following: } ``` -* The returned Access Token is valid for calling the [/userinfo endpoint](/api/authentication#get-user-info) (provided that the API specified by the `audience` param uses RS256 as signing algorithm) and optionally the [custom API](/api-auth/apis) if one was specified. +* The returned Access Token is valid for calling the [/userinfo endpoint](/api/authentication#get-user-info) (provided that the API specified by the `audience` param uses RS256 as [signing algorithm](/tokens/concepts/signing-algorithms)) and optionally the [custom API](/api-auth/apis) if one was specified. * The ID Token will be forcibly signed using RS256 if requested by a [public client](/clients/client-types#public-clients). -* A Refresh Token will be returned only if the `offline_access` scope was granted and the API has **Allow offline access** set. +* A Refresh Token will be returned only if the `offline_access` scope was granted and the API has **Allow offline access** set. Here is an example of the OIDC conformant response from `oauth/token`: diff --git a/articles/migrations/guides/passwordless-start.md b/articles/migrations/guides/passwordless-start.md new file mode 100644 index 0000000000..690d1f5786 --- /dev/null +++ b/articles/migrations/guides/passwordless-start.md @@ -0,0 +1,100 @@ +--- +title: Migration Guide for the Use of /passwordless/start from Confidential Applications +description: Auth0 is deprecating the usage of the /passwordless/start endpoint from confidential applications without a client secret in the request. +topics: + - passwordless + - migrations +contentType: + - concept + - how-to +useCase: + - customize-connections +--- +# Migration Guide: Use of /passwordless/start from Confidential Applications + +Auth0 is deprecating the use of the `/passwordless/start` endpoint from confidential applications when Auth0 cannot authenticate that the call is made on behalf of the application. + +OAuth uses the term 'confidential' for applications that can store secrets. In Auth0, those are 'Regular Web Applications', which serve web pages from a backend app. Single Page Applications and Native Applications are considered 'public' applications, and are not affected by this change. + +Auth0 can authenticate calls to `/passwordless/start` when they include a `client_secret` as a parameter, or when the calls are made from the custom login page in Universal Login and forward the `state` parameter. + +## Does this affect me? + +If any of your applications currently call the `/passwordless/start` endpoint directly to begin passwordless authentication from a Web Application, and you are not sending the `client_secret` as a parameter, this deprecation does affect you. + +If you are implementing passwordless authentication through the Universal Login page and you changed the default way Auth0 libraries are initialized, it might also affect you too. + +You can verify whether you are affected by checking the [tenant logs](${manage_url}/#/logs), filtering by "Deprecation Notice" and check for logs saying "Enforce client authentication for passwordless connections". You can also perform this search directly with the following query: `type:depnote AND description:*passwordless*`. Note that this specific query will only work for public cloud tenants, as private cloud logs cannot be searched on the description field. + +## What do I need to do? + +If you are calling the `/passwordless/start` endpoint without proper application authentication you should: + +- Follow the instructions described below to adjust the code to properly call `/passwordless/start`. +- Check your [tenant logs](${manage_url}/#/logs) to verify the change was made correctly and no deprecation logs are being generated for "Enforce client authentication for passwordless connections". +- In the **Migrations** section of Advanced Tenant Settings, turn on the **Enforce client authentication for passwordless connections** toggle. + +## How I need to change my code? + +There are a few use cases that might be affected, but for each, the migration path is fairly straightforward: + +### 1. API calls from your backend + +For any calls from your backend to the `/passwordless/start` endpoint, your call must include the client secret as a parameter. + +If making a POST request directly to `/passwordless/start`, include the `client_secret` as part of the payload: + +```json +POST https://YOUR_AUTH0_DOMAIN/passwordless/start +Content-Type: application/json +{ + "client_id": "YOUR_CLIENT_ID", + "client_secret": "YOUR_CLIENT_SECRET", + "connection": "email|sms", + "email": "EMAIL", //set for connection=email + "phone_number": "PHONE_NUMBER", //set for connection=sms + "send": "link|code", + "authParams": { + "scope": "openid", + "state": "YOUR_STATE" + } +} +``` + +If you are using an SDK, add the parameter to the method that initiates the passwordless flow. This is different for each SDK, and not all SDKs have been updated yet. If you are using an SDK that was not updated, you can make the HTTP call directly until that work is completed. + +### 2. Using Auth0.js or Lock.js in the Universal Login page + +If the Universal Login page is used for Passwordless Authentication for a Web Application, it will be making calls to the `/passwordless/start` endpoint, by either using Lock.js or Auth0.js. + +Given you can't store a client secret in a web page, the way to authenticate the call is by forwarding the `state` parameter that is received in the Universal Login page to the `/passwordless/start` endpoint. That parameter is stored in the `config.internalOptions` field in the custom login page. + +The default templates for customizing the login page use it in the following way when initializing Lock.js or auth0.js: + +```js +var lock = new Auth0Lock(config.clientID, config.auth0Domain, { + auth: { + // .. other fields set + params: config.internalOptions + }) +``` + +```js +var params = Object.assign({ + // .. some fields set +}, config.internalOptions); + +var webAuth = new auth0.WebAuth(params); +``` + +Please check in your custom page implementation to verify that you have not removed that code. + +### 3. Calling /passwordless/start from the client in a web application + +We found that some customers are calling the `/passwordless/start` endpoint from a page using JavaScript (for example, they might be using auth0.js on the page) from Regular Web Applications. This will not be possible, as you cannot specify a client secret in a call made using JavaScript. If this is currently the case for your application, you will need to change your applications so that `/passwordless/start` is called from the backend of your web application, rather than from the frontend. + +## Rate Limits + +A consequence of adding client authentication to `/passwordless/start` is that Auth0 can trust the headers sent with the request. Auth0 takes into account the `auth0-forwarded-for` header when enforcing rate limits. If you set that header with the end user's IP address when making the call from the server, Auth0 will rate limit the endpoint based on the end user's IP, instead of the server IP. + +You can read more about this in the [passwordless endpoints](/connections/passwordless/relevant-api-endpoints#rate-limiting-in-passwordless-endpoints) documentation. diff --git a/articles/migrations/guides/unpaginated-requests.md b/articles/migrations/guides/unpaginated-requests.md new file mode 100644 index 0000000000..6ee5a263c8 --- /dev/null +++ b/articles/migrations/guides/unpaginated-requests.md @@ -0,0 +1,67 @@ +--- +title: Migrate to Management API v2 Endpoint Paginated Queries +description: Query requests to specific Management API endpoints will return up to 50 results instead of all available items. You must now specify `page` and `per_page` parameters. +topics: + - pagination + - migrations +contentType: + - concept + - how-to +useCase: + - paginated-results +--- +# Migrate to Management API v2 Endpoint Paginated Queries + +After **26 January 2021**, requests to Management API v2 endpoints will return a maximum of 50 items for tenants in the Public Cloud. To retrieve more items, you must include the `page` and `per_page` parameters. Beginning on **21 July 2020**, Auth0 will display tenant logs and a migration toggle to help you prepare for this change. + +Affected tenants are those that meet the following criteria: + +* Auth0 Public Cloud (currently) +* Created **before 21 July 2020** +* Actively making calls to the affected endpoints without passing the `per_page` parameter for queries that can return more than 1 result. + +The following tenants are not affected: + +* Created **on or after 21 July 2020** +* Not using any of the affected endpoints +* Using the affected endpoints and passing the `per_page` parameter, or making queries that will always return a single result. + +## Endpoints affected + +Calls to the following Management API v2 endpoints are affected: + +* [`GET /api/v2/clients`](/api/management/v2#!/Clients/get_clients) +* [`GET /api/v2/client_grants`](/api/management/v2#!/Clients/client_grants) +* [`GET /api/v2/grants`](/api/management/v2#!/Clients/grants) +* [`GET /api/v2/connections`](/api/management/v2#!/Clients/connections) +* [`GET /api/v2/device-credentials`](/api/management/v2#!/Clients/device_credentials) (when `type` query parameter is provided) +* [`GET /api/v2/resource-servers`](/api/management/v2#!/Clients/resource_servers) +* [`GET /api/v2/rules`](/api/management/v2#!/Clients/rules) + +Deprecation notices will be recorded in your tenant logs for all requests without pagination options that are currently returning more than 1 item, once per hour, for each different client and endpoint. + +## Actions + +1. Replace all calls to the affected endpoints by providing the `page` and `per_page` parameters. + +| Parameter | Type | Description | +| -- | -- | -- | +| `page` | Integer | Page index of the results to return. First page is 0. If `page` is not specified, it will default to 0. | +| `per_page` | Integer | Number of results per page. Paging is disabled if the parameter is not sent. `per_page` has a maximum value of 100. | + +2. Confirm that you are no longer seeing deprecation notices in your tenant logs. Check if a request returned more than 50 items. Look at the `details.size_exceeded` field and check if it’s `true`. + - Use the following log query to return all calls without pagination options with more than 1 result: `type:depnote AND description:*Unpaginated*` + - Use the following log query to return all calls without pagination options with more than 50 results: `type:depnote AND description:*Unpaginated* AND details.size_exceeded:true` + + To identify the application making request, logs will include the `client_id` used to make the request. You can also find the endpoint being used in the logs `details.path` field. + +3. Disable Management API unpaginated requests for your tenant. Go to [**Dashboard > Tenant Settings > Advanced > Migration**](${manage_url}/#/tenant/advanced). This will simulate the expected behavior after the migration window closes, causing calls to affected endpoints to return up to 50 results. + + You will be able to re-enable unpaginated requests any time before that date. + +### Update extensions + +You may need to update from previous versions of [Auth0 Extensions](/extensions) and custom extensions may need to be updated to their latest versions to make sure they are only performing paginated queries. + +1. Check your tenant logs for deprecation notices for clients with an ID matching an extension URL. It means you will need to update that extension. +2. Go to [**Dashboard > Extensions**](${manage_url}/#/extensions), select **Installed Extensions**, and click on the extension's **Update** link if present. diff --git a/articles/migrations/guides/yahoo-userinfo-updates.md b/articles/migrations/guides/yahoo-userinfo-updates.md new file mode 100644 index 0000000000..33bd6ea68a --- /dev/null +++ b/articles/migrations/guides/yahoo-userinfo-updates.md @@ -0,0 +1,58 @@ +--- +title: Changes to Yahoo Profile +description: The latest version of the Yahoo API changes the structure of the user profile +toc: true +contentType: + - how-to +useCase: + - add-login + - migrate +--- + +# Changes to Yahoo Profile + +Yahoo changed the API that applications need to use to retrieve the User Profile from their [Social Directory API](https://developer.yahoo.com/oauth/social-directory-eol/) to a Yahoo `/userinfo` endpoint. This change implies that the structure of the user profile for Yahoo users in Auth0 will change. + +Auth0 previously loaded all the profile data that Yahoo returned, and added these additional fields that were mapped from the Yahoo profile: + +|Auth0 field|Yahoo field| +|---|---| +|user_id|guid| +|sub|guid| +|name|nickname| +|time_zone|timeZone| +|uri|uri| +|url|profileUrl| +|isConnected|isConnected| +|email_verified|verified| +|email|email| + +Yahoo stopped returning `url`, `profileUrl`, `isConnected`, and a set of other fields listed in [Yahoo’s documentation](https://developer.yahoo.com/oauth/social-directory-eol/) (see ‘List Of Attributes Deprecated in Social Directory Profile Api’). Those other fields will also not be part of the profile. + +The Yahoo `/userinfo` endpoint will return different fields depending on the API Permissions you configure in the [Yahoo Application](https://developer.yahoo.com/apps/) definition. + +Yahoo lets you grant one of four permissions in the **Profile (Social Directory)** permissions section: + +- Read Public Basic +- Read Public Extended +- Read Write Public +- Read Write Public and Private + +When configuring the Yahoo Connection in your Auth0 Dashboard, you need to select the attribute that corresponds to the permissions you granted in your Yahoo setup. If you choose an attribute that does not match what you specified on Yahoo, the login transaction will fail. + +|Yahoo Connection Attributes|Profile Fields| +|--|--| +|Basic Profile| sub, name, given_name, family_name, locale| +|Basic Profile Write| sub, name, given_name, family_name, locale| +|Extended Profile |sub, name, given_name, family_name, locale, email, email_verified, birthdate, profile_images, picture, preferred_username, phone_number, nickname | +|Extended Write | sub, name, given_name, family_name, locale, email, email_verified, birthdate, profile_images, picture, preferred_username, phone_number, nickname | + +If you do not select any permissions in the Auth0 connection settings, Auth0 will by default ask for the `openid` scope, which will return the profile fields that correspond to whatever API Permission you specified in the Yahoo Application. For example, if your Yahoo application is configured with `Read Public Extended`, it will return the `sub, name, given_name, family_name, locale, email, email_verified, birthdate, profile_images, picture, preferred_username, phone_number and nickname` fields. + +**Do I need to take any action?** + +Auth0 will default to send the `openid` scope when authenticating with Yahoo. + +If you are using the Yahoo connection to authenticate users and get their basic information, your application will continue to work without changes. + +If your application is accessing fields in the user profile that are no longer available, then you will need to make sure you enable the right Connection Attribute in the Auth0 dashboard and adjust your application code to use the proper field names. diff --git a/articles/migrations/index.md b/articles/migrations/index.md deleted file mode 100644 index 38a9c7b9fb..0000000000 --- a/articles/migrations/index.md +++ /dev/null @@ -1,139 +0,0 @@ ---- -toc: true -title: Auth0 Migrations -description: List of all the changes made on Auth0 platform that might affect customers ---- - -# Migrations - -Occasionally, Auth0 engineers must make breaking changes to the Auth0 platform, primarily for security reasons. If a vulnerability or other problem in the platform is not up to our high standards of security, we work to correct the issue. - -Sometimes a correction will cause a breaking change to customer's applications. Depending on the severity of the issue, we may have to make the change immediately. - -For changes that do not require immediate changes, we often allow a grace period to allow you time to update your applications. - -## Migration process - -The migration process is outlined below: - -1. We update the platform and add a new migration option for existing customers, allowing a grace period for opt-in. New customers are always automatically enrolled in all migrations. -2. After a certain period, the migration is enabled for all customers. This grace period varies based on the severity and impact of the breaking change, typically 30 or 90 days. - -During the grace period, customers are informed via dashboard notifications and emails to tenant administrators. You will continue to receive emails until the migration has been enabled on each tenant you administer. - -If you need help with the migration, create a ticket in our [Support Center](${env.DOMAIN_URL_SUPPORT}). - -## Active migrations - -Current migrations are listed below, newest first. - -For migrations that have already been enabled for all customers, see [Past Migrations](/migrations/past-migrations). - -### Node.js v8 for Webtask Runtime - -| Severity | Grace Period Start | Mandatory Opt-In| -| --- | --- | --- | -| High | 2018-04-17 | 2018-04-30 | - -The Webtask engine powering Auth0 extensibility points currently utilizes Node 4. Beginning **30 April 2018**, [Node.js v4 will no longer be under long-term support (LTS)](https://github.com/nodejs/Release#release-schedule). This means that critical security fixes will no longer be back-ported to this version. As such, Auth0 will be migrating the Webtask runtime from Node.js v4 to Node.js v8. - -On **17 April 2018** we will make the Node 8 runtime available for extensibility to all public cloud customers. You will be provided a migration switch that allows you to control your environment's migration to the new runtime environment. - -For more information on this migration and the steps you should follow to upgrade your implementation, see [Migration Guide: Extensibility and Node.js v8](/migrations/guides/extensibility-node8). - -### Introducing Lock v11 and Auth0.js v9 - -| Severity | Grace Period Start | Mandatory Opt-In| -| --- | --- | --- | -| Medium | 2017-12-21 | 2018-07-16 | - -We are continually improving the security of our service. As part of this, we are deprecating some endpoints (/usernamepassword/login and /ssodata) used by Lock.js v8, v9, and v10 and and auth0.js, v6, v7, and v8. - -Previously, these endpoints were planned to be removed from service on April 1, 2018. However, the Removal of Service date for those endpoints has been extended to **July 16, 2018**. - -Customers are still encouraged to migrate applications to the latest version of Lock 11 and Auth0.js 9 **as soon as possible** in order to ensure that applications continue to function properly. - -Please refer to our [Legacy Lock API Deprecation Guide](/migrations/guides/legacy-lock-api-deprecation) for instructions on upgrading your Auth0 implementation prior to **July 16, 2018**. - -#### Am I affected by the change? - -If you are currently implementing login in your application with Lock v8, v9, or v10, or Auth0.js v6, v7, or v8, you will be affected by these changes. - -We **recommend** that applications using [universal login](/hosted-pages/login) update. - -However, those who are using Lock or Auth0.js embedded within their applications are **required** to update, and applications which still use deprecated versions will cease to work after the removal of service date. - -Libraries and SDKs not explicitly named here are not affected by this migration. - -If you have any questions, create a ticket in our [Support Center](${env.DOMAIN_URL_SUPPORT}). - -### Deprecating the usage of ID Tokens on the Auth0 Management API - -| Severity | Grace Period Start | Mandatory Opt-In| -| --- | --- | --- | -| Medium | 2018-03-31 | - | - -For some use cases you can use [ID Tokens](/tokens/id-token) as credentials in order to call the [Management API](/api/management/v2). This functionality is being deprecated. - -This is used by the [Users](/api/management/v2#!/Users/get_users_by_id) and [Device Credentials](/api/management/v2#!/Device_Credentials/get_device_credentials) endpoints. - -List of affected endpoints: - -| **Endpoint** | **Use Case** | -|-|-| -| [GET /api/v2/users/{id}](/api/management/v2#!/Users/get_users_by_id) | Retrieve a user's information | -| [GET /api/v2/users/{id}/enrollments](/api/management/v2#!/Users/get_enrollments) | Retrieve all [Guardian](/multifactor-authentication/guardian) MFA enrollments for a user | -| [PATCH /api/v2/users/{id}](/api/management/v2#!/Users/patch_users_by_id) | Update a user's information | -| [DELETE /api/v2/users/{id}/multifactor/{provider}](/api/management/v2#!/Users/delete_multifactor_by_provider) | Delete the [multifactor](/multifactor-authentication) provider settings for a user | -| [POST /api/v2/device-credentials](/api/management/v2#!/Device_Credentials/post_device_credentials) | Create a public key for a device | -| [DELETE /api/v2/device-credentials/{id}](/api/management/v2#!/Device_Credentials/delete_device_credentials_by_id) | Delete a device credential | -| [POST/api/v2/users/{id}/identities](/api/management/v2#!/Users/post_identities) | [Link user accounts](/link-accounts) from various identity providers | -| [DELETE /api/v2/users/{id}/identities/{provider}/{user_id}](/api/management/v2#!/Users/delete_provider_by_user_id) | [Unlink user accounts](/link-accounts#unlinking-accounts) | - -These endpoints can now accept regular [Access Tokens](/access-token). - -The functionality is available and affected users are encouraged to migrate. However the ability to use ID Tokens will not be disabled in the foreseeable future so the mandatory opt-in date for this migration remains open. When this changes, customers will be notified beforehand. - -For more information on this migration and the steps you should follow to upgrade your implementation, see the [Migration Guide: Management API and ID Tokens](/migrations/guides/calling-api-with-idtokens). - -#### Am I affected by the change? - -If you are currently using [ID Tokens](/tokens/id-token) to access any part of the Management API, your application will need to be updated. - -If you have any questions, create a ticket in our [Support Center](${env.DOMAIN_URL_SUPPORT}). - -## Upcoming migrations - -Based on customer feedback, we have adjusted our plans and will continue to maintain and support the below listed endpoints and features. - -We will publish guidance for each of the below scenarios on how to transition your applications to standards-based protocols. If we need to make security enhancements to any of these legacy endpoints which would require more urgency, we will promptly announce timeframes and guidelines for any required changes. - -### Resource Owner support for oauth/token endpoint - -Support was introduced for [Resource Owner Password](/api/authentication#resource-owner-password) to the [/oauth/token](/api/authentication#authorization-code) endpoint earlier this year. - -#### Am I affected by the change? - -If you are currently implementing the [/oauth/ro](/api/authentication#resource-owner) endpoint your application can be updated to use the [/oauth/token](/api/authentication#authorization-code) endpoint. For details on how to make this transition, see the [Migration Guide for Resource Owner Password Credentials Exchange](/migrations/guides/migration-oauthro-oauthtoken). - -If you have any questions, create a ticket in our [Support Center](${env.DOMAIN_URL_SUPPORT}). - -### API authorization with third-party vendor APIs - -The mechanism by which you get tokens for third-party / vendor APIs (for example AWS, Firebase, and others) is being changed. It will work the same as any custom API, providing better consistency. This new architecture will be available in 2018 and once it becomes available, the [/delegation](/api/authentication#delegation) endpoint will be officially deprecated. - -#### Am I affected by the change? - -If you are currently using [/delegation](/api/authentication#delegation) to provide third party authorization, your application will need to be updated once migration guides are available. - -If you have any questions, create a ticket in our [Support Center](${env.DOMAIN_URL_SUPPORT}). - -### Improved OpenID Connect interoperability in Auth0 - -The [userinfo](/api/authentication#get-user-info) endpoint is being updated to return [OIDC conformant user profile attributes](/user-profile/normalized/oidc). The most notable change is that `user_id` becomes `sub`. This will deprecate the [legacy Auth0 user profile](/user-profile/normalized/auth0) (in [userinfo](/api/authentication#get-user-info) and in [id tokens](/tokens/id-token)). - -#### Am I affected by the change? - -If you are currently using the [/userinfo](/api/authentication#get-user-info) endpoint or receiving ID Tokens, you are affected by this change and need to update your implementation so that it expects normalized OIDC conformant user profile attributes once migration guides are available. - -If you have any questions, create a ticket in our [Support Center](${env.DOMAIN_URL_SUPPORT}). diff --git a/articles/migrations/past-migrations.md b/articles/migrations/past-migrations.md index 26e091c811..5956128735 100644 --- a/articles/migrations/past-migrations.md +++ b/articles/migrations/past-migrations.md @@ -1,11 +1,39 @@ --- toc: true description: List of Auth0 migrations that have already been enabled for all customers +topics: + - migrations +contentType: + - reference +useCase: + - migrate --- # Past Migrations These are migrations that have already been enabled for all customers. +## Introducing Lock v11 and Auth0.js v9 + +| Severity | Grace Period Start | Mandatory Opt-In| +| --- | --- | --- | +| Medium | 2017-12-21 | 2018-08-06 | + +We are continually improving the security of our service. As part of this effort, we have deprecated the Legacy Lock API, which consists of the /usernamepassword/login and /ssodata endpoints. These endpoints are used by Lock.js v8, v9, and v10 and Auth0.js, v6, v7, and v8, and can also be called directly from applications. + +As of August 6, 2018, Auth0 has permanently disabled the Legacy Lock API. This removal of service fully mitigates the CSRF vulnerability disclosed in April 2018. This also ends the soft removal grace period that was [first announced on July 16, 2018](https://community.auth0.com/t/auth0-legacy-lock-api-disabled-grace-period-available/12949), meaning the Legacy Lock API can no longer be re-enabled. + +If your Legacy Lock API migration has not yet been completed, your users may experience an outage, failed logins, or other adverse effects. You will need to complete your migration in order to restore normal functionality. See [Check Deprecation Errors](/troubleshoot/guides/check-deprecation-errors) to identify the source(s) of any errors in your tenant logs related to deprecations. + +### Am I affected by the change? + +If you are currently implementing login in your application with Lock v8, v9, or v10, or Auth0.js v6, v7, or v8, you are affected by these changes. Additionally, you are affected if your application calls the /usernamepassword/login or /ssodata endpoints directly via the API. + +We **recommend** that applications using [Universal Login](/universal-login) update the library versions they use inside of the login page. + +However, those who are using Lock or Auth0.js embedded within their applications, or are calling the affected API endpoints directly, are **required** to update, and applications which still use deprecated endpoints will cease to function properly after the removal of service date. + +Libraries and SDKs not explicitly named here are not affected by this migration. + ## New IP Addresses for Whitelisting in Australia | Severity | Grace Period Start | Mandatory Opt-In| @@ -52,7 +80,7 @@ The existing Auth0 CDN service is one of our older services. It was been built a ### Am I using the CDN? -If you use Lock (hosted by our CDN) in Europe or Australia, yes. +If you use Lock (hosted by our CDN) in Europe or Australia, yes. ### Do I need to do something? @@ -103,11 +131,11 @@ Even if you are not using Lock, the vulnerable reset flow can be accessed direct | --- | --- | --- | | Medium | 2017-01-03 | 2017-03-01 | -As part of Auth0's efforts to improve security and standards compliance, we will stop supporting account linking as part of the authorization callback (that is, accepting an [Access Token](/tokens/access-token) as part of the [authorize](/api/authentication#authorization-code-grant) call as stated [in the account linking section](/api/authentication?http#account-linking). +As part of Auth0's efforts to improve security and standards compliance, we will stop supporting account linking as part of the authorization callback (that is, accepting an Access Token as part of the [authorize](/api/authentication#authorization-code-grant) call as stated [in the account linking section](/api/authentication?http#account-linking). ### Am I affected by the change? -If you received an email notification about it, then you are impacted by this change. As you work to update your applications to [use the Management API to link accounts](/api/management/v2#!/Users/post_identities), you can check if you are still impacted, by checking your tenant logs for warnings indicating _"Account linking via /authorize is being deprecated. Please refer to https://auth0.com/docs/link-accounts for supported ways to link an account."_. These entries will be logged if you are sending an Access Token in your [authorize](/api/authentication#authorization-code-grant) calls. +If you received an email notification about it, then you are impacted by this change. As you work to update your applications to [use the Management API to link accounts](/api/management/v2#!/Users/post_identities), you can check if you are still impacted, by checking your tenant logs for warnings indicating _"Account linking via /authorize is being deprecated. See [User Account Linking](/users/concepts/overview-user-account-linking) for supported ways to link an account."_. These entries will be logged if you are sending an Access Token in your [authorize](/api/authentication#authorization-code-grant) calls. If you need help with the migration, create a ticket in our [Support Center](${env.DOMAIN_URL_SUPPORT}) @@ -117,7 +145,7 @@ If you need help with the migration, create a ticket in our [Support Center](${e | --- | --- | --- | | Medium | 2017-02-23 | 2017-05-31 | -As part of Auth0's efforts to improve security, we recently added the ability to execute rules during the OAuth 2.0 Resource Owner Password Grant exchange (the password exchange) and the Refresh Token exchange. +As part of Auth0's efforts to improve security, we recently added the ability to execute rules during the OAuth 2.0 Resource Owner Password Grant exchange (the password exchange) and the Refresh Token exchange. You are using this feature if you are calling the [/oauth/token](/api/authentication#authorization-code) endpoint of our Authentication API with `grant_type = "password"` , `grant_type = "http://auth0.com/oauth/grant-type/password-realm"`, or `grant_type = "refresh_token"`. @@ -127,7 +155,7 @@ You could be impacted if you are currently using these exchanges and have Rules You can add logic to your rules to alter their behavior for these exchanges by checking the `context.protocol` property: - `oauth2-password` indicates the password (and password-realm) exchange -- `oauth2-refresh-token` indicates the refresh token exchange +- `oauth2-refresh-token` indicates the Refresh Token exchange If you would like to enable the new behavior on this tenant for testing before the mandatory opt-in date, login to [Dashboard](${manage_url}) and enable the __Run Rules on Password and Refresh Token Exchanges__ toggle in [Tenant Settings > Advanced](${manage_url}/#/tenant/advanced). @@ -151,13 +179,13 @@ For more information, see: [Emails in Auth0](/email). | --- | --- | | Low | 2016-06-01 | -When calling the [TokenInfo](/api/authentication/reference#get-token-info) endpoint, the URL of the API call (for example `https://${account.namespace}/`) must match the value of the `iss` attribute of the `id_token` being validated. +When calling the [TokenInfo](/api/authentication/reference#get-token-info) endpoint, the URL of the API call (for example `https://${account.namespace}/`) must match the value of the `iss` attribute of the ID Token being validated. If these values do not match, the response will be `HTTP 400 - Bad Request`. ### Am I affected by the change? -If you are calling the [tokeninfo](/api/authentication#get-token-info) endpoint directly, make sure that the value of the `iss` attribute of the `id_token` being validated matches your Auth0 tenant namespace: `https://${account.namespace}/`. +If you are calling the [tokeninfo](/api/authentication#get-token-info) endpoint directly, make sure that the value of the `iss` attribute of the ID Token being validated matches your Auth0 tenant namespace: `https://${account.namespace}/`. ::: note You can use [jwt.io](https://jwt.io/) to decode the token to confirm the `iss` attribute value. @@ -169,9 +197,9 @@ You can use [jwt.io](https://jwt.io/) to decode the token to confirm the `iss` a | --- | --- | --- | --- | | Medium | 2016-07-11 | 2016-08-18 | -The format of the user profile JSON object (id_token) that is returned by Auth0 Authentication APIs has been changed to remove the Identity Provider's Access Token, which had been included in the user profile `identities` array. +The format of the user profile JSON object (ID Token) that is returned by Auth0 Authentication APIs has been changed to remove the Identity Provider's Access Token, which had been included in the user profile `identities` array. -Now, to obtain a user's IdP Access Token, you will need to make an HTTP GET call to the `/api/v2/users/{user-id}` endpoint containing an API token generated with `read:user_idp_tokens` scope. +Now, to obtain a user's IdP Access Token, you will need to make an HTTP GET call to the `/api/v2/users/{user-id}` endpoint containing an API token generated with `read:user_idp_tokens` scope. ::: note You will still have access to the Identity Provider Access Token in the `user` argument in Auth0 [rules](/rules). @@ -181,7 +209,7 @@ You will still have access to the Identity Provider Access Token in the `user` a You are affected by the change only if you are using the Identity Provider Access Token (`identities[0].access_token` in the user profile) outside of rules to call other services from the Identity Provider (such as Facebook Graph API, Google APIs, and so on). -For more information on how to obtain an Access Token, see: [Call an Identity Provider API](/what-to-do-once-the-user-is-logged-in/calling-an-external-idp-api) and [Identity Provider Access Token](/tokens/idp). +For more information on how to obtain an Access Token, see: [Call an Identity Provider API](/what-to-do-once-the-user-is-logged-in/calling-an-external-idp-api) and [Identity Provider Access Tokens](/tokens/overview-idp-access-tokens). ::: note If your tenant was created after the change, this update will be applied automatically. diff --git a/articles/monitoring/_includes/_monitor-private-cloud.md b/articles/monitoring/_includes/_monitor-private-cloud.md new file mode 100644 index 0000000000..a0dc01777f --- /dev/null +++ b/articles/monitoring/_includes/_monitor-private-cloud.md @@ -0,0 +1,3 @@ +::: panel Monitor a dedicated deployment +See the [Private Cloud](/private-cloud) documentation for information on [monitoring](/appliance/monitoring) a dedicated deployment. +::: \ No newline at end of file diff --git a/articles/monitoring/guides/check-external-services.md b/articles/monitoring/guides/check-external-services.md new file mode 100644 index 0000000000..3dfbf87d5f --- /dev/null +++ b/articles/monitoring/guides/check-external-services.md @@ -0,0 +1,46 @@ +--- +title: Check External Services Status +description: Learn how to check the status of services external to Auth0. +topics: + - monitoring +contentType: + - how-to +useCase: + - analyze-auth0-analytics + - analyze-logs + - integrate-analytics +--- + +# Check External Services Status + +You may want to monitor any remote identity providers you use with your Auth0 connections to quickly isolate the source of the problem. + +If you see potential issues with your Auth0 service, but [Auth0 Status](https://status.auth0.com) doesn't indicate any problems, check the status of any external services that you use with Auth0, such as: + +* [Amazon Web Services](https://status.aws.amazon.com/) +* [Azure Active Directory](https://azure.microsoft.com/en-us/status/) +* [Citrix](https://status.cloud.com/) +* [Facebook](https://developers.facebook.com/status/) +* [GitHub](https://status.github.com/) +* [Google Cloud](https://status.cloud.google.com/) +* [Google's G Suite](https://www.google.com/appsstatus#hl=en&v=status) +* [Heroku](https://status.heroku.com/) +* [IBM](https://console.bluemix.net/status) +* [Mandrill](http://status.mandrillapp.com/) +* [Microsoft Azure](https://azure.microsoft.com/en-gb/status/) +* [SAP](https://www.sap.com/about/cloud-trust-center/cloud-service-status.html) +* [SendGrid](http://status.sendgrid.com/) +* [SFDC](https://status.salesforce.com/) +* [Slack](https://status.slack.com/) +* [Twilio](https://status.twilio.com/) +* [VM Ware](https://status.vmware-services.io/) + +::: note +Your customers may have some of the same concerns, so you may want to document any monitoring pages or endpoints that they can view to help them troubleshoot and narrow down the location of an issue. +::: + +## Keep reading + +* [Check Auth0 Status](/monitoring/guides/check-status) +* [Monitor Auth0 Using System Center Operations Manager](/monitoring/guides/monitor-using-SCOM) +* [Monitor Applications](/monitoring/guides/monitor-applications) diff --git a/articles/monitoring/guides/check-status.md b/articles/monitoring/guides/check-status.md new file mode 100644 index 0000000000..98f4181a57 --- /dev/null +++ b/articles/monitoring/guides/check-status.md @@ -0,0 +1,44 @@ +--- +title: Check Auth0 Status +description: Learn how to check Auth0 public cloud service availability, incident reports, and historical uptime reports. +topics: + - monitoring +contentType: + - how-to +useCase: + - analyze-auth0-analytics + - analyze-logs + - integrate-analytics +--- + +# Check Auth0 Status + +Auth0 makes every effort to minimize outages, but if there is any disruption to service, it will appear on the [Auth0 Status](https://status.auth0.com) page. To support requirements for root cause analysis documentation after a disruption, Auth0 conducts internal analysis and publishes the results of the disruption notice. If there's an outage listed on the status page, you do not need to file a ticket. Auth0 is already working on the issue. + +## Check status + +Go to [Auth0 Status](https://status.auth0.com) to check the service availability of the cloud version of Auth0. + +You can see the status of a region or expand a region and see the status of individual services supporting functionality such as the authentication API or execution of custom code (used within custom DB connections and rules). + +## Subscribe to status updates + +On the [Auth0 Status](https://status.auth0.com) page, choose your region and environment and click **Subscribe to Updates** to get updates. You can choose from two options to view status: + +* Follow [@auth0status](https://twitter.com/auth0status) on Twitter to get the latest status updates. + +* Subscribe to the Auth0 Atom feed to get status updates that affect your tenant. Using an RSS feed aggregator of your choice (such as https://feeder.co/reader), use the following RSS feed URL to view the status of your tenant. Replace `YOUR-TENANT` with your tenant name. + + `status.auth0.com/feed?domain={YOUR-TENANT}.auth0.com` + +## Historical uptime reports + +Current and historical Auth0 uptime reports are available at [Auth0 Uptime](http://uptime.auth0.com). + +## Keep reading + +* [Check External Services Status](/monitoring/guides/check-external-services) +* [Monitor Auth0 Using System Center Operations Manager](/monitoring/guides/monitor-using-SCOM) +* [Monitor Applications](/monitoring/guides/monitor-applications) +* [Troubleshooting](/troubleshoot) +* [Support Options](/support) diff --git a/articles/monitoring/guides/monitor-applications.md b/articles/monitoring/guides/monitor-applications.md new file mode 100644 index 0000000000..f84e4eb665 --- /dev/null +++ b/articles/monitoring/guides/monitor-applications.md @@ -0,0 +1,32 @@ +--- +title: Monitor Applications +description: Learn how to monitor your own applications and perform end-to-end testing using your own tests. +topics: + - monitoring +contentType: + - how-to +useCase: + - analyze-auth0-analytics + - analyze-logs + - integrate-analytics + - synthetic-authentication + - synthetic-transactions +--- +# Monitor Applications + +If you would like to monitor your own [application](/applications) or conduct end-to-end testing, you’ll need to set up your own tests. + +If you've extended Auth0 through [rules](/rules) or a [custom database connection](/connections/database/custom-db), you can build a synthetic transaction that exercises these capabilities using the [Resource Owner Password Grant](/api-auth/tutorials/password-grant). One way of doing this is to [Monitor Auth0 Using SCOM](/monitoring/guides/monitor-using-SCOM). + +Auth0 recommends using an authentication flow that doesn't require a user interface such as the **Resource Owner Password Grant**. That way, you can use a monitoring tool that doesn't have to mimick the actions of a user. Many monitoring services exist with this capability including: + +* [New Relic](http://newrelic.com) +* [Pingdom](http://pingdom.com) + +Use one of these services to execute synthetic authentication requests. + +## Keep reading + +* [Check Auth0 Status](/monitoring/guides/check-status) +* [Check External Services Status](/monitoring/guides/check-external-services) +* [Monitor Auth0 Using System Center Operations Manager](/monitoring/guides/monitor-using-SCOM) diff --git a/articles/monitoring/guides/monitor-using-SCOM.md b/articles/monitoring/guides/monitor-using-SCOM.md new file mode 100644 index 0000000000..97918bb43f --- /dev/null +++ b/articles/monitoring/guides/monitor-using-SCOM.md @@ -0,0 +1,80 @@ +--- +title: Monitor Auth0 Using System Center Operations Manager +description: Learn how to monitor Auth0 as a standard web application using System Center Operations Manager (SCOM) or any tool that supports synthetic transactions. +toc: true +topics: + - monitoring +contentType: + - how-to +useCase: + - analyze-auth0-analytics + - analyze-logs + - integrate-analytics + - synthetic-authentication + - synthetic-transactions +--- +# Monitor Auth0 Using System Center Operations Manager + +You can monitor Auth0 as a standard web application using System Center Operations Manager (SCOM) or any tool that supports synthetic transactions. + +We recommend monitoring a synthetic login transaction that includes the extensions your applications rely on (such as rules that execute custom code for integration with your company's other services). + +## Set up SCOM + +1. Add a new SCOM instance using the **Add Monitoring Wizard**: + + | **Field** | **Description** | + | ---| ---| + | **Name** | Description name for the SCOM instance. | + | **Description** | Description of what this SCOM instance monitors. | + | **Select destination management pack** | Default Management Pack | + + When finished, click **Next** to continue. + + ![ss-2014-11-21T15-44-34.png](/media/articles/monitoring/ss-2014-11-21T15-44-34.png) + +2. Click **Add** to enter the URLs you want SCOM to monitor. When finished, click **Next** to continue. + + ![ss-2014-11-21T16-31-15.png](/media/articles/monitoring/ss-2014-11-21T16-31-15.png) + +3. Click **Add** to set up a location from which you want to monitor. + + In the pop-up dialog, search for **Internal location - Agent**. Select the appropriate address, and click **Add**. Then click **Ok** to finish selecting the location. When finished, click **Next** to continue. + + ![ss-2014-11-21T16-32-25.png](/media/articles/monitoring/ss-2014-11-21T16-32-25.png) + +4. Set the frequency with which SCOM collects data from each endpoint: + + | **Data** | **Frequency** | + | --- | --- | + | **Test frequency** | 60 seconds | + | **Performance data collection interval** | 60 seconds | + | **Test time-out** | 30 seconds | + | **HTTP status code** | Greater than or equals 400 | + + When finished, click **Next** to continue. + + ![ss-2014-11-21T16-33-51.png](/media/articles/monitoring/ss-2014-11-21T16-33-51.png) + +## Run SCOM tests + +1. Click **Run Test** to test each endpoint and ensure that the connection settings provided are correct. + + ![ss-2014-11-21T16-34-25.png](/media/articles/monitoring/ss-2014-11-21T16-34-25.png) + +2. Once you have finished configuring your SCOM instance, you can view activity through the **Monitoring** tab: + + ![ss-2014-11-25T17-20-47.png](/media/articles/monitoring/ss-2014-11-25T17-20-47.png) + +## Review test results + +Click **Web Application Status** to bring up the information SCOM has gathered. + +![ss-2014-11-25T17-22-10.png](/media/articles/monitoring/ss-2014-11-25T17-22-10.png) + +## Keep reading + +* [Monitoring the AD/LDAP Connector with System Center Operations Manager](/connector/scom-monitoring) +* [Check Auth0 Status](/monitoring/guides/check-status) +* [Check External Services Status](/monitoring/guides/check-external-services) +* [Monitor Applications](/monitoring/guides/monitor-applications) diff --git a/articles/monitoring/guides/send-events-to-keenio.md b/articles/monitoring/guides/send-events-to-keenio.md new file mode 100644 index 0000000000..22fc43d835 --- /dev/null +++ b/articles/monitoring/guides/send-events-to-keenio.md @@ -0,0 +1,77 @@ +--- +title: Send Logging Events to Keen +description: Learn how to send logging events to Keen from Auth0. +topics: + - monitoring + - keenio +contentType: + - how-to +useCase: + - analyze-auth0-analytics + - analyze-logs + - analyze-external-analytics + - integrate-analytics +--- +# Send Logging Events to Keen + +[Keen](http://keen.io) provides a service to capture and analyze events generated in your apps. In their words: + +> Analytics transforms data into answers – the kind of answers every company deserves. Unfortunately, a lot of companies a) can't find an analytics service that's right for their specific needs, and b) don't have the resources to develop their own analytics infrastructure. That's why we started Keen IO. Basically, we built it, so you don't have to. And we made it powerful, flexible, and scalable enough that you can use it however you need to – even if those needs change over time. + +In this example, you will learn how to connect Auth0 to Keen and stream `signup` events. To implement this with Auth0, you just need to create one [Rule](/rule) in your pipeline. + +![Keen IO Dataflow](/media/articles/tutorials/keen-io-dataflow.png) + +## Record a sign-up event in Keen + +Create a rule that will record user `signup` events for your apps in Keen. Please note: + +* In this example, we expect your Keen credentials to be stored in the [global `configuration` object](/rules/current#use-the-configuration-object). Be sure to add your **Write Key** here before running your rule. Doing this allows you to use your key in multiple rules and prevents you from having to store it directly in the code. + +* For this rule, we send contextual information, such as IP address (can be used to deduce location), user ID, and username. However, you can send any number of properties. + +* For this rule, we track the event type using a __persistent__ property called `user.signedUp`. When the property is set to `true`, we return immediately. Otherwise, we assume the event is a new `signup`, and if everything goes well, we set the property to `true`. The next time the user signs in, this rule will be skipped. + + +```js +function(user, context, callback) { + + var request = require('request'); + + if(user.signedUp){ + return callback(null, user, context); + } + + var writeKey = configuration.KEENIO_WRITE_KEY; + var projectId = configuration.KEENIO_PROJECT_ID; + var eventCollection = 'signups'; + + var keenEvent = { + userId: user.user_id, + name: user.name, + ip: context.request.ip //Potentially any other properties in the user profile/context + }; + + request.post({ + method: 'POST', + url: 'https://api.keen.io/3.0/projects/' + projectId + '/events/' + eventCollection, + headers: { + "Authorization: " + writeKey, + 'Content-type': 'application/json' + }, + body: JSON.stringify(keenEvent), + }, + function (e, r, body) { + if( e ) return callback(e,user,context); + //We assume everything went well + user.persistent.signedUp = true; + return callback(null, user, context); + }); +} +``` + +## Keep reading +Check out our [repository of Auth0 Rules](https://github.com/auth0/rules) for more great examples: + +* Rules for access control +* Integration with other services: [MixPanel](http://mixpanel.com), [Firebase](http://firebase.com), [TowerData](https://www.towerdata.com/email-intelligence/email-enhancement), [Parse](http://parse.com), [Splunk](https://www.splunk.com), [Segment](https://segment.com/) diff --git a/articles/monitoring/guides/send-events-to-segmentio.md b/articles/monitoring/guides/send-events-to-segmentio.md new file mode 100644 index 0000000000..51f8030308 --- /dev/null +++ b/articles/monitoring/guides/send-events-to-segmentio.md @@ -0,0 +1,90 @@ +--- +title: Send Logging Events to Segment +description: Learn how to send logging events to Segment from Auth0. +topics: + - monitoring + - segmentio +contentType: + - how-to +useCase: + - analyze-auth0-analytics + - analyze-logs + - analyze-external-analytics + - integrate-analytics +--- +# Send Logging Events to Segment + +[Segment](https://segment.com/) provides a large number of analytics-related functionality with a single, simple to use API. + +In this example, you will learn how to connect Auth0 to Segment and stream `signup` and `login` events. To implement this with Auth0, you just need to create one [Rule](/rule) in your pipeline. + +![Segment Flow](/media/articles/monitoring/segment/segment-io-dataflow.png) + +You'll be using [Segment's Node.js library](https://github.com/segmentio/analytics-node) to record Auth0 data. + +## 1. Find your Segment Write Key + +To configure this integration, you'll need your Segment **Write Key**. You can find this under Segment's **Settings** > **API**. + +![Segment API Keys](/media/articles/monitoring/segment/segment-3.png) + +## 2. Record sign-up and log-in events in Segment + +Create a rule to record user `signup` and `login` events for your apps and send the information to Segment using Segment's Node.js library. + +In this example, we expect your Segment credentials to be stored in the [global `configuration` object](/rules/current#use-the-configuration-object). Be sure to add your **Write Key** here before running your rule. Doing this allows you to use your key in multiple rules and prevents you from having to store it directly in the code. + + +```js +function(user, context, callback) { + var Analytics = require('analytics-node'); + var analytics = new Analytics(configuration.WRITE_KEY, { flushAt: 1 }); + + // Note: Set { flushAt: 1 } and use analytics.flush to ensure + // the data is sent to Segment before the rule/Webtask terminates + + // Identify your user + analytics.identify({ + userId: user.user_id, + traits: { + email: user.email, + signed_up: user.created_at, + login_count: user.logins_count + }, + "context": { + "userAgent": context.request.UserAgent, + "ip": context.request.ip + } + }); + analytics.track({ + userId: user.user_id, + event: 'Logged In', + properties: { + clientName: context.clientName, + clientID: context.clientID, + connection: context.connection + }, + "context": { + "userAgent": context.request.UserAgent, + "ip": context.request.ip + } + }); + analytics.flush(function(err, batch){ + callback(null, user, context); + }); +} +``` + +## 3. Check your integration + +See if your integration works by checking the Segment Debugger to see if your Auth0 events are appearing. + +![Segment Debugger](/media/articles/monitoring/segment/segment-14.png) + + +## Keep reading + +Check out our [repository of Auth0 Rules](https://github.com/auth0/rules) for more great examples: + +* Rules for access control +* Integration with other services: [MixPanel](http://mixpanel.com), [Firebase](http://firebase.com), [TowerData](https://www.towerdata.com/email-intelligence/email-enhancement), [Parse](http://parse.com), [Splunk](https://www.splunk.com), [Keen](https://keen.io/) diff --git a/articles/monitoring/guides/send-events-to-splunk.md b/articles/monitoring/guides/send-events-to-splunk.md new file mode 100644 index 0000000000..a805b82ebe --- /dev/null +++ b/articles/monitoring/guides/send-events-to-splunk.md @@ -0,0 +1,88 @@ +--- +title: Export Logs to Splunk Using Rules +description: Learn how to send logging events to Splunk from Auth0 using rules. +topics: + - monitoring + - splunk +contentType: + - how-to +useCase: + - analyze-auth0-analytics + - analyze-logs + - analyze-external-analytics + - integrate-analytics +--- +# Export Logs to Splunk Using Rules + +[Splunk](http://splunk.com) provides a platform that allows you to easily get insights into all the information generated by your IT infrastructure. + +In this example, you will learn how to connect Auth0 to Splunk and stream `signup` and `login` events with user contextual information. To implement this with Auth0, you just need to create one [Rule](/rule) in your pipeline. + +![](/media/articles/tutorials/splunk-dataflow.png) + +## Record sign-up or log-in event in Splunk + +Create a rule that will record user `signup` and `login` events for your apps using the [Splunk REST API](http://dev.splunk.com/view/rest-api-overview/SP-CAAADP8). When enabled, this rule will send events that will then show on Splunk's dashboard: + +![](/media/articles/scenarios/splunk/splunk-dashbaord.png) + + +Please note: + +* Splunk's API supports basic & token-based auth. In this example, we use token-based auth and expect your Splunk credentials to be stored in the [global `configuration` object](/rules/current#use-the-configuration-object). Be sure to add your token here before running your rule. Doing this allows you to use your token in multiple rules and prevents you from having to store it directly in the code. + +* For this rule, we send contextual information, such as IP address (can be used to deduce location), application name, and username. However, you can send any number of properties. + +* For this rule, we track the event type using a property called `user.app_metadata.signedUp`. When the property is set to `true`, we assume the event is a `login`. Otherwise, we assume the event is a new `signup`, and if everything goes well, we set it to `true`. Thus, the next time the user logs in, the event will be recorded as a `login`. + + +```js +function (user, context, callback) { + const request = require('request'); + + user.app_metadata = user.app_metadata || {}; + const endpoint = 'https://http-inputs-mysplunkcloud.example.com:443/services/collector'; // replace with your Splunk HEC endpoint; + + //Add any interesting info to the event + const hec_event = { + event: { + message: user.app_metadata.signedUp ? 'Login' : 'Signup', + application: context.clientName, + clientIP: context.request.ip, + protocol: context.protocol, + userName: user.name, + userId: user.user_id + }, + source: 'auth0', + sourcetype: 'auth0_activity' + }; + + request.post({ + url: endpoint, + headers: { + 'Authorization': 'Splunk ' + configuration.SPLUNK_HEC_TOKEN + }, + strictSSL: true, // set to false if using a self-signed cert + json: hec_event + }, function(error, response, body) { + if (error) return callback(error); + if (response.statusCode !== 200) return callback(new Error('Invalid operation')); + user.app_metadata.signedUp = true; + auth0.users.updateAppMetadata(user.user_id, user.app_metadata) + .then(function () { + callback(null, user, context); + }) + .catch(function (err) { + callback(err); + }); + }); + +} +``` + +## Keep reading + +Check out our [repository of Auth0 Rules](https://github.com/auth0/rules) for more great examples: + +* Rules for access control +* Integration with other services: [MixPanel](http://mixpanel.com), [Firebase](http://firebase.com), [TowerData](https://www.towerdata.com/email-intelligence/email-enhancement), [Parse](http://parse.com), [Segment](https://segment.com/), [Keen](https://keen.io/) diff --git a/articles/monitoring/guides/test-testall-endpoints.md b/articles/monitoring/guides/test-testall-endpoints.md new file mode 100644 index 0000000000..df71f9c74d --- /dev/null +++ b/articles/monitoring/guides/test-testall-endpoints.md @@ -0,0 +1,69 @@ +--- +title: Check Auth0 Authentication and Supporting Services +description: Learn how check the status of the Auth0 authentication service as well as supporting services such as the Dashboard and documentation using the test and testall endpoints. +public: false +topics: + - monitoring +contentType: + - how-to +useCase: + - analyze-auth0-analytics + - analyze-logs + - integrate-analytics + - synthetic-authentication + - synthetic-transactions +--- +# Check Auth0 Authentication and Supporting Services + +::: warning +The `/test` and `/testall` endpoints are best for determining if everything is functioning but *not* for determining if something is down. They do not provide a complete status picture. +::: + +Use the `/test` and `/testall` endpoints as a supplement to your other monitoring. You should use synthetic transactions against a test account to ensure that everything is functional. You should also track your own logs and other metrics to calls to Auth0 from servers and/or clients. + +## Test endpoint + +The `/test` endpoint checks the status of the core Auth0 authentication service. + +Here is an example of a call to the `/test` endpoint: + +```har +{ + "method": "GET", + "url": "https://${account.namespace}/test" +} +``` + +If the service is up, the endpoint returns a `200` HTTP response code; if it is not, it returns a `5xx` response code. + +Additionally, this endpoint returns a JSON object: + +```json +{ + "clock": 1417220191640 +} +``` + +## Testall endpoint + +The `/testall` endpoint checks the status of the core Auth0 authentication service, as well as supporting services such as those for the [Dashboard](${manage_url}) and documentation. + +Here is an example call to the `/testall` endpoint: + +```har +{ + "method": "GET", + "url": "https://${account.namespace}/testall" +} +``` + +If all services are up, the endpoint returns the `200` HTTP response code and a simple text message of `OK`. If any service is down, it returns a `5xx` response code. + +<%= include('../_includes/_monitor-private-cloud.md') %> + +## Keep reading + +* [Check Auth0 Status](/monitoring/guides/check-status) +* [Check External Services Status](/monitoring/guides/check-external-services) +* [Monitor Auth0 Using System Center Operations Manager](/monitoring/guides/monitor-using-SCOM) +* [Monitor Applications](/monitoring/guides/monitor-applications) diff --git a/articles/monitoring/guides/track-leads-salesforce.md b/articles/monitoring/guides/track-leads-salesforce.md new file mode 100644 index 0000000000..0c277f7219 --- /dev/null +++ b/articles/monitoring/guides/track-leads-salesforce.md @@ -0,0 +1,186 @@ +--- +title: Track New Leads in Salesforce +description: Learn how to track new leads in Salesforce and augment user profiles with public information gathered from TowerData. +topics: + - monitoring + - marketing + - salesforce + - towerdata +contentType: + - how-to +useCase: + - analyze-auth0-analytics + - analyze-logs + - analyze-external-analytics + - integrate-analytics +--- + +# Track New Leads in Salesforce + +You can track new leads in Salesforce with TowerData-Enriched User Profiles. + +Whenever a new user signs up with a website using any social credential we want to: + +1. __Augment the user profile__ with additional public information obtained through [TowerData](https://www.towerdata.com/email-intelligence/email-enhancement). + +2. __Record the sign-up as a New Lead__ on [Salesforce](http://www.salesforce.com/), so a sales professional can follow up. + +To implement this with Auth0, you just need to create two [Rules](/rules) in your pipeline: + +![](/media/articles/tutorials/rapleaf-salesforce.png) + +## 1. Enrich User Profile with TowerData + +Create a rule that will obtain more information about the user by retrieving public information from TowerData's API using the user's email address as input. + +Once the call to TowerData completes, we store this additional information in a property called `towerdata`: + +:::note +We ignore certain conditions that exist in the API and only do this when there's a successful call (`statusCode=200`). This rule will also be skipped if the user has already signed up, which is signaled by the `user.app_metadata.recordedAsLead` property being set to true (see step 2). +::: + +```js +function (user, context, callback) { + + //Filter by app + //if(context.clientName !== 'AN APP') return callback(null, user, context); + + var request = require('request'); + + if (!user.email || !user.email_verified) { + return callback(null, user, context); + } + + request.get('https://api.towerdata.com/v5/td', { + qs: { + email: user.email, + api_key: configuration.TOWERDATA_API_KEY + }, + json: true + }, + (err, response, body) => { + if (err) return callback(err); + + if (response.statusCode === 200) { + context.idToken['https://example.com/towerdata'] = body; + } + + return callback(null, user, context); + }); +} +``` + +## 2. Create New Lead in Salesforce + +Create a rule that will record the information as a __New Lead__ in Salesforce, so the sales department can follow up. Please note: + +* The Salesforce REST API uses an OAuth Access Token. So for this rule, we use the OAuth2 `Resource Owner Password Credential Grant` to obtain this token, and use the `getToken` function, which uses credentials as input, as opposed to an `API-KEY` as was used in the rule in the previous step. + +* In this example, we expect your Salesforce credentials to be stored in the [global `configuration` object](/rules/current#use-the-configuration-object). Be sure to add your credentials here before running your rule. Doing this allows you to use your credentials in multiple rules and prevents you from having to store them directly in the code. + +* For this rule, we record only the username and a fixed company name. However, we could use anything available in the enriched user profile we obtained in step 1 to record more information and provide additional context for the sales representative. + +* For this rule, we use a property called `user.app_metadata.recordedAsLead`, and if everything goes well, we set it to `true`. The next time the user signs in, this rule will be skipped. + +```js +function (user, context, callback) { + + const request = require('request'); + + user.app_metadata = user.app_metadata || {}; + if (user.app_metadata.recordedAsLead) { + return callback(null,user,context); + } + + const MY_SLACK_WEBHOOK_URL = 'YOUR SLACK WEBHOOK URL'; + const slack = require('slack-notify')(MY_SLACK_WEBHOOK_URL); + + //Populate the variables below with appropriate values + const SFCOM_CLIENT_ID = configuration.SALESFORCE_CLIENT_ID; + const SFCOM_CLIENT_SECRET = configuration.SALESFORCE_CLIENT_SECRET; + const USERNAME = configuration.SALESFORCE_USERNAME; + const PASSWORD = configuration.SALESFORCE_PASSWORD; + getAccessToken( + SFCOM_CLIENT_ID, + SFCOM_CLIENT_SECRET, + USERNAME, + PASSWORD, + (response) => { + if (!response.instance_url || !response.access_token) { + slack.alert({ + channel: '#some_channel', + text: 'Error Getting SALESFORCE Access Token', + fields: { + error: response + } + }); + + return; + } + + createLead( + response.instance_url, + response.access_token, + (err, result) => { + if (err || !result || !result.id) { + slack.alert({ + channel: '#some_channel', + text: 'Error Creating SALESFORCE Lead', + fields: { + error: err || result + } + }); + + return; + } + + user.app_metadata.recordedAsLead = true; + auth0.users.updateAppMetadata(user.user_id, user.app_metadata); + }); + }); + + //See http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_lead.htm + function createLead(url, access_token, callback){ + //Can use many more fields + const data = { + LastName: user.name, + Company: 'Web channel signups' + }; + + request.post({ + url: url + "/services/data/v20.0/sobjects/Lead", + headers: { + "Authorization": "OAuth " + access_token + }, + json: data + }, (err, response, body) => { + return callback(err, body); + }); + } + + //Obtains a SFCOM access_token with user credentials + function getAccessToken(client_id, client_secret, username, password, callback) { + request.post({ + url: 'https://login.salesforce.com/services/oauth2/token', + form: { + grant_type: 'password', + client_id: client_id, + client_secret: client_secret, + username: username, + password: password + }}, (err, respose, body) => { + return callback(JSON.parse(body)); + }); + } + + // don’t wait for the SF API call to finish, return right away (the request will continue on the sandbox)` + callback(null, user, context); +} +``` + +## Keep reading + +Check out our [repository of Auth0 Rules](https://github.com/auth0/rules) for more great examples: + +* Rules for access control +* Integration with other services: [MixPanel](http://mixpanel.com), [Firebase](http://firebase.com), [Parse](http://parse.com), [Splunk](https://www.splunk.com/), [Segment](https://segment.com/), [Keen](https://keen.io/) diff --git a/articles/monitoring/guides/track-signups-salesforce.md b/articles/monitoring/guides/track-signups-salesforce.md new file mode 100644 index 0000000000..6120985e99 --- /dev/null +++ b/articles/monitoring/guides/track-signups-salesforce.md @@ -0,0 +1,238 @@ +--- +title: Track New Sign-Ups in Salesforce +description: Learn how to track your sign-ups in Salesforce MixPanel, enrich your user profiles with public information gathered from FullContact, and generate new sales leads. +topics: + - monitoring + - marketing +contentType: + - how-to +useCase: + - analyze-auth0-analytics + - analyze-logs + - analyze-external-analytics + - integrate-analytics +--- + +# Track New Sign-Ups in Salesforce + +You can track new sign-ups in Salesforce with FullContact-Enriched User Profiles, and Send Auth0 Events to MixPanel. + +Whenever a new user signs up with a website using a social credential, you want to: + +1. __Record a `signup` event__ in [MixPanel](https://mixpanel.com). +2. __Augment the user profile__ with additional public information through [FullContact](http://www.fullcontact.com/). +3. __Record the sign-up as a New Lead__ in [Salesforce](http://www.salesforce.com/), so a sales professional can follow up. + +To implement this with Auth0, you need to create three [Rules](/rules) in your pipeline: + +![](/media/articles/tutorials/signups.png) + +## 1. Record sign-up event in MixPanel + +Create a rule to record the event by calling MixPanel. In the example below, we record the application name in the `application` property to help you filter information in MixPanel. However, the full `context` and `user` properties are available as sources of additional information (e.g., IP addresses, agent). + +::: note +This rule will be skipped if the user has already signed up, which is signaled by the `user.app_metadata.recordedAsLead` property being set to true (see step 3). +::: + +```js +function (user, context, callback) { + + const request = require('request'); + + const mpEvent = { + "event": "Sign up", + "properties": { + "distinct_id": user.user_id, + "token": configuration.MIXPANEL_API_TOKEN, + "application": context.clientName + } + }; + + const base64Event = Buffer.from(JSON.stringify(mpEvent)).toString('base64'); + + request.get({ + url: 'http://api.mixpanel.com/track/', + qs: { + data: base64Event + } + }, (err, res, body) => { + // don’t wait for the MixPanel API call to finish, return right away (the request will continue on the sandbox)` + callback(null, user, context); + }); +} +``` + +## 2. Enrich user profile with FullContact + +Create a rule to obtain more information about the user by retrieving public information from FullContact's API using the user's email address as input. + +Once the call to FullContact completes, we store this additional information in a property called `fullContactInfo`: + +:::note +We ignore certain conditions that exist in the API and only do this when there's a successful call (`statusCode=200`). This rule will also be skipped if the user has already signed up, which is signaled by the `user.app_metadata.recordedAsLead` property being set to true (see step 3). +::: + +```js +function (user, context, callback) { + + const request = require('request'); + + const FULLCONTACT_KEY = configuration.FULLCONTACT_KEY; + const SLACK_HOOK = configuration.SLACK_HOOK_URL; + + const slack = require('slack-notify')(SLACK_HOOK); + + // skip if no email + if (!user.email) return callback(null, user, context); + + // skip if fullcontact metadata is already there + if (user.user_metadata && user.user_metadata.fullcontact) return callback(null, user, context); + + request.get('https://api.fullcontact.com/v2/person.json', { + qs: { + email: user.email, + apiKey: FULLCONTACT_KEY + }, + json: true + }, (error, response, body) => { + if (error || (response && response.statusCode !== 200)) { + + slack.alert({ + channel: '#slack_channel', + text: 'Fullcontact API Error', + fields: { + error: error ? error.toString() : (response ? response.statusCode + ' ' + body : '') + } + }); + + // swallow fullcontact api errors and just continue login + return callback(null, user, context); + } + + // if we reach here, it means fullcontact returned info and we'll add it to the metadata + user.user_metadata = user.user_metadata || {}; + user.user_metadata.fullcontact = body; + + auth0.users.updateUserMetadata(user.user_id, user.user_metadata); + context.idToken['https://example.com/fullcontact'] = user.user_metadata.fullcontact; + return callback(null, user, context); + }); +} +``` + +## 3. Create New Lead in Salesforce + +Create a rule to record the information as a New Lead in Salesforce, so the sales department can follow up. Please note: + +* The Salesforce REST API uses an OAuth Access Token. So for this rule, we use the OAuth2 `Resource Owner Password Credential Grant` to obtain this token, and use the `getToken` function, which uses credentials as input, as opposed to an `API-KEY` as was used in the rules in the previous steps. + +* In this example, we expect your Salesforce credentials to be stored in the [global `configuration` object](/rules/current#use-the-configuration-object). Be sure to add your credentials here before running your rule. Doing this allows you to use your credentials in multiple rules and prevents you from having to store them directly in the code. + +* For this rule, we record only the username and a fixed company name. However, we could use anything available in the enriched user profile we obtained in step 2 to record more information and provide additional context for the sales representative. + +* For this rule, we use a property called `user.app_metadata.recordedAsLead`, and if everything goes well, set it to true. The next time the user signs in, all of these rules will be skipped. + + +```js +function (user, context, callback) { + + const request = require('request'); + + user.app_metadata = user.app_metadata || {}; + if (user.app_metadata.recordedAsLead) { + return callback(null,user,context); + } + + const MY_SLACK_WEBHOOK_URL = 'YOUR SLACK WEBHOOK URL'; + const slack = require('slack-notify')(MY_SLACK_WEBHOOK_URL); + + //Populate the variables below with appropriate values + const SFCOM_CLIENT_ID = configuration.SALESFORCE_CLIENT_ID; + const SFCOM_CLIENT_SECRET = configuration.SALESFORCE_CLIENT_SECRET; + const USERNAME = configuration.SALESFORCE_USERNAME; + const PASSWORD = configuration.SALESFORCE_PASSWORD; + getAccessToken( + SFCOM_CLIENT_ID, + SFCOM_CLIENT_SECRET, + USERNAME, + PASSWORD, + (response) => { + if (!response.instance_url || !response.access_token) { + slack.alert({ + channel: '#some_channel', + text: 'Error Getting SALESFORCE Access Token', + fields: { + error: response + } + }); + + return; + } + + createLead( + response.instance_url, + response.access_token, + (err, result) => { + if (err || !result || !result.id) { + slack.alert({ + channel: '#some_channel', + text: 'Error Creating SALESFORCE Lead', + fields: { + error: err || result + } + }); + + return; + } + + user.app_metadata.recordedAsLead = true; + auth0.users.updateAppMetadata(user.user_id, user.app_metadata); + }); + }); + + //See http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_lead.htm + function createLead(url, access_token, callback){ + //Can use many more fields + const data = { + LastName: user.name, + Company: 'Web channel signups' + }; + + request.post({ + url: url + "/services/data/v20.0/sobjects/Lead", + headers: { + "Authorization": "OAuth " + access_token + }, + json: data + }, (err, response, body) => { + return callback(err, body); + }); + } + + //Obtains a SFCOM access_token with user credentials + function getAccessToken(client_id, client_secret, username, password, callback) { + request.post({ + url: 'https://login.salesforce.com/services/oauth2/token', + form: { + grant_type: 'password', + client_id: client_id, + client_secret: client_secret, + username: username, + password: password + }}, (err, respose, body) => { + return callback(JSON.parse(body)); + }); + } + + // don’t wait for the SF API call to finish, return right away (the request will continue on the sandbox)` + callback(null, user, context); +} +``` + +## Keep reading + +Check out our [repository of Auth0 Rules](https://github.com/auth0/rules) for more great examples: + +* Rules for access control +* Integration with other services: [Firebase](http://firebase.com), [TowerData](https://www.towerdata.com/email-intelligence/email-enhancement), [Parse](http://parse.com), [Splunk](https://www.splunk.com/), [Segment](https://segment.com/), [Keen](https://keen.io/) diff --git a/articles/monitoring/how-to-monitor-auth0.md b/articles/monitoring/how-to-monitor-auth0.md deleted file mode 100644 index 3b8c93749b..0000000000 --- a/articles/monitoring/how-to-monitor-auth0.md +++ /dev/null @@ -1,133 +0,0 @@ ---- -description: How to use monitoring with an Auth0 account. -toc: true ---- - -# Monitor Auth0 - -If you are using the public cloud version of Auth0, we recommend subscribing to [Auth0 Status](http://status.auth0.com) for notifications regarding Auth0 service availability. The Auth0 DevOps team uses [Auth0 Status](http://status.auth0.com) for reports on current incidents. - -Current and historical uptime is available at [Auth0 Uptime](http://uptime.auth0.com). - -## Monitor your Auth0 account - -You can add Auth0 health probes to your monitoring infrastructure with the following endpoints: - -### The test endpoint - -The `test` endpoint checks the status of the core Auth0 authentication service. If the status is up, the endpoint returns a `200` status code; if is is not, it will return a `5xx` status code. - -```har -{ - "method": "GET", - "url": "https://${account.namespace}/test" -} -``` - -Additionally, this endpoint returns a JSON object: - -```json -{ - "clock": 1417220191640 -} -``` - -### The testall endpoint - -The `/testall` endpoint checks the status of the core Auth0 authentication service, as well as supporting services such as those for the [Dashboard](${manage_url}) and documentation. - -```har -{ - "method": "GET", - "url": "https://${account.namespace}/testall" -} -``` - -If all services are up, the endpoint returns the `200` HTTP response code and a simple text message saying, `OK`. If any service is down, the response code from `/testall` will be `5xx`. - -If you've extended Auth0 through [rules](/rules) or [a custom database connection](/connections/database/mysql), you can build a synthetic transaction that exercises these capabilities using the [Resource Owner Password Grant](/api-auth/tutorials/password-grant). - -We recommend using an authentication flow that doesn't require a user interface (such as the **Resource Owner Password Grant**) so that you don't have to use a monitoring tool that is capable of mimicking the actions of a user. Many monitoring tools exist using this approach, including: - -* [New Relic](http://newrelic.com) -* [Pingdom](http://pingdom.com) - -## Monitor external services - -If you are seeing potential issues with your Auth0 service, but the monitoring endpoints and the [Auth0 Status page](https://status.auth0.com) aren't indicating any problems, check the status of any external services that you use alongside Auth0. - -* [Amazon Web Services](https://status.aws.amazon.com/) -* [Azure Active Directory](https://azure.microsoft.com/en-us/status/) -* [Citrix](https://status.cloud.com/) -* [Facebook](https://developers.facebook.com/status/) -* [GitHub](https://status.github.com/) -* [Google Cloud](https://status.cloud.google.com/) -* [Google's G Suite](https://www.google.com/appsstatus#hl=en&v=status) -* [Heroku](https://status.heroku.com/) -* [IBM](https://console.bluemix.net/status) -* [Mandrill](http://status.mandrillapp.com/) -* [Microsoft Azure](https://azure.microsoft.com/en-gb/status/) -* [SAP](https://www.sap.com/about/cloud-trust-center/cloud-service-status.html) -* [SendGrid](http://status.sendgrid.com/) -* [SFDC](https://status.salesforce.com/) -* [Slack](https://status.slack.com/) -* [Twilio](https://status.twilio.com/) -* [VM Ware](https://status.vmware-services.io/) - -## Monitor a dedicated deployment - -Please see the [PSaaS Appliance](/appliance) pages for [information on monitoring a dedicated deployment](/appliance/monitoring). - -## Configure SCOM - -Auth0 can be monitored as a standard web application using System Center Operations Manager (SCOM) or any tool that supports synthetic transactions. - -We recommend adding SCOM probes for the `test` and `testall` endpoints, in addition to one for a synthetic login transaction that includes the extensions your applications rely on (such as rules that execute custom code for integration with your company's other services). - -To set up SCOM: - -1. Add a new SCOM instance using the **Add Monitoring Wizard**: - - * **Name**: a descriptive name for the SCOM instance - * **Description**: a description of what this SCOM instances monitors - * **Select destination management pack**: Default Management Pack - - ![ss-2014-11-21T15-44-34.png](/media/articles/monitoring/ss-2014-11-21T15-44-34.png) - - Click **Next** to continue. - -2. Click **Add** to enter the URLs you want SCOM to monitor. - - ![ss-2014-11-21T16-31-15.png](/media/articles/monitoring/ss-2014-11-21T16-31-15.png) - - Click **Next** to continue. - -3. You will be asked where you want to monitor from. Click **Add** to set up a location. In the pop-up dialog, search for **Internal location - Agent**. Select the appropriate address and click **Add**. Click **Ok** to finish selecting the location. - - ![ss-2014-11-21T16-32-25.png](/media/articles/monitoring/ss-2014-11-21T16-32-25.png) - - Click **Next** to continue. - -4. Set the frequency with which SCOM collects data from each endpoint: - - * **Test frequency**: 60 seconds - * **Performance data collection interval**: 60 seconds - * **Test time-out**: 30 seconds - - Additionally, under the *Alerts* section, **check** the box next to *HTTP status code* and set that to **Great than or equals 400**. - - ![ss-2014-11-21T16-33-51.png](/media/articles/monitoring/ss-2014-11-21T16-33-51.png) - - Click **Next** to continue. - -5. Click **Run Test** to test each endpoint and ensure that the connection settings provided are correct. - -![ss-2014-11-21T16-34-25.png](/media/articles/monitoring/ss-2014-11-21T16-34-25.png) - -Once you have finished configuring your SCOM instance, you can activity through the **Monitoring** tab: - -![ss-2014-11-25T17-20-47.png](/media/articles/monitoring/ss-2014-11-25T17-20-47.png) - -Click **Web Application Status** to bring up the information SCOM has gathered. - -![ss-2014-11-25T17-22-10.png](/media/articles/monitoring/ss-2014-11-25T17-22-10.png) diff --git a/articles/monitoring/index.md b/articles/monitoring/index.md index 9aa852e88c..7fd1ac6b73 100644 --- a/articles/monitoring/index.md +++ b/articles/monitoring/index.md @@ -1,40 +1,46 @@ --- -title: Monitoring Auth0 -description: Monitoring Your Auth0 Implementation -classes: topic-page +title: Monitor Auth0 Implementations +description: Understand how to monitor your Auth0 implementation and track your Auth0 usage, as well as how to send events and logs to external tools. +topics: + - monitoring +contentType: + - concept + - index +useCase: + - analyze-auth0-analytics + - analyze-logs + - integrate-analytics --- +# Monitor Auth0 Implementations -
    -
    -

    Monitor Your Auth0 Implementation

    -

    - Learn how to monitor your Auth0 implementation and track your Auth0 usage, as well as how to send logs to your choice of logging suite. -

    -
    - - \ No newline at end of file +You can monitor your Auth0 implementation and Auth0 status and services, as well as send logging event data to third-party tools. + +<%= include('./_includes/_monitor-private-cloud.md') %> + +## Check availability and status + +* [Check Auth0 Status](/monitoring/guides/check-status) +* [Check External Services Status](/monitoring/guides/check-external-services) +* [Monitor Auth0 Using System Center Operations Manager](/monitoring/guides/monitor-using-SCOM) +* [Monitor Applications](/monitoring/guides/monitor-applications) + +## Log events + +Need to analyze logs or store them long-term? Auth0 provides extensions to [export logs to external tools](/logs) for analysis and retention. You can also retrieve log data with the Management API. Auth0 only retains logs for a limited period of time, governed by the type of subscription purchased. If your required data retention period is longer than the retention period for your subscription,export logs so you can keep them as long as you wish. + +* [Administrator and Developer Log Usage Examples](/logs/concepts/logs-admins-devs) +* [Log Data Retention](/logs/references/log-data-retention) +* [View Log Data in the Dashboard](/logs/guides/view-log-data-dashboard) +* [Retrieve Logs Using the Management API](/logs/guides/retrieve-logs-mgmt-api) +* [Log Event Type Codes](/logs/references/log-event-type-codes) +* [Log Search Query Syntax](/logs/references/query-syntax) +* [Send Logging Events to Keen](/monitoring/guides/send-events-to-keenio) +* [Send Logging Events to Segment](/monitoring/guides/send-events-to-segmentio) +* [Send Logging Events to Splunk](/monitoring/guides/send-events-to-splunk) +* [Send Logging Events to Loggly](/extensions/loggly) +* [Send Logging Events to Mixpanel](/extensions/mixpanel) + +## Track new signups and leads + +* [Track New Sign-Ups in Salesforce](/monitoring/guides/track-signups-salesforce) +* [Track New Leads in Salesforce](/monitoring/guides/track-leads-salesforce) diff --git a/articles/monitoring/sending-events-to-keenio.md b/articles/monitoring/sending-events-to-keenio.md deleted file mode 100644 index 88c1bdeb97..0000000000 --- a/articles/monitoring/sending-events-to-keenio.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -description: How to send events to Keen IO from Auth0. ---- -# Sending events to Keen IO from Auth0 - -[Keen IO](http://keen.io) provides a service to capture and analyze events generated in your apps. In their words: - -> Analytics transforms data into answers – the kind of answers every company deserves. Unfortunately, a lot of companies a) can't find an analytics service that's right for their specific needs, and b) don't have the resources to develop their own analytics infrastructure. That's why we started Keen IO. Basically, we built it, so you don't have to. And we made it powerful, flexible, and scalable enough that you can use it however you need to – even if those needs change over time. - -This example shows how you can very easily connect Auth0 to __Keen IO__ and stream `signup` events. - -Implementing this with Auth0 is very easy, only taking a few lines of code. - -![Keen IO Dataflow](/media/articles/tutorials/keen-io-dataflow.png) - -## Recording a SignUp event in Keen IO - -This rule checks whether the user has already signed up before or not. This is tracked by the `user.signedUp` property. If the property is present then we assume return immediately, otherwise we assume a new `signup`. - -```js -function(user, context, callback) { - - if(user.signedUp){ - return callback(null, user, context); - } - - var writeKey = 'YOUR KEEN IO WRITE KEY'; - var projectId = 'YOUR KEEN IO PROJECT ID'; - var eventCollection = 'signups'; - - var keenEvent = { - userId: user.user_id, - name: user.name, - ip: context.request.ip //Potentially any other properties in the user profile/context - }; - - request.post({ - method: 'POST', - url: 'https://api.keen.io/3.0/projects/' + projectId + '/events/' + eventCollection + '?api_key=' + writeKey, - headers: { - 'Content-type': 'application/json', - }, - body: JSON.stringify(keenEvent), - }, - function (e, r, body) { - if( e ) return callback(e,user,context); - //We assume everything went well - user.persistent.signedUp = true; - return callback(null, user, context); - }); -} -``` - -::: note -Notice that if all calls are successful, we signal the user as signed up. So next time we skip the entire rule. -::: - -Check out our [repository of Auth0 Rules](https://github.com/auth0/rules) for more great examples: - -* Rules for access control -* Integration with other services: [MixPanel](http://mixpanel.com), [Firebase](http://firebase.com), [Rapleaf](http://rapleaf.com), [Parse](http://parse.com) diff --git a/articles/monitoring/sending-events-to-segmentio.md b/articles/monitoring/sending-events-to-segmentio.md deleted file mode 100644 index 2e1a879c0d..0000000000 --- a/articles/monitoring/sending-events-to-segmentio.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -description: How to send events to segment.io from Auth0 ---- -# Send Auth0 Events to Segment - -[Segment](http://segment.io/features) provides a large number of analytics-related functionality with a single, simple to use API. - -This example shows how you can connect Auth0 to Segment and stream `signup` and `login` events. You'll be using [Segment's Node.js library](https://github.com/segmentio/analytics-node) to record Auth0 data. - -![Segment Flow](/media/articles/monitoring/segment/segment-io-dataflow.png) - -## Find your Segment Write Key - -To configure this integration, you'll need your Segment **Write Key**. You can find this under **Settings** > **API**. - -![Segment API Keys](/media/articles/monitoring/segment/segment-3.png) - -## Record sign up and login events - -To record Auth0 signup and login events and send the information to Segment, you will create a [rule](/rules) implementing Segment's Node.js library. - -::: note -Be sure to add your **Write Key** to the [Global Configuration Object](/rules#using-the-configuration-object) prior to running your rule. -::: - -```js -function(user, context, callback) { - var Analytics = require('analytics-node'); - var analytics = new Analytics(configuration.WRITE_KEY, { flushAt: 1 }); - - // Note: Set { flushAt: 1 } and use analytics.flush to ensure - // the data is sent to Segment before the rule/Webtask terminates - - // Identify your user - analytics.identify({ - userId: user.user_id, - traits: { - email: user.email, - signed_up: user.created_at, - login_count: user.logins_count - }, - "context": { - "userAgent": context.request.UserAgent, - "ip": context.request.ip - } - }); - analytics.track({ - userId: user.user_id, - event: 'Logged In', - properties: { - clientName: context.clientName, - clientID: context.clientID, - connection: context.connection - }, - "context": { - "userAgent": context.request.UserAgent, - "ip": context.request.ip - } - }); - analytics.flush(function(err, batch){ - callback(null, user, context); - }); -} -``` - -## Check your integration - -To see if your integration works, you can check the Segment Debugger to see if your Auth0 events are appearing. - -![Segment Debugger](/media/articles/monitoring/segment/segment-14.png) diff --git a/articles/monitoring/sending-events-to-splunk.md b/articles/monitoring/sending-events-to-splunk.md deleted file mode 100644 index d018551b7c..0000000000 --- a/articles/monitoring/sending-events-to-splunk.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -description: How to send events from Auth0 to Spunk. ---- -# Sending Events from Auth0 to Splunk - -[Splunk](http://splunk.com) provides a platform to easily get insights into all the information generated by your IT infrastructure. - -This example shows how you can very easily connect Auth0 to Splunk and stream `signup` and `login` events with user contextual information. - -![](/media/articles/tutorials/splunk-dataflow.png) - -## Record a SignUp or Login Event in Splunk - -This [Auth0 rule](/rules) uses the [Splunk REST API](http://dev.splunk.com/view/rest-api-overview/SP-CAAADP8) to record `signup` and `login` events from users to your apps. This is tracked with the `signedUp` property. If the property is present, then we assume this is a `login` event. Otherwise we assume that this event is a new `signup`. - -You can send any number of properties. This sample sends contextual information like the user IP address (can be used for location), the application, the username, and so on. - -Splunk's API supports basic & token based auth. For simplicity, we use basic auth, with credentials in the rule. You can store these credentials securely in Auth0 using standard settings on the dashboard. - -When enabled, this rule will start sending events that will show up on Splunk's dashboard: - -![](/media/articles/scenarios/splunk/splunk-dashbaord.png) - -::: panel Securely Storing Credentials -This example has your Splunk credentials hard-coded into the rule, but if you prefer, you can store them instead in the `configuration` object (see the [Settings](${manage_url}/#/rules) under the list of your rules). This allows you to use those credentials in multiple rules if you require, and also prevents you from having to store them directly in the code. -::: - -```js -function(user, context, callback) { - user.app_metadata = user.app_metadata || {}; - var splunkBaseUrl = 'YOUR SPLUNK SERVER, like: https://your server:8089'; - - //Add any interesting info to the event - var event = { - message: user.app_metadata.signedUp ? 'Login' : 'SignUp', - application: context.clientName, - clientIP: context.request.ip, - protocol: context.protocol, - userName: user.name, - userId: user.user_id - }; - - request.post( { - url: splunkBaseUrl + '/services/receivers/simple', - auth: { - 'user': 'YOUR SPLUNK USER', - 'pass': 'YOUR SPLUNK PASSWORD', - }, - json: event, - qs: { - 'source': 'auth0', - 'sourcetype': 'auth0_activity' - } - }, function(e,r,b) { - if (e) return callback(e); - if (r.statusCode !== 200) return callback(new Error('Invalid operation')); - user.app_metadata.signedUp = true; - auth0.users.updateAppMetadata(user.user_id, user.app_metadata) - .then(function(){ - callback(null, user, context); - }) - .catch(function(err){ - callback(err); - }); - }); -} -``` - -::: note -Notice that if all calls are successful, we signal the user as signed up. So next time we record `login`. -::: - -Check out our [repository of Auth0 Rules](https://github.com/auth0/rules) for more great examples: - -* Rules for access control -* Integration with other services: [Firebase](http://firebase.com), [Rapleaf](http://rapleaf.com), [Parse](http://parse.com) diff --git a/articles/monitoring/track-signups-enrich-user-profile-generate-leads.md b/articles/monitoring/track-signups-enrich-user-profile-generate-leads.md deleted file mode 100644 index 8664908dbb..0000000000 --- a/articles/monitoring/track-signups-enrich-user-profile-generate-leads.md +++ /dev/null @@ -1,145 +0,0 @@ ---- -description: How to track sign-ups, enrich user profiles and generate new leads. ---- - -# How to track Sign-ups, enrich User Profile and generate new Leads - -Upon a signup of a new user to a website with any social credential, we want to: - -1. Record a __SignUp__ event on [MixPanel](https://mixpanel.com). -2. __Augment the user profile__ with additional public information through [FullContact](http://www.fullcontact.com/). -3. Record the new signup as a __New Lead__ on [Salesforce](http://www.salesforce.com/) for follow-up. - -Implementing this with Auth0 is very easy. You just need 3 [Rules](/rules) in your pipeline: - -![](/media/articles/tutorials/signups.png) - -## 1. Recording a SignUp in MixPanel - -This first rule checks whether the user has already signed up. If they have, it simply skips everything. If not, it calls __MixPanel__ to record the event. In the example below we are simply using a property `application` that you can then use in MixPanel to filter information. But the full `context` and `user` properties are available as sources of more information (such as IP addresses, agent, and so on.). - -We also call this event `Sign Up`: - -```js -function (user, context, callback) { - - if(user.signedUp) return callback(null,user,context); - - var mixPanelEvent = { - "event": "Sign Up", - "properties": { - "distinct_id": user.user_id, - "token": YOUR_MIXPANEL_TOKEN, - "application": context.clientName - } - }; - - var base64Event = new Buffer(JSON.stringify(mixPanelEvent)).toString('base64'); - - request('http://api.mixpanel.com/track/?data=' + base64Event, - function(e,r,b){ - if(e) return callback(e); - return callback(null,user,context); - }); -} - -``` - -## 2.Augment User Profile with FullContact - -The 2nd step is to obtain more information about this user using their email address. __FullContact__ provides an API to retrieve public information about a user using the email as input. We store this additional information in a property called `fullContactInfo`: - -:::note -We are ignoring certain conditions that exist in the API and only doing this when there's a successful call (`statusCode=200`). -::: - -```js -function (user, context, callback) { - - if(user.signedUp) return callback(null,user,context); - - var fullContactAPIKey = 'YOUR FULLCONTACT API KEY'; - - if(user.email){ - request('https://api.fullcontact.com/v2/person.json?email=' + encodeURIComponent(user.email) + '&apiKey=' + fullContactAPIKey, - function(e,r,b){ - if(e) return callback(e); - if(r.statusCode===200){ - user.fullContactInfo = JSON.parse(b); - } - return callback(null, user, context); - }); - } - else{ - return callback(null, user, context); - } -} -``` - -## 3. Create a New Lead in Salesforce - -In the last step we record the information as a __New Lead__ in Salesforce, so the sales department can followup. This __Rule__ has some interesting things: - -1. The Salesforce REST API uses an OAuth `access_token`. We are using the OAuth2 `Resource Owner Password Credential Grant` to obtain such `access_token`. This is the `getToken` function hat uses credentials as input as opposed to an `API-KEY` as the previous rules. -2. We are just recording the user name and a fixed company name. We would of course us anything available in the enriched user profile we obtained in step 2, to record more information and have better context for the sales representative. -3. If everything went well, we use a __persistent__ property: `user.signedUp` and set it to `true`. So next time this same users logs in, none of these rules will do anything. - -```js -function (user, context, callback) { - - if(user.signedUp) return callback(null,user,callback); - - getAccessToken(SFCOM_CLIENT_ID, SFCOM_CLIENT_SECRET, USERNAME, PASSWORD, - function(e,r){ - if( e ) return callback(e); - - createLead(r.instance_url, r.access_token, function(e,result){ - if(e) return callback(e); - //Everyhting worked fine. We signal this signup was succesful. - user.persistent.signedUp = true; - return callback(null,user,context); - }); - }); - - function createLead(url,access_token, callback){ - - //Just a few fields. The Lead object is much richer - var data = { - LastName: user.name, - Company: 'Web channel signups' - }; - - request.post({ - url: url + "/services/data/v20.0/sobjects/Lead/", - headers: { - "Authorization": "OAuth " + access_token, - "Content-type": "application/json" - }, - body: JSON.stringify(data) - }, function(e,r,b){ - if(e) return callback(e); - return callback(null,b); - }); - } - - function getAccessToken(client_id, client_secret, username, password, callback){ - request.post({ - url: 'https://login.salesforce.com/services/oauth2/token', - form: { - grant_type: 'password', - client_id: client_id, - client_secret: client_secret, - username: username, - password: password - }}, function(e,r,b){ - if(e) return callback(e); - return callback(null,JSON.parse(b)); - }); - } -} -``` - -Check out our [repository of Auth0 Rules](https://github.com/auth0/rules) for more great examples: - -* Rules for access control -* Integration with other services: [Firebase](http://firebase.com), [Rapleaf](http://rapleaf.com) diff --git a/articles/monitoring/tracking-new-leads-in-salesforce-and-raplead.md b/articles/monitoring/tracking-new-leads-in-salesforce-and-raplead.md deleted file mode 100644 index 5865b036f2..0000000000 --- a/articles/monitoring/tracking-new-leads-in-salesforce-and-raplead.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -description: How to track new leads in Salesforce and augment user profile with Rapleaf. ---- - -# Tracking new leads in Salesforce, augmenting user profile with RapLeaf - -Upon a signup of a new user to a website with any social credential, we want to: - -1. __Augment the user profile__ with additional public information through [RapLeaf](http://www.rapleaf.com/). -2. Record the new signup as a __New Lead__ on [Salesforce](http://www.salesforce.com/) for follow-up. - -Implementing this with Auth0 is very easy. You just need 2 [Rules](/rules) in your pipeline: - -![](/media/articles/tutorials/rapleaf-salesforce.png) - -## 1. Augment User Profile with RapLeaf - -The 1st step is to obtain more information about this user using their email address. __RapLeaf__ provides an API to retrieve public information about a user using the email as input that is extremely easy to use. - -Once the call to RapLeaf completes, we store this additional information in a property called `rapLeafData`: - -:::note -We are ignoring certain conditions that exist in the API and only doing this when there's a successful call (`statusCode=200`). The entire rule is ignored if the user has already signed up (signaled by the `user.signedUp` property setup after recording a new lead in step 2 below). -::: - -```js -function (user, context, callback) { - - if(user.signedUp) return callback(null,user,callback); - - var rapLeafAPIKey = 'YOUR RAPLEAF API KEY'; - - if(user.email){ - request('https://personalize.rapleaf.com/v4/dr?email=' + - encodeURIComponent(user.email) + - '&api_key=' + rapLeafAPIKey, - function(e,r,b){ - if(e) return callback(e); - - if(r.statusCode===200){ - user.rapLeafData = JSON.parse(b); - } - - return callback(null,user,context); - }); - } - else { - return callback(null,user,context); - } -} -``` - -## 2. Create a New Lead in Salesforce - -In this second step we record the information as a __New Lead__ in Salesforce, so the sales department can followup. This __Rule__ has some interesting things: - -1. The Salesforce REST API uses an OAuth `access_token`. We are using the OAuth2 `Resource Owner Password Credential Grant` to obtain such `access_token`. This is the `getToken` function that uses credentials as input as opposed to an `API-KEY` as the previous rule. -2. We are just recording the user name and a fixed company name. We could of course use anything available in the enriched user profile we obtained in step 1, to record more information, and have better context for the sales representative. -3. If everything went well, we use a __persistent__ property: `user.signedUp` and set it to `true`. So next time this same users logs in, these rules will be skipped. - -```js -function (user, context, callback) { - - if(user.signedUp) return callback(null, user, callback); - - getAccessToken(SFCOM_CLIENT_ID, SFCOM_CLIENT_SECRET, USERNAME, PASSWORD, - function(err, response){ - if(err) return callback(err); - - createLead(response.instance_url, response.access_token, function(err, result){ - if(err) return callback(err); - //Everyhting worked fine. We signal this signup was successful. - user.persistent.signedUp = true; - return callback(null, user, context); - }); - }); - - function createLead(url, access_token, callback){ - - //Just a few fields. The Lead object is much richer. - var data = { - LastName: user.name, - Company: 'Web channel signups' - }; - - request.post({ - url: url + "/services/data/v20.0/sobjects/Lead/", - headers: { - "Authorization": "OAuth " + access_token, - "Content-type": "application/json" - }, - body: JSON.stringify(data) - }, function(err, response, body){ - if(err) return callback(err); - return callback(null,body); - }); - } - - //Helper function to get an access_token from Salesforce - function getAccessToken(client_id, client_secret, username, password, callback){ - request.post({ - url: 'https://login.salesforce.com/services/oauth2/token', - form: { - grant_type: 'password', - client_id: client_id, - client_secret: client_secret, - username: username, - password: password - }}, function(e,r,b){ - if(e) return callback(e); - return callback(null,JSON.parse(b)); - }); - } -} -``` -That's it! - -Check out our [repository of Auth0 Rules](https://github.com/auth0/rules) for more great examples: - -* Rules for access control -* Integration with other services: [Firebase](http://firebase.com) diff --git a/articles/multifactor-authentication/administrator/customizing-widget.md b/articles/multifactor-authentication/administrator/customizing-widget.md deleted file mode 100644 index 4daa025010..0000000000 --- a/articles/multifactor-authentication/administrator/customizing-widget.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -description: How to Customize the Guardian Widget ---- -# Customizing the Guardian Screen - -You may change the logo and the friendly name that is displayed to your users. To do so, make the appropriate changes to the Guardian page's settings on the **General** tab in [Tenant Settings](${manage_url}/#/tenant). You can also reach the Tenant Settings page by clicking on your tenant name on the top right of the page and then selecting **Settings** from the dropdown menu. - -![](/media/articles/mfa/guardian-logo-and-name-settings.png) - -* **Friendly Name**: the name of the app that you want displayed to users -* **Logo URL**: the URL that points to the logo image you want displayed to users - -## Customizing the Guardian Landing Page - -### Activate the Hosted Page - -Customizing the content of the Guardian widget page is possible in the [Guardian Multifactor Hosted Page](${manage_url}/#/guardian_mfa_page) by toggling __Customize Guardian Page__. - -![](/media/articles/mfa/guardian-mfa-hosted-page.png) - -### Theming Options - -There are a few theming options for MFA-Widget, namespaced under the `theme` property. - -#### icon - -The value for `icon` is the URL for an image that will be used in the MFA-Widget header, which defaults to the Auth0 logo. It has a recommended max height of `58px` for a better user experience. - -```js - theme: { - icon: 'https://example.com/assets/logo.png' - }, -``` - -#### primaryColor - -The `primaryColor` property defines the primary color of the MFA-Widget. This option is useful when providing a custom `icon`, to ensure all colors go well together with the `icon`'s color palette. Defaults to `#ea5323`. - -```js - theme: { - icon: 'https://example.com/assets/logo.png', - primaryColor: 'blue' - }, -``` - -### Rendering "Invited Enrollments" vs. Standard Scenarios - -There are two different possible scenarios in which the page is rendered. If a user has been directed to this page specifically for enrollment (for instance, from an email with an enrollment link) then the property **ticket** will be available. Otherwise, the property **requestToken** will be available. - -### HTML + Liquid syntax - -The hosted page uses [Liquid](https://github.com/Shopify/liquid/wiki/Liquid-for-Designers) syntax for templating. -The following parameters are available to assist in rendering your page: - -* `userData.email` -* `userData.friendlyUserId` -* `userData.tenant` -* `userData.tenantFriendlyName` -* `iconUrl` - -Most of the parameters that are used in MFA-Widget need to be passed to Guardian as shown in the default template provided in the customization area. -If you need a higher level of customization you could use [auth0-guardian.js](https://github.com/auth0/auth0-guardian.js/tree/master/example). diff --git a/articles/multifactor-authentication/administrator/disabling-mfa.md b/articles/multifactor-authentication/administrator/disabling-mfa.md deleted file mode 100644 index 0f91dea20c..0000000000 --- a/articles/multifactor-authentication/administrator/disabling-mfa.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -description: How to Disable Guardian and the other types of MFA. ---- -# Disable Guardian and other MFA - -Multifactor Authentication with Push Notifications (Guardian) and SMS can be disabled from the [Multifactor Auth](${manage_url}/#/guardian) section of the dashboard. Toggle the slider to disable each type. - -![Toggle Guardian](/media/articles/mfa/disable-guardian.png) - -A confirmation popup will appear confirming that you understand all customizations will be lost and that this action cannot be reverted. - -## Disable Google Authenticator or Duo - -To disable Google Authenticator or Duo, click on the configure link on the bottom of the [Multifactor Auth](${manage_url}/#/guardian) section of the dashboard, which will bring you to the [MFA configuration page for Google Authenticator and Duo](${manage_url}/#/multifactor). Then toggle the slider to disable the MFA type you wish to disable. - -![Toggle Other](/media/articles/mfa/disable-google-auth-duo.png) - -A confirmation popup will appear confirming that you understand all customizations will be lost. diff --git a/articles/multifactor-authentication/administrator/guardian-enrollment-email.md b/articles/multifactor-authentication/administrator/guardian-enrollment-email.md deleted file mode 100644 index 7626f634c8..0000000000 --- a/articles/multifactor-authentication/administrator/guardian-enrollment-email.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -description: Send an enrollment email (Guardian) ---- -# Sending a Guardian Enrollment Email to a User - -With this, an administrator can send an email to a user with a link for registering their device with Guardian. - -To send this email: - -1. Find and select the user in the [Users](${manage_url}/#/users) section of the dashboard. -2. Click on the **Actions** button on the top right of the screen. -3. Select **Send Enrollment Email (Guardian)** from the dropdown. - - ![](/media/articles/mfa/guardian-send-enrollment-email.png) - -The user will receive an enrollment email at their registered email address. - - ![](/media/articles/mfa/enrollment-email.png) - -Administrators can also [customize the email template](/email/templates) for the enrollment emails. - -## Restricting user-initiated enrollments - -Some organizations may want to only allow users to enroll a device with Guardian via an enrollment email, and prevent users from self-enrolling upon first sign in. This is possible using the _selfServiceEnrollment_ property on a Guardian rule. When set to true, or when the property is not set, the user may self-enroll. When set to false, the user may only enroll their device via an enrollment email. - -To edit the rule, go to the **Multifactor Auth** section and edit appropriately. - -```js -function (user, context, callback) { - - context.multifactor = { - provider: 'guardian', - selfServiceEnrollment: false, - }; - - callback(null, user, context); -} -``` diff --git a/articles/multifactor-authentication/administrator/guardian-for-select-clients.md b/articles/multifactor-authentication/administrator/guardian-for-select-clients.md deleted file mode 100644 index be8a633bc0..0000000000 --- a/articles/multifactor-authentication/administrator/guardian-for-select-clients.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -description: Guardian for Select Applications ---- -# Customize MFA for Select Applications - -Once you have enabled either MFA option, you will be presented with the **Customize MFA** code snippet that allows advanced configuration of Guardian's behavior via [Rules](/rules). One option is to apply Guardian authentication only to a subset of your applications. - -By default, Auth0 enables Guardian for all applications. - -```js -function (user, context, callback) { - - var CLIENTS_WITH_MFA = ['REPLACE_WITH_YOUR_CLIENT_ID']; - - // Apply Guardian only for the specified applications - if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) { - context.multifactor = { - provider: 'guardian', //required - }; - } - - callback(null, user, context); -} -``` - -If you choose to selectively apply multifactor authentication, you simply set the appropriate `clientID` values, and the code will be executed as part of a [Rule](/rules) whenever a user logs in. - -Once you have finished making your desired changes, click **Save**. diff --git a/articles/multifactor-authentication/administrator/guardian-for-select-users.md b/articles/multifactor-authentication/administrator/guardian-for-select-users.md deleted file mode 100644 index 971dead311..0000000000 --- a/articles/multifactor-authentication/administrator/guardian-for-select-users.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -description: Guardian for Select Users ---- -# Customize MFA for Select Users - -Once you have enabled either MFA option, you will be presented with the **Customize MFA** code snippet that allows advanced configuration of Guardian's behavior via [Rules](/rules). One option is to apply Guardian authentication only to a subset of your applications. - -By default, Auth0 enables Guardian for all applications. - -```js -function (user, context, callback) { - - var USERS_WITH_MFA = ['REPLACE_WITH_YOUR_USER_ID']; - - // Apply Guardian only for the specified users - if (USERS_WITH_MFA.indexOf(user.user_id) !== -1) { - context.multifactor = { - provider: 'guardian' - }; - } - - callback(null, user, context); -} -``` - -If you choose to selectively apply multifactor authentication, you simply set the appropriate `user_id` values, and the code will be executed as part of a [Rule](/rules) whenever a user logs in. - -Once you have finished making your desired changes, click **Save**. diff --git a/articles/multifactor-authentication/administrator/guardian-logs.md b/articles/multifactor-authentication/administrator/guardian-logs.md deleted file mode 100644 index f24252843c..0000000000 --- a/articles/multifactor-authentication/administrator/guardian-logs.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -description: Guardian Logging ---- -# Tracking your Users' MFA Events - -In the [Logs](${manage_url}/#/logs) section of the dashboard, you can see the various events related to your users signing up and signing in using MFA. - -![](/media/articles/mfa/logs.png) - -Here are all the possible events related to MFA: - -| Event Type | Description | -| --- | --- | -| `gd_unenroll` | When a device account is deleted | -| `gd_update_device_account` | When a device account is updated | -| `gd_send_pn` | When a push notification is sent | -| `gd_send_sms` | When a SMS is sent | -| `gd_start_auth` | Start second factor authentication | -| `gd_start_enroll` | Second factor auth enrollment is started | -| `gd_module_switch` | When changing feature config | -| `gd_tenant_update` | When tenant info has been updated | -| `gd_user_delete` | When calling (user delete => unenroll) | -| `gd_auth_failed` | When second factor login has failed | -| `gd_auth_succeed` | When second factor authentication has succeeded | -| `gd_recovery_succeed` | Recovery succeeded | -| `gd_recovery_failed` | Failed recovery | -| `gd_otp_rate_limit_exceed` | When One Time Password fails validation because rate limit is exceeded | -| `gd_recovery_rate_limit_exceed` | When recovery validation fails because rate limit is exceeded | - -These events can also be searched using the [Management APIv2](/api/management/v2#!/Logs) using [query string syntax](/api/management/v2/query-string-syntax). You can search criteria using the `q` parameter or you can search by a specific log ID. - -## Examples searching with the `q` parameter - -To see the events for users who are enrolling with MFA: - -`type: gd_start_enroll` - -To see all the times an SMS is sent: - -`type: gd_send_sms` diff --git a/articles/multifactor-authentication/administrator/index.md b/articles/multifactor-authentication/administrator/index.md deleted file mode 100644 index de0d47ba03..0000000000 --- a/articles/multifactor-authentication/administrator/index.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -description: How to enable and use Push Notifications and SMS for Guardian MFA. ---- - -# Guardian for Administrators - -Guardian is Auth0's multifactor authentication solution that provides a simple and secure way to implement MFA. When using Guardian with Auth0, users will be prompted for additional authentication from the Guardian mobile application, helping to provide a more secure login. - -This page contains information on how to enable and configure Guardian as an administrator. Information geared toward developers and users can be found under [additional documents](#additional-documents). - -## Guardian Basics -* [Guardian Push Notifications](/multifactor-authentication/administrator/push-notifications) -* [Guardian SMS Notifications](/multifactor-authentication/administrator/sms-notifications) - * [Configuring your Twilio Account](/multifactor-authentication/administrator/twilio-configuration) - * [Customize your text messages](/multifactor-authentication/administrator/sms-templates) -* [Turning off Guardian](/multifactor-authentication/administrator/disabling-mfa) - -## Managing Users -* [Applying Guardian to Specific Users](/multifactor-authentication/administrator/guardian-for-select-users) -* [Sending Guardian Enrollment Emails](/multifactor-authentication/administrator/guardian-enrollment-email) -* [Resetting Guardian Credentials](/multifactor-authentication/administrator/reset-user) -* [Guardian logs](/multifactor-authentication/administrator/guardian-logs) - -## Customization -* [Customize the Guardian Widget](/multifactor-authentication/administrator/customizing-widget) -* [Advanced Customization of the Guardian Widget](https://github.com/auth0/auth0-guardian.js/tree/master/example) -* [Customizing Guardian Rules and Behavior](/multifactor-authentication/custom) - - -## Additional Documents -* [Guardian for Developers](/multifactor-authentication/developer) -* [Guardian for Users](/multifactor-authentication/guardian/user-guide) diff --git a/articles/multifactor-authentication/administrator/push-notifications.md b/articles/multifactor-authentication/administrator/push-notifications.md deleted file mode 100644 index 90694a12c5..0000000000 --- a/articles/multifactor-authentication/administrator/push-notifications.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -description: How to enable and use push notifications for Guardian. ---- -# Guardian Push Notifications - -To enable Push Notifications for Guardian for your users, go to the [Multifactor Auth](${manage_url}/#/guardian) section of the Auth0 dashboard. Then toggle the **Push Notification** slider to enable it. - -![](/media/articles/mfa/guardian-dashboard.png) - -New users signing up will be prompted to download the Guardian app from either the App Store or Google Play. Once they indicate that they downloaded the app, a code will appear. They will have five minutes to scan the code with the app before it expires. After the code has been successfully scanned, users will see a confirmation screen which includes a recovery code. They need to have this recovery code to login without their mobile device. If they lose both the recovery code and their mobile device, you will need to [reset their MFA](#reset-an-mfa-for-a-user). Then they will receive a push notification to their device and they will be logged in. - -Users that were previously registered before you enabled MFA will need to complete the same process as new users on their next login. diff --git a/articles/multifactor-authentication/administrator/reset-user.md b/articles/multifactor-authentication/administrator/reset-user.md deleted file mode 100644 index 68c1c21288..0000000000 --- a/articles/multifactor-authentication/administrator/reset-user.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -description: Reset a User's MFA ---- -# Resetting a User's multifactor account - -If a user has lost their mobile device they can use their recovery code to log in. If they do not have recovery code, they will need their tenant administrator to reset their multifactor. - -To reset a user's multifactor authentication: - -1. Find and select the user in the [Users](${manage_url}/#/users) section of the dashboard. -2. Once you have selected the affected user, click on the **Actions** button on the top right of the screen. -3. Select **Reset Multifactor Authentication** from the dropdown. -4. There will be a pop up box to confirm your decision. Click **YES, RESET IT** to reset the user's MFA. - - ![](/media/articles/mfa/reset-mfa.png) - -The next time the user logs in they will need to setup their MFA just like a new user. diff --git a/articles/multifactor-authentication/administrator/sms-notifications.md b/articles/multifactor-authentication/administrator/sms-notifications.md deleted file mode 100644 index 5421a85c58..0000000000 --- a/articles/multifactor-authentication/administrator/sms-notifications.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -description: How to enable and use push notifications for Guardian. ---- -# SMS notifications - -You can enable SMS messages to use as a form of multifactor authentication. This is also under the [Multifactor Auth](${manage_url}/#/guardian) section of the dashboard. By toggling the **SMS** slider, you can enable using SMS for sign in and sign up for your application. SMS can be used as your only form of MFA or in addition to Push Notifications. - -Your users must have a device capable of using SMS to use this option. If your users are unable to always receive SMS messages (such as when traveling), they will be unable sign up with SMS and unable to log in without the recovery code. - -When your users sign up with SMS, they enter their phone number's country code and mobile phone number. - -![](/media/articles/mfa/sms.png) - -After sign up, they receive a six digit code to their phone. They need to enter this code into the box, and then they will get a recovery code. They will need this code to login if they do not have their device. If they have lost their recovery code and device, you will need to [reset the user's MFA](/multifactor-authentication/administrator/reset-user). diff --git a/articles/multifactor-authentication/administrator/sms-templates.md b/articles/multifactor-authentication/administrator/sms-templates.md deleted file mode 100644 index ecea14b661..0000000000 --- a/articles/multifactor-authentication/administrator/sms-templates.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -description: Customize SMS Messages ---- - -# Customize SMS Messages - -To customize the SMS messages sent by Auth0 during enrollment (when associating a device to Guardian) or verification (when an authentication message is sent to the device), do the following: - -First, go to ([Multifactor Auth With Guardian](${manage_url}/#/guardian), then click on the **SMS** box to configure your SMS settings. - -![](/media/articles/mfa/sms-config.png) - -You have two fields to customize your messages: -* **Enrollment Template**: the message sent by Auth0 during device enrollment. -* **Verification Template**: the message sent by Auth0 to verify the possession of the device. - -[Liquid](https://github.com/Shopify/liquid/wiki/Liquid-for-Designers) syntax is the supported templating engine to use when accessing user attributes in SMS templates. The following attributes are available: -* `code`: The Enrollment/Verification code. -* `requestInfo.lang`: The browser language (ie, `es-AR,es;q=0.8`, `en-US,en`, and so on.). -* `tenant.friendlyName`: The **Friendly Name** set in [Tenant Settings](${manage_url}/#/tenant). diff --git a/articles/multifactor-authentication/administrator/twilio-configuration.md b/articles/multifactor-authentication/administrator/twilio-configuration.md deleted file mode 100644 index ea2d015252..0000000000 --- a/articles/multifactor-authentication/administrator/twilio-configuration.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -description: Configuring Twilio for Guardian ---- - -# Configuring Twilio for Guardian SMS - -When initially setting up SMS, you have up to 100 SMS to be used for testing. This limit can be removed by setting up a Twilio account. To prevent malicious login attempts, your users will always be limited to up to 10 SMS/Hour (replenishing one message an hour, up to 10). - -Click on the **SMS** box to configure your SMS settings. - -![](/media/articles/mfa/sms-config.png) - -## 1. Open an account with Twilio - -You will need a [Twilio Account SID](https://www.twilio.com/help/faq/twilio-basics/what-is-an-application-sid) and a [Twilio Auth Token](https://www.twilio.com/help/faq/twilio-basics/what-is-the-auth-token-and-how-can-i-change-it). These are the Twilio API credentials that Auth0 will use to send an SMS to the user. You may also need to enable permissions for your [geographic region](https://support.twilio.com/hc/en-us/articles/223181108-How-International-SMS-Permissions-work). - -## 2. Configure the connection - -Enter your **Twilio Account SID** and **Twilio Auth Token** in the appropriate fields. - -Choose your **SMS Source**. - -* If you choose **Use From**, you will need to enter the **From** phone number that users will see as the sender of the SMS. You may also configure this in Twilio. - -* If you choose **Use Copilot **, you will need to enter a [Copilot SID](https://www.twilio.com/docs/api/rest/sending-messages-copilot). - -Click **SAVE**. diff --git a/articles/multifactor-authentication/api/_authenticator-before-start.md b/articles/multifactor-authentication/api/_authenticator-before-start.md deleted file mode 100644 index 282bd635df..0000000000 --- a/articles/multifactor-authentication/api/_authenticator-before-start.md +++ /dev/null @@ -1,6 +0,0 @@ -## Before you start - -Before you can use the MFA APIs, you'll need to: - -* Enable the MFA grant type for your application. You can enable the MFA grant by going to [Applications > Your Application > Advanced Settings > Grant Types](${manage_url}/#/applications) and selecting MFA. -* Create a rule that sets Guardian as the MFA provider. For more information, see [Guardian for Administrators](/multifactor-authentication/administrator). \ No newline at end of file diff --git a/articles/multifactor-authentication/api/challenges.md b/articles/multifactor-authentication/api/challenges.md deleted file mode 100644 index 6aab03043c..0000000000 --- a/articles/multifactor-authentication/api/challenges.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: Associate a New Authenticator for Use with Multifactor Authentication -description: How to associate a new authenticator for use with MFA using the new MFA API endpoints ---- -# Multifactor Authentication Challenges - -You can trigger MFA challenges for enrolled authenticators by calling the `/mfa/challenge` endpoint. - -## OTP Challenges - -To trigger an OTP challenge, make the appropriate `POST` call to `mfa/challenge`. - -```har -{ - "method": "POST", - "url": "https://${account.namespace}/mfa/challenge", - "postData": { - "mimeType": "application/json", - "text": "{ \"client_id\": \"YOUR_CLIENT_ID\", \"challenge_type\": \"otp\", \"mfa_token\": \"Fe26.2**05...\" }" - } -} -``` - -If successful, you'll receive the following response: - -```json -{ - "challenge_type": "otp" -} -``` - -Proceed with the authentication process as usual. - -## OOB Challenges - -To trigger an OOB challenge, make the appropriate `POST` call to `mfa/challenge`. - -```har -{ - "method": "POST", - "url": "https://${account.namespace}/mfa/challenge", - "postData": { - "mimeType": "application/json", - "text": "{ \"client_id\": \"YOUR_CLIENT_ID\", \"challenge_type\": \"oob\", \"authenticator_id\": \"sms|dev_s...O\", \"mfa_token\": \"Fe26.2**05...\" }" - } -} -``` - -If successful, you'll receive the following response, as well as an SMS message containing the required six-digit code: - -```json -{ - "challenge_type": "oob", - "oob_code": "asdae35fdt5...oob_code_redacted", - "binding_method": "prompt" -} -``` - -Proceed with the authentication process as usual. - -## Posting the MFA Responses - -You can post MFA OTP or MFA OOB responses using the `/oauth/token` endpoint. \ No newline at end of file diff --git a/articles/multifactor-authentication/api/faq.md b/articles/multifactor-authentication/api/faq.md deleted file mode 100644 index 27c7f6d579..0000000000 --- a/articles/multifactor-authentication/api/faq.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: Multifactor Authentication API FAQ -description: Frequently asked questions about MFA and its API ---- - -# FAQ: MFA and the MFA API - -The following is a list of frequently-asked questions about multifactor authentication (MFA) and Auth0's MFA API. - -## When can I self-associate authenticators during the authorization process? - -You can self-associate authenticators if you don't have any active authenticators. If there are one or more active authenticators, you cannot self-associate a new authenticator. - -## With push notifications, why do I get two authenticators instead of one? - -Push notifications have two authenticators. One to trigger the push notification and the other for a time-based one-time password (TOTP). The TOTP authenticator lets you authenticate if you are offline or can't receive the push notification. - -## Why can I associate more than one authenticator with a particular end user? - -Associating multiple authenticators with a user can provide flexibility for the user. - -For example, a user may enable push notifications on their phone and TOTP codes on their computer. If the user is unable to use one of the devices, they can use the other (and not have to rely on the recovery code). - -## When should I use self-association during authorization vs. association outside the authorization process? - -You can self-associate during the authorization process if there are no active authenticators. Associating authenticators outside the authorization process (generally used to add additional authenticators) requires additional programming, such as the use of [rules](/rules). - -## What happens if I delete an authenticator? - -If you delete an authenticator and have multiple authenticators associated, you can use the remaining authenticators. - -If you delete a push authenticator, the associated one-time password (OTP) authenticator is also deleted. If you delete the OTP authenticator, the associated push authenticator is deleted. - -Recovery codes can only be deleted by an administrator using the [Management API](/multifactor-authentication/api/manage#delete-authenticators). - -## If I'm using Guardian, what happens if I delete one of the authenticators? - -Guardian behaves as you'd expect when deleting authenticators. If you delete the push notification authenticator, Guardian removes both it and the OTP authenticator. \ No newline at end of file diff --git a/articles/multifactor-authentication/api/index.md b/articles/multifactor-authentication/api/index.md deleted file mode 100644 index bf554533f5..0000000000 --- a/articles/multifactor-authentication/api/index.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: Multifactor Authentication API -description: Overview of available multifactor authentication APIs ---- - -# Multifactor Authentication API - -The Multifactor Authentication (MFA) API endpoints allow you to enforce MFA when users interact with [the Token endpoints](/api/authentication#get-token), as well enroll and manage user authenticators. - -## Multifactor authentication with the Token endpoint - -We have expanded MFA support on the Token endpoints to cover the following use cases: - -* Use MFA with the [password](/api-auth/grant/password), [password-realm](/api-auth/grant/password#realm-support), and [refresh-token](/tokens/refresh-token/current#use-a-refresh-token) grants. -* Completion of first-time enrollment by users during authentication. -* Selection of the desired MFA authenticator by the user before they execute the MFA challenge. - -### More information - -* [Manually triggering MFA challenges](/multifactor-authentication/api/challenges) -* [Using one-time passwords as the MFA challenge](/multifactor-authentication/api/otp) -* [Using SMS messages as the MFA challenge](/multifactor-authentication/api/oob) -* [Tutorial: How to use MFA with the Resource Owner Password Grant](/api-auth/tutorials/multifactor-resource-owner-password) - -## Enrollment and management of user authenticators - -The MFA Associate API allows you to create, read, update, and delete authenticators. You can use this API to power user interfaces where users can manage MFA enrollments, or add and remove authenticators. - -This enables users to enroll more than one device and select a fallback MFA mechanism in case the primary one is not available. For example, your user might use OTP when their SMS network is not present or unresponsive. - -Check out [Manage Authenticators](/multifactor-authentication/api/manage) for more on listing or deleting authenticators. - -<%= include('./_authenticator-before-start') %> - -If you are using the MFA API in conjunction with the [Token endpoint](/api/authentication#get-token), you must meet the requirements of the corresponding grant. - -## Limitations - -* The MFA API is designed to work with the Guardian Provider. Support for other providers will be provided in future releases. - -* Support for authenticator selection is currently limited to the Token Endpoint. Auth0 is working to extend support to [Hosted MFA Pages](/hosted-pages/guardian. If users have more than one authenticator enrolled, the most-recently enrolled option will be used by the Hosted MFA Pages. \ No newline at end of file diff --git a/articles/multifactor-authentication/api/manage.md b/articles/multifactor-authentication/api/manage.md deleted file mode 100644 index 09bffa67aa..0000000000 --- a/articles/multifactor-authentication/api/manage.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: Manage the Authenticators for Multifactor Authentication -description: How to manage your MFA authenticators ---- - -# Manage the Authenticators - -Auth0 provides several API endpoints to help you manage the authenticators you're using with an application for multifactor authentication (MFA). - -## Before you start - -The MFA endpoints require an [Access Token](/tokens/access-token) with: - -- `audience`: Set to `https://${account.namespace}/mfa` -- `scope`: Include `enroll` for enrollment, `read:authenticators` to list authenticators, and `remove:authenticators` to delete authenticators. - -For example: - -```har -{ - "method": "POST", - "url": "https://${account.namespace}/oauth/token", - "headers": [{ - "name": "Content-Type", "value": "application/json" - }], - "postData": { - "mimeType": "application/json", - "text": "{\"grant_type\":\"password\",\"username\": \"user@example.com\",\"password\": \"pwd\",\"audience\": \"https://${account.namespace}/mfa\", \"scope\": \"enroll read:authenticators remove:authenticators\", \"client_id\": \"${account.clientId}\", \"client_secret\": \"YOUR_CLIENT_SECRET\"}" - } -} -``` - -## List Authenticators - -To get a list of the authenticators you've associated and can be used with your tenant, you can make the appropriate call to the `/mfa/authenticators` endpoint: - -```har -{ - "method": "GET", - "url": "https://${account.namespace}/mfa/authenticators", - "headers": [{ - "name": "Authorization", - "value": "Bearer ACCESS_TOKEN" - }] -} -``` - -You should receive information about the authenticator type(s) in the response: - -```json -[ - { - "authenticator_type": "recovery-code", - "id": "recovery-code|dev_IsBj5j3H12VAdOIj", - "active": true - }, - { - "authenticator_type": "otp", - "id": "totp|dev_nELLU4PFUiTW6iWs", - "active": true, - }, - { - "authenticator_type": "oob", - "oob_channel": "sms", - "id": "sms|dev_sEe99pcpN0xp0yOO", - "name": "+1123XXXXX", - "active": true - } -] -``` - -## Delete Authenticators - -To delete an authenticator you've associated, send a delete request to the `/mfa/authenticators/AUTHENTICATOR_ID` endpoint (be sure to replace `AUTHENTICATOR_ID` with your authenticator ID). - -```har -{ - "method": "DELETE", - "url": "https://${account.namespace}/mfa/authenticators/AUTHENTICATOR_ID", - "headers": [{ - "name": "Authorization", - "value": "Bearer ACCESS_TOKEN" - }] -} -``` - -If the authenticator was deleted, a 204 response is returned. diff --git a/articles/multifactor-authentication/api/oob.md b/articles/multifactor-authentication/api/oob.md deleted file mode 100644 index b2cd5210ef..0000000000 --- a/articles/multifactor-authentication/api/oob.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -title: Associate an Out-of-Band Authenticator -description: Configure your application so users can self-associate out-of-band (OOB) authenticators. ---- - -# Associate an Out-of-Band Authenticator - -In this tutorial, you'll learn how to configure your application so users can self-associate out-of-band (OOB) authenticators. - -<%= include('./_authenticator-before-start') %> - -## 1. Get the MFA token - -When a user begins the authorization process without an active authenticator associated with their account, they will trigger the following MFA response when calling the `/oauth/token` endpoint: - -```json -{ - "error": "mfa_required", - "error_description": "Multifactor authentication required", - "mfa_token": "Fe26...Ha" -} -``` - -In the next step, use the MFA token (`mfa_token`) instead of the standard access token to request association of a new authenticator. - -## 2. Request association of the authenticator - -Next, make a `POST` request to the `/mfa/associate` endpoint to request association of your authenticator. Remember to use the MFA token from the previous step. - -To associate an authenticator where the challenge type is an SMS message containing a code the user provides, make the following `POST` request to the `/mfa/associate` endpoint. Be sure to replace the placeholder values in the payload body shown below as appropriate. - -```har -{ - "method": "POST", - "url": "https://${account.namespace}/mfa/associate", - "headers": [{ - "name": "Authorization", - "value": "Bearer MFA_API_ACCESS_TOKEN" - }], - "postData": { - "mimeType": "application/json", - "text": "{ \"authenticator_types\": [\"oob\"], \"oob_channels\": [\"sms\"], \"phone_number\": \"+11...9\" }" - } -} -``` - -If successful, you'll receive a response like this: - -```json -{ - "authenticator_type": "oob", - "oob_channel": "sms", - "recovery_codes": [ "N3BGPZZWJ85JLCNPZBDW6QXC" ], - "oob_code": "ata6daXAiOi..." -} -``` - -### Recovery Codes - -If this is the first time you're associating an authenticator, you'll notice your response includes `recovery_codes`. This is used to access your account in the event that you lose access to the account or device used for your second factor authentication. These are one-time usable codes, and new ones are generated as necessary. - -## 3. Confirm the authenticator association - -Once you've associated an authenticator, **you must use it at least once to confirm the association**. - -You can check if an authenticator has been confirmed by calling the [`mfa/authenticators` endpoint](/multifactor-authentication/api/manage#list-authenticators). If confirmed, the value of `active` is `true`. - -To confirm the association of an authenticator using SMS messages for the MFA challenge, make a `POST` request to the `oauth/token` endpoint. Be sure to replace the placeholder values in the payload body shown below as appropriate. - -```har -{ - "method": "POST", - "url": "https://${account.namespace}/oauth/token", - "postData": { - "mimeType": "application/json", - "text": "{ \"client_id\": [\"YOUR_CLIENT_ID\"], \"grant_type\": \"http://auth0.com/oauth/grant-type/mfa-oob\", \"mfa_token\": \"YOUR_MFA_TOKEN\", \"oob_code\": \"ata...i0i\", \"binding_code\": \"000000\" }" - } -} -``` - -If your call was successful, you'll receive a response like this: - -``` -{ - "access_token": "eyJ...i", - "expires_in": 600, - "scope": "enroll read:authenticators remove:authenticators", - "token_type": "Bearer" -} -``` - -At this point, your authenticator is fully associated and ready to be used. \ No newline at end of file diff --git a/articles/multifactor-authentication/api/otp.md b/articles/multifactor-authentication/api/otp.md deleted file mode 100644 index 173d98add6..0000000000 --- a/articles/multifactor-authentication/api/otp.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: Associate a One-Time Password Authenticator -description: Configure your application so users can self-associate one-time password (OTP) authenticators. ---- - -# Associate a One-Time Password Authenticator - -In this tutorial, you'll learn how to configure your application so users can self-associate one-time password (OTP) authenticators. - -<%= include('./_authenticator-before-start') %> - -## 1. Get the MFA Token - -When a user begins the authorization process without an active authenticator associated with their account, they will trigger the an `mfa_required` error when calling the `/oauth/token` endpoint. For example: - -```har -{ - "method": "POST", - "url": "https://${account.namespace}/oauth/token", - "headers": [ - { "name": "Content-Type", "value": "application/json" } - ], - "postData": { - "mimeType": "application/json", - "text": "{\"grant_type\":\"password\",\"username\": \"user@example.com\",\"password\": \"pwd\",\"audience\": \"https://someapi.com/api\", \"scope\": \"read:sample\", \"client_id\": \"${account.clientId}\", \"client_secret\": \"YOUR_CLIENT_SECRET\"}" - } -} -``` - -The `mfa_required` error will look like this: - -```json -{ - "error": "mfa_required", - "error_description": "Multifactor authentication required", - "mfa_token": "Fe26...Ha" -} -``` - -In the next step, use the `mfa_token` value instead of the standard Access Token to request association of a new authenticator. - -## 2. Request association of the authenticator - -Next, make a `POST` request to the `/mfa/associate` endpoint to request association of your authenticator. Remember to use the `mfa_token` from the previous step. - -To associate an authenticator where the challenge type is an OTP code the user provides, make the following `POST` request to the `/mfa/associate` endpoint. Be sure to replace the placeholder values in the payload body shown below as appropriate. - -```har -{ - "method": "POST", - "url": "https://${account.namespace}/mfa/associate", - "headers": [{ - "name": "Authorization", - "value": "Bearer ACCESS_TOKEN" - }], - "postData": { - "mimeType": "application/json", - "text": "{ \"authenticator_types\": [\"otp\"] }" - } -} -``` - -If successful, you'll receive a response like this: - -```json -{ - "authenticator_type": "otp", - "secret": "EN...S", - "barcode_uri": "otpauth...period=30", - "recovery_codes": [ "N3B...XC"] -} -``` - -In the next step, you'll need the one-time password (`otp`), which can be obtained by using the `barcode_uri` to generate a QR code that can be scanned by the OTP generator of your choice (such as Guardian). - -You might also consider displaying the `secret` in plain text so that your users can copy and paste it directly into the OTP generator (this is especially helpful for users on desktop applications). - -### Recovery Codes - -If this is the first time you're associating an authenticator, you'll notice that your response includes `recovery_codes`. This is used to access your account in the event that you lose access to the account or device used for your second factor authentication. These are one-time usable codes, and new ones are generated as necessary. - -## 3. Confirm the authenticator association - -Once you've associated an authenticator, **you must use it at least once to confirm the association**. - -You can check if an authenticator has been confirmed by calling the [`mfa/authenticators` endpoint](/multifactor-authentication/api/manage#list-authenticators). If confirmed, the value of `active` is `true`. - -To confirm the association of an authenticator using OTP, make a `POST` request to the `oauth/token` endpoint with the `otp` (from the previous step after turning the `barcode_uri` into a QR code). - -```har -{ - "method": "POST", - "url": "https://${account.namespace}/oauth/token", - "postData": { - "mimeType": "application/json", - "text": "{ \"client_id\": [\"YOUR_CLIENT_ID\"], \"grant_type\": \"http://auth0.com/oauth/grant-type/mfa-otp\", \"mfa_token\": \"YOUR_MFA_TOKEN\", \"otp\": \"000000\" }" - } -} -``` - -If the call was successful, you'll receive a response like this: - -``` -{ - "access_token": "eyJ...d", - "expires_in": 600, - "scope": "enroll read:authenticators remove:authenticators", - "token_type": "Bearer" -} -``` - -At this point, your authenticator is fully associated and ready to be used. \ No newline at end of file diff --git a/articles/multifactor-authentication/custom/custom-landing.md b/articles/multifactor-authentication/custom/custom-landing.md deleted file mode 100644 index 0322c8245b..0000000000 --- a/articles/multifactor-authentication/custom/custom-landing.md +++ /dev/null @@ -1,136 +0,0 @@ ---- -title: Configuring Custom Multifactor Authentication -url: /multifactor-authentication/custom -description: Examples for configuring custom MFA implementations. ---- -# Configuring Custom MFA - -You may configure [rules](/rules) for custom MFA processes, which allow you to define the conditions that will trigger additional authentication challenges, such as changes in geographic location or logins from unrecognized devices. - -## Implementing Contextual MFA - -The exact requirements for configuring Contextual MFA will vary. Below are sample snippets you might consider using as you customize your specific solution. - -### Change the frequency of authentication requests - -When using the Guardian multi-factor application, by default users are given the option to be remembered and skip MFA for a period of 30 days. To disable this choice for users, set the `allowRememberBrowser` field to `false`. - -For other types of MFA, users are remembered for 30 days by default, or when `allowRememberBrowser` is explicitly set to `true`. You can disable this by setting `allowRememberBrowser` to `false`. - -Note that some older rules may use the field `ignoreCookie` here. While deprecated, that field will still function as expected, and will force multifactor authentication at every login. - -```JS -function (user, context, callback) { - - if (conditionIsMet()){ - context.multifactor = { - allowRememberBrowser: false, - provider: 'guardian' - }; - } - - callback(null, user, context); -} -``` - -### Access from an extranet - -You can have Auth0 request MFA from users whose requests originate from outside the corporate network: - -```js -function (user, context, callback) { - var ipaddr = require('ipaddr.js'); - var corp_network = "192.168.1.134/26"; - - var current_ip = ipaddr.parse(context.request.ip); - if (!current_ip.match(ipaddr.parseCIDR(corp_network))) { - context.multifactor = { - provider: 'guardian', - - // optional, defaults to true. Set to false to force Guardian authentication every time. - // See https://auth0.com/docs/multifactor-authentication/custom#change-the-frequency-of-authentication-requests for details - allowRememberBrowser: false - }; - } - - callback(null, user, context); -} -``` - -### Access from a different device or location - -If the user makes a request from an IP address that Auth0 has not already associated with them, you can configure Auth0 to request MFA. - -```js -function (user, context, callback) { - - var deviceFingerPrint = getDeviceFingerPrint(); - user.app_metadata = user.app_metadata || {}; - - if (user.app_metadata.lastLoginDeviceFingerPrint !== deviceFingerPrint) { - - user.app_metadata.lastLoginDeviceFingerPrint = deviceFingerPrint; - - context.multifactor = { - allowRememberBrowser: false, - provider: 'guardian' - }; - - auth0.users.updateAppMetadata(user.user_id, user.app_metadata) - .then( function() { - callback(null, user, context); - }) - .catch( function(err) { - callback(err); - }); - } else { - callback(null, user, context); - } - - function getDeviceFingerPrint() { - - var shasum = crypto.createHash('sha1'); - shasum.update(context.request.userAgent); - shasum.update(context.request.ip); - return shasum.digest('hex'); - - } -} -``` - -## Use a Custom MFA Service - -If you are using an MFA provider that does not have Auth0 built-in support or if you are using a service you have created, you can use the [redirect](/rules/redirect) protocol for the integration. - -By using the redirect protocol, you interrupt the authentication transaction and redirect the user to a specified URL where they are asked for MFA. If authentication is successful, Auth0 will continue processing the request. - -Some MFA options you can implement using the redirect protocol include: - -* A one-time code sent via SMS -* A personally identifying question (such as about the user's parents, childhood friends, and so on) -* Integration with specialized providers, such as those that require hardware tokens - -To use the redirect protocol, edit the `URL` field: - -```JS -function (user, context, callback) { - - if (condition() && context.protocol !== 'redirect-callback'){ - context.redirect = { - url: 'https://your_custom_mfa' - }; - } - - if (context.protocol === 'redirect-callback'){ - //TODO: handle the result of the MFA step - } - - callback(null, user, context); -} -``` - -## Additional Notes - -* A tutorial is available on using MFA with the [Resource Owner](/api-auth/tutorials/multifactor-resource-owner-password) endpoint. -* If you are using MFA for database connections that use Popup Mode, set `sso` to `true` when defining the options in [auth0.js](/libraries/auth0js) or [Lock](/libraries/lock). If you fail to do this, users will be able to log in without MFA. -* If you are using MFA after an authentication with one or more social providers, you may need to use your own application `ID` and `Secret` in the connection to the provider's site in place of the default Auth0 development credentials. For instructions on how to get the credentials for each social provider, select your particular from the list at: [Identity Providers](/identityproviders). diff --git a/articles/multifactor-authentication/developer/custom-enrollment-ticket.md b/articles/multifactor-authentication/developer/custom-enrollment-ticket.md deleted file mode 100644 index 021a24da44..0000000000 --- a/articles/multifactor-authentication/developer/custom-enrollment-ticket.md +++ /dev/null @@ -1,124 +0,0 @@ ---- -description: Describes how to create an enrollment ticket from api ---- -# Custom Enrollment - -In addition to [directly sending emails to enroll users](/multifactor-authentication/administrator/guardian-enrollment-email), it is also possible to manage users' enrollments by creating _enrollment tickets_ via the [post_ticket API](/api/management/v2#!/Guardian/post_ticket). - -This API will return an _enrollment ticket_ containing a `ticket_id` and a `ticket_url`, which can be used to enroll a user. - -The `ticket_url` can be delivered to the user (for instance, via email) and used to kick off the enrollment process. - -Alternatively, the ticket can be leveraged inside the Guardian [Hosted Page](${manage_url}/#/guardian_mfa_page) to customize the Guardian widget's appearance: - -```html - - - - 2nd Factor Authentication - - - - - - - -
    -
    -

    Welcome! {{ userData.email }} enroll your device

    -
    - - -
    -
    -
    -
    - - - - - - -``` - -Since this hosted page is used for displaying the Guardian widget in both enrollment and standard multifactor login scenarios, it's important to note that the existence of the `ticket` variable can be used to determine which scenario is being used, and to control the content accordingly. - -For example, the following code could be used to used to alter the message: - -```html -{% if ticket %} -

    Welcome, {{ userData.email }}, enroll your device below

    -{% else %} -

    Welcome back, {{ userData.email }}, authenticate below

    -{% endif %} -```` - -Note that this conditional logic around the existence of the `ticket` variable is also used in the initialization of the `Auth0MFAWidget` above. - -## Keep reading - -::: next-steps -* [Sending Guardian Enrollment Emails](/multifactor-authentication/administrator/guardian-enrollment-email) -::: diff --git a/articles/multifactor-authentication/developer/index.md b/articles/multifactor-authentication/developer/index.md deleted file mode 100644 index eb1f48b360..0000000000 --- a/articles/multifactor-authentication/developer/index.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: Developer Documentation for Guardian -url: /multifactor-authentication/developer -description: Developer Documentation for Guardian ---- - -# Developer Resources for Guardian - -At Auth0, we believe in giving developers the tools they need to get their jobs done. With Guardian, developers are able to customize their users' experience, and even build their own applications on top of our multifactor capabilities. - -## Getting started with Guardian within your Application -Most often, administrators will [manage multifactor configuration for an application](multifactor-authentication/guardian/admin-guide). For more advanced use cases, Guardian provides developers the ability to control user access directly. -* [Example Application using Guardian for Multifactor Authentication](https://github.com/auth0/guardian-example) -* [How to do 'Step-Up' Authentication with Guardian](/multifactor-authentication/developer/step-up-with-acr) - -## Customize the Guardian Widget -Use our Guardian client libraries to apply the look-and-feel of your organization. -* [Client library for Auth0 Guardian](https://github.com/auth0/auth0-guardian.js) -* [Creating a Custom Guardian Widget](https://github.com/auth0/auth0-guardian.js/tree/master/example) - -## Manage Enrollments -Directly customize the enrollment process for your users. -* [Custom enrollment](/multifactor-authentication/developer/custom-enrollment-ticket) - -## Build Custom Mobile Applications -Developers can build custom _white-label_ Guardian-like applications, or add multifactor functionality into their own applications. -* [Getting Started with Guardian for Android](/multifactor-authentication/developer/libraries/android) -* [Getting Started with Guardian for iOS](/multifactor-authentication/developer/libraries/ios) diff --git a/articles/multifactor-authentication/developer/libraries/android/index.md b/articles/multifactor-authentication/developer/libraries/android/index.md deleted file mode 100644 index 9d5b186a7d..0000000000 --- a/articles/multifactor-authentication/developer/libraries/android/index.md +++ /dev/null @@ -1,167 +0,0 @@ ---- -title: Getting Started with Guardian for Android -url: /multifactor-authentication/developer/libraries/android -description: Installation, usage, and configuration options guide for Guardian for Android ---- - -# Guardian for Android -The [Guardian for Android Software Development Kit](https://github.com/auth0/Guardian.Android) allows developers to create Android apps with Guardian functionality, providing easy and secure access to multifactor authentication with push notifications. For example, this toolkit gives you the power to build a 'white label' version of the Guardian application for your users, using your own look-and-feel. - -More information can be found on Guardian [here](/multifactor-authentication/guardian). For general multifactor discussion, read more [here](/multifactor-authentication). - -Get started using Guardian for Android below, or, if you're looking for a specific document, try the listing of [additional documents](#additional-documents) related to Guardian for Android. - -## Requirements - -Android API level 15+ is required in order to use the Guardian Android SDK. - -## Installation - -Guardian is available both in [Maven Central](http://search.maven.org) and [JCenter](https://bintray.com/bintray/jcenter). To start using *Guardian* add these lines to your `build.gradle` dependencies file: - -```gradle -compile 'com.auth0.android:guardian-sdk:0.2.0' -``` - -::: note -You can check for the latest version on the repository [Releases](https://github.com/auth0/GuardianSDK.Android/releases) tab, in [Maven](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.auth0.android%22%20AND%20a%3A%22guardian%22), or in [JCenter](https://bintray.com/auth0/android/Guardian.Android). -::: - -After adding your Gradle dependency, make sure to remember to sync your project with Gradle files. - -## Dashboard Settings - -To enable Guardian Push Notifications for your users, go to the [Multifactor Auth](${manage_url}/#/guardian) section of the dashboard. Then toggle the **Push Notification** slider to enable it. - -![](/media/articles/mfa/guardian-dashboard.png) - -## SNS configuration - -For your native application to receive push notifications from Guardian, you will need to override the default SNS settings. Follow the instructions [here](/multifactor-authentication/developer/sns-configuration). - -## Using the SDK - - -`Guardian` is the core of the SDK. You'll need to create an instance of this class for your specific tenant/url. - -```java -Uri url = Uri.parse("https://tenant.guardian.auth0.com/"); - -Guardian guardian = new Guardian.Builder() - .url(url) - .build(); -``` - -or - -```java -String domain = "tenant.guardian.auth0.com"; - -Guardian guardian = new Guardian.Builder() - .domain(domain) - .build(); -``` - - -### Enroll - -The link between the second factor (an instance of your app on a device) and an Auth0 account is referred to as an enrollment. - -You can create an enrollment using the `Guardian.enroll` function, but first you'll have to create a new pair of RSA keys for it. The private key will be used to sign the requests to allow or reject a login. The public key will be sent during the enroll process so the server can later verify the request's signature. - -```java -KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); -keyPairGenerator.initialize(2048); // you MUST use at least 2048 bit keys -KeyPair keyPair = keyPairGenerator.generateKeyPair(); -``` - -Next, obtain the enrollment information by scanning the Guardian QR code, and use it to enroll the account: - -```java -Uri enrollmentUriFromQr = ...; // the URI obtained from a Guardian QR code - -CurrentDevice device = new CurrentDevice(context, "gcmToken", "deviceName"); - -Enrollment enrollment = guardian - .enroll(enrollmentUriFromQr, device, keyPair) - .execute(); -``` - -Alternatively, you can execute the request in a background thread: - -```java -guardian - .enroll(enrollmentUriFromQr, device, keyPair) - .start(new Callback { - @Override - void onSuccess(Enrollment enrollment) { - // we have the enrollment data - } - - @Override - void onFailure(Throwable exception) { - // something failed - } - }); -``` - -The `deviceName` and `gcmToken` are data that you must provide: - -- The `deviceName` is the name that you want for the enrollment. It will be displayed to the user when the second factor is required. -- The `gcmToken` is the token for Google's GCM push notification service. See the [docs](https://developers.google.com/cloud-messaging/android/client#sample-register) for more information about the GCM token. - -### Unenroll - -To disable multifactor authentication you can delete the enrollment: - -```java -guardian - .delete(enrollment) - .execute(); // or start(new Callback<> ...) -``` - -### Allow a login request - -Once you have the enrollment in place, you will receive a GCM push notification every time the user needs multifactor authentication. - -Guardian provides a method to parse the `Bundle` received from GCM and return a `Notification` instance ready to be used. - -```java -// at the GCM listener you receive a Bundle -@Override -public void onMessageReceived(String from, Bundle data) { - Notification notification = Guardian.parseNotification(data); - if (notification != null) { - // you received a Guardian notification, handle it - handleGuardianNotification(notification); - return; - } - - /* handle other push notifications you might be using ... */ -} -``` - -Once you have the notification instance, you can easily approve the authentication request by using the `allow` method. You'll also need the enrollment that you obtained previously. If there are multiple enrollments, be sure to use the one that has the same `id` as the notification (the `enrollmentId` property). - -```java -guardian - .allow(notification, enrollment) - .execute(); // or start(new Callback<> ...) -``` - -### Reject a login request - -To deny an authentication request, use `reject` instead. You can optionally add a reason for the rejection, which will be available in the guardian logs. - -```java -guardian - .reject(notification, enrollment) // or reject(notification, enrollment, reason) - .execute(); // or start(new Callback<> ...) -``` - - - -## Additional Documents - -* [Configuring Amazon SNS with Guardian](/multifactor-authentication/developer/sns-configuration) -* [Getting Started with Google Cloud Messaging for Android](https://docs.aws.amazon.com/sns/latest/dg/mobile-push-gcm.html) diff --git a/articles/multifactor-authentication/developer/libraries/ios/index.md b/articles/multifactor-authentication/developer/libraries/ios/index.md deleted file mode 100644 index 06617842c4..0000000000 --- a/articles/multifactor-authentication/developer/libraries/ios/index.md +++ /dev/null @@ -1,188 +0,0 @@ ---- -title: Getting Started with Guardian for iOS -url: /multifactor-authentication/developer/libraries/ios -description: Installation, usage, and configuration options guide for Guardian for iOS ---- - -# Guardian for iOS -The [Guardian for iOS Software Development Kit](https://github.com/auth0/GuardianSDK.iOS) allows developers to create iOS apps with Guardian functionality, providing easy and secure access to multifactor authentication with push notifications. For example, this toolkit gives you the power to build a 'white label' version of the Guardian application for your users, using your own look-and-feel. - -More information can be found on Guardian [here](/multifactor-authentication/guardian). For general multifactor discussion, read more [here](/multifactor-authentication). - -Get started using Guardian for iOS below, or, if you're looking for a specific document, try the listing of [additional documents](#additional-documents) related to Guardian for iOS. - -## Requirements - -The Guardian iOS SDK requires iOS 9.3+ and Swift 3. - -## Installation - -### CocoaPods - -Guardian.swift is available through [CocoaPods](http://cocoapods.org). -To install it, simply add the following line to your Podfile: - -```ruby -pod "Guardian" -``` - -### Carthage - -In your Cartfile add this line - -``` -github "auth0/Guardian.swift" -``` - -## Dashboard Settings - -To enable Guardian Push Notifications for your users, go to the [Multifactor Auth](${manage_url}/#/guardian) section of the dashboard. Then toggle the **Push Notification** slider to enable it. - -![](/media/articles/mfa/guardian-dashboard.png) - -## SNS configuration - -For your native application to receive push notifications from Guardian, you will need to override the default SNS settings. Follow the instructions [here](/multifactor-authentication/developer/sns-configuration). - -## Using the SDK - -`Guardian` is the core of the SDK. To get things going you'll have to import the library: - -```swift -import Guardian -``` - -Then you'll need the Auth0 Guarduan domain for your account: - -```swift -let domain = "{YOUR_ACCOUNT_NAME}.guardian.auth0.com" -``` - -### Enroll - -An enrollment is a link between the second factor and an Auth0 account. When an account is enrolled you'll need it to provide the second factor required to verify the identity. - -For an enrollment you need the following things, besides your Guardian Domain: - -- Enrollment Uri: The value encoded in the QR Code scanned from Guardian Web Widget or in your enrollment ticket sent to you, for example, by email. -- APNS Token: Apple APNS token for the device and **MUST** be a `String`containing the 64 bytes (expressed in hexadecimal format) -- Key Pair: A RSA (Private/Public) key pair used to assert your identity with Auth0 Guardian - -::: note -In case your app is not yet using push notifications or you're not familiar with it, you should check their [docs](https://developer.apple.com/go/?id=push-notifications). -::: - -After your have all of them, you can enroll your device: - -```swift -Guardian - .enroll(forDomain: "{YOUR_GUARDIAN_DOMAIN}", - usingUri: "{ENROLLMENT_URI}", - notificationToken: "{APNS_TOKEN}", - keyPair: keyPair) - .start { result in - switch result { - case .success(let enrollment): - // success, we have the enrollment data available - case .failure(let cause): - // something failed, check cause to see what went wrong - } - } -``` - -On success you'll obtain the enrollment information, that should be secured stored in your application. This information includes the enrollment identifier, and the token for Guardian API associated to your device for updating or deleting your enrollment. - -#### RSA key pair - -Guardian.swift provides a convenience class to generate an RSA key pair and store it in iOS Keychain. - -```swift -let rsaKeyPair = RSAKeyPair.new( - usingPublicTag: "com.auth0.guardian.enroll.public", - privateTag: "com.auth0.guardian.enroll.private" - ) -``` - -::: note -The tags should be unique since it's the identifier of each key inside iOS Keychain. -::: - -::: note -Since the keys are already secured stored inside iOS Keychain, you olny need to store the identifiers -::: - -### Allow a login request - -Once you have the enrollment in place, you will receive a push notification every time the user has to validate their identity with MFA. - -Guardian provides a method to parse the data received from APNs and return a `Notification` instance ready to be used. - -```swift -if let notification = Guardian.notification(from: notificationPayload) { - // we have received a Guardian push notification -} -``` - -Once you have the notification instance, you can easily allow the authentication request by using -the `allow` method. You'll also need the enrollment that you obtained previously. -In case you have more than one enrollment, you'll have to find the one that has the same `id` as the -notification (the `enrollmentId` property). - -```swift -Guardian - .authentication(forDomain: "{YOUR_GUARDIAN_DOMAIN}", andEnrollment: enrollment) - .allow(notification: notification) - .start { result in - switch result { - case .success: - // the auth request was successfuly allowed - case .failure(let cause): - // something failed, check cause to see what went wrong - } - } -``` - -### Reject a login request - -To deny an authentication request just call `reject` instead. You can also send a reject reason if -you want. The reject reason will be available in the guardian logs. - -```swift -Guardian - .authentication(forDomain: "{YOUR_GUARDIAN_DOMAIN}", andEnrollment: enrollment) - .reject(notification: notification) - // or reject(notification: notification, withReason: "hacked") - .start { result in - switch result { - case .success: - // the auth request was successfuly rejected - case .failure(let cause): - // something failed, check cause to see what went wrong - } - } -``` - -### Unenroll - -If you want to delete an enrollment -for example if you want to disable MFA- you can make the -following request: - -```swift -Guardian - .api(forDomain: "{YOUR_GUARDIAN_DOMAIN}") - .device(forEnrollmentId: "{USER_ENROLLMENT_ID}", token: "{ENROLLMENT_DEVICE_TOKEN}") - .delete() - .start { result in - switch result { - case .success: - // success, the enrollment was deleted - case .failure(let cause): - // something failed, check cause to see what went wrong - } - } -``` - -## Additional Documents - -* [Configuring Amazon SNS with Guardian](/multifactor-authentication/developer/sns-configuration) -* [Getting Started with Apple Push Notification Service](https://docs.aws.amazon.com/sns/latest/dg/mobile-push-apns.html) diff --git a/articles/multifactor-authentication/developer/sns-configuration.md b/articles/multifactor-authentication/developer/sns-configuration.md deleted file mode 100644 index 3a546ed7ff..0000000000 --- a/articles/multifactor-authentication/developer/sns-configuration.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -description: Describes how to configure Amazon SNS with Guardian Multifactor ---- -# Configuring Amazon SNS - -In order to receive push notifications from Guardian, it's necessary to override Guardian's default SNS settings. - -To do this, go to the [Multifactor Auth](${manage_url}/#/guardian) section of the dashboard and click on the **Push Notifications** box. - -![Push Notifications](/media/articles/mfa/push-notification-config.png) - -Enable the switch to use a custom app and provide the following values for your configuration: - -Name | Description ------|------------ -AWS Access Key Id | Your AWS access key id. -AWS Secret Access Key | Your AWS secret access key. -AWS Region | Your AWS application's region. -APNS ARN | The Amazon Resource Name for your [Apple Push Notification Service](http://docs.aws.amazon.com/sns/latest/dg/mobile-push-apns.html). -GCM ARN | The Amazon Resource Name for your [Google Cloud Messaging Service](http://docs.aws.amazon.com/sns/latest/dg/mobile-push-gcm.html). - -Then click **SAVE**. - -## Keep reading - -::: next-steps -* [Auth0 Management API](/api/management/v2) -* [Getting Started with Apple Push Notification Service](https://docs.aws.amazon.com/sns/latest/dg/mobile-push-apns.html) -* [Getting Started with Google Cloud Messaging for Android](https://docs.aws.amazon.com/sns/latest/dg/mobile-push-gcm.html) -::: diff --git a/articles/multifactor-authentication/developer/step-up-authentication/index.md b/articles/multifactor-authentication/developer/step-up-authentication/index.md deleted file mode 100644 index 9cb6aaba7b..0000000000 --- a/articles/multifactor-authentication/developer/step-up-authentication/index.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: Step-up Authentication -description: Describes using acr_values and acr claims to perform step-up authentication with Auth0 ---- -# Step-up Authentication - -With step-up authentication, applications that allow access to different types of resources can require users to authenticate with a stronger authentication mechanism to access sensitive resources. - -For example, Fabrikam's Intranet requires users to authenticate with their username and password to access customer data. However, a request for access to employee data (which may contain sensitive salary information) triggers a stronger authentication mechanism like multifactor authentication. - -You can add step-up authentication to your app with Auth0's extensible multifactor authentication support. Your app can verify that the user has logged in using multifactor authentication (MFA) and, if not, require the user to step-up to access certain resources. - -![Step-up flow](/media/articles/mfa/step-up-flow.png) - -## Step-up Authentication for APIs - -When your audience is an API, you can implement step-up authentication with Auth0 using [scopes](/scopes), [Access Tokens](/tokens/access-token) and [rules](/rules). - -::: note -An Access Token is a credential you can use to access an API. The actions that you can perform to that API are defined by the scopes your Access Token includes. The rules are JavaScript functions you can use to run custom logic when a user authenticates. -::: - -You can use a rule to trigger the step-up authentication mechanism (for example, prompt MFA) whenever the user requests scopes that map to sensitive resources. - -This is best explained with an example. - -A user signs into Fabrikam's web app. The standard login gives to this user the ability to interact with their API and fetch the users account list. This means that the Access Token that the application receives after the user authentication contains a scope like `read:accounts`. - -Now the user wishes to transfer funds from one account to another, which is deemed a high-value transaction. In order to perform this action, the API requires the scope `transfer:funds`. - -The Access Token that the user currently has does not include this scope and the application knows it since it knows the set of scopes it requested in the initial authentication call. - -The solution is that the application performs another authentication call, but this time it requests the required scope. The browser redirects to Auth0 and a rule is used to challenge the user to authenticate with MFA since a high-value scope was requested. - -Once the user successfully authenticates with MFA, a new Access Token which includes the high-value scope is generated and sent. The application will pass the Access Token to the API which will discard it after verification, thereby treating it like a single-use token. - -For details and sample code, see [Step-up Authentication for APIs](/multifactor-authentication/developer/step-up-authentication/step-up-for-apis). - -## Step-up Authentication for Web Apps - -If it is a web app that verifies the authentication level, and not an API, then you do not have an Access Token. In this case you can check if a user has logged in with MFA by reviewing the contents of their [ID Token](/tokens/id-token). You can then configure your application to deny access to pages with sensitive information if the ID Token indicates that the user did not log in with MFA, and use a rule to trigger the step-up authentication mechanism (for example, prompt MFA). - -For example, you might have an employee app that authenticates users with username and password, but if a user wants to access salary information, they have to provide a second factor, using for example a mobile push notification. - -You can implement this by checking the ID Token when the user tries to access that screen. If the claims show that the user has authenticated with MFA already then display the sensitive information. Otherwise, trigger authentication again, and using a rule, prompt the user to authenticate with MFA. - -For details and sample code, see [Step-up Authentication for Web Apps](/multifactor-authentication/developer/step-up-authentication/step-up-for-web-apps). - -## Keep reading - -::: next-steps -* [Step-up Authentication for Web Apps](/multifactor-authentication/developer/step-up-authentication/step-up-for-web-apps) -* [Step-up Authentication for APIs](/multifactor-authentication/developer/step-up-authentication/step-up-for-apis) -* [Authentication policy definitions](http://openid.net/specs/openid-provider-authentication-policy-extension-1_0.html#rfc.section.4) -::: diff --git a/articles/multifactor-authentication/developer/step-up-authentication/step-up-for-apis.md b/articles/multifactor-authentication/developer/step-up-authentication/step-up-for-apis.md deleted file mode 100644 index a8a69440d6..0000000000 --- a/articles/multifactor-authentication/developer/step-up-authentication/step-up-for-apis.md +++ /dev/null @@ -1,210 +0,0 @@ ---- -title: Step-up Authentication for APIs -description: Describes how an API can check if a user has logged in with Multifactor Authentication by examining their Access Token -toc: true ---- -# Step-up Authentication for APIs - -With step-up authentication, applications that allow access to different types of resources can require users to authenticate with a stronger mechanism to access sensitive information or perform certain transactions. - -For instance, a user may be allowed to transfer money only after they have confirmed their identity using Multifactor Authentication (MFA). - -When your audience is an API, you can implement step-up authentication with Auth0 using [scopes](/scopes), [Access Tokens](/tokens/access-token) and [rules](/rules). In this article we will explain how you can do that and use a sample implementation to go through the process step-by-step. - -## How to check the Access Token - -When an application wants to access an API's protected resources it must provide an Access Token. The resources that it will have access to depend on the permissions that are included in the Access Token. These permissions are defined as **scopes**. - -For example, a banking API may accept two different levels of authorization: view account balance (scope `view:balance`) or transfer funds (scope `transfer:funds`). When an application asks the API to retrieve the user's balance, then the Access Token should contain the `view:balance` scope. In order to transfer money to another account the Access Token should contain the `transfer:funds` scope. - -A sample flow for this example is the following: -1. The user logs in to the application using username/password authentication. The standard login gives to this user the ability to interact with their API and fetch their balance. This means that the Access Token that the app receives after the user authentication contains the scope like `view:balance` -1. The application sends a request to the API to retrieve the balance, using the Access Token as credentials -1. The API validates the token and sends the balance info to the application -1. Now the user wishes to transfer funds from one account to another, which is deemed a high-value transaction. The application sends a request to the API using the same Access Token -1. The API validates the token and denies access since it's missing the required scope `transfer:funds` -1. The application redirects to Auth0 and a rule is used to challenge the user to authenticate with MFA since a high-value scope was requested. Once the user successfully authenticates with MFA, a new Access Token which includes this scope is generated and sent to the application as part of the response -1. The application sends again the transfer funds request using the new Access Token, which includes the `transfer:funds` scope. -1. The API validates the token, discards it (thereby treating it like a single-use token) and proceeds with the operation - -Note that the API needs to do more validations than just check the scope. These are: -- Verify the token's signature. The signature is used to verify that the sender of the token is who it says it is and to ensure that the message wasn't changed along the way. -- Validate the standard claims: `exp` (when the token expires), `iss` (who issued the token), `aud` (who is the intented recipient of the token) - -For details on how to do these validations, see the [Verify Access Tokens for Custom APIs](/api-auth/tutorials/verify-access-token) article. - -## Example - -In this section we will see how you would implement the scenario described in the previous paragraph. - -### Before you start - -This tutorial assumes that you have already done the following: - -- [Register an application](/applications#how-to-configure-an-application). For the purposes of this example we'll be using a single-page web app -- [Create a database connection](${manage_url}/#/connections/database) -- [Register the API](/apis#how-to-configure-an-api-in-auth0). It should include two scopes: `view:balance` and `transfer:funds` -- [Enable Multifactor Authentication](/multifactor-authentication). For the purposes of this example we'll be using [Guardian push notifications](/multifactor-authentication/administrator/push-notifications) - - -### 1. Create the rule - -First we will create a rule that will challenge the user to authenticate with MFA when the `transfer:funds` scope is requested. - -Go to [Dashboard > Multifactor Auth](${manage_url}/#/guardian) and modify the script as follows. - -```js -function (user, context, callback) { - - var CLIENTS_WITH_MFA = ['${account.clientId}']; - // run only for the specified clients - if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) { - // ask for MFA only if scope transfer:funds was requested - if (context.request.query.scope.indexOf('transfer:funds') > -1) { - context.multifactor = { - provider: 'guardian', - allowRememberBrowser: false - }; - } - } - - callback(null, user, context); -} -``` - -The `CLIENTS_WITH_MFA` variable holds the Cliend IDs of all the applications you want to use this rule. You can remove this (and the `if` statement that follows) if you don't need it. - -The `context.request.query.scope` property contains all the scopes that the authentication request asked for. If it includes the value `transfer:funds` then we ask for MFA by setting the `context.multifactor` property to the appropriate value. In this case we are asking for MFA using [Guardian](/multifactor-authentication/guardian). - -### 2. Configure your application - -Next you need to configure your application to send the appropriate authentication request, depending on the action that the user wants to perform. Notice that the only difference between the two authentication requests (with or without MFA) is the scope `transfer:funds`. - -
    - -
    -
    -
    -        
    -https://${account.namespace}/authorize?
    -  audience=https://my-banking-api
    -  &scope=openid%20view:balance
    -  &response_type=id_token%20token
    -  &client_id=${account.clientId}
    -  &redirect_uri=${account.callback}
    -  &nonce=CRYPTOGRAPHIC_NONCE
    -  &state=OPAQUE_VALUE
    -        
    -      
    -
    -
    -
    -        
    -https://${account.namespace}/authorize?
    -  audience=https://my-banking-api
    -  &scope=openid%20view:balance%20transfer:funds
    -  &response_type=id_token%20token
    -  &client_id=${account.clientId}
    -  &redirect_uri=${account.callback}
    -  &nonce=CRYPTOGRAPHIC_NONCE
    -  &state=OPAQUE_VALUE
    -        
    -      
    -
    -
    -
    - -- Set `audience` to the **Identifier** of your API (find it at [API Settings](${manage_url}/#/apis/)). We set ours to `https://my-banking-api` -- The `response_type` is set to `id_token token` so we get both an ID Token and an Access Token in the response -- Set `client_id` to the Client ID of your application (find it at [Application Settings](${manage_url}/#/applications/${account.clientId}/settings)) -- Set the `redirect_uri` to the URL of your application that Auth0 should redirect back to after authentication (find it at [Application Settings](${manage_url}/#/applications/${account.clientId}/settings)) -- Set `nonce` to a string value which will be included in the response from Auth0. This is [used to prevent token replay attacks](/api-auth/tutorials/nonce) and is required for `response_type=id_token token` -- Set `state` to an opaque value that Auth0 includes when redirecting back to the application. This value must be used by the application to [prevent CSRF attacks](/protocols/oauth2/oauth-state) - -### 3. Configure your API - -Finally, you need to make your API validate the incoming token and check the authorized permissions. - -For the purposes of this example we will configure two endpoints for our API: -- `GET /balance`: used to retrieve the current balance -- `POST /transfer`: used to transfer funds - -We will be using Node.js and a number of modules: -- [express](https://expressjs.com/): adds the Express web application framework -- [jwks-rsa](https://github.com/auth0/node-jwks-rsa): retrieves RSA signing keys from a **JWKS** (JSON Web Key Set) endpoint. Using `expressJwtSecret` we can generate a secret provider that will provide the right signing key to `express-jwt` based on the `kid` in the JWT header -- [express-jwt](https://github.com/auth0/express-jwt): lets you authenticate HTTP requests using JWT tokens in your Node.js applications. It provides several functions that make working with JWTs easier -- [express-jwt-authz](https://github.com/auth0/express-jwt-authz): checks if the Access Token contains a specific scope - -Start with installing the dependencies. - -```text -npm install express express-jwt jwks-rsa express-jwt-authz --save -``` - -Next define the API endpoints, create a middleware function to validate the Access Token, and secure the endpoints using that middleware. The code in your `server.js` file should look like the following sample script. - -```js -// set dependencies -const express = require('express'); -const app = express(); -const jwt = require('express-jwt'); -const jwksRsa = require('jwks-rsa'); -const jwtAuthz = require('express-jwt-authz'); - -// Create middleware for checking the JWT -const checkJwt = jwt({ - // Dynamically provide a signing key based on the kid in the header and the singing keys provided by the JWKS endpoint - secret: jwksRsa.expressJwtSecret({ - cache: true, - rateLimit: true, - jwksRequestsPerMinute: 5, - jwksUri: `https://${account.namespace}/.well-known/jwks.json` - }), - - // Validate the audience and the issuer - audience: 'https://my-banking-api', // replace with your API's audience, available at Dashboard > APIs - issuer: 'https://${account.namespace}/', - algorithms: [ 'RS256' ] // we are using RS256 to sign our tokens -}); - -// create retrieve balance endpoint -app.get('/balance', checkJwt, jwtAuthz(['view:balance']), function (req, res) { - // code that retrieves the user's balance and sends it back to the calling app - res.status(201).send({message: "This is the GET /balance endpoint"}); -}); - - -// create transfer funds endpoint -app.post('/transfer', checkJwt, jwtAuthz(['transfer:funds']), function (req, res) { - // code that transfers funds from one account to another - res.status(201).send({message: "This is the POST /transfer endpoint"}); -}); - -// launch the API Server at localhost:8080 -app.listen(8080); -console.log('Listening on http://localhost:8080'); -``` - -Each time the API receives a request the following will happen: -1. The endpoint will call the `checkJwt` middleware -1. `express-jwt` will decode the token and pass the request, the header and the payload to `jwksRsa.expressJwtSecret` -1. `jwks-rsa` will then download all signing keys from the JWKS endpoint and see if a one of the signing keys matches the `kid` in the header of the Access Token. If none of the signing keys match the incoming `kid`, an error will be thrown. If we have a match, we will pass the right signing key to `express-jwt` -1. `express-jwt` will the continue its own logic to validate the signature of the token, the expiration, audience and the issuer -1. `jwtAuthz` will check if the scope that the endpoint requires is part of the Access Token - -That's it, you're done! Now your application allows access to different types of resources using a stronger mechanism to perform certain high-value transactions. - -## Keep reading - -::: next-steps -* [Overview of Access Tokens](/tokens/access-token) -* [Overview of rules](/rules) -* [Overview of scopes](/scopes) -* [How to verify Access Tokens](/api-auth/tutorials/verify-access-token) -* [Step-up Authentication for Web Apps](/multifactor-authentication/developer/step-up-authentication/step-up-for-web-apps) -::: diff --git a/articles/multifactor-authentication/developer/step-up-authentication/step-up-for-web-apps.md b/articles/multifactor-authentication/developer/step-up-authentication/step-up-for-web-apps.md deleted file mode 100644 index 337c26aa9e..0000000000 --- a/articles/multifactor-authentication/developer/step-up-authentication/step-up-for-web-apps.md +++ /dev/null @@ -1,178 +0,0 @@ ---- -title: Step-up Authentication for Web Apps -description: Describes how to check if a user has logged in your web app with Multifactor Authentication by examining their ID Token -toc: true ---- -# Step-up Authentication for Web Apps - -With Step-up Authentication, applications that allow access to different types of resources can require users to authenticate with a stronger mechanism to access sensitive information or perform certain transactions. - -For instance, a user may be allowed to access views with sensitive data or reset their password only after confirming their identity using Multifactor Authentication (MFA). - -When a user logs in you can get an [ID Token](/tokens/id-token) which is a [JSON Web Token](/jwt) that contains information relevant to the user's session, in the form of claims. - -The claim that is relevant to this scenario is `amr`. If it contains the value `mfa` then you know that the user has authenticated using MFA. Note the following: -- `amr` **must** be present in the ID Token's payload (if you log in with username/password the claim will not be included in the payload) -- `amr` **must** contain the value `mfa` (`amr` can contain claims other than `mfa`, so its existence is not a sufficient test, its contents must be examined for the value `mfa`) - -If the token shows that the user has not authenticated with MFA, then you can trigger again authentication, and using a rule, trigger MFA. Once the user provides the second factor, a new ID Token, that contains the `amr` claim, is generated and sent to the app. - -## How to check the ID Token for MFA - -In order to check if a user logged in with MFA follow these steps: - -1. Retrieve the ID Token -1. Verify the token's signature. The signature is used to verify that the sender of the token is who it says it is and to ensure that the message wasn't changed along the way. -1. Validate the standard claims: `exp` (when the token expires), `iss` (who issued the token), `aud` (who is the intented recipient of the token) -1. Verify that the token contains the `amr` claim. - - If `amr` **is not** in the payload or it does not contain the value `mfa`, the user did not log in with MFA - - If `amr` **is** in the payload and it contains the value `mfa`, then the user logged in with MFA - -For more information on the signature verification and claims validation, see [ID Token](/tokens/id-token). - -## Sample payloads - -In the snippet below you can see how an ID Token's payload is if the user has authenticated with MFA, and how it is if they have not. - -
    - -
    -
    -
    -        
    -{
    -  "iss": "https://${account.namespace}/",
    -  "sub": "auth0|1a2b3c4d5e6f7g8h9i",
    -  "aud": "${account.clientId}",
    -  "iat": 1522838054,
    -  "exp": 1522874054,
    -  "acr": "http://schemas.openid.net/pape/policies/2007/06/multi-factor",
    -  "amr": [
    -    "mfa"
    -  ]
    -}
    -        
    -      
    -
    -
    -
    -        
    -{
    -  "iss": "https://${account.namespace}/",
    -  "sub": "auth0|1a2b3c4d5e6f7g8h9i",
    -  "aud": "${account.clientId}",
    -  "iat": 1522838197,
    -  "exp": 1522874197
    -}
    -        
    -      
    -
    -
    -
    - -## Example - -Let's say that you have a web app that authenticates users with username and password. When a user wants to access a specific screen with sensitive information, for example, one that displays salary data, you want the user to authenticate with another factor, for example [Guardian push notifications](/multifactor-authentication#mfa-using-push-notifications-auth0-guardian-). - -### Before you start - -This tutorial assumes that you have already done the following: - -- [Register an application](/applications#how-to-configure-an-application). For the purposes of this example we'll be using a regular web app -- [Create a database connection](${manage_url}/#/connections/database) -- [Enable Multifactor Authentication](/multifactor-authentication). For the purposes of this example we'll be using [Guardian push notifications](/multifactor-authentication/administrator/push-notifications) - -### 1. Create the rule - -First we will create a rule that will challenge the user to authenticate with MFA when the web app asks for it. - -Go to [Dashboard > Multifactor Auth](${manage_url}/#/guardian) and modify the script as follows. - -```js -function (user, context, callback) { - - var CLIENTS_WITH_MFA = ['${account.clientId}']; - // run only for the specified clients - if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) { - // ask for MFA only if the web app said so in the authentication request - if (context.request.query.acr_values === 'http://schemas.openid.net/pape/policies/2007/06/multi-factor'){ - context.multifactor = { - provider: 'guardian', - allowRememberBrowser: false - }; - } - } - - callback(null, user, context); -} -``` - -The `CLIENTS_WITH_MFA` variable holds the Cliend IDs of all the applications you want to use this rule. You can remove this (and the `if` statement that follows) if you don't need it. - -The `context.request.query.acr_values` property exists only if the web app included it in the authentication request, using the request parameter `acr_values=http://schemas.openid.net/pape/policies/2007/06/multi-factor`. The web app will only include this parameter in the authentication request (as we will see in a while) if the user tries to access salary information and has not authenticated with MFA. In this case we ask for MFA using [Guardian](/multifactor-authentication/guardian) by setting the `context.multifactor` property to the appropriate value. - -### 2. Configure your application - -If the user tries to access the salary information screen, then the web app must check the ID Token claims for MFA. If the user has already authenticated with MFA, then the screen is displayed, otherwise the web app sends a new authentication request to Auth0. This time the request parameter `acr_values` is included so the rule we saw in the previous paragraph triggers MFA. Once the user authenticates, a new token is sent to the app. - -#### Check the ID Token - -The web app must validate the token as described in [How to check the ID Token for MFA](#how-to-check-the-id-token-for-mfa). - -In this example, we do these validations, using the [JSON Web Token Sample Code](https://github.com/auth0/node-jsonwebtoken). - -The code verifies the token's signature (`jwt.verify`), decodes the token, and checks whether the payload contains `amr` and if it does whether it contains the value `mfa`. The results are logged in the console. - -```js -const AUTH0_CLIENT_SECRET = '${account.clientSecret}'; -const jwt = require('jsonwebtoken') - -jwt.verify(id_token, AUTH0_CLIENT_SECRET, { algorithms: ['HS256'] }, function(err, decoded) { - if (err) { - console.log('invalid token'); - return; - } - - if (Array.isArray(decoded.amr) && decoded.amr.indexOf('mfa') >= 0) { - console.log('You used mfa'); - return; - } - - console.log('you are not using mfa'); - }); -``` - -#### Ask for MFA - -If the output of the previous validations is that the user has not authenticated with MFA, then you must trigger authentication again. The request will include the `acr_values=http://schemas.openid.net/pape/policies/2007/06/multi-factor` parameter, which as a result will trigger the rule we wrote at [the first step](#1-create-the-rule). - -Our web app uses the [Authorization Code Grant](/api-auth/tutorials/authorization-code-grant) to authenticate, so the request is as follows. - -```text -https://${account.namespace}/authorize? - audience=https://${account.namespace}/userinfo& - scope=openid& - response_type=code& - client_id=${account.clientId}& - redirect_uri=${account.callback}& - state=YOUR_OPAQUE_VALUE& - acr_values=http://schemas.openid.net/pape/policies/2007/06/multi-factor -``` - -Once the user authenticates with Guardian, the web app receives in the response the authorization code which must be exchanged for the new ID Token, using the [Token endpoint](/api/authentication#authorization-code). For more details, and sample requests, see [Exchange the Authorization Code for a Token](/api-auth/tutorials/authorization-code-grant#2-exchange-the-authorization-code-for-an-access-token). - -That's it, you are done! - -## Keep reading - -::: next-steps -* [Overview of ID Tokens](/tokens/id-token) -* [Overview of JSON Web Tokens](/jwt) -* [OpenID specification](http://openid.net/specs/openid-connect-core-1_0.html) -* [Step-up Authentication for APIs](/multifactor-authentication/developer/step-up-authentication/step-up-for-apis) -::: diff --git a/articles/multifactor-authentication/duo/admin-guide.md b/articles/multifactor-authentication/duo/admin-guide.md deleted file mode 100644 index 6df80ed0e8..0000000000 --- a/articles/multifactor-authentication/duo/admin-guide.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -description: Information for how to use Duo Security for administrators. ---- - -# Duo for Administrators - -## Enabling Duo for MFA - -To turn on Duo for two-step verification, first visit the [Multifactor Auth](${manage_url}/#/guardian) page from the dashboard. Then click on the link to use a different provider. - -![](/media/articles/mfa/change-provider.png) - -Then you can use the slider to turn on Duo. - -![](/media/articles/mfa/toggle-duo.png) - -::: note -If you enable Duo while using another provider for MFA, all other providers will be disabled. All customizations and enrolled users in other MFA will be lost. Be careful as this action cannot be reverted. -::: - -### Customize Duo - -After you toggle the slider to enable using Duo, a portal displays a code editing textbox containing the following code snippet for you to use: - -```JS -function (user, context, callback) { - - var CLIENTS_WITH_MFA = ['REPLACE_WITH_YOUR_CLIENT_ID']; - // run only for the specified applications - if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) { - // uncomment the following if clause in case you want to request a second factor only from user's that have user_metadata.use_mfa === true - // if (user.user_metadata && user.user_metadata.use_mfa){ - context.multifactor = { - //required - provider: 'duo', - ikey: 'DIXBMN...LZO8IOS8', - skey: 'nZLxq8GK7....saKCOLPnh', - host: 'api-3....049.duosecurity.com', - - // optional, defaults to true. Set to false to force DuoSecurity every time. - // See https://auth0.com/docs/multifactor-authentication/custom#change-the-frequency-of-authentication-requests for details - allowRememberBrowser: false, - - // optional. Use some attribute of the profile as the username in DuoSecurity. This is also useful if you already have your users enrolled in Duo. - // username: user.nickname, - - // optional. Admin credentials. If you provide an Admin SDK type of credentials. auth0 will update the realname and email in DuoSecurity. - // admin: { - // ikey: 'DIAN...NV6UM', - // skey: 'YL8OVzvoeeh...I1uiYrKoHvuzHnSRj' - // }, - }; - // } - } - - callback(null, user, context); -} -``` - -#### Changing the Required Fields - -Required fields that you **must** replace to use Duo are: `ikey`, `skey` and `host`. - -1. To get these fields first [login to your Duo account](https://admin.duosecurity.com/login). - -2. Click on the **Applications** section from the sidebar. - -3. Then click on the button to **Protect an Application**. - -4. Find the **Auth API** option from the list and then click **Protect this Application**. - -5. Then you will be brought to the **Auth API** page under your Appications, you should see a **Details** section. - -6. Under the **Details** section you will see: - -* **Integration key** - use this for your `ikey` field -* **Secret key** - use this for your `skey` field -* **API hostname** - use this for your `host` field - -Replace the three fields in the code snippet. For more details about editing the other parts of this code snippet, [see Duo for Developers](/multifactor-authentication/duo/dev-guide#other-customizations). - -When you have finished editing the code snippet based on the requirements of your app, click **Save**. - -## Editing a User's Settings - -If you need to change the settings for logging in with Duo for one of your users or if a user has lost their mobile device, you will need to edit User setting on the Duo site. - -1. Visit [Duo.com](https://duo.com/) and login to your account. -2. Click **Users** from the sidebar. -3. Find the desired user and click their username. -4. From a User page you can edit their settings. - -## Disabling Duo - -Duo can be disabled from the [Multifactor Auth](${manage_url}/#/guardian) section of the dashboard then by clicking the link to use a different provider. - -![](/media/articles/mfa/change-provider.png) - -Toggle the slider button to disable Duo, then a confirmation popup will appear. - -By disabling Duo you will lose all customizations, but your previously enrolled users will still be visible in your Duo settings. diff --git a/articles/multifactor-authentication/duo/dev-guide.md b/articles/multifactor-authentication/duo/dev-guide.md deleted file mode 100644 index f704210fd0..0000000000 --- a/articles/multifactor-authentication/duo/dev-guide.md +++ /dev/null @@ -1,99 +0,0 @@ ---- -description: Information for how to use Duo Security for developers. ---- - -# Duo for Developers - -## Enabling Duo for MFA - -To turn on Duo for two-step verification, first visit the [Multifactor Auth](${manage_url}/#/guardian) page from the dashboard. Then click on the link to use a different provider. - -![](/media/articles/mfa/change-provider.png) - -Then you can use the slider to turn on Duo. - -![](/media/articles/mfa/toggle-duo.png) - -### Customize Duo - -After you toggle the slider to enable using Duo, a portal displays a code editing textbox containing the following code snippet for you to use: - -```JS -function (user, context, callback) { - - var CLIENTS_WITH_MFA = ['REPLACE_WITH_YOUR_CLIENT_ID']; - // run only for the specified clients - if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) { - // uncomment the following if clause in case you want to request a second factor only from user's that have user_metadata.use_mfa === true - // if (user.user_metadata && user.user_metadata.use_mfa){ - context.multifactor = { - //required - provider: 'duo', - ikey: 'DIXBMN...LZO8IOS8', - skey: 'nZLxq8GK7....saKCOLPnh', - host: 'api-3....049.duosecurity.com', - - // optional, defaults to true. Set to false to force DuoSecurity every time. - // See https://auth0.com/docs/multifactor-authentication/custom#change-the-frequency-of-authentication-requests for details - allowRememberBrowser: false, - - // optional. Use some attribute of the profile as the username in DuoSecurity. This is also useful if you already have your users enrolled in Duo. - // username: user.nickname, - - // optional. Admin credentials. If you provide an Admin SDK type of credentials. auth0 will update the realname and email in DuoSecurity. - // admin: { - // ikey: 'DIAN...NV6UM', - // skey: 'YL8OVzvoeeh...I1uiYrKoHvuzHnSRj' - // }, - }; - // } - } - - callback(null, user, context); -} -``` - -### Changing the Required Fields - -Required fields that you **must** replace to use Duo are: `ikey`, `skey` and `host`. - -1. To get these fields first [login to your Duo account](https://admin.duosecurity.com/login). - -2. Click on the **Applications** section from the sidebar. - -3. Then click on the button to **Protect an Application**. - -4. Find the **Auth API** option from the list and then click **Protect this Application**. - -5. Then you will be brought to the **Auth API** page under your Appications, you should see a **Details** section. - -6. Under the **Details** section you will see: - -* **Integration key** - use this for your `ikey` field -* **Secret key** - use this for your `skey` field -* **API hostname** - use this for your `host` field - -Replace the three fields in the code snippet, and click **SAVE**. - -[Click here to learn more about Duo's Auth API](https://duo.com/docs/authapi) - -## Other Customizations - -### Use Duo only for Specified Users - -#### Based on your Application -To use Duo for logins only for the specified applications, replace `REPLACE_WITH_YOUR_CLIENT_ID` field with the Client ID of the application you wish to use. You can find your Client ID(s) under the [Applications](${manage_url}/#/applications) section of the dashboard and then clicking the application you wish to use. - -To use Duo for users of all your applications, you can comment or remove the sections regarding `CLIENTS_WITH_MFA`. - -#### Specify users to use MFA -To only use Duo for MFA on users that have `user_metadata.use_mfa === true` uncomment this if block. This field can be updated using the [Management APIv2](/api/management/v2#!/Users/patch_users_by_id). - -### Setting `allowRememberBrowser: false` -If `allowRememberBrowser: true` is set, or if the field is left unset, then users will not have to login with Duo everytime they login. The browser will save a cookie that will persist for 30 days and this cannot be undone. - -### Changing the Username sent to Duo -To use a specific attribute of the profile as the username in DuoSecurity, uncomment `username: user.nickname` and change it to the attribute you wish to use. This is also useful if you already have your users enrolled in Duo. - -### Setting Admin Credentials -If you provide an Admin SDK type of credentials then Auth0 will update the realname and email in Duo. To do this, replace the `ikey` and `skey` with the integration key and secret key. diff --git a/articles/multifactor-authentication/duo/duo-landing.md b/articles/multifactor-authentication/duo/duo-landing.md deleted file mode 100644 index a3b805a031..0000000000 --- a/articles/multifactor-authentication/duo/duo-landing.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: Duo Security with Auth0 -description: Links to documentation on using Duo with Auth0 for each user type. -url: /multifactor-authentication/duo ---- - -# Duo Security - -Duo Security is a vendor of cloud-based two-factor authentication services. If you have an account with Duo it is easy to integrate Duo's two-factor authentication into your Auth0 application. - -**Click the link below that most fits your role to learn more:** - -[Duo Security for Administrators](/multifactor-authentication/duo/admin-guide) - this page explains how to setup using Duo, how to reset accounts and how to disable using Duo. - -[Duo Security for Developers](/multifactor-authentication/duo/dev-guide) - this page explains how to enable using Duo for two-factor auth and details on how to configure it to meet your needs. - -[Duo Security for Users](/multifactor-authentication/duo/user-guide) - this page is for users logging into your application using Duo. It also has troubleshooting tips for any issues they may encounter. diff --git a/articles/multifactor-authentication/duo/user-guide.md b/articles/multifactor-authentication/duo/user-guide.md deleted file mode 100644 index a25eab2f49..0000000000 --- a/articles/multifactor-authentication/duo/user-guide.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -description: Information for how to use Duo Security for users. ---- - -# How to Use Duo - -Duo is a service and has a mobile app used for two-factor authentication when logging into an application, which helps create a more secure login. With two-factor authentication you will always need your mobile device when you log in. - -This page will help to explain how to sign up and log in using Duo. - -## Signing Up - -After entering your username and password see [Duo's Enrollment Guide](https://guide.duo.com/enrollment) for help with the sign up process. - -## Logging In - -When you are logging in, first enter you username and password. Then you will see a page to choose how to use Duo to complete your login. - -![](/media/articles/mfa/duo-login.png) - -### Send me a Push -If you choose this option, you must have the Duo App installed on your device. The app will send you a push notification, choose Accept to login. - -### Call me -If you choose this option, you will recieve an automated call from Duo. Answer the call and press any key to finish logging in. - -### Enter a Passcode -If you choose this option, you must have the Duo App installed on your device. Open the app on your device and then click on the key icon next to the name of the application you are logging into. This will reveal a six-digit code, enter this passcode and then click **Log In** to continue. - -## Troubleshooting - -### If you do not have your mobile device - -If you have lost your phone and are unable to finish the two-step authentication you will need to contact your system administrator for help accessing your account. - -### If you forgot your password - -If you forgot your password when you are trying to login, click **Don't remember your password?** underneath the login. Enter your email to receive an email that will contain a link to reset your password. - -### Additional Help - -For other issues/questions regarding Duo [see here.](https://guide.duo.com) - - diff --git a/articles/multifactor-authentication/google-auth/admin-guide.md b/articles/multifactor-authentication/google-auth/admin-guide.md deleted file mode 100644 index 63685199da..0000000000 --- a/articles/multifactor-authentication/google-auth/admin-guide.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -description: Using Google Authenticator with Auth0 for administrators ---- - -# Google Authenticator for Administrators - -## Enabling Google Authenticator for MFA - -To turn on Google Authenticator for two-step verification, first visit the [Multifactor Auth](${manage_url}/#/guardian) page from the dashboard. Then click on the link to use a different provider. - -![](/media/articles/mfa/change-provider.png) - -Then you can use the slider to turn on Google Authenticator. - -![](/media/articles/mfa/toggle-google-auth.png) - -::: note -If you enable Google Authenticator while using another provider for MFA, all other providers will be disabled. All customizations and enrolled users in other MFA will be lost. Be careful as this action cannot be reverted. -::: - -## Google Authenticator Supported Devices - -Your users must have a supported device to use the Google Authenticator app. If some of your users have an unsupported device type, they may be able to use Auth0's Guardian app instead of Google Authenticator. [Click here for information on using Guardian.](/multifactor-authentication/guardian/admin-guide) - -| **OS** | **Google Authenticator** | -| --- | --- | -| **iOS** | Requires iOS 5.0 or later | -| **Android** | Requires Android version 2.1 or later | -| **Windows** | Unsupported | -| **Blackberry** | Requires OS 4.5-7.0 | -| **Other** | Unsupported | - -## Customize Google Authenticator - -Once you have turned on Google Authenticator, the portal displays a code editing textbox containing the following code snippet for you to use: - -```JS -function (user, context, callback) { - // Uncomment the following to skip MFA when impersonating a user - // if (user.impersonated) { return callback(null, user, context); } - - var CLIENTS_WITH_MFA = ['REPLACE_WITH_YOUR_CLIENT_ID']; - // run only for the specified clients - if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) { - // uncomment the following if clause in case you want to request a second factor only from users that have app_metadata.use_mfa === true - // if (user.app_metadata && user.app_metadata.use_mfa){ - context.multifactor = { - provider: 'google-authenticator', - // issuer: 'Label on Google Authenticator App', // optional - // key: 'YOUR_KEY_HERE', // optional, the key to use for TOTP. by default one is generated for you - - // optional, defaults to true. Set to false to force Google Authenticator every time. - // See https://auth0.com/docs/multifactor-authentication/custom#change-the-frequency-of-authentication-requests for details - allowRememberBrowser: false, - }; - // } - } - - callback(null, user, context); -} -``` - -When you have finished editing the code snippet based on the requirements of your app, click **Save**. - -::: panel Screen customization -At this time Google Authenticator does not allow any customizations to the look and feel of the Google Authenticator screens. For other customization options [see Auth0 Guardian](/multifactor-authentication/administrator#customization). -::: - -## Reset a MFA for a User - -If a user has lost their mobile device, you as an administrator will need to reset their MFA. - -To reset a user's MFA: - -1. Find and select the user in the [Users](${manage_url}/#/users) section of the dashboard. -2. Once you have selected the affected user click on the **Actions** button on the top right of the screen. -3. Select **Reset Multi Factor (Google)** from the dropdown. -4. There will be a pop up box to confirm your decision, click **YES, RESET IT** to reset the user's MFA. - -![](/media/articles/mfa/reset-google-mfa.png) - -The next time the user logs in they will need to resetup their MFA just like a new user. - -## Disabling Google Authenticator - -Google Authenticator can be disabled from the [Multifactor Auth](${manage_url}/#/guardian) section of the dashboard then by clicking the link to use a different provider. - -![](/media/articles/mfa/change-provider.png) - -Toggle the slider button to disable Google Authenticator, then a confirmation popup will appear. - -By disabling a type of MFA you will lose all customizations. diff --git a/articles/multifactor-authentication/google-auth/dev-guide.md b/articles/multifactor-authentication/google-auth/dev-guide.md deleted file mode 100644 index 3f99a1b29d..0000000000 --- a/articles/multifactor-authentication/google-auth/dev-guide.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -description: Using Google Authenticator with Auth0 for developers ---- - -# Google Authenticator for Developers - -## Enabling Google Authenticator for MFA - -To turn on Google Authenticator for two-step verification, first visit the [Multifactor Auth](${manage_url}/#/guardian) page from the dashboard. Then click on the link to use a different provider. - -![](/media/articles/mfa/change-provider.png) - -Then you can use the slider to turn on Google Authenticator. - -![](/media/articles/mfa/toggle-google-auth.png) - -## Customize Google Authenticator - -Once you have turned on Google Authenticator, the portal displays a code editing textbox containing the following code snippet for you to use: - -```JS -function (user, context, callback) { - - var CLIENTS_WITH_MFA = ['REPLACE_WITH_YOUR_CLIENT_ID']; - // run only for the specified clients - if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) { - // uncomment the following if clause in case you want to request a second factor only from user's that have user_metadata.use_mfa === true - // if (user.user_metadata && user.user_metadata.use_mfa){ - context.multifactor = { - provider: 'google-authenticator', - // issuer: 'Label on Google Authenticator App', // optional - // key: 'YOUR_KEY_HERE', // optional, the key to use for TOTP. by default one is generated for you - - // optional, defaults to true. Set to false to force Google Authenticator every time. - // See https://auth0.com/docs/multifactor-authentication/custom#change-the-frequency-of-authentication-requests for details - allowRememberBrowser: false - }; - // } - } - - callback(null, user, context); -} -``` - -When you have finished editing the code snippet based on the requirements of your app, click **Save**. - -::: panel Screen customization -At this time Google Authenticator does not allow any customizations to the look and feel of the Google Authenticator screens. For other customization options [see Auth0 Guardian](/multifactor-authentication/administrator#customization). -::: - -### Configuring Google Authenticator for Select Users - -You may choose to enable Google Authenticator only for select users. Within the Customize MFA code snippet, you may include the conditions for Google Authenticator is enabled. - -For example, suppose you want to *omit* MFA for all users signing in from the `foo.com` domain. - - -```js -function (user, context, callback) { - - if (context.connection !== 'foo.com'){ - context.multifactor = { - provider: 'google-authenticator', //required - }; - } - - callback(null, user, context); -} -``` - -Once you have finished making your desired changes, click **SAVE** so that they persist. diff --git a/articles/multifactor-authentication/google-auth/google-landing.md b/articles/multifactor-authentication/google-auth/google-landing.md deleted file mode 100644 index 4f91b187de..0000000000 --- a/articles/multifactor-authentication/google-auth/google-landing.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: Multifactor Authentication - Google Authenticator -description: Links to Google Authentication with Auth0 documentation for each type of user role. -url: /multifactor-authentication/google-authenticator ---- - -# Google Authenticator - -Google Authenticator is a mobile application made by Google that implements two-step verification. Authenticator provides a six to eight digit one-time password which users must provide in addition to their username and password to log into an application. - -**Click the link below that most fits your role to learn more:** - -[Google Authenticator for Administrators](/multifactor-authentication/google-auth/admin-guide) - this page explains how to enable/disable using Google Authenticator, how to reset accounts, supported devices and customization. - -[Google Authenticator for Developers](/multifactor-authentication/google-auth/dev-guide) - this page explains how to enable Google Authenticator and details on how to configure it to meet your needs. - -[Google Authenticator for Users](/multifactor-authentication/google-auth/user-guide) - this page is for users logging into your application using Google Authenticator. It also has troubleshooting tips for any issues they may encounter. diff --git a/articles/multifactor-authentication/google-auth/user-guide.md b/articles/multifactor-authentication/google-auth/user-guide.md deleted file mode 100644 index a310fbeb64..0000000000 --- a/articles/multifactor-authentication/google-auth/user-guide.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -description: How to sign-up and login using the Google Authenticator app. ---- - -# How to Use Google Authenticator - -Google Authenticator is a mobile app used for two-factor authentication when logging into an application, which helps create a more secure login. With two-factor authentication you will always need your mobile device when you log in. - -This page will help to explain how to sign up and log in using the Google Authenticator app. - -## Download the Google Authenticator App - -### Android -Requirements: Must be running Android version 2.1 or later. - -To download the app: - -1. Visit [Google Play](https://play.google.com/store). -2. Search for Google Authenticator. -3. Download and install the application. - -### iOS -Requirements: Must have iOS 5.0 or later. In addition, in order to set up the app on your iPhone using a QR code, you must have a 3G model or later. - -To download the app: - -1. Visit the [iTunes App Store](https://itunes.apple.com/us/genre/ios/id36). -2. Search for Google Authenticator. -3. Download and install the application. - -### Blackberry - -Requirements: Must have OS 4.5-7.0. In addition, make sure your BlackBerry device is configured for US English -- you might not be able to download Google Authenticator if your device is operating in another language. - -To download the app: - -1. Open the web browser on your BlackBerry. -2. Visit [m.google.com/authenticator](https://m.google.com/authenticator). -3. Download and install the application. - -## Sign Up as a New User - -If you do not have an existing account, you will need to sign up to create one. Click the **SIGN UP** button and enter your email and create a password. - -![](/media/articles/mfa/sign-up.png) - -You will need to download Google Authenticator app. - -A code will appear, and you will have five minutes to scan the code before it expires. After scanning the code, you will get a six digit code to enter. Once you enter this code you will be logged in. - -![](/media/articles/mfa/google-code.png) - -## Logging in - -After entering your username and password, you will be prompted for a six digit code. Open the Google Authenticator app on your mobile device to find the correct code. If you use Google Authenticator for other applications as well, make sure you are using the code for the current application. After entering the six digit code you will be logged in. - -## Troubleshooting - -### If you do not have your mobile device - -If you have lost your phone and are unable to finish the two-step authentication you will need to contact your system administrator for help accessing your account. - -### If you forgot your password - -If you forgot your password when you are trying to login, click **Don't remember your password?** underneath the login. Enter your email to receive an email that will contain a link to reset your password. - -### Transaction Expiration - -For logging in with Google Authenticator, there is a timeout that occurs with the passcode where it will expire. Try logging in again if you do not see a refreshed passcode in the app. - -### Additional Help - -For other issues/questions regarding Google Authenticator, see: [Install Google Authenticator](https://support.google.com/accounts/answer/1066447). diff --git a/articles/multifactor-authentication/guardian/admin-guide.md b/articles/multifactor-authentication/guardian/admin-guide.md deleted file mode 100644 index 80f6a7fb98..0000000000 --- a/articles/multifactor-authentication/guardian/admin-guide.md +++ /dev/null @@ -1,187 +0,0 @@ ---- -description: How to enable and use Push Notifications and SMS for Guardian MFA. -toc: true ---- - -# Guardian for Administrators - -Guardian is Auth0's multifactor authentication (MFA) application that provides a simple, safe way for you to implement MFA. The Guardian app is used for two-factor authentication when logging into an application, which helps create a more secure login. With two-factor authentication your users will always need their mobile device in order to login. - -This page explains how to enable and use Push Notifications and SMS for MFA for signing in your users. - -For more information on Guardian, how to download the app, and common questions, see: [How to Use the Guardian App](/multifactor-authentication/guardian/user-guide). - -## Support for Push Notifications - -To enable Push Notifications MFA for sign in and sign up for your application by your users, go to the [Multifactor Auth](${manage_url}/#/guardian) section of the dashboard. Then toggle the **Push Notification** slider to enable it. - -![Dashboard > Guardian](/media/articles/mfa/guardian-dashboard.png) - -For your users to utilize this type of MFA, they will need a supported mobile device. The device must have either the Guardian app installed, the Google Authenticator app installed, or an app that supports scanning Time-based One-time Password (TOTP) codes to use with Guardian. Here are the available options: - -| **OS** | **Guardian** | **Google Authenticator** | -| --- | --- | --- | -| **iOS** | Requires iOS 9.0 or later| Requires iOS 5.0 or later | -| **Android** | Requires Android API version 18 or later| Requires Android version 2.1 or later | -| **Windows** | Guardian codes are supported using the Microsoft Authenticator app available for Windows 10 Mobile and Windows Phone 8/8.1 | Unsupported | -| **Blackberry** | Must use a TOTP scanning app | Requires OS 4.5-7.0 | -| **Other** | Must use a TOTP scanning app | Unsupported | - -::: note -For more information on using the Google Authenticator app, refer to [Google Authenticator](/multifactor-authentication/google-authenticator). -::: - -New users signing up will be prompted to download the Guardian app from either the App Store or Google Play. Once they indicate that they downloaded the app, a code will appear. They will have five minutes to scan the code with the app before it expires. After the code has been successfully scanned, users will see a confirmation screen which includes a recovery code. They need to have this recovery code to login without their mobile device. If they lose both the recovery code and their mobile device, you will need to [reset their MFA](#reset-an-mfa-for-a-user). Then they will receive a push notification to their device and they will be logged in. - -Users that were previously registered before you enabled MFA will need to complete the same process as new users on their next login. - -## Support for SMS - -You can enable SMS messages to use as a form of multifactor authentication. This is also under the [Multifactor Auth](${manage_url}/#/guardian) section of the dashboard. By toggling the **SMS** slider, you can enable using SMS for sign in and sign up for your application. SMS can be used as your only form of MFA or in addition to Push Notifications. - -Your users must have a device capable of using SMS to use this option. If your users are unable to always receive SMS messages (such as when traveling), they will be unable sign up with SMS and unable to login without the recovery code. - -When your users sign up with SMS, they enter their phone number's country code and mobile phone number. - -![](/media/articles/mfa/sms.png) - -After sign up, they receive a six digit code to their phone. They need to enter this code into the box, and then they will get a recovery code. They will need this code to login if they do not have their device. If they have lost their recovery code and device, you will need to [reset the user's MFA](#reset-an-mfa-for-a-user). - -::: panel Rate Limits - -Each hour, any given user is allotted a maximum of ten failed SMS attempts. After that, Auth0 considers all OTP codes invalid, and any additional attempts to log in results in a `Too Many Attempts` error. - -More specifically, this means that if someone enters in the code incorrectly ten or more times within an hour, they will need to wait six minutes to gain another attempt. If the user attempts another code before sufficient time has elapsed, Auth0 considers all OTP codes invalid (even if they aren't expired). -::: - -### Configuring Guardian SMS with Twilio - -When initially setting up SMS, you have up to 100 SMS to be used for testing. This limit can be removed by setting up a Twilio account. To prevent malicious login attempts, your users will always be limited to up to 10 SMS/Hour (replenishing one message an hour, up to 10). - -Click on the **SMS** box to configure your SMS settings. - -![](/media/articles/mfa/sms-config.png) - -#### 1. Open an account with Twilio - -You will need a [Twilio Account SID](https://www.twilio.com/help/faq/twilio-basics/what-is-an-application-sid) and a [Twilio Auth Token](https://www.twilio.com/help/faq/twilio-basics/what-is-the-auth-token-and-how-can-i-change-it). These are the Twilio API credentials that Auth0 will use to send an SMS to the user. You may also need to enable permissions for your [geographic region](https://support.twilio.com/hc/en-us/articles/223181108-How-International-SMS-Permissions-work). - -#### 2. Configure the connection - -Enter your **Twilio Account SID** and **Twilio Auth Token** in the appropriate fields. - -Choose your **SMS Source**. - -* If you choose **Use From**, you will need to enter the **From** phone number that users will see as the sender of the SMS. You may also configure this in Twilio. - -* If you choose **Use Copilot **, you will need to enter a [Copilot SID](https://www.twilio.com/docs/api/rest/sending-messages-copilot). - -Click **SAVE**. - -## Customize MFA for Select Users - -Once you have enabled either MFA option, you will be presented with the **Customize MFA** code snippet that you can edit to ensure that MFA is applied to the appropriate Applications. By default, Auth0 enables Guardian for all accounts. - -```js -function (user, context, callback) { - - //var CLIENTS_WITH_MFA = ['REPLACE_WITH_YOUR_CLIENT_ID']; - // run only for the specified applications - // if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) { - // uncomment the following if clause in case you want to request a second factor only from user's that have user_metadata.use_mfa === true - // if (user.user_metadata && user.user_metadata.use_mfa){ - context.multifactor = { - provider: 'guardian', //required - - // optional, defaults to true. Set to false to force MFA authentication every time. - // See https://auth0.com/docs/multifactor-authentication/custom#change-the-frequency-of-authentication-requests for details - allowRememberBrowser: false - }; - // } - //} - - callback(null, user, context); -} -``` - -If you choose to selectively apply MFA, you will need the appropriate `clientID` values, and the code will be executed as part of a [Rule](/rules) whenever a user logs in. - -More specifically, you will uncomment and populate the following line of the **Customize MFA** snippet with the appropriate client IDs: - -`var CLIENTS_WITH_MFA = ['REPLACE_WITH_CLIENT_ID'];` - -By setting `allowRememberBrowser: false`, the user will always be prompted for MFA when they login. This prevents the browser cookie from saving the credentials and helps make logins more secure, especially from untrusted machines. See [here](/multifactor-authentication/custom#change-the-frequency-of-authentication-requests) for details - -Once you have finished making your desired changes, click **Save**. - -## Customizing the Guardian Screen - -You may change the logo and the friendly name that is displayed to your users. To do so, make the appropriate changes to the Guardian page settings on the [Tenant Settings](${manage_url}/#/tenant) page. You may also reach the **Tenant Settings** page by clicking on your tenant name on the top right of the page and then selecting **Settings** from the dropdown menu that appears. - -![](/media/articles/mfa/guardian-logo-and-name-settings.png) - - * **Friendly Name**: the name of the app that you want displayed to users - * **Logo URL**: the URL that points to the logo image you want displayed to users - -Auth0 recommends using a logo image that is at least 100x100 pixels, although an image that is 200x200 pixels ensures quality viewing in devices with Retina or high DPI displays. - -## Tracking your Users MFA Events - -In the [Logs](${manage_url}/#/logs) section of the dashboard, you can see the various events related to your users signing up and signing in using MFA. - -![](/media/articles/mfa/logs.png) - -Here are all the possible events related to MFA: - -| Event Type | Description | -| --- | --- | -| `gd_unenroll` | When a device account is deleted | -| `gd_update_device_account` | When a device account is updated | -| `gd_send_pn` | When a push notification is sent | -| `gd_send_sms` | When a SMS is sent | -| `gd_sms_failure` | When a SMS failed to be sent. It usually means a configuration mistake for Twilio provider. You can check the provider error message and code as part of the details. | -| `gd_start_auth` | Start second factor authentication | -| `gd_start_enroll` | Second factor auth enrollment is started | -| `gd_enrollment_complete` | Second factor enrollment has been completed | -| `gd_module_switch` | When changing feature config | -| `gd_tenant_update` | When tenant info has been updated | -| `gd_user_delete` | When calling (user delete => unenroll) | -| `gd_auth_failed` | When second factor login has failed | -| `gd_auth_succeed` | When second factor authentication has succeeded | -| `gd_recovery_succeed` | Recovery succeeded | -| `gd_recovery_failed` | Failed recovery | -| `gd_otp_rate_limit_exceed` | When One Time Password fails validation because rate limit is exceeded | -| `gd_recovery_rate_limit_exceed` | When recovery validation fails because rate limit is exceeded | - -These events can also be searched using the [Management APIv2](/api/management/v2#!/Logs) using [query string syntax](/api/management/v2/query-string-syntax). You can search criteria using the `q` parameter or you can search by a specific log ID. - -### Examples searching with the `q` parameter - -To see the events for users who are enrolling with MFA: - -`type: gd_start_enroll` - -To see all the times an SMS is sent: - -`type: gd_send_sms` - -## Reset an MFA for a User - -If a user has lost their mobile device, they will need their recovery code to be able to log in. If they have also lost their recovery code, you, as an administrator, will need to reset their MFA. - -To reset a user's MFA: - -1. Find and select the user in the [Users](${manage_url}/#/users) section of the dashboard. -2. Once you have selected the affected user, click on the **Actions** button on the top right of the screen. -3. Select **Reset Multifactor Authentication** from the dropdown. -4. There will be a pop up box to confirm your decision. Click **YES, RESET IT** to reset the user's MFA. - - ![](/media/articles/mfa/reset-mfa.png) - -The next time the user logs in they will need to re-setup their MFA just like a new user. - -## Disabling Guardian and other MFA - -Guardian, and other types of MFA, can be disabled from the [Multifactor Auth](${manage_url}/#/guardian) section of the dashboard. Toggle the button to disabled for the type of MFA you wish to turn off. A confirmation popup will appear. - -By disabling a type of MFA, you will un-enroll all your current users of that type of MFA. They will be asked to re-enroll next time they try to login. This action cannot be reverted. diff --git a/articles/multifactor-authentication/guardian/dev-guide.md b/articles/multifactor-authentication/guardian/dev-guide.md deleted file mode 100644 index 49011428f6..0000000000 --- a/articles/multifactor-authentication/guardian/dev-guide.md +++ /dev/null @@ -1,131 +0,0 @@ ---- -description: How to implement multifactor authentication with Guardian. ---- - -# Developer Guide to Configuring Guardian - -Guardian is Auth0's multifactor authentication (MFA) application that provides a simple, safe way for you to implement MFA. The Guardian app is currently available for mobile devices running iOS or Android. - -For applications where Guardian MFA is enabled, the user will be required to sign in **and** confirm the login with a verified mobile device. You can find additional information on user login and sign-up process and common user questions at: [How to Use the Guardian App](/multifactor-authentication/guardian/user-guide). - -## Implementing Multifactor Authentication - -Within Auth0, you may implement MFA via the [Multifactor Auth](${manage_url}/#/guardian) page of the Management Dashboard. - -![](/media/articles/mfa/guardian-dashboard.png) - -::: panel MFA options -Auth0 provides [built-in support](/multifactor-authentication) for MFA using Google Authenticator or Duo. You may choose to use either of these providers, in lieu of Guardian, or any code generator application, on the **Multifactor Auth** page of the Management Dashboard. -::: - -### Configuring Guardian in the Management Dashboard - -The first thing you will do when setting up Guardian is to decide whether you would like MFA to occur via push notifications, SMS, or both. - -* **Push Notifications**: the user receives, via the Guardian app, a push notification that requires their input prior to gaining access to the app. Or, instead, if the user chooses, they can use the Google Authenticator app in a similar way. -* **SMS**: the user receives, via SMS, a code that they are required to enter prior to gaining access to the app. - -To enable either Push Notifications or SMS verification, move the appropriate slider to the right. - -![](/media/articles/mfa/guardian-both.png) - -Once you have enabled either option, you will be presented with the **Customize MFA** code snippet that is applied automatically as a new [Rule](/rules). This rule will be executed in Auth0 as part of the transaction everytime a user authenticates to your application. By default, Auth0 enables Guardian for everything, but you may edit the rule so that MFA is applied only to some applications or users, as shown below. - - -```js -function (user, context, callback) { - - //var CLIENTS_WITH_MFA = ['REPLACE_WITH_YOUR_CLIENT_ID']; - // run only for the specified applications - // if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) { - // uncomment the following if clause in case you want to request a second factor only from user's that have user_metadata.use_mfa === true - // if (user.user_metadata && user.user_metadata.use_mfa){ - context.multifactor = { - provider: 'guardian', //required - - // optional, defaults to true. Set to false to force MFA authentication every time. - // See https://auth0.com/docs/multifactor-authentication/custom#change-the-frequency-of-authentication-requests for details - allowRememberBrowser: false - }; - // } - //} - - callback(null, user, context); -} -``` - -If you choose to selectively apply MFA, you will need the appropriate `clientID` values, and the code is executed as part of a [Rule](/rules) whenever a user logs in. - -More specifically, you will uncomment and populate the following line of the Customize MFA snippet with the appropriate application's client IDs: - -```js -var CLIENTS_WITH_MFA = ['REPLACE_WITH_CLIENT_ID']; -``` - -Once you have finished making your desired changes, click "Save" so that they persist. - -### Configuring Guardian for Select Users - -You may choose to enable Guardian only for select users. Within the Customize MFA code snippet, you may include the conditions for when Guardian is enabled. - -For example, suppose you want to disable MFA for all users signing in from the `foo.com` domain. - - -```js -function (user, context, callback) { - - if (context.connection !== 'foo.com'){ - context.multifactor = { - provider: 'guardian', //required - }; - } - - callback(null, user, context); -} -``` - -Once you have finished making your desired changes, click **Save** so that they persist. - -### Customizing the Guardian Screen - -You may change the logo and the friendly name that is displayed to your users. To do so, make the appropriate changes to the Guardian page settings on the [Tenant Settings](${manage_url}/#/tenant) page. You may also reach the **Tenant Settings** page by clicking on your tenant name on the top right of the page and then selecting **Settings** from the dropdown menu that appears. - -![](/media/articles/mfa/guardian-logo-and-name-settings.png) - -* **Friendly Name**: the name of the app that you want displayed to the users; -* **Logo URL**: the URL that points to the logo image you want displayed to your users. - -Auth0 recommends using a logo image that is at least 100x100 pixels, though an image that is 200x200 pixels ensures quality viewing in devices with Retina or high DPI displays. - -## Tracking and Searching MFA Events - -All MFA related events are recorded for audit purposes. For example, each time a new user enrolls with a form of MFA enabled, an **Enroll started** event is triggered. - -![](/media/articles/mfa/log-example.png) - -You can view events in the [Logs](${manage_url}/#/logs) sections of the dashboard. - -![](/media/articles/mfa/logs.png) - -Here are all the possible events related to MFA: - -| Event Name | Description | -| --- | --- | -| `gd_unenroll` | When a device account is deleted | -| `gd_update_device_account` | When a device account is updated | -| `gd_send_pn` | When a push notification is sent | -| `gd_send_sms` | When a SMS is sent | -| `gd_sms_failure` | When a SMS failed to be sent. It usually means a configuration mistake for Twilio provider. You can check the provider error message and code as part of the details. | -| `gd_start_auth` | Start second factor authentication | -| `gd_start_enroll` | Second factor auth enrollment is started | -| `gd_module_switch` | When changing feature config | -| `gd_tenant_update` | When tenant info has been updated | -| `gd_user_delete` | When calling (user delete => unenroll) | -| `gd_auth_failed` | When second factor login has failed | -| `gd_auth_succeed` | When second factor authentication has succeeded | -| `gd_recovery_succeed` | Recovery succeeded | -| `gd_recovery_failed` | Failed recovery | -| `gd_otp_rate_limit_exceed` | When One Time Password fails validation because rate limit is exceeded | -| `gd_recovery_rate_limit_exceed` | When recovery validation fails because rate limit is exceeded | - -These events can also be searched using the [Management APIv2](/api/management/v2#!/Logs) using [query string syntax](/api/management/v2/query-string-syntax). You can search criteria using the `q` parameter or you can search by a specific log ID. diff --git a/articles/multifactor-authentication/guardian/index.md b/articles/multifactor-authentication/guardian/index.md deleted file mode 100644 index 46f01b31f0..0000000000 --- a/articles/multifactor-authentication/guardian/index.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Auth0 Guardian -description: Links to Guardian documentation for each type of Guardian user role. ---- - -# Auth0 Guardian - -Guardian is Auth0's multifactor authentication solution that provides a simple and secure way to implement MFA. When using Guardian with Auth0, users will be prompted for additional authentication from the Guardian mobile application, helping to provide a more secure login. - -**To learn more, click the link below that most suits your role:** - -[Guardian for Administrators](/multifactor-authentication/administrator) - information on how to enable and configure Guardian. - -[Guardian for Developers](/multifactor-authentication/developer) - learn how to customize Guardian to your needs, and use multifactor within your applications. - -[Guardian for Users](/multifactor-authentication/guardian/user-guide) - this page is for users logging into your application using Guardian, Google Authenticator or SMS. It also has troubleshooting tips for any issues they may encounter. diff --git a/articles/multifactor-authentication/guardian/user-guide.md b/articles/multifactor-authentication/guardian/user-guide.md deleted file mode 100644 index 29af26598f..0000000000 --- a/articles/multifactor-authentication/guardian/user-guide.md +++ /dev/null @@ -1,131 +0,0 @@ ---- -description: How to sign-up and login using the Guardian app. -toc: true ---- -# How to Use the Guardian App - -Guardian is an app that can be downloaded from the [App Store](https://itunes.apple.com/us/app/auth0-guardian/id1093447833) or from [Google Play](https://play.google.com/store/apps/details?id=com.auth0.guardian). The Guardian app is used for two-factor authentication when logging into an application, which helps create a more secure login. With two-factor authentication you will always need your mobile device when you log in. - -This page will help to explain how to sign up and log in using the Guardian app and using other forms of two-factor authentication. - -## Enroll for MFA - -Enrolling for MFA is a separate, distinct step from the initial sign-up for Auth0. Typically, the user is prompted to enroll the first time they attempt to sign-in to an application protected by MFA. Additionally, administrators have the ability to [invite users to enroll](multifactor-authentication/administrator/guardian-enrollment-email). - -If you choose to enroll from the Guardian widget, then following your initial authentication you will see the option to download the Auth0 Guardian app from the [App Store](https://itunes.apple.com/us/app/auth0-guardian/id1093447833) or from [Google Play](https://play.google.com/store/apps/details?id=com.auth0.guardian). - -Underneath that, there is the option to use [Google Authenticator](#google-authenticator) or [SMS](#sms) depending on the application's settings. - -![Guardian widget enroll](/media/articles/mfa/choose-mfa.png) - -Choose the type of two-factor to use: the Guardian app, the Google Authenticator app, or an SMS. - -### Guardian - -To use the Guardian app, first download either the [iOS](https://itunes.apple.com/us/app/auth0-guardian/id1093447833) or [Android](https://play.google.com/store/apps/details?id=com.auth0.guardian) app depending on the type of device you have. Once you have Guardian downloaded, click **I've already downloaded it**. - -Next, a code will appear, you will have five minutes to scan the code before it expires. Open the Guardian app and scan the code. - -![Guardian code](/media/articles/mfa/guardian-code.png) - -After the code has been successfully scanned, you will see a confirmation screen which includes a recovery code. If for some reason you do not have your mobile device, you will need this recovery code to login. Make sure to take note of this code and keep it somewhere safe. Check the box that you have recorded the code, and then you are logged in. - -![Guardian recover code](/media/articles/mfa/guardian-recover-code.png) - -::: panel Passphrase for Android Users -After first enrolling using the Guardian app for Android, you will be required to create a passphrase. This recovery passphrase will not be required every time you use the app, but could be required when your lock screen security options have been changed. You can use the suggested passphrase or create your own. - -
    Android Passphrase Example
    -::: - - -### Google Authenticator - -If you would prefer to use the Google Authenticator app, click on the link for Google Authenticator. You will need to download Google Authenticator for [Android](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2) or [iOS](https://itunes.apple.com/us/app/google-authenticator/id388497605). - -A code will appear, and you will have five minutes to scan the code before it expires. After scanning the code, you will get a six digit code to enter. Once you enter this code, you will see a confirmation screen which has a recovery code. If for some reason you do not have your mobile device, you will need this recovery code to login. Make sure to take note of this code and keep it somewhere safe. Check the box that you have recorded the code, and then you are logged in. - -![Google Authenticator code](/media/articles/mfa/google-code.png) - -For more information about Google Authenticator, see [Install Google Authenticator](https://support.google.com/accounts/answer/1066447). - -### SMS - -Depending on the applications settings, SMS may be an option to use for two-factor authentication. Click on the the **SMS** link after entering your email and password. - -Then select your phone number's country code and enter your mobile phone number. You must be able to receive SMS to your device to use this option. - -![SMS enroll](/media/articles/mfa/sms.png) - -Then you should receive a six digit code in a message to your phone. Enter this code into the box. Then you will see a recovery code, make sure to note this code as you will need it to login if you do not have your device. Check the box that you have recorded the code, and then you are all set and logged in. - -## Log in - -Depending on the type of two-factor authentication you chose when you were signing up, this will affect how you login. - -### Guardian - -After entering your username and password, a push notification will be sent to the Guardian app on your mobile device. This notification is a login request, it includes the application name, the OS and browser of the request, the location and the date of the request. If you recognize this request as your own, tap the **Allow** button. You should now be logged in. - -If you are not currently connected to the internet on your mobile device to receive push notifications, you can enter the OTP (One-time password) manually by clicking "enter the code". - -![Enter code at Guardian widget](/media/articles/mfa/guardian-enter-code.png) - -To find this code, go into the Guardian app on your device, and click on the application you are trying to log into. Then you should see information on your last sign in and a 6-digit code at the bottom which is your OTP. - -
    Lock-iOS
    - -Enter this code to finish signing in. - -::: panel Rate Limits - -Each hour, you are allotted a maximum of ten failed SMS attempts. After that, Auth0 considers all OTP codes invalid, and any additional attempts to log in results in a `Too Many Attempts` error. - -More specifically, this means that if you enter in the code incorrectly ten or more times within an hour, you will need to wait six minutes to gain another attempt. If you attempt another code before sufficient time has elapsed, Auth0 will consider any OTP code you enter as invalid (even if they aren't expired). -::: - -If you do not have your mobile device available to you during sign in, you can enter the recovery code that was given when you signed up by clicking the "Use the Recovery Code" link. - -### Google Authenticator - -After entering your username and password, you will be prompted for a six digit code. Open the Google Authenticator app on your mobile device to find the correct code. If you use Google Authenticator for other applications as well, make sure you are using the code for the current application. After entering the six digit code you will be logged in. - -If you do not have your mobile device available to you during sign in, you can enter the recovery code that was given when you signed up by clicking the "Use Recovery Code" link. - -### SMS - -After entering you enter your email and password, a SMS message will be sent to the phone number you entered when you signed up. Enter the six digit code from the message into the box to complete your login. - -If you do not have your mobile device available to you during sign in, you can enter the recovery code that was given when you signed up by clicking the "Use Recovery Code" link. - -## Troubleshooting - -### If you do not have your mobile device or it is turned off - -If you have lost your device you can finish the two-step authentication with the recovery code from when you signed up. After entering your email and password to login, click the link that says "Use the recovery code" to access your account without using your device. - -If you don't have your recovery code you will not be able to login. Contact your system administrator for help accessing your account. - -### If you forgot your password - -If you forgot your password when you are trying to login, click **Don't remember your password?** underneath the login. Enter your email to receive an email that will contain a link to reset your password. - -### If your OTP is not being accepted - -If the 6-digit code in the Guardian or the Google Authenticator app are being rejected for sign in, first check that you are selecting the right application from the list on the landing page of each application. You should see the name of the application and the email you are using for sign in, make sure these are correct. - -If you know you are selecting the correct connection, make sure that your mobile device's clock settings are correct. One-time passwords are generated using Coordinated Universal Time(UTC) so your device time must be correct to generate the correct OTP. - -### Transaction Expiration - -For all types of multifactor authentication types there is a five minute expiration. Check the timestamp on the messages to see if it is still valid when trying to login. If it has been longer than five minutes, you will need to try to login again and get a new code or notification. - -If using SMS, make sure you are not [exceeding rate limits](#sms-rate-limits). - -### If you did not receive a SMS - -If you did not receive your six digit code via SMS, check that the phone number you entered is correct. If it is the correct number, make sure you have a cellular signal. If you still are not receiving the messages, check with your service provider to confirm that messages are not getting blocked. - -### SMS Rate Limits - -If you attempt to send more than ten SMS to your device within an hour, you will see an error message about a rate limit exception. If you have exceeded the limit of ten, you will need to wait at least an hour from your first SMS send to send another message. Each hour after the first attempt you will gain one more message request maxing out at ten requests. diff --git a/articles/multifactor-authentication/index.md b/articles/multifactor-authentication/index.md deleted file mode 100644 index 077fb1de81..0000000000 --- a/articles/multifactor-authentication/index.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: Multifactor Authentication in Auth0 -description: The basics of multifactor authentication and the different methods of implementing it with Auth0. -url: /multifactor-authentication ---- - -# Multifactor Authentication in Auth0 - -Multifactor Authentication (MFA) is a method of verifying a user's identity by requiring them to present more than one piece of identifying information. This method provides an additional layer of security, decreasing the likelihood of unauthorized access. The type of information required from the user is typically two or more of the following: - -* **Knowledge**: Something the user knows (such as a password) -* **Possession**: Something the user has (such as a cell phone) -* **Inheritance**: Something the user is (such as a fingerprint or retina scan) - -## Implementing MFA with Auth0 - -Auth0 supports the following methods of implementing MFA: - -1. [Push Notifications (Auth0 Guardian)](/multifactor-authentication#mfa-using-push-notifications-auth0-guardian-) - Auth0's mobile application Guardian sends push notifications for MFA -2. [SMS (Auth0 Guardian)](/multifactor-authentication#mfa-with-sms) - Verification by sending a six-digit code via SMS -3. Support for one-time password authentication services [Google Authenticator](/multifactor-authentication#mfa-using-google-authenticator) and [Duo Security](/multifactor-authentication#mfa-using-duo-security). -4. [Configuring rules for custom processes](/multifactor-authentication#mfa-using-custom-rules) - such as Contextual MFA, which allows you to define the conditions that will trigger additional authentication challenges, such as changes in geographic location or logins from unrecognized devices. -5. Using a [custom provider](/multifactor-authentication#mfa-using-a-custom-provider), such as **Yubikey**. - -## MFA using Push Notifications (Auth0 Guardian) - -
    Guardian Push Screenshot
    - -Guardian is Auth0's MFA application. It is a frictionless approach to implementing MFA for your apps, and provides a full MFA experience without requiring integration with third-party utilities. - -[Click here to learn more about enabling push notifications with Guardian](/multifactor-authentication/guardian) - -## MFA with SMS - -
    MFA SMS Screenshot
    - -Auth0 supports sending an SMS with a one-time password code to be used for another step of verification. - -[Click here to learn more about enabling SMS](/multifactor-authentication/guardian/admin-guide#support-for-sms) - -## MFA Using Google Authenticator - -
    Screenshot of Google Authenticator
    - -Google Authenticator is a mobile app that generates 2-step verification codes. This creates a one-time use password that is used as the second factor after your user has attempted to log in with their Google credentials. - -[Click here to learn more about enabling Google Authenticator](/multifactor-authentication/google-authenticator) - -## MFA Using Duo Security - -
    DUO Screenshot
    - -Duo Security allows you to request either of the following as your second factor once the user has provided their initial login credentials: - -* A user response to a push notification sent to the appropriate device -* A passcode provided to the user via SMS - -[Click here to learn more about enabling Duo](/multifactor-authentication/duo) - -## MFA Using Custom Rules - -You may [configure rules](/rules) for custom MFA processes, which allow you to define the conditions that will trigger additional authentication challenges, such as changes in geographic location or logins from unrecognized devices. - -[Click here for sample code snippets](/multifactor-authentication/custom) to assist you in building your rules here. - -## MFA Using a Custom Provider - -For a detailed look at implementing a custom MFA provider, see [Multifactor Authentication with YubiKey-NEO](/multifactor-authentication/yubikey) as an introduction. - -## User-initiated MFA - -For details on how to implement user-initiated MFA, so you can flag users for MFA as part of the user creation/login process, refer to [User-Initiated Multifactor Authentication](/multifactor-authentication/user-initiated-mfa). diff --git a/articles/multifactor-authentication/touchid.md b/articles/multifactor-authentication/touchid.md deleted file mode 100644 index 3fa009783f..0000000000 --- a/articles/multifactor-authentication/touchid.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -description: Links to documentation for Touch ID. ---- -# Touch ID Settings - -Below you can find useful links in our documentation to handle Touch ID within Auth0. - -- [Authenticate users with Touch ID in iOS](/connections/passwordless/ios-touch-id-swift) -- [Touch ID Authentication](/libraries/lock-ios/touchid-authentication) -- [Passwordless authentication using Touch ID & JWT](https://github.com/auth0/TouchIDAuth) -- [Touch ID and React Native](https://auth0.com/blog/2015/04/03/using-touchid-for-authentication-in-your-react-native-app/) diff --git a/articles/multifactor-authentication/user-initiated-mfa.md b/articles/multifactor-authentication/user-initiated-mfa.md deleted file mode 100644 index 2a10875b63..0000000000 --- a/articles/multifactor-authentication/user-initiated-mfa.md +++ /dev/null @@ -1,118 +0,0 @@ ---- -title: User-Initiated Multifactor Authentication (MFA) -description: How to set up user-initiated multifactor authentication -toc: true ---- -# User-Initiated Multifactor Authentication - -In this tutorial, we will show you how to implement and enable user-initiated multifactor authentication (MFA). We will cover how to: - -* Enable MFA using Auth0's Management Dashboard -* Programmatically flag new users for MFA -* Set the users up to initiate MFA enrollment when logging in for the first time. - -## Enable Multifactor Authentication - -You can enable Multifactor Authentication (MFA) using the Dashboard. - -Log in to your Auth0 account and navigate to the [**Multifactor Auth** page of the Management Dashboard](${manage_url}/#/guardian). - -![](/media/articles/mfa/mfa-home.png) - -You'll have the option to enable MFA that uses either **Push Notifications** or **SMS**. You can also use both. Click the slider(s) next to the option(s) you want enabled. - -Once you've enabled one or more types of MFA, you'll see the **Customize MFA** section, which is a text editor that allows you to write the code to determine when MFA is necessary. The code runs as part of your [rules](/rules) whenever a user logs in. - -![](/media/articles/mfa/mfa-template.png) - -To help you get started, you'll see a template you can modify. Additional templates that implement various MFA features are available under **Templates**, which is located to the top right of the code editor. - -As an example, the follow code snippet calls for MFA when: - -* The application specified is used -* The user's `app_metadata` has a `use_mfa` flag set to `true` - -Finally, if the two parameters above are met, MFA occurs every login. - -```js -function (user, context, callback) { - - // run only for the specified applications - var CLIENTS_WITH_MFA = ['REPLACE_WITH_YOUR_CLIENT_ID']; - - if (CLIENTS_WITH_MFA.indexOf(context.clientID) !== -1) { - if (user.app_metadata && user.app_metadata.use_mfa){ - - context.multifactor = { - // required - provider: 'guardian', - - // set to false to force Guardian authentication every login - allowRememberBrowser: false - }; - } - } - - callback(null, user, context); -} -``` - -## Flag New Users for MFA - -In this step, we'll add functionality within the user creation/login process that flags users for MFA. - -You'll need to [get an Access Token](/api/management/v2/tokens) to call the [Management API](/api/management/v2) during the user creation process. The only scope that you need to grant to the issued token is `update:users_app_metadata`. - -Using this token, you can place a flag on app_metadata that indicates whether MFA is needed whenever that user logs in. More specifically, you'll be programmatically setting their the user's `app_metadata` field with `use_mfa = true`. - -You can do this by making the appropriate `PATCH` call to the [Update a User endpoint of the Management API](/api/management/v2#!/Users/patch_users_by_id). Note that the body of the call omits most of the extra details (such as email and phone number) you might need to include. - -```har -{ - "method": "POST", - "url": "https://${account.namespace}/api/v2/users/USER_ID", - "httpVersion": "HTTP/1.1", - "cookies": [], - "headers": [{ - "name": "Authorization", - "value": "Bearer MGMT_API_ACCESS_TOKEN" - }], - "queryString": [], - "postData": { - "mimeType": "application/json", - "text": "{ \"blocked\": false, \"email_verified\": false, \"email\": \"\", \"verify_email\": false, \"phone_number\": \"\", \"phone_verified\": false, \"verify_phone_number\": false, \"password\": \"\", \"verify_password\": false,\"user_metadata\": {},\"app_metadata\": { \"use_mfa\": true }, \"connection\": \"\", \"username\": \"\",\"client_id\": \"DaM8...rdyX\"}" - }, - "headersSize": -1, - "bodySize": -1, - "comment": "" -} -``` - -## Initiate Guardian Enrollment - -In this step, we'll initiate Guardian Enrollment for users who have been flagged for MFA. Note that you can use any MFA provider that integrates with Auth0 -- you do not necessarily have to use Guardian. - -You'll need to [get an Access Token](/api/management/v2/tokens) to call the [Management API](/api/management/v2). The only scope that you need to grant to the issued token is `create:guardian_enrollment_tickets`. You might consider adding both scopes to the Access Token when you make the initial request in the [previous step](#flag-new-users-for-mfa) in lieu of making two separate requests, each resulting in a token with a different scope. - -You can enroll a user in Guardian MFA by making the appropriate `POST` call to the [Create a Guardian Enrollment Ticket endpoint of the Management API](/api/management/v2#!/Guardian/post_ticket). - -```har -{ - "method": "POST", - "url": "https://${account.namespace}/api/v2/guardian/enrollments/ticket", - "httpVersion": "HTTP/1.1", - "cookies": [], - "headers": [{ - "name": "Authorization", - "value": "Bearer MGMT_API_ACCESS_TOKEN" - }], - "queryString": [], - "postData": { - "mimeType": "application/json", - "text": "{ \"user_id\": \"\", \"email\": \"\", \"send_mail\": false }", - "headersSize": -1, - "bodySize": -1, - "comment": "" - } -} -``` diff --git a/articles/multifactor-authentication/yubikey.md b/articles/multifactor-authentication/yubikey.md deleted file mode 100644 index 3f43e3f260..0000000000 --- a/articles/multifactor-authentication/yubikey.md +++ /dev/null @@ -1,156 +0,0 @@ ---- -description: How to implement Multifactor Authentication Using YubiKey NEO. -toc: true ---- -# Multifactor Authentication with YubiKey NEO - -This tutorial shows you how to implement Multifactor Authentication (MFA) using [YubiKey NEO](https://www.yubico.com/products/yubikey-hardware/yubikey-neo/). - -Implementing MFA using YubiKey NEO requires use of the following Auth0 features for the described reasons: - -| Feature | Usage | -| - | - | -| [Webtask](https://webtask.io) | Hosts the website where the user undergoes the second authentication factor using YubiKey | -| The [Redirect Protocol](/rules/redirect) | Redirects the user to the website that performs the second authentication factor using YubiKey | -| [Rule](/rules) | Evaluates whether the conditions you set for triggering MFA have been met or not | - -In this tutorial, we will walk you through the configuration required for the Webtask, redirect protocol, and rules. - -## Configure the Webtask - -The first thing we'll do is create the website where the user completes the second authentication step using YubiKey. We'll use a Webtask, which allows you to run code using the Auth0 sandbox, to host the site. More specifically, the Webtask will: - -* **Render** the UI with the `otpForm` function -* **Capture** the YubiKey NEO code and validate it using the Yubico API -* **Return** the result of the validation to Auth0 -- if successful, Auth0 continues to process the login transaction - -### Step 1: Create the Webtask Code - -Webtask runs code you provide, so we'll begin by creating the code needed. We've provided you with a [fully-functional sample](https://github.com/auth0/rules/blob/master/redirect-rules/yubico-mfa.md), which you need to save locally in a file called `yubico-mfa-wt.js`. - -Within the code provided is a redirect URL to Auth0. It contains querystring parameters called `id_token` and `state`. The `id_token` parameter is used to transfer information back to Auth0. The `state`parameter is used to protect against CSRF attacks. - -No actual key values are hard-coded into the Webtask code. Your Yubico Client ID and Secret values are referred to using `context.data.yubico_clientid` and `context.data.yubico_secret`. These parameters are securely embedded in the Webtask token when you created the Webtask. - -### Step 2: Initialize the Webtask CLI - -Now that we have the code for our Webtask, we'll need to create the Webtask itself. We do this using the Webtask CLI. - -To use the Webtask CLI, you'll need to install it using instructions that can be found under [Tenant Settings > Webtasks](${manage_url}/#/tenant/webtasks) on the Auth0 Dashboard. - -![](/media/articles/mfa/yubi-1.png) - -Once you've installed the Webtask CLI, run the following code after you've replaced the placeholders with your Yubico Client ID and Secret values (make sure that the Webtask CLI can access to location where you have your `yubico-mfa-wt.js` file): - -```txt -wt create --name yubikey-mfa --secret yubikey_secret={YOUR YUBIKEY SECRET} --secret yubikey_clientid={YOUR YUBIKEY CLIENT ID} --secret returnUrl=https://${account.namespace}/continue --profile {WEBTASK PROFILE} yubico-mfa-wt.js -``` - -::: note -You can get your `WEBTASK PROFILE` value (needed for the-p parameter shown at the end of the code above) in **Step 2** of the Webtask installation instructions shown on the [Tenant Settings > Webtasks](${manage_url}/#/tenant/webtasks) page. -::: - -Running the `create` command as shown above will generate a URL that looks like this: - -```txt -https://sandbox.it.auth0.com/api/run/${account.tenant}/yubikey-mfa?webtask_no_cache=1 -``` - -Keep a copy of this URL. - -## Create the Rule - -This sample uses a single rule that handles: - -* The initial redirect to the Webtask -* The returned result - -Here is what the rule looks like: - -```js -function (user, context, callback) { - var jwt = require('jsonwebtoken@5.7.0'); - var yubikey_secret = configuration.YUBIKEY_SECRET; - - //Returning from OTP validation - if(context.protocol === 'redirect-callback') { - var decoded = jwt.verify( - context.request.query.id_token, - new Buffer(yubikey_secret,'base64') - ); - if (!decoded) { return callback(new Error('Invalid OTP')); } - if (decoded.status !== 'OK') { return callback(new Error('Invalid OTP Status')); } - - return callback(null,user,context); - } - - //Trigger MFA - context.redirect = { - url: configuration.WEBTASK_URL + "?user=" + user.name - }; - - callback(null,user,context); -} -``` - -You also need to create two new settings on [Rules](${manage_url}/#/rules): - -* One using `WEBTASK_URL` as the key, and the URL returned by the `create` command as the value. -* Another using `YUBIKEY_SECRET` as the key, and `{YOUR YUBIKEY SECRET}` passed to `create` as the value. - -::: note -The returning section of the rule validates the JWT issued by the Webtask. This prevents the result of the MFA part of the transaction from being tampered with because the payload is digitally signed with a shared secret. -::: - -Some notes regarding the rule code: - -* The `context.redirect` statement instructs Auth0 to redirect the user to the Webtask URL instead of calling back to the app -* The return is indicated by the `protocol` property of the `context` object -* The section handling the return validates the JWT issued by the Webtask to ensure that the result of MRA hasn't been tampered by an unauthorized party - -You'll [create the rule using the Management Dashboard](${manage_url}/#/rules). - -![](/media/articles/mfa/yubi-2.png) - -Click **Create Your First Rule** (or **Create Rule** if you've already created rules before). Choose **empty rule**. - -![](/media/articles/mfa/yubi-3.png) - -You'll see the following editor window where you can paste in the rule code above. - -![](/media/articles/mfa/yubi-4.png) - -You can test your code for correctness using **Try This Rule**. When done, click **Save** to proceed. - -You also need to create two new Settings for your [Rules](${manage_url}/#/rules): - -| Setting | Value | -| - | - | -| `WEBTASK_URL` | The URL you saved after running the `CREATE` command in the Webtask CLI | -| `YUBIKEY_SECRET` | Your YubiKey client secret | - -With these settings, you can access the provded values in your rules code using the configuration global object (such as `configuration.WEBTASK_URL`). - -![](/media/articles/mfa/yubi-5.png) - -With this rule in place, the user will be redirected to the Webtask after every login. They will see the following prompt for their second factor: - -![](/media/articles/mfa/yubico-mfa.png) - -### Customize the Rule - -You can add logic to the rule to determine which conditions the challenge will be triggered based on: - -You can add logic to the rule to set the conditions under which the MFA challenge will be triggered. Some examples include: - -* The IP address or location of the user -* The application the user is logging into -* The type of authentication used (such as AD, LDAP, or Social) - -## Keep Reading - -::: next-steps -* [Rules](/rules) -* [Multi-factor in Auth0](/multifactor-authentication) -* [Auth0 Webtask](https://webtask.io/) -::: diff --git a/articles/onboarding/appliance-sprint.md b/articles/onboarding/appliance-sprint.md index 4be0f84ad8..1beb874949 100644 --- a/articles/onboarding/appliance-sprint.md +++ b/articles/onboarding/appliance-sprint.md @@ -2,8 +2,15 @@ sitemap: false section: appliance description: PSaaS Appliance Sprint is Auth0’s onboarding program for enterprise customers choosing an PSaaS Appliance. It helps you achieve value quickly with your Auth0 enterprise subscription. +topics: + - appliance + - onboarding +contentType: + - concept +useCase: + - appliance +applianceId: appliance64 --- - # PSaaS Appliance Deployment Project PSaaS Appliance Sprint is Auth0’s onboarding program for enterprise customers choosing an PSaaS Appliance. It helps you achieve value quickly with your Auth0 enterprise subscription. @@ -48,4 +55,4 @@ The following sections describe what happens during each step of the PSaaS Appli ## What's next? -Once the PSaaS Appliance is deployed, an Auth0 Customer Success Manager will work with you to complete the rest of the [Sprint onboarding program](https://auth0.com/docs/onboarding/sprint) - the end result being a joint success plan to drive value throughout the subscription lifecycle. +Once the PSaaS Appliance is deployed, an Auth0 Technical Account Manager will work with you to build a joint success plan to drive value throughout the subscription lifecycle. \ No newline at end of file diff --git a/articles/onboarding/cloud-sprint.md b/articles/onboarding/cloud-sprint.md deleted file mode 100644 index 7384806f9b..0000000000 --- a/articles/onboarding/cloud-sprint.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -sitemap: false -description: An overview of the steps in the Cloud Sprint onboarding program. ---- - -# Cloud Sprint - -## Auth0 Customer Onboarding Program - -Cloud Sprint is Auth0’s onboarding program for enterprise customers. It helps you achieve value quickly with your Auth0 enterprise cloud subscription. The 6 steps in the onboarding program set both you and Auth0 up for success. - -## Cloud Sprint Overview - -![Cloud Sprint Program Overview](/media/articles/onboarding/cloud-sprint-program-overview.png) - -[Download the Cloud Sprint PDF here.](/media/articles/onboarding/cloud-sprint-onboarding.pdf) - -Hours allocated as consulting, are delivered by our services team of system architects and software engineers for the purpose of guiding you through the common technical requirements, questions, advice and best practices to get successfully started with Auth0. - -If you have complex requirements needing deeper consulting and advice from our experts than the time allocated here will allow then ask your Sales Executive about purchasing [Professional Services](/services) hours. These hours can be used for services including: -- Systems architecture design consulting -- Software development assistance related to integration of your application to Auth0 -- Data migration from 3rd party/proprietary databases -- Performance & load testing - -## Cloud Sprint: Details & Resources - -### Step 1. Welcome & Orientation - -**When?** This session is generally booked within 5 days of signing your subscription agreement. - -**What?** Our Customer Success team are devoted to learning more about your business and what you want to achieve with Auth0. In this short, casual session our Customer Success Managers will ask lots of questions and do lots of listening. - -[Cloud Sprint - Get Started Form](https://docs.google.com/a/auth0.com/forms/d/1R0vq5DQxdbgdE0kkJPcruKXiFdZpddLV_P5wlTQwOfE/viewform) - Spend 5 minutes to fill out this form. This can help speed up the process of your subscription being applied your correct Auth0 account or help us provision a new one so you can access it ASAP! - -[Auth0 support resources and guidance for enterprise customers.](/onboarding/enterprise-support) - Already developing? No need to wait, you can plug in to our support resources immediately! - -### Step 2. Technical Discovery & Guidance - -**When?** This session is generally booked within 14 days of signing your subscription agreement. - -**What?** The goal of this technical session is to send you forward on the best path. It’s an opportunity for our Customer Success Engineers to understand your software architecture and integration plans and for your team to ask questions or seek advice. - -[Common Architecture and Scenarios](/architecture-scenarios) - Quick guidance on common Business Scenarios and Application Configurations and the things you need to know to get started. - -[Auth0 Learn Resources](https://auth0.com/learn/) - Explore these resources for guidance on topics including Refresh Tokens, 2FA, implementing SSO and migrating existing user data. - -### Step 3. Management Dashboard Guidance -**When?** You can access self service resources immediately. A live session is generally booked soon after the Technical Discovery & Guidance session. - -**What?** The goal of this light technical session is to familiarize your team with the Auth0 Management Dashboard to understand both some of the administrative elements (such as setting up new Dashboard Admin users) as well as functional elements. - -[Comprehensive Dashboard Walkthrough](https://youtu.be/hkMHBXRImPk?t=8m9s) - This 40 minute video walks you through many elements of the Auth0 Dashboard in a practical manner. - -### Step 4. Customer Integration -**When?** Varies by customer and project. - -**What?** This is where it all comes together and your team integrates Auth0 with your application/project. Our support resources are always there to help and our Customer Success Managers will be following your progress and removing any blockers. - -[Auth0 support resources and guidance for enterprise customers.](/onboarding/enterprise-support) - Our support resources are there to help during implementation and integration. - -### Step 5. Integration Best Practice Review -**When?** Soon after your initial implementation or integration and before you move to beta/UAT or production. - -**What?** In this technical session, our Customer Success Engineers will review your implementation and integration to ensure best practices are applied. This often includes reviewing rules you’ve written, how you’re calling our APIs and answering any questions you may have. - -[Auth0 Learn Resources](https://auth0.com/learn/) - Explore these resources for guidance on topics including Refresh Tokens, 2FA, implementing SSO and migrating existing user data. - -Pre-Production Checklist: This list will walk through basic checks to make in Auth0 to ensure a smooth production launch (Coming soon). - -### Step 6. Achieve First Value Goal -**When?** 30-45 days after signing your subscription agreement. - -**What?** Ultimately, this is the goal our team will be focused on moving towards as the outcome of the onboarding process. It’s something we’ll agree on with you in Step 1. diff --git a/articles/onboarding/enterprise-support.md b/articles/onboarding/enterprise-support.md index 39587737cd..1a2979c5fe 100644 --- a/articles/onboarding/enterprise-support.md +++ b/articles/onboarding/enterprise-support.md @@ -1,7 +1,15 @@ --- toc: true section: appliance -description: Outlines the Auth0 enterprise support options, definitions, coverage offered and procedures to follow for the best support experience. +description: Outlines the Auth0 enterprise support options, definitions, coverage offered and procedures to follow for the best support experience. +topics: + - appliance + - onboarding +contentType: + - concept +useCase: + - appliance +applianceId: appliance66 --- # Enterprise Support Guidance @@ -14,7 +22,7 @@ Refer to your subscription agreement to confirm which support offering is includ For general queries related to functionality, integration, best practice, or advice, you can use the following resources: - The [Auth0 Community](https://community.auth0.com/): Post questions to our audience of Customer Success Engineers, as well as other Auth0 users, or search and read existing posts for useful information. -- Your __Customer Success Manager__: Your Auth0 Customer Success Manager is always available for general queries and helping you navigate to the right Auth0 resource. The orientation information you received during onboarding should have the contact details for your Customer Success Manager. +- Your __Technical Account Manager__: Your Auth0 Technical Account Manager is always available for general queries and helping you navigate to the right Auth0 resource. The orientation information you received during onboarding should have the contact details for your Technical Account Manager. - The [Auth0 Docs](/search#gsc.tab=0) ## For Issues Impacting Production Environments (SLA Applicable) @@ -73,9 +81,9 @@ To speed resolution, please check the following before logging an issue: * Is the issue experienced by all users or just a few? * All? - Could be a service or configuration issue * Check status of Auth0 service - * Americas: (http://status.auth0.com) - * EU Region: (http://status.eu.auth0.com) - * APAC Region: (http://status.au.auth0.com) + * Americas: (https://status.auth0.com) + * EU Region: (https://status.auth0.com/?region=EU) + * APAC Region: (https://status.auth0.com/?region=AU) * You can subscribe to updates via the button on those pages * Check authentication services (connections) are up and reachable * Check application components - make sure they are functioning @@ -106,10 +114,10 @@ To speed resolution, please provide the following when logging an issue: * Issue experienced by users every time or just some times? * Issue experienced with all browsers or just one? * Screenshot of error message (if any) -* HTTP trace in the form of a [.har file](/har) +* HTTP trace in the form of a [HAR file](/troubleshoot/guides/generate-har-files) -*For PSaaS Appliance Customers*: +*For Private Cloud Customers*: -* PSaaS Appliance version/build number (top left hand corner of configuration screen on config tenant, such as https://yourmanage.yourdomain.com/configuration#/) +* Private Cloud version/build number (top left hand corner of configuration screen on config tenant, such as https://yourmanage.yourdomain.com/configuration#/) * Status of nodes (https://yourmanage.yourdomain.com/configuration#/nodes) * Status of health check (https://yourmanage.yourdomain.com/configuration#/troubleshoot) \ No newline at end of file diff --git a/articles/onboarding/sprint.md b/articles/onboarding/sprint.md deleted file mode 100644 index 598a4aad4b..0000000000 --- a/articles/onboarding/sprint.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -sitemap: false -description: An overview of Auth0’s onboarding program for enterprise customers. ---- -# Auth0 Sprint Onboarding - -Sprint is Auth0’s enterprise customer onboarding program. It helps you achieve value quickly by ensuring your setup for success with your Auth0 subscription. - -All customer's who subscribe to a qualifying 12 month+ subscription agreement obtained through our enterprise sales team will be offered access to Sprint Onboarding. However, the engagement varies slightly based on your subscription value, additions and support option. - -## Sprint Onboarding Overview - -### Goal - -During the onboarding process, the Auth0 Customer Success Team’s goal is to fulfill our obligation to: - -* Have your subscription tenant correctly provisioned and setup in our systems (including the [PSaaS Appliance deployment project](/onboarding/appliance-sprint) in the case of on-premise/private-cloud managed service customers) -* Receive information from you that our Customer Success Managers will use to engage with you, measure success and manage your subscription throughout its various lifecycles -* Provide information to you around accessing and utilizing informational, training and support resources to meet your success goals -* Offer high level initial technical architecture guidance and plug you in to our Professional Services offerings if deeper guidance or hands-on development/implementation assistance is desired - -The outcome of these obligations is a Success Plan that will be co-managed by your lead contact and the Auth0 Customer Success Management team. - -### Sprint Onboarding Activities by Subscription - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Sprint StarterSprint BusinessSprint Jumpstart
    Qualifying CustomersEnterprise planEnterprise plan over USD$25k annual subscriptionEnterprise plan with Jumpstart or Preferred Support additions
    Customer Success engagementCustomer Success teamAllocated Customer Success ManagerAllocated Customer Success Manager
    Orientationdelivered via online assetsLive 1:1 orientation session* and online assetsLive 1:1 orientation session* and online assets
    Architecture guidanceDelivered via online assets and webinarsDelivered via online assets and webinars, with CSM able to co-ordinate other limited guidanceDelivered in Jumpstart services engagement
    Auth0 foundations trainingDelivered via online assets and webinarsDelivered via online assets and webinars, with CSM able to co-ordinate other limited trainingDelivered in Jumpstart services engagement
    Auth0 advanced trainingLimited online assets and optional Services Engagement for additional feeLimited online assets and optional Services Engagement for additional feeLimited online assets and optional Services Engagement for additional fee
    Success PlanTemplated, self-serve. Completed plan reviewed with Customer Success TeamCustom, built in consultation with Success ManagerCustom, built in consultation with Success Manager
    - -* *Live sessions are delivered remotely via web conference.* - -### Timing - -The Sprint program isn’t bound by a specific time restriction, but rather it’s considered completed on delivery of the obligations and the Success Plan. For customers with a Cloud subscription, this usually takes between 1 and 3 weeks. For customers with an on-premise or private cloud managed service it can take up to 6 weeks. Sprint onboarding ends when the final Success Plan is shared with you. - -### What happens next? - -At the conclusion of the Sprint program, our Customer Success Management team will continue to monitor your progress against the Success Plan and work with you throughout different stages of the subscription lifecycle or when things are not moving to plan. This can mean a number of different activities and interactions depending on where you’re at in the development lifecycle and based on your subscription. - -Aside from engagement with our Customer Success Management team, you’ll have many other resources to move you along the journey as introduced to you in the Sprint program - this includes our support team, community forums, documentation, videos and webinars. - -The table below outlines examples of the different ongoing engagement delivered by the Customer Success Management team based on your subscription. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Enterprise planEnterprise plan over USD$25k annual subscriptionEnterprise plan over USD$100k annual subscription
    Customer Success engagementCustomer Success team, predominantly digital engagementAllocated Customer Success ManagerAllocated Customer Success Manager with small subscriber management ratio and more strategic engagement
    Pre-launch best practices reviewdelivered via online assetsLive 1:1 session* and online assetsLive 1:1 session* and online assets
    Success Plan management and reviewWhen off planAt key subscription milestones, annual reviews and when off planOngoing with allocated Customer Success Manager
    Executive business reviewsNAAnnualQuarterly or as required
    - -* *Live sessions are delivered remotely via web conference.* diff --git a/articles/policies/billing.md b/articles/policies/billing.md index 08b284aad0..2de85a2518 100644 --- a/articles/policies/billing.md +++ b/articles/policies/billing.md @@ -1,6 +1,13 @@ --- description: Describes the Billing policy which governs requests for billing mechanisms within the Auth0 dashboard crews: crew-2 +topics: + - auth0-policies + - billing +contentType: + - reference +useCase: + - support --- # Billing Policy @@ -79,22 +86,35 @@ Please note that you have to be a Tenant admin to do this request. Also, more than often the email which receives the receipt is the one that created the Auth0 tenant. Please make sure that you are in touch with the owner of that email. That person can also forward you the receipt of the payment. If you want to change this setting, please let us know through our [Support Center](${env.DOMAIN_URL_SUPPORT}). +## Do you charge sales tax? + +For US-based customers, we will charge sales tax where applicable. This is dependent on your state's sales tax laws and requirements. For non-US customers, we will not charge sales tax. + +You can determine if you will be responsible for sales tax during the checkout process after you provide your billing address. If the billing address provided is tax-eligible, you'll see the sales tax added to your total. You will also see the sales tax amount on all of your Auth0 invoices and receipts. + ## In our pricing, what is the difference between internal and external users? Are they different technically? -An active user is a user that has authenticated with username/password, a passwordless connection or any social provider in the last 30 days, counted per application. +An active user is a user that has authenticated with a username/password combination, a Passwordless connection, or any social provider in a given calendar month. -For example, if a person logs in to Application 1 through Facebook, then logs in to Application 2 through Google and then logs in to Application 2 using username/password, that would count as 3 active users, even if it's just one individual. +Auth0 counts users on a per-tenant basis. That means that somebody who logs in to multiple applications still counts as one user as long as you've created all of the applications using a single tenant. You will find that for certain plans, you have the ability to select between being charged for external users or for internal users. There are no technical differences between these types of users, they simply refer to whether someone is external to your company, or an internal employee. External users are most likely not going to be using Auth0 on a daily basis, and therefore this plan uses the active users criteria to calculate the price. -On the other hand, internal users have to login everyday to their different tools and platforms in order to get the work done, so for this case you would pay a flat rate per user, rather than per active user/per app. +On the other hand, internal users have to login everyday to their different tools and platforms in order to get the work done, so for this case you would pay a flat rate per user. ## Can we scale the number of users as needed each month? Definitely. In the Dashboard, you can do this by going to the upper right corner, and selecting **Settings** from the drop down menu. Then in the **Subscriptions** tab you can select them depending on your needs. More information about it can be found there or in our [Pricing page](https://auth0.com/pricing/). +## Can we combine billing for multiple tenants? + +Unfortunately combined billing is not supported for regular self-service tenants. The only two cases where we support combined billing are: + +1. For enterprise customers +2. For customers whose master tenant is billed at $167 per month (or more). In this case, we mark the testing tenant as [a child tenant](https://auth0.com/docs/dev-lifecycle/child-tenants) and bill only the master tenant. + ## How can I convert my tenant from a free trial to any other version? You can do this by heading to the upper right corner of the Dashboard, clicking your tenant name and selecting **Settings**. Then in the **Subscriptions** tab you can select the plan that best suits your needs. More information about this can be found there or in our [Pricing page](https://auth0.com/pricing/). diff --git a/articles/policies/dashboard-authentication.md b/articles/policies/dashboard-authentication.md index 4b219958e6..23d1a8d253 100644 --- a/articles/policies/dashboard-authentication.md +++ b/articles/policies/dashboard-authentication.md @@ -1,33 +1,38 @@ --- description: Describes the Dashboard Authentication Policy which governs requests for special authentication mechanisms for the Auth0 dashboard. crews: crew-2 +topics: + - auth0-policies + - dashboard +contentType: + - reference +useCase: + - support --- # Dashboard Authentication Policy The following policy governs requests for special authentication mechanisms for the Auth0 dashboard. -## Multifactor Authentication +## Multi-factor Authentication -You can enable multifactor authentication for logging in to the dashboard with your account. +You can enable multi-factor authentication for logging in to the dashboard with your account. -To enable multifactor authentication for your account: +To enable multi-factor authentication for your account: 1. Go to your [Account Profile page](${manage_url}/#/profile) -2. Scroll down to the **Multifactor** section. +2. Scroll down to the **Multi-factor** section. 3. Click the **Enroll Your Device Now** link to get started. -The process for setting up each form of authentication is the same as using MFA with an application, [click here for more information on each type of authentication.](/multifactor-authentication) +The process for setting up each form of authentication is the same as using MFA with an application, [click here for more information on each type of authentication.](/mfa) -### Unenrolling a Device from Multifactor +### Unenrolling a Device from Multi-factor -To stop using multifactor authentication to log in to your dashboard: +To stop using multi-factor authentication to log in to your dashboard: 1. Go to your [Account Profile page](${manage_url}/#/profile) -2. Scroll down to the **Multifactor** section and click the **REMOVE** button next to the enrolled device. -3. To verify this request you will need to login once more with multifactor authentication. - -If you have lost your device after enrolling in MFA or are having trouble logging in after enabling MFA, [click here for troubleshooting tips.](/multifactor-authentication/guardian/user-guide#troubleshooting) +2. Scroll down to the **Multi-factor** section and click the **REMOVE** button next to the enrolled device. +3. To verify this request you will need to login once more with multi-factor authentication. ## Other forms of authentication @@ -39,4 +44,4 @@ This policy is effective April 4, 2016 This policy may be revised when we are able to make configuration and troubleshooting visibility available on a self-service basis for other forms of authentication. -Any accounts with special dashboard authentication implemented before the effective date of this policy shall be grandfathered and allowed to continue. +Any accounts with special dashboard authentication implemented before the effective date of this policy shall be allowed to continue. diff --git a/articles/policies/data-export.md b/articles/policies/data-export.md index 45f2d66948..e4442cef34 100644 --- a/articles/policies/data-export.md +++ b/articles/policies/data-export.md @@ -1,9 +1,17 @@ --- description: Auth0 policies on exporting data. +topics: + - auth0-policies + - data + - data-exports +contentType: + - reference +useCase: + - support --- # Data Export Policy -If you would like to export your data from Auth0 there are a several ways you can do this. +If you would like to export your data from Auth0 there are a several ways you can do this. Please note these tools do not export password hashes of your [Auth0-hosted database users](/connections/database). You can still request this information by opening a [support ticket](https://support.auth0.com/). Please note that in order to make this request you must be signed in to the Developer plan for one month. ## Use the Import/Export Extension @@ -13,6 +21,6 @@ You can use our [Import/Export Extension](/extensions/user-import-export) to exp If you want to export certain sets of data programmatically, the **Management API** can assist you with this. For more information on using the Management API, you can: -* Browse the [Management API documentation](/api/management/v2) -* Read about [obtaining a token](/api/management/v2/tokens) which you can use to call the Management API -* Read about [searching for users](/api/management/v2/user-search) as well as the [query syntax](/api/management/v2/query-string-syntax) that can be used +* Browse the [Management API documentation](/api/management/v2). +* Read about [obtaining a token](/api/management/v2/tokens) which you can use to call the Management API. +* Read about [searching for users](/users/search) as well as the [query syntax](/users/search/v3/query-syntax) that can be used. diff --git a/articles/policies/data-transfer.md b/articles/policies/data-transfer.md index fd9b19cd9e..e3cd3206a9 100644 --- a/articles/policies/data-transfer.md +++ b/articles/policies/data-transfer.md @@ -1,10 +1,18 @@ --- description: Describes the Data Transfer Policy which governs requests for transfer of data from one Auth0 tenant to another. +topics: + - auth0-policies + - data + - data-transfer +contentType: + - reference +useCase: + - support --- # Data Transfer Policy -At this time, Auth0 will not transfer data from one Auth0 tenant to another. This applies to both Cloud and PSaaS Appliance customers. +At this time, Auth0 will not transfer data from one Auth0 tenant to another. This applies to both Public Cloud and Private Cloud customers. All data in your Auth0 tenant is always under your control and is [available through the Management API](/api/v2) at any time. The only information which is not available through the API are the password hashes of your [Auth0-hosted database users](/connections/database) and private keys, for security reasons. @@ -14,5 +22,6 @@ If you are opting to move out from our service, then you might want to check [th * Transfer data from a non-production tenant to a production tenant * Rename a tenant +* Re-use the name of a previously deleted tenant * Rename a connection * Migrate a tenant from one region to another (for example, from US to EU) diff --git a/articles/policies/endpoints.md b/articles/policies/endpoints.md index 5d564a4adb..0ad9cc03ba 100644 --- a/articles/policies/endpoints.md +++ b/articles/policies/endpoints.md @@ -1,25 +1,32 @@ --- description: Lists all the endpoints used by Auth0 public cloud service. +topics: + - auth0-policies + - endpoints +contentType: + - reference +useCase: + - support --- -# Endpoints used by Auth0 public cloud service +# Auth0 Public Cloud Service Endpoints The following endpoints are used by Auth0 public cloud service: -## US Region +## United States Region * https://manage.auth0.com * https://auth0.com -* https://login.auth0.com -* https://cdn.auth0.com -* https://{YOUR ACCOUNT}.auth0.com -* https://{YOUR ACCOUNT}.guardian.auth0.com +* https://login.us.auth0.com +* https://cdn.us.auth0.com (or https://cdn.auth0.com if your tenant was created prior to 11 June 2020) +* https://{YOUR ACCOUNT}.us.auth0.com +* https://{YOUR ACCOUNT}.guardian.us.auth0.com -## EU & AU Regions +## Europe and Australia Regions * https://manage.auth0.com * https://auth0.com * https://login.[eu|au].auth0.com * https://cdn.[eu|au].auth0.com * https://{YOUR ACCOUNT}.[eu|au].auth0.com -* https://{YOUR ACCOUNT}.[eu|au].guardian.auth0.com +* https://{YOUR ACCOUNT}.guardian.[eu|au].auth0.com diff --git a/articles/policies/entity-limits.md b/articles/policies/entity-limits.md new file mode 100644 index 0000000000..24f00d44c1 --- /dev/null +++ b/articles/policies/entity-limits.md @@ -0,0 +1,52 @@ +--- +title: Entity Limit Policy +description: Describes Auth0's tenant entity limit policy for subscribers. +topics: + - auth0-policies + - rate-limits + - entity-limits +contentType: + - reference +useCase: + - support +--- +# Entity Limit Policy + +::: note +This policy is effective for all Developer, Developer Pro, and free subscriptions made on or after May 19, 2020. Starting on **June 18, 2020**, the policy will apply to all Developer, Developer Pro, and free subscriptions. +::: + +Entities in Auth0 are tenant configuration elements such as applications, connections, rules, and API resource servers. + +Auth0 limits the number of entities you can have depending on your subscription level. Auth0 provides notifications to you when you are approaching (80%) and when you have reached your respective entity limits (100% or higher). We will also provide messages to prevent you from attempting to configure entities that would be rejected because they would put you over your limit. Here is an example of a message you would see if you reached your connection limit: + +![Entity Limit Reached](/media/articles/policies/entity-limit-reached.png) + +::: note +Entity counts may take a few seconds to update. If you see a warning that you believe is in error, try again after a few seconds or contact support if the issue persists. +::: + +## Developer and Developer Pro subscription limits + +| Entity | Maximum | +| - | - | +| Applications | 100 | +| Connections | 100 | +| Rules | 100 | +| API Resource Servers | 100 | + +## Free subscription limits + +| Entity | Maximum | +| - | - | +| Applications | 10 | +| Connections | 10 | +| Rules | 10 | +| API Resource Servers | 10 | + +## Keep reading + +* [Rate Limit Policy](/policies/rate-limits) +* [Management API Endpoint Rate Limits](/policies/rate-limits-mgmt-api) +* [Authentication API Endpoint Rate Limits](/policies/rate-limits-auth-api) +* [Legacy Rate Limits](/policies/legacy-rate-limits) diff --git a/articles/policies/index.md b/articles/policies/index.md index 78c5d18d69..f404b79512 100644 --- a/articles/policies/index.md +++ b/articles/policies/index.md @@ -1,6 +1,12 @@ --- url: /policies -description: This page lists all of Auth0's established operational policies. +description: List of all of Auth0's established operational policies. +topics: + - auth0-policies +contentType: + - index +useCase: + - support --- # Operational Policies @@ -15,5 +21,6 @@ Auth0 has established the following operational policies. - [Penetration Testing](/policies/penetration-testing) - [Migrations](/migrations) - [Rate Limits](/policies/rate-limits) -- [Restoration of a Deleted Tenant](/policies/restore-deleted-tenant) -- [Support Requests](/policies/requests) \ No newline at end of file +- [Entity Limits](/policies/entity-limits) +- [Tenant Restoration](/policies/restore-deleted-tenant) +- [Unsupported Requests](/policies/unsupported-requests) \ No newline at end of file diff --git a/articles/policies/legacy-rate-limits.md b/articles/policies/legacy-rate-limits.md new file mode 100644 index 0000000000..a1ddda609d --- /dev/null +++ b/articles/policies/legacy-rate-limits.md @@ -0,0 +1,173 @@ +--- +description: Describes Auth0's rate limit policy for subscriptions created before 05-21-2020 when working with Auth0 API endpoints. +topics: + - auth0-policies + - rate-limits +contentType: + - reference +useCase: + - support +--- +# Management API Endpoint Rate Limits before May 19, 2020 + +**This policy is effective for all paid and free subscriptions made before May 19, 2020.** + +::: warning +All subscriptions made on or after **May 19, 2020** are subject to the [updated rate limits](/policies/rate-limits-mgmt-api). +Starting on **June 18, 2020**, the new limits will apply to all tenants. You will be notified of the new limits through a **Dashboard Notification**. If the changes will impact your tenant, you will be notified directly via email with additional information about minimizing API calls and upgrading plans. +::: + +The rate limits for Auth0 Management API differ depending on whether your tenant is free or paid, production or not. + +| Tenant Type | Limit | +| - | - | +| Free or Trial | 2 requests per second (and bursts up to 10 requests) | +| Non-Production (Paid) | 2 requests per second (and bursts up to 10 requests) | +| Production (Paid) | 15 requests per second (and bursts up to 50 requests) | + +The aforementioned rate limits include calls made via [Rules](/rules) and are set **by tenant** and not by endpoint. + +The following Auth0 Management API endpoints return rate limit-related headers. For additional information about these endpoints, please consult the [Management API explorer](/api/management/v2). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    EndpointGETPOSTDELETEPATCHPUT
    Application Grants/client-grants/client-grants/client-grants/{id}/client-grants/{id}
    Signing Keys/keys/signing
    /keys/signing/{id}
    /keys/signing/rotate
    Limited to 5 requests per day
    /keys/signing/{kid}/revoke
    Applications/client
    /client/{id}
    /client/client/{id}/client/{id}
    Connections/connections
    /connections/{id}
    /connections/connections/{id}
    /connections/{id}/users
    /connections/{id}
    Device Credentials/device-credentials/device-credentials/device-credentials/{id}
    Logs/logs
    /log/{id}
    Rules/rules
    /rules/{id}
    /rules/rules/{id}/rules/{id}
    User Blocks/user-blocks
    /user-blocks/{id}
    /user-blocks
    /user-blocks/{id}
    Users/users
    /users/{id}
    /users/{id}/logs
    /users/{id}/enrollments
    /users
    /users/{id}/identities
    /users/{id}
    /users/{id}/identities
    /users/{id}/multifactor/{provider}
    /users/{id}
    Emails/emails/provider/emails/provider/emails/provider
    Jobs/jobs/{id}
    /jobs/{id}/errors
    /jobs/verification-email
    /jobs/users-imports
    /jobs/users-exports
    Resource Servers/resource-servers
    /resource-servers/{id}
    /resource-servers/resource-servers/{id}/resource-servers/{id}
    Stats/stats/active-users
    /stats/daily
    Tenants/tenants/settings/tenants/settings
    + +#### Concurrent import users jobs + +The [create import users job](/api/management/v2#!/Jobs/post_users_imports) endpoint has a limit of two concurrent import jobs. Requesting additional jobs while there are two pending returns a `429 Too Many Requests` response: + +```json +{ + "statusCode": 429, + "error": "Too Many Requests", + "message": "There are 2 active import users jobs, please wait until some of them are finished and try again +} +``` + +#### Access tokens for SPAs + +If you obtain Access Tokens for your SPAs, note that there are rate limits that are applicable when working with the available `current_user`-related [scopes and endpoints](/api/management/v2/get-access-tokens-for-spas#available-scopes-and-endpoints). You are allowed a maximum of **10 requests per minute per user**. diff --git a/articles/policies/load-testing.md b/articles/policies/load-testing.md index a9a89d2ae2..fe8a00fbdb 100644 --- a/articles/policies/load-testing.md +++ b/articles/policies/load-testing.md @@ -1,64 +1,71 @@ --- description: This page details Auth0's Load Testing Policy. +topics: + - auth0-policies + - load-testing + - testing +contentType: + - reference +useCase: + - support --- - # Load Testing Policy -Load testing against the Auth0 production cloud service is not permitted at any time, as stated in our [Terms of Service](https://auth0.com/terms). - -Customers who have purchased an enterprise support plan that includes load testing may request one load test (with up to 2 repeats) to conduct load testing against an Auth0 test instance. For load tests that require more than 100 RPS a separate environment will have to be created and it will have a different time schedule than normal load tests. +Auth0 recognizes that customers may occasionally need to perform load tests against its production cloud service. In order to ensure a successful test and maintain a high quality of service for all customers, Auth0 has established the following guidelines. Any load testing in Auth0 must be conducted in accordance with this Policy. -## How to request +Only customers who have purchased an Enterprise subscription may conduct load testing. Free, Developer, Developer Pro and other non-Enterprise customers may not conduct load testing. Customers with an Enterprise subscription may request one load test (with up to 2 repeats) per year against an Auth0 production tenant. Performance and load testing is only allowed with Auth0's prior written approval. Once approved, testing can only target tenants that we have approved. -* Customers must file a load testing request in writing, via the [Auth0 support center](${env.DOMAIN_URL_SUPPORT}). -* Requests must be filed at least two (2) weeks in advance of the desired test date. -* Requests must be approved in writing before any load/performance testing is conducted. +::: note +Auth0 reserves the right to reject the load test request or ask for modifications. Failure to abide by this policy may result in temporary blocking of access to a tenant until the issue is remediated. +::: -* Customers must have configured their own email provider within the Auth0 dashboard (Email -> Providers) before a load testing request will be approved. +## How to request -## Test windows -Approved load testing windows are subject to availability of testing windows on a first-come first-served basis. Customers are encouraged to submit requests well in advance of the 2-week advance notice period. +Customers must file a load testing request via the Auth0 Support Center. Under the Issue typefield, select Public Cloud Support Incident. -Testing windows will have a scheduled start and end time assigned by Auth0 and all testing must begin and complete during the window. +To be considered for approval, the request must: -It is common for an initial load test to experience some unexpected issues, resulting in a need for repeat tests. Customers should plan in advance and allow sufficient time for repeat tests before any planned golive. +* Be filed at least two (2) weeks prior to the desired test date; in many cases, Auth0 encourages one (1) month of advance notice to ensure time for a thorough review and any required modifications. +* Be approved in writing before any testing is conducted. +* Stay within our [published production rate limits](/policies/rate-limits). +* Include all information described below. ## Information to include in requests -The load testing request must include the following information: + +The load testing request must include the following: * A description of the test to be done -* The Auth0 tenant to be used during the test +* The name and region of the Auth0 tenant to be used during the test +* The requested date and time of the test, including time zone * The requested duration of the test (2 hour maximum) -* The Auth0 features, such as rules, email, used during the test -* The Auth0 API endpoints to be used +* The platforms to be used for the test (desktop/laptop, iOS, Android, other) +* The Auth0 features (such as rules or email) used during the test +* The Auth0 API methods and endpoints to be used (for example `GET /api/v2/clients`) +* The maximum requests per second for each type of request or endpoint * The types of Auth0 connections involved in the test * Which Auth0 Rules, if any, will execute during the test * Which Custom DB, if any, will be used * Which Auth0 Webtasks, if any, will be used * Whether verification, welcome or other emails will be sent -* The peak load, specified in requests-per-second, expected for each API endpoint or Auth0 feature involved in the test. -* An explanation/justification for the peak load numbers. The justification should include the size of the target user population and realistic estimates of logins per hour to justify TPS numbers. +* The peak load, specified in requests-per-second, expected for each API endpoint or Auth0 feature involved in the test +* An explanation/justification for the peak load numbers, including the size of the target user population and realistic estimates of logins per hour * The ramp-up rate for the test * Contacts who will be available during the test and how to reach them +* Number of unique users participating in the load test -## Test requirements -Note that load testing will require customer to: +## Email considerations + +Before any testing, customers must: * Configure their own email provider in Auth0 * Receive approval from their email provider to send the expected volume of email * Make arrangements for bounced emails * Establish a mechanism for testing that emails arrived -## Limitations -Auth0 reserves the right to reject or request modifications to load test plans. - -A load testing approval will specify pre-arranged dates/times in which load testing can be performed. All load testing must be limited to those pre-arranged dates/times. Load testing windows will be a maximum of 2 hours in duration. Failure to abide by this policy may result in temporary blocking of access to an tenant until the issue is remediated. - -## Effectivity -This policy is effective April 4, 2016 - - - +## Test requirements +Load testing windows are subject to availability so advance notice is highly recommended. Once approved, load testing windows will have a scheduled start and end time not to exceed two (2) hours in duration. All testing must begin and end during this window. +Auth0 strongly recommends including a brief "ramp up" period to the desired load test target numbers. For example, a load test request of 100 RPS might be preceded by three five minute periods: 5 minutes at 25 RPS, 5 minutes at 50 RPS, and 5 minutes at 75 RPS. This ramp up period allows Auth0 and the customer to observe and compare effects at increasing RPS levels prior to peak RPS. If a ramp up period is not possible, please indicate why. +_Updated February 4, 2019_ diff --git a/articles/policies/penetration-testing.md b/articles/policies/penetration-testing.md index d5d65b7b50..850efd2fc0 100644 --- a/articles/policies/penetration-testing.md +++ b/articles/policies/penetration-testing.md @@ -1,15 +1,27 @@ --- description: This page details Auth0's Penetration Testing Policy. +topics: + - auth0-policies + - penetration-testing + - testing +contentType: + - reference +useCase: + - support --- # Penetration Testing Policy -::: warning -This policy is effective August 1, 2017. -::: +**This policy is effective July 1, 2019.** -While conducting a security test of your own application it is **not** permitted to directly test Auth0 infrastructure (such as `tenant.auth0.com`) without prior approval. Please notify us in advance via the [Auth0 support center](${env.DOMAIN_URL_SUPPORT}). Auth0 requires at least **1 week** (7 days) notice prior to the test's planned start date. +If you have a *paid* Auth0 subscription, you may conduct a security test of your application involving Auth0 infrastructure (e.g. `your-tenant.auth0.com`) with **prior approval**. -Please provide the following information in the support ticket: +To conduct a security test, please notify us in advance via the [Auth0 Support Center](${env.DOMAIN_URL_SUPPORT}). Auth0 requires at least **1 week's (7 days')** notice prior to your test's planned start date. + +If the test is isolated to your infrastructure (that is, there will be no testing of Auth0 services), you do not need to notify Auth0. + +## Information required + +Please provide the following information in the support ticket when requesting approval for testing: 1. The specific dates/times of the test and timezone 2. The high level scope of the test @@ -17,13 +29,20 @@ Please provide the following information in the support ticket: 4. The Auth0 tenant(s) involved 5. Two (2) contacts who will be available during the entire test period in case we need to contact you. If we have any questions, we will make a reasonable attempt to contact you. If you cannot be reached, we reserve the right to take measures to protect the service, which may include shutting down or blocking your tenant and/or the source of the intrusion traffic. +## Requirements + Auth0 requires that: -* The test be restricted to only your tenant +* The test be restricted to only your tenant * You disclose any suspected findings to the Auth0 Security team for explanation/discussion +* You understand that your tenant will be moved between environments during testing. Auth0 will move your tenant from the Production environment to the Preview environment before the testing commences. Auth0 will then return your tenant to the Production environment once the testing period ends. Note that while your tenant is on the Preview environment it may receive updates more rapidly. -Private SaaS Appliance customers should also request permission to run a penetration test via the [Auth0 support center](${env.DOMAIN_URL_SUPPORT}). Please include the information listed above with your support request. +## Private Cloud customers -If the test is isolated to your infrastructure (that is, there will be no testing of Auth0 services), you do not need to notify Auth0. +Private Cloud customers should also request permission to run a penetration test via the [Auth0 support center](${env.DOMAIN_URL_SUPPORT}). Please include the [information listed above](/policies/penetration-testing#information-required) with your support request. + +## Restrictions -You may not conduct any [load testing](/policies/load-testing) (such as Denial of Service testing) per the load testing policy. +* You may not conduct any [load testing](/policies/load-testing) (such as Denial of Service testing) per the load testing policy. +* You may not conduct any penetration testing targeting our management dashboard. Management and Authentication APIs are allowed. +* You may not conduct any penetration testing targeting tenants that we have not approved. diff --git a/articles/policies/rate-limits-auth-api.md b/articles/policies/rate-limits-auth-api.md new file mode 100644 index 0000000000..546658f45a --- /dev/null +++ b/articles/policies/rate-limits-auth-api.md @@ -0,0 +1,297 @@ +--- +title: Authentication API Endpoint Rate Limits +description: Describes Auth0's rate limit policy when working with Auth0 Authentication API endpoints. +toc: true +topics: + - auth0-policies + - rate-limits +contentType: + - reference +useCase: + - support +--- +# Authentication API Endpoint Rate Limits + +Each Authentication API endpoint is configured with a bucket that defines: + +- Request limit +- Rate limit window (per second, per minute, per day, etc.) + +```text +bucket: + size: x + per_minute: y +``` + +For example, the above states that, for the given bucket, there is a maximum request limit of `x` per minute, and for each minute that elapses, permissions for `y` requests are added back. In other words, for each `60 / y` seconds, one additional request is added to the bucket. This occurs automatically until the bucket contains the maximum permitted number of requests. + +For some API endpoints, the rate limits are defined per bucket, so the origins of the call do not influence the rate limit changes. For other buckets, the rate limits are defined using different keys, so the originating IP address is considered when counting the number of received API calls. + +::: note +If you are using an API endpoint **not** listed below and you receive rate limit headers as part of your response, see [Anomaly Detection](/anomaly-detection) for more information. +::: + +## Limits for production tenants of paying customers + +| Endpoint | Path | Limited By | Rate Limit | +| - | - | - | - | +| All Endpoints | [All Authentication API endpoints](/api/authentication) | Sum of all combined requests to any Authentication API endpoint | 100 requests per second | +| User Profile | `/tokeninfo` (Legacy) | IP Address | 800 requests per minute | +| | `/userinfo` | User ID | 5 requests per minute with bursts up to 10 requests | +| Delegation | `/delegation` | User ID, IP Address | 10 requests per second | +| Change Password | `/dbconnections/change_password` | User Email, IP Address | 1 request per minute with bursts up to 10 requests | +| Signup | `/dbconnections/signup` | IP Address | 50 requests per minute | +| Get Passwordless Code or Link | `/passwordless/start` | IP Address | 50 requests per hour when using non-authenticated calls. It's considered an Authentication API endpoint otherwise. | + +## Limits for non-production tenants of paying customers and all tenants of free customers + +| Endpoint | Path | Limited By | Rate Limit | +| - | - | - | - | +| User Profile | `/tokeninfo` (Legacy) | IP Address | 800 requests per minute | +| | `/userinfo` | User ID | 5 requests per minute with bursts up to 10 requests | +| Delegation | `/delegation` | User ID, IP Address | 10 requests per second | +| Change Password | `/dbconnections/change_password` | User Email, IP Address | 1 request per minute with bursts up to 10 requests | +| Signup | `/dbconnections/signup` | IP Address | 50 requests per minute | +| Get Passwordless Code or Link | `/passwordless/start` | IP Address | 50 requests per hour | +| Get Token | `/oauth/token` | Any request | 30 requests per second | +| Cross Origin Authentication | `/co/authenticate` | Any request | 5 requests per second | +| Authentication | `usernamepassword/login` | Any request | 5 requests per second | +| Resource Owner (Legacy) | `/oauth/ro` | Any request | 10 requests per second | +| JSON Web Token Keys | `/.well-known/jwks.json` | Any request | 20 requests per second | + +## Free tenant global limits + +To ensure Auth0's quality of service, the Authentication API is subject to several levels of rate limiting for free subscribers. Auth0's Authentication API has a global limit of **300 requests per minute** for free tenants. + +::: note +The limit is global for the tenant and not per endpoint. +::: + +### Affected endpoints + +The global rate limit applies to all [Authentication API](/api/authentication) endpoints. A complete list of endpoints that are affected by this limit, along with the associated response if the rate limit is exceeded, is a follows: + +Endpoint | Response +---------|--------- +`GET /authorize` | [Error Page](#error-page) +`GET /passwordless/verify_redirect` | [Error Page](#error-page) +`POST /dbconnections/change_password` | [JSON Error](#json-error) (`too_many_requests`) +`GET /dbconnections/change_password` | [JSON Error](#json-error) (`too_many_requests`) +`POST /dbconnections/self_change_password` | [JSON Error](#json-error) (`too_many_requests`) +`POST /co/authenticate` | [JSON Error](#json-error) (`access_denied`) +`POST /delegation` | [JSON Error](#json-error) (`too_many_requests`) +`GET /delegation` | [JSON Error](#json-error) (`too_many_requests`) +`GET /activate` | [Error Page](#error-page) +`POST /activate` | [Error Page](#error-page) +`POST /oauth/device/code` | [JSON Error](#json-error) (`access_denied`) +`POST /oauth/ro` | [JSON Error](#json-error) (`access_denied`) +`GET /oauth/ro` | [JSON Error](#json-error) (`access_denied`) +`POST /oauth/token` | [JSON Error](#json-error) (`access_denied`) +`POST /oauth/introspect` | [JSON Error](#json-error) (`access_denied`) +`GET /passwordless/start` | [JSON Error](#json-error) (`too_many_requests`) +`POST /passwordless/start` | [JSON Error](#json-error) (`too_many_requests`) +`POST /u/reset-password/request/:connection` | [Error Page](#error-page) +`GET /u/consent` | [Error Page](#error-page) +`POST /u/consent` | [Error Page](#error-page) +`GET /u/login` | [Error Page](#error-page) +`POST /u/login` | [Error Page](#error-page) +`GET /u/mfa-country-codes` | [Error Page](#error-page) +`POST /u/mfa-country-codes` | [Error Page](#error-page) +`GET /u/mfa-email-challenge` | [Error Page](#error-page) +`POST /u/mfa-email-challenge` | [Error Page](#error-page) +`GET /u/mfa-email-enrollment` | [Error Page](#error-page) +`POST /u/mfa-email-enrollment` | [Error Page](#error-page) +`GET /u/mfa-email-enrollment-verify` | [Error Page](#error-page) +`POST /u/mfa-email-enrollment-verify` | [Error Page](#error-page) +`GET /u/mfa-email-list` | [Error Page](#error-page) +`POST /u/mfa-email-list` | [Error Page](#error-page) +`GET /u/mfa-enroll-options` | [Error Page](#error-page) +`POST /u/mfa-enroll-options` | [Error Page](#error-page) +`GET /u/mfa-guardian-list` | [Error Page](#error-page) +`POST /u/mfa-guardian-list` | [Error Page](#error-page) +`GET /u/mfa-guardian-welcome` | [Error Page](#error-page) +`POST /u/mfa-guardian-welcome` | [Error Page](#error-page) +`GET /u/mfa-login-options` | [Error Page](#error-page) +`POST /u/mfa-login-options` | [Error Page](#error-page) +`GET /u/mfa-otp-challenge` | [Error Page](#error-page) +`POST /u/mfa-otp-challenge` | [Error Page](#error-page) +`GET /u/mfa-otp-enrollment` | [Error Page](#error-page) +`POST /u/mfa-otp-enrollment` | [Error Page](#error-page) +`GET /u/mfa-push-challenge` | [Error Page](#error-page) +`POST /u/mfa-push-challenge` | [Error Page](#error-page) +`GET /u/mfa-push-enrollment` | [Error Page](#error-page) +`POST /u/mfa-push-enrollment` | [Error Page](#error-page) +`GET /u/mfa-recovery-code-challenge` | [Error Page](#error-page) +`POST /u/mfa-recovery-code-challenge` | [Error Page](#error-page) +`GET /u/mfa-recovery-code-challenge-new-code` | [Error Page](#error-page) +`POST /u/mfa-recovery-code-challenge-new-code` | [Error Page](#error-page) +`GET /u/mfa-recovery-code-enrollment` | [Error Page](#error-page) +`POST /u/mfa-recovery-code-enrollment` | [Error Page](#error-page) +`GET /u/mfa-sms-challenge` | [Error Page](#error-page) +`POST /u/mfa-sms-challenge` | [Error Page](#error-page) +`GET /u/mfa-sms-enrollment` | [Error Page](#error-page) +`POST /u/mfa-sms-enrollment` | [Error Page](#error-page) +`GET /u/mfa-sms-enrollment-verify` | [Error Page](#error-page) +`POST /u/mfa-sms-enrollment-verify` | [Error Page](#error-page) +`GET /u/mfa-sms-list` | [Error Page](#error-page) +`POST /u/mfa-sms-list` | [Error Page](#error-page) +`GET /u/reset-password` | [Error Page](#error-page) +`POST /u/reset-password` | [Error Page](#error-page) +`GET /u/reset-password/request/:connection` | [Error Page](#error-page) +`GET /u/signup` | [Error Page](#error-page) +`POST /u/signup` | [Error Page](#error-page) +`GET /tokeninfo` | Text: "Rate limit exceed" +`POST /tokeninfo` | Text: "Rate limit exceed" +`POST /userinfo` | Text: "Rate limit exceed" +`GET /userinfo` | Text: "Rate limit exceed" +`POST /usernamepassword/login` | [JSON Error](#json-error) (`too_many_requests`) +`GET /usernamepassword/login` | [JSON Error](#json-error) (`too_many_requests`) +`GET /.well-known/jwks.json` | Text: "Rate limit exceed" +`GET /.well-known/openid-configuration` | [JSON Error](#json-error) (`access_denied`) +`GET /cer/:clientID?` | Text: "Rate limit exceed" +`GET /pb7/:clientID?` | Text: "Rate limit exceed" +`GET /pem/:clientID?` | Text: "Rate limit exceed" +`GET /rawpem/:clientID?` | Text: "Rate limit exceed" +`GET /samlp/:clientID` | Text: "Rate limit exceed" +`POST /samlp/:clientID` | Text: "Rate limit exceed" +`GET /samlp/metadata` | Text: "Rate limit exceed" +`GET /samlp/metadata/:clientID` | Text: "Rate limit exceed" +`GET /:clientID/trust/mex` | XML Error (`wst:RequestFailed`) +`POST /:clientID/trust/usernamemixed` | XML Error (`wst:RequestFailed`, Status Code: 500) +`GET /decision` | [Error Page](#error-page) +`POST /decision` | [Error Page](#error-page) +`POST /drwatson` | Text: "Rate limit exceed" +`POST /mfa/associate` | [JSON Error](#json-error) (`access_denied`) +`GET /mfa/authenticators` | [JSON Error](#json-error) (`access_denied`) +`DELETE /mfa/authenticators/:authenticator_id` | [JSON Error](#json-error) (`access_denied`) +`POST /mfa/challenge` | [JSON Error](#json-error) (`access_denied`) +`GET /oauth/access_token` | [JSON Error](#json-error) (`access_denied`) +`POST /oauth/access_token` | [JSON Error](#json-error) (`access_denied`) +`GET /p/:strategy/:ticket` | Text: "Rate limit exceed" +`POST /p/:strategy/:ticket` | Text: "Rate limit exceed" +`GET /p/:strategy/:ticket/info` | Text: "Rate limit exceed" +`GET /passwordless/verify` | [JSON Error](#json-error) (`too_many_requests`) +`POST /passwordless/verify` | [JSON Error](#json-error) (`too_many_requests`) +`GET /rms` | [Error Page](#error-page) +`GET /rms/:clientID/adfs/fs/federationserverservice.asmx` | XML Error (`fed:BadRequest`) +`POST /rms/:clientID/adfs/fs/federationserverservice.asmx` | XML Error (`fed:BadRequest`) +`GET /rms/:clientID/FederationMetadata/2007-06/FederationMetadata.xml` | [JSON Error](#json-error) (`too_many_requests`) +`GET /samlp/:clientID/logout` | [Error Page](#error-page) +`POST /samlp/:clientID/logout` | [Error Page](#error-page) +`GET /samlp/idp/slo` | Text: "Rate limit exceed" +`GET /sso_dbconnection_popup/:clientID` | [JSON Error](#json-error) (`access_denied`) +`GET /wsfed` | [Error Page](#error-page) +`GET /wsfed/:clientID` | [Error Page](#error-page) +`GET /wsfed/:clientID/FederationMetadata/2007-06/FederationMetadata.xml` | [Error Page](#error-page) +`GET /wsfed/FederationMetadata/2007-06/FederationMetadata.xml` | [Error Page](#error-page) +`GET /.well-known/apple-app-site-association` | [JSON Error](#json-error) (`access_denied`) +`GET /.well-known/assetlinks.json` | [JSON Error](#json-error) (`access_denied`) +`GET /adfs/fs/federationserverservice.asmx` | XML Error (`fed:BadRequest`) +`POST /adfs/fs/federationserverservice.asmx` | XML Error (`fed:BadRequest`) +`GET /apple-app-site-association` | [JSON Error](#json-error) (`access_denied`) +`GET /aws-saml/metadata` | Text: "Rate limit exceed" +`GET /changepwd/completed` | [JSON Error](#json-error) (`too_many_requests`) +`GET /changepwd/form` | [Error Page](#error-page) +`POST /changepwd/reset` | [JSON Error](#json-error) (`too_many_requests`) +`POST /co/verify` | Text: "Rate limit exceed" +`GET /continue` | [Error Page](#error-page) +`POST /continue` | [Error Page](#error-page) +`GET /custom-login/preview` | [JSON Error](#json-error) (`too_many_requests`) +`POST /dbconnections/delete` | [JSON Error](#json-error) (`too_many_requests`) +`GET /dbconnections/login` | [JSON Error](#json-error) (`too_many_requests`) +`POST /dbconnections/login` | [JSON Error](#json-error) (`too_many_requests`) +`GET /dbconnections/signup` | [JSON Error](#json-error) (`too_many_requests`) +`POST /dbconnections/signup` | [JSON Error](#json-error) (`too_many_requests`) +`POST /dbconnections/verify_email` | [JSON Error](#json-error) (`too_many_requests`) +`GET /FederationMetadata/2007-06/FederationMetadata.xml` | XML Error (`fed:BadRequest`) +`GET /i/login` | [Error Page](#error-page) +`GET /i/login/sso/:provider` | Text: "Rate limit exceed" +`GET /i/oauth2/authorize` | [JSON Error](#json-error) (`access_denied`) +`GET /login` | [Error Page](#error-page) +`GET /login/callback` | [Error Page](#error-page) +`POST /login/callback` | [Error Page](#error-page) +`GET /logout` | [Error Page](#error-page) +`POST /logout` | [Error Page](#error-page) +`GET /mf` | [Error Page](#error-page) +`POST /mf` | [Error Page](#error-page) +`POST /oauth/reverse` | [JSON Error](#json-error) (`access_denied`) +`POST /oauth/revoke` | [JSON Error](#json-error) (`access_denied`) +`POST /state/introspect` | [JSON Error](#json-error) (`too_many_requests`) +`GET /unblock` | [Error Page](#error-page) +`POST /unlink` | [JSON Error](#json-error) (`too_many_requests`) +`GET /user/ssodata` | Text: "Rate limit exceed" +`GET /users/:id/impersonate` | [JSON Error](#json-error) (`too_many_requests`) +`POST /users/:id/impersonate` | [JSON Error](#json-error) (`too_many_requests`) +`GET /v2/logout` | [Error Page](#error-page) + +## Exceeding the Rate Limit + +If you exceed the rate limit for a given API endpoint, you'll receive an [HTTP 429 (Too Many Requests)](http://tools.ietf.org/html/rfc6585#section-4) response (except for the cases documented in the [previous section](#affected-endpoints)). The response will also contain [HTTP Response Headers](/policies/rate-limits#http-response-headers) that provide additional information on the rate limits applicable to that endpoint. + +If you exceed the global rate limit, the following example log entry will be emitted to your logs: **You have reached the global limit for your account**. There will be a single log entry per hour while your account exceeds the rate limit. + +To view the log entries for a subscription, navigate the to [Logs](${manage_url}#/logs) page in the [Dashboard](${manage_url}). + +### Reducing the number of calls to Auth0 + +When you exceed your rate limits, you'll need to reduce the number of calls you make to Auth0. The specifics depend on your use case, but here are some recommendations: + + * Cache `/.well-known/*` responses: This information does not change frequently, so you can usually cache it to reduce the number of times you need to call Auth0. + + * Consider requesting an `id_token` instead of calling `/userinfo` to get information about the user. + +### Response body + +The response body you receive depends on the endpoint. Each endpoint typically provides a return value in a different format (for example, some return an HTTP response, while others redirect to a URL and pass values in the query string). If the endpoint typically provides the response expected as JSON in the HTTP body, then a JSON error response will be sent if a rate limit is reached (exceptions are documented above). + +To view the particular response per endpoint, see [Affected endpoints](#affected-endpoints). Descriptions of each possible error are listed below. + +#### Error Page + +The Error Page response is sent for endpoints that render HTML content to the end user. When you exceed the rate limit, Auth0 renders the [Error Page](/universal-login/custom-error-pages) instead of the expected content. + +#### JSON Error + +Endpoints that usually provide JSON-formatted responses will return a JSON object containing an error code and description. + +```json +{ + "error": "access_denied or too_many_requests", + "error_description": "Global rate limit exceeded", + "error_uri": "https://.../... documentation url" +} +``` + +The error you receive depends on the type of endpoint you're calling: + +* `access_denied`: for OAuth endpoints +* `too_many_requests`: for endpoints that return JSON + +#### XML Error + +XML Errors are returned for endpoints that normally return XML. + +```xml + + + + + env:Sender + + fed:BadRequest or wst:RequestFailed + + + + Global rate limit exceeded + + + + + + +``` + +The error you receive depends on the type of endpoint you're calling: + +- `fed:BadRequest` will be sent for WSFed-related endpoints. +- `wst:RequestFailed` will be used in for WSTrust-related endpoints. diff --git a/articles/policies/rate-limits-mgmt-api.md b/articles/policies/rate-limits-mgmt-api.md new file mode 100644 index 0000000000..6c8340b61b --- /dev/null +++ b/articles/policies/rate-limits-mgmt-api.md @@ -0,0 +1,100 @@ +--- +title: Management API Endpoint Rate Limits +description: Describes Auth0's rate limit policy when working with Auth0 Management API endpoints. +toc: true +topics: + - auth0-policies + - rate-limits +contentType: + - reference +useCase: + - support +--- +# Management API Endpoint Rate Limits + +**This policy is effective May 19, 2020.** + +::: warning +If you subscribed before **May 19, 2020**, the [previous rate limit policy](/policies/legacy-rate-limits) applies to you until **June 18, 2020**. Starting on **June 18, 2020**, these limits will apply to all tenants. You will be notified of the new limits through a **Dashboard Notification**. If the new limits impact your tenant, you will be notified directly via email with additional information about minimizing API calls and upgrading plans. +::: + +The rate limits for this API differ depending on whether your tenant is free or paid, production or not. + +| Tenant Type | Rate Limit (per second) | Rate Limit (per minute) | +| - | - | - | +| Free or Trial | 10 | 120 | +| Developer or Developer Pro (created before May 19, 2020) | 50 | 1000 | +| Enterprise (Production) | 50 | 1000 | +| Enterprise (Non-production) | 10 | 120 | + +The rate limits include calls made via [Rules](/rules) and are set **by tenant** and not by endpoint. + +Each endpoint is configured with a bucket that defines: + +- Request limit +- Rate limit window (per second, per minute, per day, etc.) + +```text +bucket: + size: x + per_minute: y +``` + +For example, the above states that, for the given bucket, there is a maximum request limit of `x` per minute, and for each minute that elapses, permissions for `y` requests are added back. In other words, for each `60 / y` seconds, one additional request is added to the bucket. This occurs automatically until the bucket contains the maximum permitted number of requests. + +For some API endpoints, the rate limits are defined per bucket, so the origins of the call do not influence the rate limit changes. For other buckets, the rate limits are defined using different keys, so the originating IP address is considered when counting the number of received API calls. + +::: note +If you are using an API endpoint **not** listed below and you receive rate limit headers as part of your response, see [Anomaly Detection](/anomaly-detection) for more information. +::: + +The following Auth0 Management API endpoints return rate limit-related headers. For additional information about these endpoints, please consult the [Management API explorer](/api/management/v2). + +## Developer and Developer Pro subscription limits + +| Endpoint Group | Path | Rate Limit (per second) | Rate Limit (per minute) | +| - | - | - | - | +| Read users | `GET /api/v2/users` | 40 | 500 | +| | `GET /api/v2/users-by-email` | | | +| | `GET /api/v2/users/{id}` | | | +| Write users | `POST /api/v2/users` | 20 | 200 | +| | `POST /api/v2/users/{id}/identities` | | | +| | `PATCH /api/v2/users/{id}` | | | +| | `DELETE /api/v2/connections/{id}/users` | | | +| | `DELETE /api/v2/users/{id}/identities/{provider}/{user_id}` | | | +| | `DELETE /api/v2/users/{id}` | | | +| Read logs | `GET /api/v2/logs` | 10 | 100 | +| | `GET /api/v2/logs/{id}` | | | +| | `GET /api/v2/users/{id}/logs` | | | +| Read clients | `GET /api/v2/clients` | 5 | 100 | +| | `GET /api/v2/clients/{id}` | | | +| Read connections | `GET /api/v2/connections` | 10 | 100 | +| | `GET /api/v2/connections/{id}` | | | +| Write device credentials | `POST /api/v2/device-credentials` | 5 | 100 | +| | `DELETE /api/v2/device-credentials/{id}` | | | +| All other endpoints combined | | 10 | 150 | + +## Endpoint limits for all subscriptions + +| Endpoint | Path | Rate Limit (per second) | Rate Limit (per minute) | Rate Limit (per day) | +| - | - | - | - | - | +| Verify custom domain | `POST /api/v2/custom-domains{id}/verify` | n/a | 5 | n/a | +| Register dynamic client | `POST /oidc/register` | 5 | n/a | n/a | +| Read connection status | `GET /api/v2/connections/{id}/status` | 15 | n/a | n/a | +| Rotate signing keys | `POST /api/v2/keys/signing/rotate` | n/a | n/a | 5 | + +## Concurrent import users job limits + +The [create import users job](/api/management/v2#!/Jobs/post_users_imports) endpoint has a limit of 2 concurrent import jobs. If you request additional jobs while there are 2 pending returns, the following response occurs: + +```json +{ + "statusCode": 429, + "error": "Too Many Requests", + "message": "There are 2 active import users jobs, please wait until some of them are finished and try again +} +``` + +## Access token limits for SPAs + +If you obtain Access Tokens for your SPAs, there are rate limits that are applicable when working with the available `current_user`-related [scopes and endpoints](/api/management/v2/get-access-tokens-for-spas#available-scopes-and-endpoints). You are allowed a maximum of **10 requests per minute per user**. diff --git a/articles/policies/rate-limits.md b/articles/policies/rate-limits.md index d20e785ff9..3c86e92079 100644 --- a/articles/policies/rate-limits.md +++ b/articles/policies/rate-limits.md @@ -1,284 +1,79 @@ --- -title: Rate Limit Policy For Auth0 APIs -description: This page details Auth0's Rate Limit Policy with hitting Auth0 API endpoints. -toc: true +title: Rate Limit Policy +description: Describes Auth0's rate limit policy. +toc: true +topics: + - auth0-policies + - rate-limits +contentType: + - reference +useCase: + - support --- -# Rate Limit Policy For Auth0 APIs +# Rate Limit Policy -To ensure the quality of Auth0's services, the Auth0 APIs are subject to rate limiting. +Actions such as rapidly updating configuration settings, aggressive polling, or making highly concurrent API calls may result in your app being rate limited. -::: note -If you are looking for information on the rate limits on user logins, refer to [Rate Limits on User/Password Authentication](/connections/database/rate-limits). -::: +Auth0's rate limits vary based on the tenant type you have. The tenants that have no credit card associated in the [Dashboard](${manage_url}/#/tenant/billing/payment) are free. There are also variations in terms of paid tenant types (e.g., non-production, production). To set an environment for your tenant (development, staging or production), go to [Support Center > Tenants](${env.DOMAIN_URL_SUPPORT}/tenants/public), find your tenant, select __Assign Environment Tag__, set the environment and save changes. -## Limits +## API endpoint limits -Depending on the API endpoint, the request limit and the rate limit window in which the request limit resets, varies. +To ensure the quality of Auth0's services, the Auth0 APIs are subject to rate limiting. Depending on the API endpoint, the request limit and the rate limit window in which the request limit resets, varies. -Each endpoint is configured with a bucket that defines: +Using the Management API for free and trial tenants is restricted to **2 requests per second** (with bursts of up to **10 requests**). Exceeding these values triggers an HTTP 429 error, but the error message states, "Global limit has been reached." These are in addition to those indicated in the rate limit response headers. -- the request limit, and -- the rate limit window (per second, per minute, per hour, and so on) - -```text -bucket: - size: x - per_minute: y -``` - -For example, the above states that, for the given bucket, there is a maximum request limit of `x` per minute, and for each minute that elapses, permissions for `y` requests are added back. In other words, for each `60 / y` seconds, one additional request is added to the bucket. This occurs automatically until the bucket contains the maximum permitted number of requests. - -::: warning -For some API endpoints, the rate limits are defined per bucket, so the origins of the call do not influence the rate limit changes. For other buckets, the rate limits are defined using different keys, so the originating IP address is considered when counting the number of received API calls. -::: - -## Exceeding the Rate Limit - -If you exceed the provided rate limit for a given API endpoint, you will receive a response with [HTTP Status Code 429 (Too Many Requests)](http://tools.ietf.org/html/rfc6585#section-4). You can refer to the [HTTP Response Headers](#http-response-headers) for more information on the rate limits applicable to that endpoint. +If your app triggers the rate limit, please refrain from making additional requests until the appropriate amount of time has elapsed. -Actions such as rapidly updating configuration settings, aggressive polling, or making highy concurrent API calls may result in your app being rate limited. +See the rate limits for [Management API Endpoints](/policies/rate-limits-mgmt-api) and [Authentication API Endpoints](/policies/rate-limits-auth-api) for complete details on each endpoint limitation. -If your app triggers the rate limit, please refrain from making additional requests until the appropriate amount of time has elapsed. +### Review HTTP response headers -## HTTP Response Headers +Auth0 reserves the right to modify the rate limits at any time. For the up-to-date information on rate limits, you can review the HTTP response headers returned from rate limited endpoints. -API requests to selected [Authentication](/api/authentication) or [Management API](/api/management/v2) endpoints will return HTTP Response Headers that provide relevant data on the current status of your rate limits for that endpoint. If you receive a rate limit-related response header, it will include numeric information detailing your status. +API requests to selected [Authentication](/api/authentication) or [Management API](/api/management/v2) endpoints will return HTTP response headers that provide relevant data on the current status of your rate limits for that endpoint. If you receive a rate limit-related response header, it will include numeric information detailing your status. * **X-RateLimit-Limit**: The maximum number of requests available in the current time frame. * **X-RateLimit-Remaining**: The number of remaining requests in the current time frame. * **X-RateLimit-Reset**: A [UNIX timestamp](https://en.wikipedia.org/wiki/Unix_time) of the expected time when the rate limit will reset. -## Endpoints with Rate Limits - -::: note -If you are using an API endpoint **not** listed below and you receive rate limit headers as part of your response, please see the page on [Anomaly Detection](/anomaly-detection) for additional information. -::: - -### Management API v2 +### Handle rates limitations in code -The rate limits for this API defer depending on whether your tenant is free or paid, production or not. +You should add logic to handle cases in which you exceed the provided rate limits and receive the HTTP Status Code 429 (Too Many Requests). In this case, if a retry is needed, it is best to allow for a back-off to avoid going into an infinite retry loop. -::: note -- The tenants that have no credit card associated in the [Dashboard](${manage_url}/#/tenant/billing/payment) are free. -- To set an environment for your tenant (development, staging or production), go to [Support Center > Tenants](${env.DOMAIN_URL_SUPPORT}/tenants/public), find your tenant, select __Assign Environment Tag__, set the environment and save changes. -::: +For scripts and rules that call Auth0 APIs, you should always handle rate limiting by checking the `X-RateLimit-Remaining` header and acting appropriately when the number returned nears 0. -The following rate limits apply: +## Database login limits -- For all __free tenants__, usage of the Management API is restricted to 2 requests per second (and bursts up to 10 requests). This policy goes into effect on __Tuesday, September 12 at 1PM PT__. -- For __non-production tenants__ of enterprise customers, usage of the Management API is restricted to 2 requests per second (and bursts up to 10 requests). This policy goes into effect on __Tuesday, September 19 at 1PM PT__. -- For __paid__ tenants, usage of the Management API is restricted to 50 requests per second. +For database connections, Auth0 limits certain types of repeat login attempts depending on the user account and IP address. For more information, see [Rate Limits on User/Password Authentication](/policies/rate-limit-policy/database-connections-rate-limits). -The aforementioned rate limits include calls made via [Rules](/rules). +## SMS/Voice message limits for multi-factor authentication -Note, that the limit is set by tenant and not by endpoint. +There's a limit of 10 SMS or Voice messages/hour per user for MFA. For more information, see [Configure SMS or Voice Notifications for MFA](/mfa/guides/configure-phone). -The following Auth0 Management API endpoints return rate limit-related headers. For additional information about these endpoints, please consult the [Management API explorer](/api/management/v2). +## Native social login limits - +Limits are only applied to requests related to the Native Social Login flows, which are identified based on the body of the requests with the following initial criteria: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    EndpointGETPOSTDELETEPATCH
    Application Grants/client-grants/client-grants/client-grants/{id}/client-grants/{id}
    Applications/client
    /client/{id}
    /client/client/{id}/client/{id}
    Connections/connections
    /connections/{id}
    /connections/connections/{id}
    /connections/{id}/users
    /connections/{id}
    Device Credentials/device-credentials/device-credentials/device-credentials/{id}
    Logs/logs
    /log/{id}
    Rules/rules
    /rules/{id}
    /rules/rules/{id}/rules/{id}
    User Blocks/user-blocks
    /user-blocks/{id}
    /user-blocks
    /user-blocks/{id}
    Users/users
    /users/{id}
    /users/{id}/logs
    /users/{id}/enrollments
    /users
    /users/{id}/identities
    /users/{id}
    /users/{id}/identities
    /users/{id}/multifactor/{provider}
    /users/{id}
    Emails/emails/provider/emails/provider/emails/provider
    Jobs/jobs/{id}
    /jobs/{id}/errors
    /jobs/verification-email
    /jobs/users-imports
    Resource Servers/resource-servers
    /resource-servers/{id}
    /resource-servers/resource-servers/{id}/resource-servers/{id}
    Stats/stats/active-users
    /stats/daily
    Tenants/tenants/settings/tenants/settings
    +| Request Type | Body | +| - | - | +| `grant_type` | `urn:ietf:params:oauth:grant-type:token-exchange` | +| `subject_token_type` | `http://auth0.com/oauth/token-type/apple-authz-code` | -### Authentication API +### Limits for production tenants of paying customers -The following Auth0 Authentication API endpoints return rate limit-related headers. +| Endpoint | Path | Limited By | Rate Limit | +| - | - | - | - | +| Get Token | `/oauth/token` | Any native social login request | 50 per minute with bursts up to 500 requests | -::: warning -Auth0 reserves the right to modify the rate limits at any time. For the up-to-date information on rate limits, please review the headers returned from rate limited endpoints. -::: +### Limits for non-production tenants of paying customers and all tenants of free customers - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +| Endpoint | Path | Limited By | Rate Limit | +| - | - | - | - | +| Get Token | `/oauth/token` | Native social login requests and IP | 30 per minute | - - - - - - - - - - - - - - - - - - - - - - -
    EndpointPathLimited ByAffected TenantsRate Limit
    User Profile/tokeninfo (legacy)IPAll800 requests per minute
    /userinfoUser IDAll5 requests per minute with bursts of up to 10 requests
    Delegated Authentication (legacy)/delegationUser ID and IPAll1 request per minute with bursts of up to 10 requests
    (any request)Free (*)10 requests per second
    Change Password/dbconnections/change_passwordUser ID and IPAll1 request per minute with bursts of up to 10 requests
    Get Passwordless Code or Link/passwordless/startIPAll50 requests per hour
    Get Token/oauth/token(any request)Free30 requests per second
    Cross Origin Authentication/co/authenticate(any request)Free5 requests per second
    Authentication/usernamepassword/login(any request)Free5 requests per second
    Resource Owner (legacy)/oauth/ro(any request)Free10 requests per second
    Json Web Token Keys/.well-known/jwks.json(any request)Free20 requests per second
    +## Keep reading -:::note -(*) In all instances above, **Free** includes tenants on the Free plan, as well as the non-production tenants of enterprise customers. -::: +* [Management API Endpoint Rate Limits](/policies/rate-limits-mgmt-api) +* [Authentication API Endpoint Rate Limits](/policies/rate-limits-auth-api) +* [Legacy Rate Limits](/policies/legacy-rate-limits) +* [Entity Limit Policy](/policies/entity-limits) diff --git a/articles/policies/requests.md b/articles/policies/requests.md deleted file mode 100644 index 4d2df15835..0000000000 --- a/articles/policies/requests.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -description: The following is a list of requests Auth0 currently doesn't support. ---- - -# Unsupported Requests - -Our support team strives to assist you to the best of our ability. However, we are currently unable to grant the following requests: - -* Transferring data from a non-production to a production account - -* Renaming a tenant - -* Renaming a connection \ No newline at end of file diff --git a/articles/policies/restore-deleted-tenant.md b/articles/policies/restore-deleted-tenant.md index 3664ed2502..a9e135d7c6 100644 --- a/articles/policies/restore-deleted-tenant.md +++ b/articles/policies/restore-deleted-tenant.md @@ -1,31 +1,23 @@ --- description: This page details Auth0's deleted tenant restoration policy. +topics: + - auth0-policies + - tenants + - tenant-restoration +contentType: + - reference +useCase: + - support --- # Tenant Restoration Policy -The following policy governs requests for restoration of Auth0 tenants that were previously deleted. - -::: note -If you are considering deleting your tenant, please see our [Resetting/Deleting Tenant](/tutorials/delete-reset-tenant) page for alternative options. +::: warning +**Deleted tenants cannot be restored** and the **tenant name may not be used again** when creating new tenants. ::: -A customer may request a tenant restoration if the tenant was deleted by human error and restoration is critical for the continuity of customer's operations. Please note that before deleting a tenant, from the Auth0 Dashboard, a warning explains that this cannot be undone. However, in some cases we might opt for support this kind of request. - -## Considerations - -* We support tenant restoration for all paying customers. - -* Tenant restoration is not supported for non-paying customers. - -* The restoration can take up to seven days, for paying customers. - -* Tenant restoration will be allowed if the request is made before 20 days have passed from the date the tenant was deleted. - -## How to request - -* Customers must file a tenant restoration request in writing, via the [Auth0 support center](${env.DOMAIN_URL_SUPPORT}) or via email. - -* Please specify the name that the deleted tenant had and the region where it belonged. +**Before you delete your tenant, please check out the following resources for alternative options:** +* [Updating a Tenant Admin](https://auth0.com/docs/dashboard/manage-dashboard-admins#update-admin) **for changing ownership of the tenant** +* [Delete or Reset Tenants](/tutorials/delete-reset-tenant) for reseting tenant configuration. -* A member of the Auth0 team will respond your request. +If you've deleted your tenant, and you require the use of a particular domain name, we recommend configuring a [custom domain name](/custom-domains) for your new tenant. diff --git a/articles/policies/unsupported-requests.md b/articles/policies/unsupported-requests.md new file mode 100644 index 0000000000..793fd7ff2f --- /dev/null +++ b/articles/policies/unsupported-requests.md @@ -0,0 +1,41 @@ +--- +description: The following is a list of requests Auth0 currently doesn't support. +topics: + - auth0-policies + - support +contentType: + - reference +useCase: + - support +--- + +# Unsupported Requests + +Our support team strives to assist you to the best of our ability. However, we are currently unable to grant the following requests: + +* Transferring data from a non-production to a production account + +* Renaming a tenant + +* Renaming a connection + +* Re-using the name of a previously deleted tenant + +* Migrating a tenant from one region to another (for example, from US to EU) + +* Ad hoc usage data reports. + +* Restore any deleted or modified data or settings in tenants, including: + + * Database connections and their users and passwords + * Users, their profile information, metadata, roles membership + * Roles and permissions + * Applications + * SSO Integrations + * APIs + * Connections + * Rules + * Hooks + * Extensions + * Email templates + * Tenant logs once the [standard retention time](/logs/references/log-data-retention) passed diff --git a/articles/pre-deployment/how-to-run-test.md b/articles/pre-deployment/how-to-run-test.md index c5525bda2d..f06bf5038a 100644 --- a/articles/pre-deployment/how-to-run-test.md +++ b/articles/pre-deployment/how-to-run-test.md @@ -1,10 +1,20 @@ --- -description: How to run the Auth0 Pre-Deployment Tests to ensure that your Applications are production-ready +description: How to run the Auth0 Production Check to ensure that your Applications are production-ready +topics: + - pre-deployment + - pre-deployments-tests + - tests + - production-checks +contentType: + - reference + - how-to +useCase: + - support --- -# How to Run the Pre-Deployment Test +# How to Run the Production Checks -The Pre-Deployment Tests are available via the [Auth0 Support Center](${env.DOMAIN_URL_SUPPORT}). +The Production Checks can be reviewed in the [Auth0 Support Center Tenants section](${env.DOMAIN_URL_SUPPORT}/tenants/public). ![](/media/articles/support/pre-deployment-tests/support-home.png) @@ -12,45 +22,48 @@ Once you've logged in to your account, click **Tenants** in the navigation bar. ![](/media/articles/support/pre-deployment-tests/tenants.png) -You'll see a listing of all tenants associated with your Auth0 account. Each tenant displays in its own box. Identify the tenant for which you want to run the Pre-Deployment Tests, and click on the **gear icon** located in the top right-hand corner of its box. +You'll see a listing of all tenants associated with your Auth0 account. Each tenant displays in its own box. Identify the tenant for which you want to run the Production Checks, and click on the **gear icon** located in the top right-hand corner of its box. ![](/media/articles/support/pre-deployment-tests/tenants-tests.png) Click **Run Production Check** to launch the testing interface. -At this point, you'll be able to select one or more [Applications](/applications) associated with this tenant for which you want tests run. +At this point, you'll be able to select one or more [Applications](/applications) associated with this tenant for which you want checks run. -![](/media/articles/support/pre-deployment-tests/choose-clients.png) +![](/media/articles/support/pre-deployment-tests/choose-applications.png) Once you've selected your applications, click **Run Check**. -When the test is complete, your screen will automatically refresh to display your test results. +When the test is complete, your screen will automatically refresh to display your check results. ![](/media/articles/support/pre-deployment-tests/results.png) -There are three types of test results: Required, Recommended, and Best Practices. + +## Production Check Results + +There are three types of check results: Required, Recommended, and Best Practices. | Result Type | Description | | ----------- | ----------- | -| Required | These tests check to see if you are missing any steps you **must** complete before deploying to Production, otherwise you'll see errors. | -| Recommended | These tests check to see if you are missing any steps **recommended** by Auth0. While you do not have to complete the steps suggested, we recommend that you at least review the results to see if any of them are helpful to your implementation. -| Best Practices | These areas are ones where Auth0 cannot check using automates tests. We list areas of possible concern, and we suggest that you review your implementation to see if you're compliant with Auth0 recommendations. | +| Required | These checks see if you are missing any steps you **must** complete before deploying to Production; otherwise you'll see errors. | +| Recommended | These checks see if you are missing any steps **recommended** by Auth0. While you do not have to complete the steps suggested, we recommend that you at least review the results to see if any of them are helpful to your implementation. +| Best Practices | These areas are ones where Auth0 cannot use automated checks. We list areas of possible concern, and we suggest that you review your implementation to see if you're compliant with Auth0 recommendations. | ## How to Read Your Results Set -The following are possible results for your test: Passed, Failed, Unable to Verify. +The following are possible results for your check: Passed, Failed, Unable to Verify. -Under each set of test results, Auth0 tells you how many tests your Application passed, as well as how many tests your Applications failed. +Under each set of check results, Auth0 tells you how many checks your Application passed, as well as how many checks your Application failed. ![](/media/articles/support/pre-deployment-tests/reading-results.png) -If your Applications **failed** one or more tests, Auth0 provides you: +If your Application **failed** one or more checks, Auth0 provides: -* The name of the test -* Information on what the test is looking for -* Details on the error thrown to and retrieved by the test -* Hyperlink to the appropriate area where you can make the required fixes so that your Application passes the test +* The name of the check +* Information on what the check is looking for +* Details on the error thrown to and retrieved by the check +* Hyperlink to the appropriate area where you can make the required fixes so that your Application passes the check ![](/media/articles/support/pre-deployment-tests/detailed-results.png) -All of the tests that your Application **passed** are grouped together at the bottom of the results set. You can view the name of and information about the test, as well as review the associated documentation and use the hyperlink to go to the corresponding configuration area where you can make changes (if desired). \ No newline at end of file +All of the checks that your Application **passed** are grouped together at the bottom of the results set. You can view the name of and information about the check, as well as review the associated documentation and use the hyperlink to go to the corresponding configuration area where you can make changes (if desired). diff --git a/articles/pre-deployment/index.html b/articles/pre-deployment/index.html index fe4f063178..d3f15af976 100644 --- a/articles/pre-deployment/index.html +++ b/articles/pre-deployment/index.html @@ -1,27 +1,36 @@ --- classes: topic-page -title: Pre-Deployment Tests +title: Production Checks +topics: + - pre-deployment + - pre-deployments-tests + - tests + - production-checks +contentType: + - index +useCase: + - support ---
    -

    Pre-Deployment Tests

    +

    Production Checks

    - Before you go live, run Auth0's pre-deployment test suite to ensure that your tenants are ready for use in a production environment. + Before you go live, run Auth0's production checks suite to ensure that your tenants are ready for use in a production environment.