docusignapi - 如何在不使用浏览器的情况下获取访问令牌
问题描述
当我使用自己的 client_id 在浏览器中访问以下 URL 时:
我需要登录,然后我被重定向到: 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(); }
此函数的响应包含大量数据,但没有访问令牌。
解决方案
请查看我们在此处提供的 SDK 示例:https ://github.com/docusign/code-examples-node
在这些示例中,我们提供了有关如何使用 api 使用令牌的示例。
推荐阅读
- c++ - 我的数据结构有问题,双向链表
- font-awesome - #id 和 .subclass 都不能同时工作
- arrays - 通过将每个单元格值拆分为由字符分隔的多个整数来创建一维数组,忽略其他字符
- c# - 如何将我的应用程序中的参数插入外部 url
- python-3.x - 如何在 HDP 2.6 上启用 Python3 支持
- apache-spark - 如何配置 spark 和 log4j 以在 yarn 集群模式下登录本地文件系统
- jquery - mouseenter 和 mouseout 在悬停时同时触发
- c# - 如何将按钮从组框添加到数组
- node.js - 启动用户态代理时出错:绑定 127.0.0.1:3306 失败:端口已分配。在 docker 运行命令上
- xml - 使用 XPath 生成 XML 文件