|
| 1 | +.. _anon-embedding-charts: |
| 2 | + |
| 3 | +============================== |
| 4 | +Embed an Unauthenticated Chart |
| 5 | +============================== |
| 6 | + |
| 7 | +.. default-domain:: mongodb |
| 8 | + |
| 9 | +.. contents:: On this page |
| 10 | + :local: |
| 11 | + :backlinks: none |
| 12 | + :depth: 2 |
| 13 | + :class: singlecol |
| 14 | + |
| 15 | +You can embed a chart in a web application and not require authentication |
| 16 | +to view chart data. To restrict access to your embedded chart, see the |
| 17 | +:ref:`authenticated embedded chart tutorials <authenticated-embedding-tutorials>`. |
| 18 | + |
| 19 | +Prerequisites |
| 20 | +------------- |
| 21 | + |
| 22 | +- You must be a dashboard :ref:`Author <dashboard-permissions>` to enable |
| 23 | + unauthenticated embedding for a chart. |
| 24 | +- :ref:`add-data-source` |
| 25 | +- :ref:`create-new-dashboard` |
| 26 | +- :ref:`create-new-chart` |
| 27 | + |
| 28 | +Procedures |
| 29 | +---------- |
| 30 | + |
| 31 | +.. _anon-embedding-procedure: |
| 32 | + |
| 33 | +Enable Unauthenticated Embedding for a Chart |
| 34 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 35 | + |
| 36 | +Enable unauthenticated embedding to generate a chart ID and |charts-short| |
| 37 | +Base URL. You will need your chart ID and |charts-short| Base URL to |
| 38 | +display your chart on a web page. |
| 39 | + |
| 40 | +.. include:: /includes/steps/enable-embedding-sdk-anon.rst |
| 41 | + |
| 42 | +Create a Web App to Display Your Chart |
| 43 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 44 | + |
| 45 | +If you already have an app in which to display your chart, you're ready |
| 46 | +to add an unauthenticated embedded chart. If not, proceed with the remaining |
| 47 | +steps to create a new app. |
| 48 | + |
| 49 | +MongoDB offers a pre-built example app that shows how to use the |
| 50 | +Embedding SDK to display an unauthenticated embedded chart. |
| 51 | + |
| 52 | +Clone the :gh:`GitHub repository </mongodb-js/charts-embed-sdk/>` |
| 53 | +to get all the example apps. Instructions for running the unauthenticated |
| 54 | +example are in the :gh:`Readme |
| 55 | +</mongodb-js/charts-embed-sdk/tree/master/examples/unauthenticated>` file |
| 56 | +in the ``unauthenticated`` directory. You can run the app as-is, or you can |
| 57 | +customize it to use a chart of your own. |
| 58 | + |
| 59 | +Customize the Node.js App |
| 60 | +~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 61 | + |
| 62 | +All the lines you need to edit are marked with a comment containing |
| 63 | +``~REPLACE~``. |
| 64 | + |
| 65 | +.. include:: /includes/steps/customize-anon-auth-app.rst |
| 66 | + |
| 67 | +After you finish customizing the app, it's ready to run. |
0 commit comments