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

124
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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