API 身份验证可确保只有授权方才能与可用资源进行交互并执行必要的操作。UiPath 为不同场景提供了多种身份验证方法。
请参阅 Automation Suite 指南,详细了解可用的身份验证方法。
通过持有者令牌进行本地用户身份验证(ROPC 身份验证)
We support authentication through ROPC for backwards compatibility for Orchestrator instances that have been migrated from standalone to Automation Suite deployments.Only Host administrators should authenticate using the /api/account/authenticate/ endpoint.Business users should authenticate using External Applications.
资源所有者密码凭据身份验证方法是租户作用域,因此外部应用程序将无法使用此方法进行身份验证,因为无法在租户级别创建外部应用程序。
-
要检索访问令牌,请使用以下负载向
{OrchestratorURL}/api/account/authenticate端点发出 POST 请求:{ "TenancyName": "{account_tenancy_name}", "UsernameOrEmailAddress": "{account_username}", "Password": "{account_password}" }{ "TenancyName": "{account_tenancy_name}", "UsernameOrEmailAddress": "{account_username}", "Password": "{account_password}" }在上述请求中:
{account_tenancy_name}- 是您的 Automation Suite 帐户中的租户唯一标识符{account_username}- 是您的 Automation Suite 帐户的用户名{account_password}- 是用于登录 Automation Suite 帐户的密码
-
要查找 Orchestrator 实例的
TenancyName值,请向/odata/Users/UiPath.Server.Configuration.OData.GetCurrentUser端点发出 GET 请求。响应正文返回持有者令牌,您的应用程序使用该令牌来授权进一步的 API 调用。 因此,在 API 调用的“授权”标头中,附加
Bearer xxxx并将xxxx替换为{access_token}值(例如Authorization: Bearer eyJhbG ... LnVxjA)。{ "result": "{access_token}", "targetUrl": null, "success": true, "error": null, "unAuthorizedRequest": false, "__abp": true }{ "result": "{access_token}", "targetUrl": null, "success": true, "error": null, "unAuthorizedRequest": false, "__abp": true }默认情况下,访问令牌的有效期为 30 分钟。 要生成新端点,请再次调用
api/account/authenticate端点。重要提示:If your organization uses the Azure Active Directory model, you must register external applications in Orchestrator and use the OAuth flow.
访问 Swagger
如果您使用 Swagger 试用我们的 API,只需在单独的选项卡中登录 Orchestrator 实例即可。
The Orchestrator API Swagger definition can be accessed by adding the /swagger/ui/index#/ suffix to your Orchestrator URL. For example, https://{yourDomain} /swagger/ui/index#/.
域用户身份验证
API access with Windows Auto-logon (NTLM authentication) has been removed, as indicated in the deprecation timeline.
我们建议您改用 OAuth 流程,这需要在 Orchestrator 中注册外部应用程序。
If the external application is already registered, refer to Using OAuth for External Apps.