向 Revolut 进行身份验证 API

Authenticating to Revolut API

我正在尝试按照 Revolut 的教程对他们的 API 进行身份验证,但我一直在请求可重复使用的访问令牌。

到目前为止,我已经做到了: 1.创建public/private个键 2.上传public密钥 3.用生成的client_id签署一个jwt 4.获取授权码

但我无法使用上述方法请求可重用访问令牌。

根据这个 page,我应该在 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"
}

在 SO 上寻找答案时我偶然发现了这个 ,但我总是遇到这个错误,即使我更改了 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