Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

178
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda