Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/authenticated-custom-jwt/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edit: This change is no longer necessary, but it doesn't hurt. I hadn't made my provider yet and was confused.

});
res.json({ bearerToken: token });
} else {
Expand Down
4 changes: 2 additions & 2 deletions examples/authenticated-custom-jwt/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
5 changes: 2 additions & 3 deletions examples/authenticated-google/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion examples/authenticated-realm/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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('<your-app-id>')`
Expand Down
9 changes: 3 additions & 6 deletions examples/authenticated-realm/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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"));
Expand Down