Dynamics 365 OAuth 2.0身份验证失败
我已经使用数据库的试验订阅设置了Dynamics 365。部署设置为现场服务高级试验。
要查询来自Dataverse的数据,我必须使用WebAPI,但它无法从邮递员那里进行身份验证。我已经设置了具有以下设置的Azure Active Directory。
和清单是这样设置的:
{
"acceptMappedClaims": null,
"accessTokenAcceptedVersion": null,
"addIns": [],
"allowPublicClient": true,
"appRoles": [],
"oauth2AllowUrlPathMatching": false,
"createdDateTime": "2022-04-22T11:11:03Z",
"description": null,
"certification": null,
"disabledByMicrosoftStatus": null,
"groupMembershipClaims": null,
"identifierUris": [],
"informationalUrls": {
"termsOfService": null,
"support": null,
"privacy": null,
"marketing": null
},
"keyCredentials": [],
"knownClientApplications": [],
"logoUrl": null,
"logoutUrl": null,
"name": "RentReady",
"notes": null,
"oauth2AllowIdTokenImplicitFlow": true,
"oauth2AllowImplicitFlow": true,
"oauth2Permissions": [],
"oauth2RequirePostResponse": false,
"optionalClaims": null,
"orgRestrictions": [],
"parentalControlSettings": {
"countriesBlockedForMinors": [],
"legalAgeGroupRule": "Allow"
},
"passwordCredentials": [],
"preAuthorizedApplications": [],
"publisherDomain": "rentreadytrialtest.onmicrosoft.com",
"replyUrlsWithType": [
{
"url": "https://localhost",
"type": "Web"
}
],
"requiredResourceAccess": [
{
"resourceAppId": "00000007-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "78ce3f0f-a1ce-49c2-8cde-64b5c0896db4",
"type": "Scope"
}
]
},
{
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "e1fe6dd8-ba31-4d61-89e7-88639da4683d",
"type": "Scope"
}
]
}
],
"samlMetadataUrl": null,
"signInUrl": null,
"signInAudience": "AzureADMultipleOrgs",
"tags": [],
"tokenEncryptionKeyId": null
}
出于安全原因,我已从此清单中删除了应用程序ID。共享邮局配置。
我在此处删除了有关安全问题的应用程序ID。在授权将同时用作邮递员和Web浏览器之后,我遇到了相同的错误。
I have set up Dynamics 365 using a Trial subscription with a database. Deployment is set to FieldService Premium Trial.
For querying data from Dataverse I have to use WebAPI but it is failing to authenticate from the postman. I have set up Azure Active directory with the following settings.
And manifest is set up like this:
{
"acceptMappedClaims": null,
"accessTokenAcceptedVersion": null,
"addIns": [],
"allowPublicClient": true,
"appRoles": [],
"oauth2AllowUrlPathMatching": false,
"createdDateTime": "2022-04-22T11:11:03Z",
"description": null,
"certification": null,
"disabledByMicrosoftStatus": null,
"groupMembershipClaims": null,
"identifierUris": [],
"informationalUrls": {
"termsOfService": null,
"support": null,
"privacy": null,
"marketing": null
},
"keyCredentials": [],
"knownClientApplications": [],
"logoUrl": null,
"logoutUrl": null,
"name": "RentReady",
"notes": null,
"oauth2AllowIdTokenImplicitFlow": true,
"oauth2AllowImplicitFlow": true,
"oauth2Permissions": [],
"oauth2RequirePostResponse": false,
"optionalClaims": null,
"orgRestrictions": [],
"parentalControlSettings": {
"countriesBlockedForMinors": [],
"legalAgeGroupRule": "Allow"
},
"passwordCredentials": [],
"preAuthorizedApplications": [],
"publisherDomain": "rentreadytrialtest.onmicrosoft.com",
"replyUrlsWithType": [
{
"url": "https://localhost",
"type": "Web"
}
],
"requiredResourceAccess": [
{
"resourceAppId": "00000007-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "78ce3f0f-a1ce-49c2-8cde-64b5c0896db4",
"type": "Scope"
}
]
},
{
"resourceAppId": "00000003-0000-0000-c000-000000000000",
"resourceAccess": [
{
"id": "e1fe6dd8-ba31-4d61-89e7-88639da4683d",
"type": "Scope"
}
]
}
],
"samlMetadataUrl": null,
"signInUrl": null,
"signInAudience": "AzureADMultipleOrgs",
"tags": [],
"tokenEncryptionKeyId": null
}
I have removed the App Id from this manifest for security reasons. Sharing the postman configuration.
I have removed the App ID here as well for security concerns. After authorizing using both as a postman and on a web browser I am having the same error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您需要从Azure广告中获得带有客户ID,客户端秘密和您的房客ID的访问令牌。发送的最后一个对象是您的范围。范围定义为:
https://yourorgurl.crmx.dynamics.com/.default
返回是一个访问令牌,您可以使用它来访问数据。
另外,不要忘记将客户注册添加为环境中的应用程序用户。
First you need to get an access token from Azure AD with the Client ID, Client secret and your tenant ID. The last object to send is your scope. The scope is defined as:
HTTPS://yourorgurl.crmx.dynamics.com/.default
The return is an access token which you can use to access your data.
Also, don’t forget to add your client registration as app user in your environment.