【问题标题】:How do I get the access token without using the browser如何在不使用浏览器的情况下获取访问令牌
【发布时间】:2020-12-15 15:23:01
【问题描述】:

当我在浏览器中使用自己的 client_id 访问以下 URL 时:

https://account-d.docusign.com/oauth/auth?response_type=token&scope=signature&client_id=6d1a8594-xxxx-xxxx-xxxx-878e593de049&state=a39fh23hnf23&redirect_uri=http://localhost:8888/auth

我需要登录,然后我被重定向到: http://localhost:8888/auth#access_token=myAccessToken&expires_in=28800&token_type=bearer&state=a39fh23hnf23

现在我有一个 node.js 应用程序,我想在其中使用我的访问令牌进行 API 调用,直到现在我每次都手动执行上述操作来获取我的访问令牌,当然,这不是最佳的。因此,我的问题是:如何在不使用浏览器的情况下获取访问令牌?

现在我有以下内容

sendRequestAccessToken(): Promise<any> {
const scope = 'signature';
const clientId = '*my client id*';
const state = 'a39fh23hnf23';
const url = `https://account-d.docusign.com/oauth/auth?
  response_type=token
  &scope=${scope}
  &client_id=${clientId}
  &state=${state}
  &redirect_uri=http://localhost:8888/auth
`;
return this.httpService.get(url).toPromise(); }

此函数的响应包含大量数据,但没有访问令牌。

【问题讨论】:

  • 授权代码授权工作流每次都需要用户/浏览器交互。如果您希望能够以编程方式生成令牌,则应查看 JWT / Impersonation auth,它只需要用户交互一次即可获得同意。

标签: docusignapi


【解决方案1】:

请查看我们在此处提供的 SDK 示例:https://github.com/docusign/code-examples-node

在这些示例中,我们提供了有关如何使用 api 使用令牌的示例。

【讨论】:

    猜你喜欢
    • 2012-04-30
    • 1970-01-01
    • 2016-10-15
    • 2014-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-01
    相关资源
    最近更新 更多