Questions tagged [msal.js]

The Microsoft Authentication Library for JavaScript enables client-side JavaScript web applications, running in a web browser, to authenticate users using Azure AD for work and school accounts (AAD), Microsoft personal accounts (MSA), and social identity providers like Facebook, Google, LinkedIn, Microsoft accounts, etc. through Azure AD B2C service.

Msal.js library can be found here: https://github.com/AzureAD/microsoft-authentication-library-for-js

Official Documentation by Microsoft can be found here: https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-overview

505 questions
20
votes
2 answers

Unable to acquire token silently or via redirect using msal-browser

I'm trying to develop a VueJS single page application that logs you into AAD so that I can get an access token to call various APIs (e.g. Graph). Once a user is logged in, you have to acquire a token and there are two ways of doing this: silently…
chivano
  • 603
  • 1
  • 5
  • 13
18
votes
1 answer

Azure MSAL JS: How to edit profile?

I've successfully implemented MSAL JS for Azure AD B2C. The next step is to let the user edit their profile. I've created a new policy for Edit Profile. But how to redirect the user there? There are only login methods / acquire token methods. I've…
Boland
  • 1,531
  • 1
  • 14
  • 42
16
votes
3 answers

Is it possible to use MSAL.js to get refresh token?

I want to integrate with Miscrosoft Outlook. I am able to login with MSAL.js and get an access token, but I am not able to get a refresh token. Is there a way to do it?
Igor G.
  • 6,955
  • 6
  • 26
  • 26
15
votes
2 answers

How to know if a given user is already logged in with MSAL?

With msal.js library (The Microsoft Authentication Library), which is the way to know if a given user is already logged in? My intention is to avoid to show login pop-up if the user's credentials are already saved in browser's storage My current…
Daniel San
  • 1,937
  • 3
  • 19
  • 36
12
votes
2 answers

msal.js 2.0 tokenResponse null after loginRedirect

I am developing an Angular 10 app that utilizes Azure B2C for policy and user management. I set up my app registration in Azure Active Directory as a singlepage app without the implicit option checked. I am using msal.js 2.0 @azure/msal-browser to…
afriedman111
  • 1,925
  • 4
  • 25
  • 42
10
votes
3 answers

MSAL.js protectedResourceMap - explanation needed for what to set it to

I have 2 sites, an angular application and a WebAPI. When I use MSAL.js from the frontend to call the WebAPI, no token is being attached (because of CORS). I know I need to set protectedResourceMap but I can't find a clear explanation of how to set…
Beakie
  • 1,948
  • 3
  • 20
  • 46
9
votes
3 answers

@azure/msal-browser TypeError: this.startPerformanceMeasurement is not a function

Introduction Because there is no build in Auth library for nuxt 3 yet, I am trying to create my own composable called useAuth. The Problem I am getting a startPerformanceMeasurement error when i try to call the loginRedirect or loginPopup…
Eric
  • 361
  • 6
  • 25
9
votes
2 answers

Mocking authentication when testing MSAL React Apps

Our app is wrapped in the MSAL Authentication Template from @azure/msal-react in a standard way - key code segments are summarized below. We would like to test app's individual components using react testing library (or something similar). Of…
9
votes
1 answer

How to specify Resource URI when acquiring access token for Azure AD V2 endpoint?

I have used ADAL.js in a previous project which supported only work accounts and am able to successfully acquire idtokens and then accesstokens to an API (ResourceURI: "https://myresource.com"). Works fine. Now, I am trying to use MSAL.js for…
Sat Thiru
  • 922
  • 2
  • 10
  • 20
9
votes
4 answers

how do we renew idtoken using msal?

I am currently trying to develop an SPA application with a webapi, I am using msal for login. The flow is the user logs in, gets an idtoken (used to authorize for my api), gets an access token (for graph api) using acquiretokensilent method. I renew…
CKS
  • 497
  • 3
  • 9
  • 16
7
votes
1 answer

msal.js - Logout without redirect

Is it possible to log out without redirect? Every time I sign up user I need to verify if the user that is in external DB (db with invitation tokens). I do it just after sign up is completed. When I discover that user shouldn't be a allowed to log…
Akak
  • 95
  • 1
  • 2
  • 8
7
votes
1 answer

msal.js angular 6 SPA callback and errors handling

I m using msal.js on a angular 6 SPA to handle authentication, I have a few problems: First, I couldn t find a clear example on how to handle errors with the lib, so I picked things left and right, and I arrived to the next…
lazizanie
  • 493
  • 3
  • 15
6
votes
2 answers

Microsoft Authentication React "hash_empty_error" when using loginPopup

I am failing to understand the error that I am getting while trying to authenticate a user with the Micrsoft Authentication library for React (PWA). I need help understanding why it fails when attempting to sign in a user using the loginPopup…
0xdeadbeef
  • 101
  • 1
  • 5
6
votes
3 answers

No refreshToken in msal-node when providing scope "offline-access"

I hope you can help me: I currently develop an app which needs access to the users calendar (outlook-calendar) to find free meeting slots (other users will be able to see and then select one of the free slots - similar to calendly). For that I use…
Lasklu
  • 103
  • 1
  • 5
5
votes
1 answer

MSAL: InteractionRequiredAuthError: no_tokens_found: No refresh token found in the cache. Please sign-in

Here's the bit of code that I was working on. I am using MSAL for two SSO apps on same domain for example https://some-domain.com/app1 and https://some-domain.com/app2 and please see the code snippet below. App 1 seems to be fine it allows user to…
Murali N
  • 3,451
  • 4
  • 27
  • 38
1
2 3
33 34