Azure AD B2C Graph Api - 获取/设置个人资料图片 [英] Azure AD B2C Graph Api - Get/Set profile picture

查看:20
本文介绍了Azure AD B2C Graph Api - 获取/设置个人资料图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的一个仪表板,出于明显的个性化原因,我想向用户显示他们的个人资料图片,并为他们提供更改它的可能性.

For one of my dashboards I want to show the user their profile picture for obvious personalisation reasons, and offer them the possibility to change it.

Microsoft Docs 站点上的大多数博客文章和文章都命名了我可以用来获取这些数据的各种端点,但我只是无法通过简单的邮递员调用来获得它.由于我什至无法获得照片,我也不知道如何更改(更新)它.

Most blog posts and articles on the Microsoft Docs site name a variety of endpoints I can leverage to get this data, but I'm just unable to get this to work with a simple postman call. Since I can't even get the photo, I wouldn't know how to change (update) it either.

以下端点不起作用:

  • GET https://graph.microsoft.com/beta/users/{id}/photo/$value
  • GET https://graph.microsoft.com/beta/users/{id}/photo
  • GET https://graph.windows.net/myorganization/users/{id}/photo?api-version=1.6
  • GET https://graph.windows.net/myorganization/users/{id}/photo/$value?api-version=1.6

所有这些都导致资源'照片'不存在,或者 json 响应中的'内部服务器错误'.

All of them either result in an "resource 'photo' does not exist, or 'Internal server errors' in the json response.

注意:我可以很好地查询其他资源的图形 api.

Note: I can query the graph api perfectly fine for other resources.

推荐答案

对于遇到 B2C 相同问题的任何人,请尝试使用thumbnailPhoto"端点.这对我有用(特别是 GET 方法).

For anyone running into the same issue with B2C, try using the "thumbnailPhoto" endpoint. This worked for me (the GET method, specifically).

https://graph.windows.net/[租户]/users/[objectid]/thumbnailPhoto?api-version=1.6

这篇关于Azure AD B2C Graph Api - 获取/设置个人资料图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆