【发布时间】:2021-10-05 14:02:52
【问题描述】:
我正在将应用程序代码授予用于 Angular for Angular 应用程序。
问题 1- 刷新令牌在接下来的 2 天内无效,即使签名已延长,我如何才能将访问令牌延长 30 天?
Issue2- 查看该文档
error: SyntaxError: Unexpected token % in JSON at position 0 at JSON.parse message:
“demo.docusign.net/restapi/v2.1/accounts/解析过程中的Http失败...” 名称:“HttpErrorResponse” ok:false 状态:200 statusText:“OK” url:“demo.docusign.net/restapi/v2.1/accounts/CCCC-XXXXX-a54115-ddff-588/envelopes/XXXXXX-ccccc-30c1ce29f66a /documents/1
header = header.append('Access-Control-Allow-Methods', 'GET,POST,OPTIONS,DELETE,PUT');
header = header.append('Access-Control-Allow-Origin', '*');
header = header.append('Access-Control-Allow-Credentials', 'true');
header = header.append('Content-Type', 'application/pdf');
header = header.append('accept', 'application/pdf');
headers = headers.append('Authorization', "Bearer " + token);
步骤 1-https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature extended&client_id=39b5f6fb-97ca-XXXXXXXXXXXXX&state=a39fh23hnf23XXXXX&redirect_uri=http://localhost:4200/callbackdocusign
结果 - 成功
第 2 步 - 使用代码获取访问令牌
//curl--header "Authorization: Basic BASE64_COMBINATION_OF_INTEGRATION_AND_SECRET_KEYS"
//--data "grant_type=authorization_code&code=YOUR_AUTHORIZATION_CODE"
//--request POST https://account-d.docusign.com/oauth/token
let key = btoa(environment.client_id_authentication_code_grant + ":" + environment.secret_key_authentication_code_grant);
let paramInHeader: any = [];
paramInHeader.push({ Name: 'Content-Type', Value: 'application/x-www-form-urlencoded;charset=UTF-8' });
paramInHeader.push({ Name: 'Authorization', Value: "Basic " + key });
paramInHeader.push({ Name: 'Accept', Value: "application/json" });
var details = {
'grant_type': 'authorization_code',
'code': code
};
发帖https://account-d.docusign.com/oauth/token 结果 - 成功
第 3 步 - 获取用户信息
https://account-d.docusign.com/oauth/userinfo
headers = headers.append('Authorization', "Bearer " + token);
headers = headers.append('content-type', 'application/json');
headers = headers.append('Access-Control-Allow-Origin', '*');
结果 - 成功
第 4 步 - 获取刷新令牌
//curl--header "Authorization: Basic MjMwNTQ2.....Y4MmM3YmYyNzZlOQ=="
//--data "grant_type=refresh_token&refresh_token=ey4fd.....3d31d`
//--request POST https://account-d.docusign.com/oauth/token
let key = btoa(environment.client_id_authentication_code_grant + ":" + environment.secret_key_authentication_code_grant);
let paramInHeader: any = [];
paramInHeader.push({ Name: 'Content-Type', Value: 'application/x-www-form-urlencoded;charset=UTF-8' });
paramInHeader.push({ Name: 'Authorization', Value: "Basic " + key });
paramInHeader.push({ Name: 'Accept', Value: "application/json" });
var details = {'grant_type': 'refresh_token','refresh_token': refresh_token};
结果 - 成功
【问题讨论】:
标签: docusignapi