[英]Dynamics CRM 401 with token provided
I'm working on a dynamics crm integration for a Single-Tenant Server-to-server authentication.我正在研究用于单租户服务器到服务器身份验证的动态 crm 集成。 This is required to obtain tokens invisibly as the data will be used to create customer facing ui.
这是在无形中获取令牌所必需的,因为数据将用于创建面向客户的 ui。
Therefore I'm getting a token back from Azure using the client_credentials grant type.因此,我使用 client_credentials 授权类型从 Azure 取回令牌。 However when I attempt to use this token to access any dynamics endpoint (such as those documented here: https://msdn.microsoft.com/en-us/library/mt607871.aspx ) All I get back is a 401 - access denied.
但是,当我尝试使用此令牌访问任何动态端点(例如此处记录的那些: https : //msdn.microsoft.com/en-us/library/mt607871.aspx )时,我得到的只是 401 - 访问被拒绝.
I've done the following:我做了以下工作:
Create an Azure application创建 Azure 应用程序
Created and stored a key创建并存储密钥
Enabled permissions for Dynamics CRM online为 Dynamics CRM online 启用权限
I've seen some suggestion that I need a service user in the CRM itself to provide access, however when I try and create one the options described do not appear.我已经看到一些建议,我需要 CRM 本身中的服务用户来提供访问权限,但是当我尝试创建一个时,所描述的选项没有出现。 (such as here: https://msdn.microsoft.com/en-us/library/mt790170.aspx#bkmk_ManuallyCreateUser )
(例如这里: https : //msdn.microsoft.com/en-us/library/mt790170.aspx#bkmk_ManuallyCreateUser )
Can you suggest any steps I might be missing here?你能建议我在这里可能遗漏的任何步骤吗?
Heres a sample call using the token这是使用令牌的示例调用
{ method: 'GET',
url: 'https://<snip>/api/data/v8.2/accounts?$select=name&$top=3',
headers:
{ Authorization: 'Bearer <snip>',
Accept: 'application/json',
'OData-MaxVersion': '4.0',
'OData-Version': '4.0' }
}
EDIT: Please note that I am using node.js here and C# / .net based answers are probably not going to be massively helpful编辑:请注意,我在这里使用 node.js 并且基于 C#/.net 的答案可能不会有很大帮助
Here is a post on how to configure server to server auth .这是一篇关于如何配置服务器到服务器 auth的帖子。 Assuming you ran through all the steps except creating the application user, you can do so by:
假设您完成了除创建应用程序用户之外的所有步骤,您可以通过以下方式实现:
You should now be able to create your application user.您现在应该能够创建您的应用程序用户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.