1

I am trying to set profile picture using graph API. Here is the service

  readdetails():Observable<any>{   
    return this.http.get<any>('https://graph.microsoft.com/v1.0/me/photo');
  }

So I am getting the JSON without much issue and here is how it looks

{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users('69sdf57b-f186-4007-b481-438fd5a870d3')/photo/$entity","@odata.mediaContentType":"image/jpeg","@odata.mediaEtag":"\"F52AEF83\"","id":"648X648","height":648,"width":648}

But I have no idea, how to use this information to set as src of my image in component

Sandeep Thomas
  • 4,303
  • 14
  • 61
  • 132

1 Answers1

1

If you look at the response, you need a base64 encoded representation of the image. You need to tell Angular to expect a Blob using the responseType parameter.

Check this answer for more details

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396