Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

181
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda