From c26abfa3ea297a556db7cd29075d66a3f037e1c5 Mon Sep 17 00:00:00 2001 From: Andrew McMenemy Date: Fri, 1 May 2020 09:27:15 +1000 Subject: [PATCH] chore: CHARTS-3889 Updated all embedding urls to use production charts apps instead of charts-dev. Updated Stitch sample to use production stitch app, no longer requiring an update to the base url --- examples/authenticated-custom-jwt/app.js | 2 +- examples/authenticated-custom-jwt/src/index.js | 4 ++-- examples/authenticated-google/index.html | 5 ++--- examples/authenticated-realm/readme.md | 2 +- examples/authenticated-realm/src/index.js | 9 +++------ 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/examples/authenticated-custom-jwt/app.js b/examples/authenticated-custom-jwt/app.js index 256de3d..62ac01a 100644 --- a/examples/authenticated-custom-jwt/app.js +++ b/examples/authenticated-custom-jwt/app.js @@ -24,7 +24,7 @@ app.post("/login", (req, res) => { loginDetails.password === mockedPassword ) { let token = jwt.sign({ username: loginDetails.username }, config.secret, { - expiresIn: "24h" // expires in 24 hours + expiresIn: "12h" // expires in 12 hours }); res.json({ bearerToken: token }); } else { diff --git a/examples/authenticated-custom-jwt/src/index.js b/examples/authenticated-custom-jwt/src/index.js index a40d467..291e2e3 100644 --- a/examples/authenticated-custom-jwt/src/index.js +++ b/examples/authenticated-custom-jwt/src/index.js @@ -50,13 +50,13 @@ async function login(username, password) { */ async function renderChart() { const sdk = new ChartsEmbedSDK({ - baseUrl: "https://charts-dev.mongodb.com/charts-test2-pebbp", // Optional: ~REPLACE~ with the Base URL from your Embed Chart dialog + baseUrl: "https://charts.mongodb.com/charts-embedding-examples-wgffp", // Optional: ~REPLACE~ with the Base URL from your Embed Chart dialog getUserToken: async function() { return await login(getUser(), getPass()); } }); - const chart = sdk.createChart({ chartId: "a2e775e6-f267-4c2c-a65d-fbf3fad4a4f2" }); // Optional: ~REPLACE~ with the Chart ID from your Embed Chart dialog + const chart = sdk.createChart({ chartId: "8d4dff93-e7ca-4ccd-a622-e20e8a100197" }); // Optional: ~REPLACE~ with the Chart ID from your Embed Chart dialog // render the chart into a container chart.render(document.getElementById("chart")); diff --git a/examples/authenticated-google/index.html b/examples/authenticated-google/index.html index 30791b5..9d3a5d1 100755 --- a/examples/authenticated-google/index.html +++ b/examples/authenticated-google/index.html @@ -25,14 +25,13 @@ const id_token = googleUser.getAuthResponse().id_token; const ChartsEmbedSDK = window.ChartsEmbedSDK; - console.log("ID TOKEN == " + id_token); const sdk = new ChartsEmbedSDK({ - baseUrl: "https://charts-dev.mongodb.com/charts-test2-pebbp", // Optional: ~REPLACE~ with your Charts URL + baseUrl: "https://charts.mongodb.com/charts-embedding-examples-wgffp", // Optional: ~REPLACE~ with your Charts URL getUserToken: () => id_token, }); const chart = sdk.createChart({ - chartId: "0d984f0c-5f1b-4711-9e5d-f78aa1ea8fcb", // Optional: ~REPLACE~ with your Chart ID + chartId: "8d4dff93-e7ca-4ccd-a622-e20e8a100197", // Optional: ~REPLACE~ with your Chart ID }); document.body.classList.toggle("logged-in", true); diff --git a/examples/authenticated-realm/readme.md b/examples/authenticated-realm/readme.md index 936d840..bddd9fc 100644 --- a/examples/authenticated-realm/readme.md +++ b/examples/authenticated-realm/readme.md @@ -126,7 +126,7 @@ Your provider config, (ignoring the completed optional settings) should look som If you do not wish to use our sample data and have completed the above steps to prepare your own chart for embedding, - Open the _index.js_ file (`src/index.js`) -- Replace the Realm `baseUrl` string with the base URL for your Realm app +- Replace the Realm `AppClientID` string with the base URL for your Realm app (look for "\~REPLACE\~" in the comments) - Replace the Charts `baseUrl` string with the base URL you copied from the MongoDB Charts Embedded Chart menu (look for "\~REPLACE\~" in the comments) - Replace the `chartId` string with the chart ID you copied from the MongoDB Charts Embedded Chart menu (look for "\~REPLACE\~" in the comments) - Replace the Stitch App ID in the Stitch Constructor, and remove the base URL. `Stitch.initializeAppClient('')` diff --git a/examples/authenticated-realm/src/index.js b/examples/authenticated-realm/src/index.js index ea59e57..8ce0af0 100644 --- a/examples/authenticated-realm/src/index.js +++ b/examples/authenticated-realm/src/index.js @@ -3,10 +3,7 @@ import { Stitch, UserPasswordCredential } from 'mongodb-stitch-browser-sdk' import "regenerator-runtime/runtime"; const client = Stitch.initializeAppClient( - 'realm-authentication-sample-eibkj', // Optional: ~REPLACE~ with your Realm App ID - { - baseUrl: 'https://stitch-dev.mongodb.com' // Optional: ~REPLACE~ with your Realm URL - } + 'charts-embedding-sdk-nsuat', // Optional: ~REPLACE~ with your Realm App ID ); function getUser() { @@ -38,12 +35,12 @@ async function tryLogin() { client.auth.loginWithCredential(credential).then(() => { const sdk = new ChartsEmbedSDK({ - baseUrl: "https://charts-dev.mongodb.com/charts-test2-pebbp", // Optional: ~REPLACE~ with your Charts URL + baseUrl: "https://charts.mongodb.com/charts-embedding-examples-wgffp", // Optional: ~REPLACE~ with your Charts URL getUserToken: () => getRealmUserToken(client), }); const chart = sdk.createChart({ - chartId: "a2e775e6-f267-4c2c-a65d-fbf3fad4a4f2", // Optional: ~REPLACE~ with your Chart ID + chartId: "e966910a-563d-40af-a0e6-57f9d7824c12", // Optional: ~REPLACE~ with your Chart ID }); chart.render(document.getElementById("chart"));