@@ -9,113 +9,53 @@ Embedding Charts in Your Web Application
9
9
.. contents:: On this page
10
10
:local:
11
11
:backlinks: none
12
- :depth: 1
12
+ :depth: 2
13
13
:class: singlecol
14
14
15
15
Overview
16
16
--------
17
17
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
21
21
signature to accompany each data request, or allow anyone with the
22
22
chart's identifying information to embed it in a web page.
23
23
24
24
If 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
26
26
is 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.
28
39
29
40
.. _embedding-procedure:
30
41
31
42
Procedure
32
43
---------
33
44
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::
66
46
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: |
101
51
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
108
53
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: |
113
57
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
119
59
120
60
Embedded Charts Error Codes
121
61
---------------------------
@@ -152,4 +92,4 @@ If an embedded chart fails to render, an error code is displayed:
152
92
153
93
* - ``5``
154
94
- Invalid payload. Your application server is not creating a
155
- usable :ref:`signature <verified-signature >`.
95
+ usable :ref:`signature <admin-settings >`.
0 commit comments