[英]Trying to authenticate to MS Dynamics CRM 2016 WebApi using R
I could use some help..我可以使用一些帮助..
I am trying to connect to a MS Dynamics CRM (2016) on-premise database.我正在尝试连接到 MS Dynamics CRM (2016) 本地数据库。 it is facing the internet (IFD) and uses adfs 3.0 to authenticate users.它面向互联网 (IFD) 并使用 adfs 3.0 对用户进行身份验证。
Now, when I try to connect to the api using the webbrouwser, a smal log-in form appears that lets me enter my username and password.现在,当我尝试使用网络浏览器连接到 api 时,会出现一个小登录表单,让我输入用户名和密码。 When I submit these credentials, the browser opens a page with nice json code, however, when I try the following code in R当我提交这些凭据时,浏览器会打开一个带有漂亮 json 代码的页面,但是,当我在 R 中尝试以下代码时
library(httr)
result <- GET(
"https://xrm.company.nl/Company/api/data/v8.2/some=query",
config = authenticate(
user = "MyUsername",
password = "MyPassword",
type = "ntlm"
)
)
I get text/html content that builds a POST form.我得到了构建 POST 表单的 text/html 内容。 This form is already filled out for me, but it relies on some js script to auto submit.这个表格已经为我填写好了,但是它依赖于一些 js 脚本来自动提交。 There's also is a warning message available in the html that says that script is disabled combined with a handy (but unreachable) submit button. html 中还有一条警告消息,说明脚本已禁用,并带有一个方便(但无法访问)的提交按钮。
When I extract the html from the content content(result, as = "text")
, put it in an html file and open it in my browser, the json results sow up.当我从内容content(result, as = "text")
中提取 html 时,将其放入 html 文件并在我的浏览器中打开它,json 结果如下。
But I don't know how to enable script, or how to click submit using R.但我不知道如何启用脚本,或者如何使用 R 单击提交。
Anybody any ideas for a workaround for these issues, or on how to authenticate correctly to adfs using R?任何人对这些问题的解决方法有任何想法,或者关于如何使用 R 正确地向 adfs 进行身份验证?
You will to request a SAML bearer access token.您将请求 SAML 不记名访问令牌。 See this post on the Magnatism blog: Dynamics 365 Online ADFS Authenticate with User Credentials请参阅 Magnatism 博客上的这篇文章: Dynamics 365 Online ADFS 使用用户凭据进行身份验证
In a nut shell you need to do the following...在螺母 shell 中,您需要执行以下操作...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.