node.js - 对 Revolut API 进行身份验证
问题描述
我正在尝试按照 Revolut 的教程对他们的 API 进行身份验证,但我一直在请求可重用的访问令牌。
到目前为止,我已经设法: 1. 创建公钥/私钥 2. 上传公钥 3. 使用生成的 client_id 签署 jwt 4. 获取授权码
但是我无法使用上述方法请求可重用的访问令牌。
根据此页面,我应该https://b2b.revolut.com/api/1.0/auth/token
使用以下正文创建一个 POST 请求:
{
"grant_type": "authorization_code",
"client_id": my_client_id,
"code": my_authorisation_code,
"client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
"client_assertion": my_jwt
}
我在 Insomnia 中做过,但我一直收到这个错误:
{
"error": "invalid_client",
"error_description": "client_id is missing"
}
在寻找答案时我偶然发现了这个答案,但我一直收到这个错误,即使我更改了client_id。
解决方案
原来正文不应该是 JSON,它应该是 url 编码的,如下所示:
grant_type=authorization_code&client_id=client_id&code=code&client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&client_assertion=jwt
推荐阅读
- android - recyclerview 中按钮的 OnComplete 操作仅适用于第一个位置
- python - Python GUI tkinter arduino 串行数据
- python - python中excel中的countifs之类的函数,用于多个数据帧
- c++ - C++ O(1) 按派生类型查找
- python - 从“子进程”导入名称“_args_from_interpreter_flags”时遇到问题
- html - 页脚不显示在页面底部(内容下方)
- javascript - 使用 css 显示图像的一部分,但使用 img-responsive 进行响应
- javascript - Javascript:如何实时显示变量?
- visual-studio-code - 如何使 VSCode for MacOS 中的字体渲染看起来与 VSCode for Windows 完全相同?
- c - 我的程序没有在 c 程序中显示负输入错误