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

152
Visualizações
Method returns undefined when called

I am trying to call a method from a service, within a react component, and call another method from the service within the component.

This is the method in the service:

  async GetAuthToken(){
    microsoftTeams.authentication.getAuthToken({
            
      successCallback: (result) => {
        return {
          client_id: "",
          client_secret: "",
          scope: "channel.readbasic.all files.read.all files.readwrite.all group.read.all group.readwrite.all user.read email offline_access openid profile",
          grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
          requested_token_use: "on_behalf_of",
          assertion: result,
        }
      },
      failureCallback(error) {
        console.log(error)
      },
    });
  }

And this is where I call it:

      httpClient.GetAuthToken().then((res)=>{
        httpClient.GetUser(res).then((res2)=> console.log(res2))
      });

When I console.log res, I get undefined, but when I log the result within the service, the value is there.

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