@@ -9,113 +9,53 @@ Embedding Charts in Your Web Application
99.. contents:: On this page
1010 :local:
1111 :backlinks: none
12- :depth: 1
12+ :depth: 2
1313 :class: singlecol
1414
1515Overview
1616--------
1717
18- As a dashboard :ref:`Author <dashboard-permissions>`, you can embed
19- charts into your own web sites , allowing people who are not Charts
20- users to see your visualizations . You can either require a verified
18+ As a dashboard :ref:`Author <dashboard-permissions>`, you can enable
19+ embedding on your charts , allowing your visualizations to be embedded
20+ in external web sites . You can either require a verified
2121signature to accompany each data request, or allow anyone with the
2222chart's identifying information to embed it in a web page.
2323
2424If you want strict control over who can embed your charts, use the
25- :ref :`Verified Signature <require-authentication> ` option. If your data
25+ :guilabel :`Verified Signature Required ` option. If your data
2626is non-sensitive and you prefer a simpler embedding solution, use the
27- :ref:`Unauthenticated Access <allow-unauthenticated>` option.
27+ :guilabel:`Unauthenticated Access` option.
28+
29+ .. note::
30+
31+ You can enable chart embedding with the verified signature
32+ required option even if you don't currently have an :ref:`embedding
33+ key <admin-settings>`, but you'll need a key to generate a
34+ verified signature. If you are a `Project Owner
35+ <https://docs.atlas.mongodb.com/reference/user-roles/#project-roles>`__
36+ for your Atlas project, you can generate an embedding key on the
37+ :ref:`Admin Settings <admin-settings>` page. Otherwise, you must
38+ contact the Atlas Project Owner and ask for an embedding key.
2839
2940.. _embedding-procedure:
3041
3142Procedure
3243---------
3344
34- From your dashboard tab, select the dashboard containing the chart you
35- wish to make embeddable. From the dashboard, click the ellipsis
36- (:guilabel:`...`) button at the top-right of the chart to access its
37- embedding information. Select :guilabel:`Embed Chart` from the dropdown
38- menu.
39-
40- If you have not already enabled embedding for the data source this
41- uses, and if you are the data source owner, you have the opportunity to
42- do so now. Click the :guilabel:`Enable embedding options` link.
43-
44- .. figure:: /images/charts/embed-chart-options.png
45- :figwidth: 507px
46- :alt: Embed a chart
47-
48- Once the data source has embedding enabled, you can choose to allow
49- unauthenticated access or restrict access to those with a
50- :ref:`verified signature <require-authentication>`.
51-
52- .. figure:: /images/charts/embed-chart.png
53- :figwidth: 507px
54- :alt: Embed a chart
55-
56- .. _allow-unauthenticated:
57-
58- Allow Unauthenticated Access
59- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60-
61- To allow anyone with the chart link to embed the chart in a web page,
62- select the :guilabel:`Unauthenticated` tab and toggle the switch marked
63- :guilabel:`Enable unauthenticated access` to :guilabel:`On`. The HTML
64- code necessary to embed the chart appears in the modal window. This
65- HTML snippet is ready to copy and paste into an external web page.
45+ .. tabs::
6646
67- .. figure:: /images/charts/embed-chart2.png
68- :figwidth: 508px
69- :alt: Embed unauthenticated chart
70-
71- .. _require-authentication:
72-
73- Require Authentication for Access
74- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
75-
76- For increased security, you can require a verified signature to
77- accompany each data request for an embedded chart. Select the
78- :guilabel:`Verified Signature` tab and toggle the :guilabel:`Enable
79- signed authentication acces` switch to :guilabel:`On`.
80-
81- .. figure:: /images/charts/embed-chart3.png
82- :figwidth: 508px
83- :alt: Embed authenticated chart
84-
85- In addition to the HTML iframe, the verified signature option requires
86- some server-side code in order to work. The HTML snippet above shows
87- what the iframe needs to look like, but it is not usable as-is.
88- Your web application must use a secret embedding key to sign the URL
89- and include a timestamp.
90-
91- .. _verified-signature:
92-
93- Verified Signature Generation
94- -----------------------------
95-
96- To grant data access for embedded charts which require authentication,
97- you must obtain an embedding key from the
98- :ref:`Admin Settings <admin-settings>` page.
99-
100- .. note::
47+ tabs:
48+ - id: unauthenticated
49+ name: Unauthenticated Access
50+ content: |
10151
102- You must be a :ref:`Project Owner <dashboard-permissions>` to access
103- the :guilabel:`Admin Settings` page. For users with the
104- :ref:`Project Owner <dashboard-permissions>` role, the
105- :guilabel:`Admin Settings` link appears in the top right corner of
106- the charts UI. As a non-admin user, you can still use embedded
107- charts, but you will need to ask a Project Owner for a key.
52+ .. include:: /includes/steps/embed-chart-unauthenticated.rst
10853
109- Once you have a key, you can create the server-side code required to
110- generate the verified signature which must accompany a data request
111- from an embedded chart. Code examples of how to generate a verified
112- signature are available for the following languages and platforms:
54+ - id: verified-signature
55+ name: Verified Signature Required
56+ content: |
11357
114- - `Node.js <https://github.com/mongodb/charts-embedding-examples/tree/master/node>`__
115- - `C# <https://github.com/mongodb/charts-embedding-examples/tree/master/c-sharp>`__
116- - `Java <https://github.com/mongodb/charts-embedding-examples/tree/master/java>`__
117- - `Python <https://github.com/mongodb/charts-embedding-examples/tree/master/python>`__
118- - `MongoDB Stitch <https://github.com/mongodb/charts-embedding-examples/tree/master/stitch>`__
58+ .. include:: /includes/steps/embed-chart-verified.rst
11959
12060Embedded Charts Error Codes
12161---------------------------
@@ -152,4 +92,4 @@ If an embedded chart fails to render, an error code is displayed:
15292
15393 * - ``5``
15494 - Invalid payload. Your application server is not creating a
155- usable :ref:`signature <verified-signature >`.
95+ usable :ref:`signature <admin-settings >`.
0 commit comments