Skip to content

New msal-browser sample enabling version switching at runtime #7922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 22, 2025

Conversation

tnorling
Copy link
Collaborator

@tnorling tnorling commented Jul 9, 2025

Adds a new sample that includes the ability to switch versions at runtime (both local development builds and any published version). This will be used to test upgrade and downgrade scenarios both manually and in CI.

@github-actions github-actions bot added documentation Related to documentation. samples Related to the samples apps for the library. labels Jul 9, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a new Express-based sample for msal-browser that demonstrates runtime version switching of the MSAL library.

  • Introduces a version switcher UI and backing API endpoints in server.js
  • Adds Handlebars views, public JS (including versionSwitcher.js), and CSS for the sample
  • Provides a starter README for running and using the sample

Reviewed Changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 2 comments.

File Description
samples/msal-browser-samples/ExpressSample/server.js New API endpoints and logic for dynamic MSAL versioning
samples/msal-browser-samples/ExpressSample/public/js/versionSwitcher.js UI logic for version dropdown, custom version modal
samples/msal-browser-samples/ExpressSample/public/css/styles.css Styles for version switcher, modals, and general UI
samples/msal-browser-samples/ExpressSample/README.md Initial instructions (missing version switcher docs)
Comments suppressed due to low confidence (2)

samples/msal-browser-samples/ExpressSample/server.js:184

  • Consider adding unit tests for the /api/version endpoint (and other versioning endpoints) to verify correct JSON responses and cache behavior under different scenarios.
app.get('/api/version', async (req, res) => {

samples/msal-browser-samples/ExpressSample/README.md:70

  • The README doesn't yet document the new version switcher feature. Add a section describing how to use the version dropdown and custom version modal.
- The Profile page will automatically fetch and display your user information from MS Graph.

hectormmg
hectormmg previously approved these changes Jul 10, 2025
Copy link
Member

@hectormmg hectormmg left a comment

Choose a reason for hiding this comment

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

This is great!

Non-blocking but if you think it's a good idea maybe we can add an alert in the sample UI for when the environment variables haven't been set. I spent like 30 min re-installing and building before I realized that's why it wasn't working for me.

@tnorling
Copy link
Collaborator Author

This is great!

Non-blocking but if you think it's a good idea maybe we can add an alert in the sample UI for when the environment variables haven't been set. I spent like 30 min re-installing and building before I realized that's why it wasn't working for me.

Let me see what I can do. At the very least I'll make sure an .env file is included here to be more obvious, I guess it got ignored by git

@tnorling tnorling enabled auto-merge (squash) July 11, 2025 22:52
@tnorling tnorling merged commit afeaedd into dev Jul 22, 2025
7 checks passed
@tnorling tnorling deleted the browser-expressSample branch July 22, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Related to documentation. samples Related to the samples apps for the library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants