首页 > 解决方案 > 如何在 DocuSign 中使用刷新令牌

问题描述

我正在使用 docusign 身份验证流程作为

登录
时让 url = "https://account-d.docusign.com/oauth/auth?response_type=token&scope=signature extended&client_id=39b5f6fb-97ca-XXXXXXXXXXXXX&state=a39fh23hnf23XXXXXX&redirect_uri=http://localhost:4200/callbackdocusign";

window.open(url, '_self'); 成功验证后返回 access_token/expires_in/token_type/state。

请指导如何获得refresh_token?refresh_token 后如何获取新的 access_token?

对于 refresh_token 我尝试了 let url = "https://account-d.docusign.com/oauth/auth?response_type=refresh_token&scope=signature extended&client_id=39b5f6fb-97ca-XXXXXXXXXXXXX&state=a39fh23hnf23XXXXXX&redirect_uri=http://localhost:4200/callbackdocusign" ; window.open(url, '_self');

但它没有返回 refresh_token

标签: docusignapirefresh-token

解决方案


您使用的 URL 具有response_type=token. 此响应类型用于隐式授权身份验证,不支持刷新令牌。如果您需要刷新令牌,则必须使用授权代码授予。您的网址看起来像这样

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

当您的用户在身份验证后被重定向时,这将在 URL 中提供一个“代码”参数。您可以使用该代码来获取实际的访问和刷新令牌。

你可以在这里找到完整的解释: https ://developers.docusign.com/platform/auth/authcode/authcode-get-token/


推荐阅读