javascript - 使用 Duo Security Admin API 创建用户
问题描述
我正在关注 Duo Security Admin Api 的此文档:https ://duo.com/docs/adminapi
我正在尝试在我的 ColdFusion webapp 中使用他们的 API 创建/删除用户,但文档仅表明需要使用 post 命令。没有给出示例,我不确定从哪里开始。我假设他们的意思是在提交表单时发布喜欢?但我不确定。
我正在尝试使用以下代码创建用户并删除用户。两者都不起作用,因为我没有看到在我的管理控制台中创建或删除用户。浏览器控制台也没有显示任何信息。
创建用户:
<!--- Create the user in the DuoSecurity Admin API --->
<cfhttp method="post" url="https://api-2fa0b2f8.duosecurity.com/admin/v1/users?username=#get_user.userid#&realname=#get_user.displayName#&email=#get_user.email#" />
删除用户
<!--- Deleted the user in the DuoSecurity Admin API --->
<cfhttp method="delete" url="https://api-2fa0b2f8.duosecurity.com/admin/v1/users/#get_user.userid#" />
如果我将我的 cfhttp 网址粘贴到浏览器中,我会看到以下结果:
{"code": 40401, "message": "Resource not found", "stat": "FAIL"}
我是否还需要以某种方式发送我的应用程序密钥和秘密?
谁能指出我正确的方向?谢谢你。
解决方案
应用程序密钥和秘密 可能需要通过<cfhttpparam>
你正在寻找类似的东西
<cfhttp method="delete" url="https://api-2fa0b2f8.duosecurity.com/admin/v1/users/#get_user.userid#" />
<cfhttpparam type = "header" name = "appkey" value = "#appkey#">
<cfhttpparam type = "header" name = "secret" value = "#secret#">
</cfhttp>
或<cfscript>
等价物。
推荐阅读
- c# - 如何以及在何处实施 IVsMultiViewDocumentView
- matlab - 二进制向量乘法
- java - 在 java 中从 MS Excel 中读取数据
- r - 数据框值获取整数值而不是文本
- javascript - 如何使用axios作为流下载大尺寸文件并在reactjs中下载为zip
- windows-installer - 如何使用高级安装程序在桌面应用程序中添加认证发布者
- angular - 试图验证角度 6 中没有字段为空
- android - 使用 Intent 的文件选择器在 Android 中选择文件时如何限制文件的大小?
- string - 如何将字符串与输入 mips 进行比较
- php - 如何将两个数字相除并得到整数的结果 MONGODB