Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
can't fetch msgraph data using vanilla js

I am trying to pull data from the endpoint https://graph.microsoft.com/v1.0/me/. I have done this using python but I can't seem to fetch data from Microsoft Graph using vanilla js.

When I attempt to perform a fetch request. I get a 200 response but nothing is inside the response object.

Here is the fetch code:

fetch("https://graph.microsoft.com/v1.0/me/", {
  method: "GET",
  "headers": {
    "authorization": "Bearer ENTERTOKENHERE"}
}).then(data =>{console.log(data)});

I get a response of:

Response {type: 'cors', url: 'https://graph.microsoft.com/v1.0/me/', redirected: false, status: 200, ok: true, …}

but I am expecting more of a response like the one I get from the https://developer.microsoft.com/en-us/graph/graph-explorer website like this:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
    "businessPhones": [],
    "displayName": "Edd Bighead",
    "givenName": "Edd",
    "jobTitle": null,
    "mail": "Edd@conglomo.onmicrosoft.com",
    "mobilePhone": null,
    "officeLocation": null,
    "preferredLanguage": "en-US",
    "surname": "Bighead",
    "userPrincipalName": "Edd@conglomo.com",
    "id": "2fa321d9-bda3-41c1-8be8-5d4049ed8765"
}

Is there anything I am missing to get the data from msgraph using vanilla js only?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I figured it out - I needed to jsonize the data then print that data. Can't believe I missed that. lol

fetch("https://graph.microsoft.com/v1.0/me/", {
  method: "GET",
  "headers": {
    "authorization": "Bearer ENTERTOKENHERE"}
}).then(response => response.json())
.then(data => {console.log(data)})
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!