beovolytics

Composer-Playground “Authorization Failure” error using Hyperledger REST API

Composer Issue : Error trying login and get user Context

Composer Error :

{
“error”: {
“statusCode”: 500,
“name”: “Error”,
“message”: “Error trying login and get user Context. Error: Error trying to enroll user. Error: Enrollment failed with errors [[{\”code\”:20,\”message\”:\”Authorization failure\”}]]”,
“stack”: “Error: Error trying login and get user Context. Error: Error trying to enroll user. Error: Enrollment failed with errors [[{\”code\”:20,\”message\”:\”Authorization failure\”}]]\n at HLFConnection.login (/root/.nvm/versions/node/v8.11.4/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:477:30)\n at <anonymous>\n at process._tickCallback (internal/process/next_tick.js:188:7)”
}
}

REST Server Errror : Rest API Multiuser error “Error trying login and get user Context”

Unhandled error for request GET /api/org.xxx.xxxxx: Error: Error trying login and get user Context. Error: Error trying to enroll user. Error: Enrollment failed with errors [[{“code”:20,”message”:”Authorization failure”}]]
at HLFConnection.login (/root/.nvm/versions/node/v8.11.4/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:477:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)

Error occurs when trying to call any API endpoint (except the /wallet/ endpoints) while in multi user mode and authenticated with a valid activate identity.

Solution :

Export Business Archive File from composer playground and install it using composer client this issue will be solved.

composer network install — archiveFile trade-network.bna — card PeerAdmin@hlfv1

composer network start — networkName trade-network — networkVersion 0.2.6-deploy.3 — networkAdmin admin — networkAdminEnrollSecret adminpw — card PeerAdmin@hlfv1 — file networkadmin.card

composer card import — file networkadmin.card

composer network ping — card admin@trade-network

composer-rest-server — card admin@trade-network -p 3050 -a true -m true

After following above steps i am able to access REST API end point.

Beovolytics integrates software assembly lines into large organizations by deploying solutions offered by the Cloud ecosystem.