我们使用自定义web api和angular作为前端。我们已经有了活动目录访问令牌,我们需要在用户上下文中访问SharePoint列表。如何使用azure活动目录令牌生成用户访问令牌以代表Flow访问SharePoint?
要使用获取的access_token从另一个API请求新的access_token,您可以使用on_behalf_of流。
对于V2 enpoint,请求URL:
https://login.microsoftonline.com/ /的oauth2 / V2.0 /令牌
POST /oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
&client_id=<application-id>
&client_secret=<key value>
&assertion=<acquired access_token>
&requested_token_use=on_behalf_of
&scope=https://graph.microsoft.com/User.Read email(here the example API is [ms graph API][1], and the permissions are User.Read and email)
有关详细信息,您可以参考此dos。