我使用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
所以我猜我的有效负载是不正确的,因为它找不到enrollmentid和secret。那么有效载荷的正确格式是什么?
答案 0 :(得分: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