Created
November 30, 2018 21:01
-
-
Save jgw96/f6da076157695b71d069589bf2789077 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function getUser(token: string) { | |
const headers = new Headers(); | |
const bearer = "Bearer " + token; | |
headers.append("Authorization", bearer); | |
const options = { | |
method: "GET", | |
headers: headers | |
}; | |
const graphEndpoint = "https://graph.microsoft.com/beta/me"; | |
const response = await fetch(graphEndpoint, options); | |
const data = await response.json(); | |
return data; | |
} | |
export async function getProfilePhoto(token: string) { | |
const headers = new Headers(); | |
const bearer = "Bearer " + token; | |
headers.append("Authorization", bearer); | |
const options = { | |
method: "GET", | |
headers: headers | |
}; | |
const graphEndpoint = "https://graph.microsoft.com/beta/me/photos/24x24/$value"; | |
const response = await fetch(graphEndpoint, options); | |
const data = await response.blob(); | |
return data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment