-->

澄清围绕用户管理的REST API的帐户(Clarification on REST APIs ar

2019-10-18 18:31发布

我最近建立了一个开发者的DocuSign帐户和集成的密钥,用的DocuSign的REST API玩,有一些问题

  1. 我可以用下面的REST调用我的帐户下获取一个用户的完整列表。 https://demo.docusign.net/restapi/v2/accounts/<accountid>/users?additional_info=true

    但是,如果我尝试和检索特定用户(一个比我路过我的X-的DocuSign认证等)头,我收到HTTP 400错误有消息认为,“在请求中指定无效的用户ID。用户ID URI不符合认证的用户”

    https://demo.docusign.net/restapi/v2/accounts/<accountid>/users/0d51a699-b17a-48b7-95b6-1e9e9806deb6

    在这两种情况下我发送下面的头。

    X-DocuSign-Authentication: <DocuSignCredentials><Username>{0}</Username><Password>{1}</Password><IntegratorKey>{2}</IntegratorKey></DocuSignCredentials>

    我很惊讶,虽然我可以读取所有用户都很好,我不能只是看一个特定的用户。 当然,它似乎并不像这是安全的事情,因为我可以通过一个API读取用户,但使用相同的身份验证令牌不是其他。

    我在想什么?

    我想我可以去SOBO(代表发送的功能)的途径,但我想,以确认上述行为的预期。

更新#1

:我去了SOBO 办法 ,现在我得到一个不同的错误(USER_NOT_ACCOUNT_ADMIN),如下图所示

GET /restapi/v2/accounts/{accountid}/users/0fe29a55-5564-42a9-b09d-cbe699db13dd HTTP/1.1
Authorization: bearer {token for authenticating user}
X-DocuSign-Act-As-User: {operating user's email}
Accept: application/json
Host: demo.docusign.net
Connection: Keep-Alive

HTTP/1.1 401 Unauthorized
Cache-Control: no-cache
Content-Length: 100
Content-Type: application/json; charset=utf-8
Date: Thu, 17 Oct 2013 21:18:32 GMT
Strict-Transport-Security: max-age=7776000; includeSubDomains

{
  "errorCode": "USER_NOT_ACCOUNT_ADMIN",
  "message": "User is not an account administrator."
}

我也试着得到一个的OAuth令牌操作用户的第二SOBO方法,但回来HTTP 400错误下面的消息

{
  "error": "invalid_request",
  "error_description": "An OAuth2 error occurred."
}

因此,虽然我可以得到的autheitcating用户OAuth凭证,我不能够获得代表其操作用户或行为的OAuth令牌。

我已确保认证用户“帐户管理员”和既有“apiAccountWideAccess”和“•allowSendOnBehalfOf”设置为true。 设置为“假”的唯一的事情就是“canSendAPIRequests”。 在沙箱环境中我的帐户ID是 “601565a7-e9c7-463b-9d7c-622aed905ea8” 任何想法?

更新#2

相反,代表这两个认证用户和操作用户生成的OAuth令牌,我试图通过页眉下方,我终于可以得到其他用户的个人资料,并更新其他用户的个人资料。

X-DocuSign-Authentication: <DocuSignCredentials><SendOnBehalfOf>{operating userid}</SendOnBehalfOf><Username>{authenticating userid}</Username><Password>{authenticating user's password}</Password><IntegratorKey>{developer's integrator key}</IntegratorKey></DocuSignCredentials>

大! 因此,这里是一个什么样的工作状态,什么不可行。

没有SOBO头在任何地方工作

GET /restapi/v2/accounts/357938/users?additional_info=true // Read all users  
GET /restapi/v2/accounts/357938/users?email=someshchandraatwork@gmail.com&additional_info=true // Read single user by email
POST /restapi/v2/accounts/357938/users // Add users
DELETE /restapi/v2/accounts/357938/users // Close users    

* 与SOBO工程在X-的DocuSign-认证头

PUT /restapi/v2/accounts/357938/users/74a021e1-3090-4843-b9ab-cceb7cd119f4/profile // Update user's profile
GET /restapi/v2/accounts/357938/users/74a021e1-3090-4843-b9ab-cceb7cd119f4/profile // Read user's profile

仍然不使用或不SOBO工作**

GET /restapi/v2/accounts/357938/users/74a021e1-3090-4843-b9ab-cceb7cd119f4/settings 
GET /restapi/v2/accounts/357938/users/74a021e1-3090-4843-b9ab-cceb7cd119f4

在这两种不工作的情况下我得到以下错误

  • 如果没有SOBO我得到错误的用户ID不匹配autheitcating用户。
  • 随着SOBO我得到错误不是用户不是一个管理员帐户

我非常感激在解决没有工作的情况下任何帮助。 如需要,我可以提供更多的detaisl。

  1. 第二,我想实现这样一个场景,我可以在账户停用用户,使他们无法再登录到的DocuSign。 随后,我想与他们他们是残疾人收到了相同的权限再次启用该用户。

    我看到,用户有一个“userStatus”领域,并想知道如果我可以用它来重新激活用户,然后根据需要重新激活。 如果这是支持那么什么值对应停用用户?

    我注意到的另一件事是,在删除一个用户,用户只有软删除,因为我仍然可以查询与状态“封闭”的用户。 这将解决我的“停用”的问题。 但是我不知道是否有一种方法可以再次在用户已经被“关闭”激活呢?

Answer 1:

我相信这可能是一个帐户管理问题。 我不知道为什么,但我打量起的DocuSign的一侧的帐户设置,我看到没有被检查你的帐户 - “上的代表发送”这是奇怪的,因为它似乎你有你的控制台访问设置 - >首选项设置。

但是,在这两种情况下,如果我只是在自己的帐户启用该设置已经解决您的问题,因为它可能有我不知道。

我也不能确定你的问题的用户信息部分,让我看看,如果我能想出什么该有一次我做我将修改我的答案。



Answer 2:

在回答上述Erign的职位。

任何人谁是帐户管理员应该能够修改/添加/删除用户帐户。 我不知道,如果你的SOBO步骤是正确的,虽然,你能确认你是否完全按照以下步骤? 如果是这样,在这一步你遇到问题或得到一个错误- Ergin5分钟前

是的,我下面这些步骤。 我能够做同样的操作用户时生成的autheitcating用户的OAuth令牌,但得到一个错误。 下面是我的请求和响应。

1.请求身份验证令牌用于验证用户

POST /restapi/v2/oauth2/token HTTP/1.1
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Host: demo.docusign.net
Content-Length: 139
Expect: 100-continue
Connection: Keep-Alive

grant_type=password&client_id={integratorykey}&username={authenticating user's email}&password={authenticating user's password}&scope=api

响应

HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 100
Content-Type: application/json; charset=utf-8
Date: Thu, 17 Oct 2013 22:57:26 GMT
Strict-Transport-Security: max-age=7776000; includeSubDomains

{
  "access_token": "{authenticating user's token}",
  "token_type": "bearer",
  "scope": "api"
}

2.请在认证令牌操作用户

POST /restapi/v2/oauth2/token HTTP/1.1
Authorization: bearer {authenticating user's token}
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Host: demo.docusign.net
Content-Length: 137
Expect: 100-continue

grant_type=password&client_id={integratorykey}&username={operating user's id}&password={empty}&scope=api

响应

HTTP/1.1 400 Bad Request
Cache-Control: no-cache
Content-Length: 87
Content-Type: application/json; charset=utf-8
Date: Thu, 17 Oct 2013 22:57:29 GMT
Strict-Transport-Security: max-age=7776000; includeSubDomains

{
  "error": "invalid_request",
  "error_description": "An OAuth2 error occurred."
}


文章来源: Clarification on REST APIs around user management in an account
标签: docusignapi