Dynamics 365 OAuth 2.0身份验证失败

发布于 2025-01-23 05:53:59 字数 2752 浏览 4 评论 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.

enter image description here

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.

enter image description here

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.

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

网名女生简单气质 2025-01-30 05:53:59

首先,您需要从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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文