最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

docusignapi - DocuSign Admin API - user export API throws unauthorize error - Stack Overflow

programmeradmin2浏览0评论

I'm trying to export all users list using DocuSign admin API, however I have provide the required consent but still getting "Unauthorized error"

Below is the code (Azure Function C#) that i am using:

string url = $";;
   _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);

   var requestBody = new StringContent("{\"type\": \"anization_user_list_export\"}", Encoding.UTF8, "application/json");
   var response = await _httpClient.PostAsync(url, requestBody);

   if (response.IsSuccessStatusCode)

Error: {StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:{ Cache-Control: no-cache Pragma: no-cache X-DocuSign-TraceToken: XXXXXXXXXXXXXXXX602 X-DocuSign-Node: SE101FE98 Date: Sat, 15 Feb 2025 20:15:28 GMT Strict-Transport-Security: max-age=31536000; includeSubDomains Content-Type: application/json; charset=utf-8 Expires: -1 Content-Length: 87}}

CONSENT URL USED //oauth/auth?response_type=code&scope=user_read user_write anization_read anization_write account_read group_read permission_read identity_provider_read domain_read&client_id=CLIENT_ID&redirect_uri=http://localhost

I'm trying to export all users list using DocuSign admin API, however I have provide the required consent but still getting "Unauthorized error"

Below is the code (Azure Function C#) that i am using:

string url = $"https://api.docusign/Management/v2/anizations/ORGID/exports/user_list";
   _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);

   var requestBody = new StringContent("{\"type\": \"anization_user_list_export\"}", Encoding.UTF8, "application/json");
   var response = await _httpClient.PostAsync(url, requestBody);

   if (response.IsSuccessStatusCode)

Error: {StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:{ Cache-Control: no-cache Pragma: no-cache X-DocuSign-TraceToken: XXXXXXXXXXXXXXXX602 X-DocuSign-Node: SE101FE98 Date: Sat, 15 Feb 2025 20:15:28 GMT Strict-Transport-Security: max-age=31536000; includeSubDomains Content-Type: application/json; charset=utf-8 Expires: -1 Content-Length: 87}}

CONSENT URL USED https://account-d.docusign//oauth/auth?response_type=code&scope=user_read user_write anization_read anization_write account_read group_read permission_read identity_provider_read domain_read&client_id=CLIENT_ID&redirect_uri=http://localhost

Share Improve this question edited Feb 15 at 20:36 Neon delphifer asked Feb 15 at 20:27 Neon delphiferNeon delphifer 133 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

The consent URL is from the developer environment. The API URL is from production.

If you want to use developer environment, you have to change the API URL basePath to

https://api-d.docusign/Management/v2

If you want to use production (assuming your app is live in prod) then the consent URL should be changed to:

https://account.docusign//oauth/auth?response_type=code&scope=user_read user_write anization_read anization_write account_read group_read permission_read identity_provider_read domain_read&client_id=CLIENT_ID&redirect_uri=http://localhost

发布评论

评论列表(0)

  1. 暂无评论