我正在使用angular应用程序的应用程序代码Grant。
Issue1-刷新令牌在接下来的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状态:200url:"OK”statusText:"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};结果-成功
发布于 2021-10-05 19:13:12
问题1-刷新令牌在接下来的2天内无效,即使签名已延长,如何将访问令牌延长30天?
基于浏览器的应用程序不支持授权码授予,因为应用程序无法保护客户端ID机密。此限制来自OAuth RFC。
在基于浏览器的应用程序中,仅支持隐式授权(8小时访问令牌)。如果您有应用程序的后端,并且应用程序用户登录到后端,则后端可以实现Authorize Code grant并使用刷新令牌进行续订。
问题2-查看文档
EnvelopeDocuments.get返回实际的PDF文档,它是一个二进制文件。因此它不是JSON,您不应该尝试将其解析为JSON。只需向用户显示或让他们下载即可。
https://stackoverflow.com/questions/69451905
复制相似问题