Accessing Graph Api from Team Toolkit personal tab

Kevin Thankachan 41 Reputation points
2021-03-15T23:26:23.427+00:00

I'm trying to access the graph API from a personal tab setup using Microsoft teams tool kit.
I have created an Azure app and given the appropriate permissions.
I'm trying to read the current users details. All i get is the generic error- No response from the server.
Please let me know what additional steps i need to do to fix this.

import { graph } from '@pnp/graph/presets/all'  ;  
import { AdalFetchClient } from "@pnp/nodejs";  
graph.setup({  
  graph: {  
      fetchClientFactory: () => {  
          return new AdalFetchClient("***********-f3bf-4315-******", "d36b0cfb-368c-4573-b488-940b4de29514", "Password");  
      },  
  },  
});  
private async getUserDetails()  
  {  
      await graph.me().then(u=>{  
          this.setState({  
            UserEmail:u['mail']!,  
            UserName:u['displayName']!    
          })  
          console.log(JSON.stringify(u));  
      }).catch((err) => {    
          console.log("Graph API Error "+err);  
        });  
         
  }  
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,323 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,035 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Kevin Thankachan 41 Reputation points
    2021-03-23T06:01:32.307+00:00

    Apologies for the late reply..From the console log, all i could get is "No response from the server."