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.