【问题标题】:Getting Error while Updating UserProfile using Docusign admin api [docusignapi]使用 Docusign admin api [docusignapi] 更新 UserProfile 时出错
【发布时间】:2020-04-23 09:43:22
【问题描述】:

我想使用 DocuSign Admin Api 更新用户个人资料(Federated_status)。

以下是 URL 中指定的范围,用于使用 Auth Code Grant 生成登录 UI (签名组织_读取组_读取用户_读取用户_写入)。

但是当我使用下面的代码调用 Docusing 管理 api 时,它不允许任何更新并抛出错误“未经授权”

try
            {
                HttpContent PostContent = new StringContent(JsonConvert.SerializeObject(ObjUser), Encoding.UTF8, "application/json");
                string reponsebody = string.Empty;
                string Url = "https://api-d.docusign.net/management/v2/organisation/" + OrgID + "users/profiles";
                using (var client = new HttpClient())
                {

                    client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application / json"));
                    client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token));
                    HttpResponseMessage rep = client.PostAsync(new System.Uri(Url), PostContent).Result;
                    reponsebody = rep.Content.ReadAsStringAsync().Result;
                }
                var userProfileResponse = JsonConvert.DeserializeObject<UserProfile>(reponsebody);
                return userProfileResponse;
            }

更进一步

  1. 我已包含所有角色(请参阅下面的 URL 用于授权代码授予)

https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature%20organization_read%20group_read%20user_read%20user_write&client_id=4c1exxxxxxx&redirect_uri=http://localhost50455

  1. 当我在浏览器中粘贴上面的 url 时,我得到了仅获得以下角色的同意: 一种。阅读组织的域详细信息。 湾。阅读组织的身份提供者详细信息。 C。读取账户权限集列表。 d。阅读帐户详细信息。

    • 我在那里看不到任何与用户相关的权限。我不知道为什么,但您可以看到我已将所有与用户相关的范围 (user_read user_write) 添加到该 URL。

任何建议

我仍然收到错误:400 - 更新用户个人资料时“未经授权”。

【问题讨论】:

  • 您是如何获得访问令牌的?您可能需要确保您拥有所需的范围和/或管理员同意。
  • 以下是我为生成访问令牌而执行的步骤。 1.在管理面板-> APIs and key部分获取集成密钥、密钥并设置重定向网址。 2. 然后我从 DocuSign 门户获取授权码授予 url,我已经设置了所需的范围、集成密钥和密钥,使用 base 64 格式和重定向 url,我已经在浏览器中点击了 url 3. 同意读取/用户写入。 4. 其中返回code和j调用了OAuth api,通过传递code的参数,集成Key和秘钥OAuth返回token响应。
  • 好的,您用于授权代码授权的网址(带有account-d.docusign.com 的网址)包含一些范围信息。它只有 &scope=signature 吗?我认为这可能是问题
  • developers.docusign.com/orgadmin-api/guides/auth 查看范围列表,看看你是否使用了正确的
  • 我有相同的范围列表,我使用了 user_write user_read organization_read。

标签: c# docusignapi


【解决方案1】:

我怀疑您的问题与您在用于 Auth Code Grant 的 URL 中指定的正确范围有关。 (即 account-d URL)

Check list of scopes

确保 URL 中的 &scope 参数具有此 endpint 所需的正确范围。

【讨论】:

  • 此外,管理员权限同意还显示用户写入、更新以接受,然后为我返回令牌。用于调用更新配置文件。
  • 只是为了排除它-您可以在我发送的列表中添加所有范围。如果您仍然收到错误 - 这不是范围问题。
  • 包括所有角色 account-d.docusign.com/oauth/… 以在浏览器中测试上述 url - 它显示仅获得以下角色的同意。阅读组织的域详细信息。阅读组织的身份提供者详细信息。阅读帐户的权限集列表。阅读帐户详细信息。我在那里看不到任何与用户相关的权限。我不知道为什么,我已经添加了与用户相关的所有范围(user_read user_write)。
  • 为了更好地理解我已经更新了问题。
  • 您是否创建了组织?与域等?我认为这个特殊的活动需要一个。
猜你喜欢
  • 1970-01-01
  • 2020-08-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多