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

151
Vistas
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 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