如何从活动目录令牌生成用户访问令牌?

问题描述 投票:0回答:1

我们使用自定义web api和angular作为前端。我们已经有了活动目录访问令牌,我们需要在用户上下文中访问SharePoint列表。如何使用azure活动目录令牌生成用户访问令牌以代表Flow访问SharePoint?

azure-active-directory access-token sharepoint-online
1个回答
0
投票

要使用获取的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

© www.soinside.com 2019 - 2024. All rights reserved.