Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
Can MSAL-react handle manually setting an access token, to log us in?

Our app uses Authorization Code Flow with PKCE which is implemented using the MSAL-React package https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-reactand which runs on the Azure B2C Active Directory.

We currently authenticate users by getting them to type in their username and password, which is exchanged for an access_token which is then sent with every request. In this way the back end knows what to send the front end.

We have a new requirement which boils down to us getting an access_token from another method. This is to facilitate some new functionality not originally known to us.

We currently set the token using this code as part of the flow

msalInstance
  .acquireTokenSilent(tokenRequest)
  .then(async (tokenResponse) => {
    setToken(tokenResponse.accessToken)
  })

However we now need to set this token manually (don't worry about how we get this token just presume we have one)

Is there any way for MSAL to manually set a token that we pass to it ?

So something like this would be great (I know this doesn't exist)

comst token = {} // our token object which would be correct 
msalInstance
 .manuallyGetToken(token)
 .then(async (tokenResponse) => {
   setToken(tokenResponse.accessToken)
 })

The 'black box' nature of MSAL is proving to be difficult because it is hiding the internals of OAuth from us which is great until you need to deviate slightly from the way it is supposed to work.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!