0

我正在使用 RESTful API 与账本通信。我使用 Passport 为 API 添加了一些保护。

现在我想向网络中的特定参与者颁发身份。CLI 命令工作得很好。

composer identity issue -n 'epd' -i admin -s adminpw -u "myid" -a "nl.epd.blockchain.Patient#myid"

但是每当我尝试使用 RESTful API 调用时,它总是说:

未提供注册 ID 或注册密码

我发送的有效载荷如下所示

{
  "participant": "nl.epd.blockchain.Patient#myid",
  "userID": "myid",
  "options": {
    "enrollmentID" : "admin",
    "enrollmentSecret" : "adminpw"
   }
}

要启动 REST 服务器,我使用以下代码:

composer-rest-server -n epd -p defaultProfile -i admin -s adminpw -N never -P 3000 -S true

所以我猜我的有效载荷不正确,因为它找不到注册 ID 和秘密。那么有效载荷的正确格式是什么?

4

1 回答 1

1

您不需要将enrollmentID 和enrollmentSecret 作为有效负载的一部分。那些通过composer-rest-server.

以下是有关为业务网络启用 REST 身份验证的一些说明。https://hyperledger.github.io/composer/integrating/enabling-rest-authentication.html

我认为您缺少的步骤是Adding a Blockchain identity to the default wallet

于 2017-06-05T12:41:38.027 回答