azure - 如何在没有任何授权令牌的情况下使用 Azure API for FHIR Server
问题描述
我为Azure API for FHIR Server创建了一个资源。我可以使用https://fhir-server-url/metadata之类的 URL 查看元数据信息。如文档https://docs.microsoft.com/en-us/azure/healthcare-apis/access-fhir-postman-tutorial中所述访问其他 URL,如https://fhir-server-url/Patient,我们需要先获取授权令牌。要获取授权令牌,我们需要 ClientID,我们可以通过在 Azure Active Directory 中创建应用程序来获取它。但我无权访问它。
有什么方法可以在不需要授权令牌的情况下访问此 URL?通过在 Azure 门户中进行一些设置。
解决方案
如果您使用第一方受众(例如https://azurehealthcareapis),这是为 FHIR 部署 Azure API 时的默认设置,您实际上可以使用第一方客户端应用程序(例如 Azure CLI)来获取令牌。检查https://docs.microsoft.com/azure/healthcare-apis/get-healthcare-apis-access-token-cli了解详细信息。
首先使用 Azure CLI ( https://docs.microsoft.com/cli/azure/?view=azure-cli-latest ) 登录:
az login
获取令牌并存储它
token=$(az account get-access-token --resource=https://azurehealthcareapis.com | jq -r .accessToken)
使用令牌:
curl -X GET --header "Authorization: Bearer $token" https://<FHIR ACCOUNT NAME>.azurehealthcareapis.com/Patient
推荐阅读
- java - 将页面中的特定内容捕获为图像文件
- python - 为什么 CSV 只用浮动数据写入最后一个数据?
- python - 如何根据熊猫python中的两列值进行分组和计数
- r - 为什么 max_n 没有记录在 base::print 文档中?
- c# - 我正在制作一个简单的登录服务来练习,如何将我的用户列表传递给我的创建用户方法
- command-line - PHP 脚本适用于浏览器,但不适用于 Windows Server 任务计划程序或 CMD/PS
- linux - 为什么我不能执行复制到容器中的二进制文件?
- html - 如何摆脱保证金
- react-big-calendar - 有没有办法通过拖放添加禁用 React Big Calendar 上特定视图的事件大小调整和拖动?
- webstorm - 在 WebStorm 中,有没有办法自动将语言注入到特定函数的参数中?