是否可以使用通过 Azure Active Directory 1.0 端点获取的访问令牌以及客户端凭据 OAuth 2 流来访问 Microsoft Graph API?
例如:
POST https://login.microsoftonline.com/{mytenant}.onmicrosoft.com/oauth2/token
grant_type=client_credentials,
client_id={app id registered in azure portal},
client_secret={registered app key},
resource=https://graph.microsoft.com
Run Code Online (Sandbox Code Playgroud)
当我使用从此请求返回的令牌时,尝试调用https://graph.microsoft.com/v1.0/groups 时出现以下错误。
解码的 JWT
标题
{
"typ": "JWT",
"alg": "RS256",
"x5t": "HHByKU-0DqAqMZh6ZFPd2VWaOtg",
"kid": "HHByKU-0DqAqMZh6ZFPd2VWaOtg"
}
Run Code Online (Sandbox Code Playgroud)
有效载荷
{
"aud": "00000002-0000-0000-c000-000000000000",
"iss": "https://sts.windows.net/{tenant id}/",
"iat": 1504804880,
"nbf": 1504804880,
"exp": 1504808780,
"aio": "Y2FgYDiiO8/s3smXRdxLg87zBPRNAwA=",
"appid": "{client id}",
"appidacr": "1",
"idp": "https://sts.windows.net/{tenant id}/",
"oid": "{enterprise app object id}",
"sub": "{enterprise app object id}",
"tenant_region_scope": "NA",
"tid": "{tenant …Run Code Online (Sandbox Code Playgroud)