首页 > 解决方案 > 对 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。

标签: node.jsexpressinsomnia

解决方案


原来正文不应该是 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


推荐阅读