Single Sign On (SSO) with Vue JS and Azure Active Directory
Summary
I had the opportunity to create a proof of concept (PoC) to demonstrate how to integrate a Vue.js Single Page Architecture (SPA) application with Microsoft Azure Active Directory (Entra ID).
Objectives
The PoC had to achieve the following -
- Login
- Logout
- Persistence of login state
- Protection of secure routes
- Authorization Code flow with PKCE
Challenges
I faced two challenges -
- It was my first time with Vue.js although I had worked with React previously.
- I had never implemented SSO in any manner
- I could not find code examples that did all of the above with Vue.js and Azure AD and the latest version of the official MSAL library.
I took a short course on Vue and Vuex by Stephen Grider on Udemy. I highly recommend this course which you can find here https://www.udemy.com/course/vue-js-course
Solution
I started with developing the store using vuex. I encapsulated the authentication logic in an auth module within the store. Next was creating the API helper which contains the logic to use the @azure/msal-browser library post which I added the router logic and the navigation guards.
The solution has satisfied all the objectives and I was able to hand it over to the development team to use it as a template for building SSO in the actual web application.
Comments
Post a Comment