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

BeovolyticsAdmin
Apr 16, 2019 · 2 min read

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

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

BeovolyticsAdmin

Written by

beovolytics

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

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade