How to enable authentication in hyperledger Angular application

0 votes

I have deployed hyperledger composer blockchain to multiple organizations by following this tutorial which is successful.

I have generated angular2 app by using command yo hyperledger-composer:angular by selecting options use existing network and generate new rest api.

When I start application it is successful and I can browse assets and participants from hyperledgercomposer using URL http://localhost:4200

Now I want to enable rest authentication for which I have installed passport-github and configured export option by following this tutorial and edited package.json file of angular2 app as below so that authentication is enabled at start

 "app": "composer-rest-server --card admin@some-network -n never -p 3000 -m true"

I have added -m true option so that authentication is enabled by default when I start angular2 app using npm start command.

When I start application I get below error. How to resolve this?

[0] ** NG Live Development Server is running on http://localhost:4200 **
[0]  10% building modules 4/4 modules 0 activeDiscovered types from business network definition
[1] Generating schemas for all types in business network definition ...
[1] Generated schemas for all types in business network definition
[1] Adding schemas for all types to Loopback ...
[1] Added schemas for all types to Loopback
[1] { Error: Cannot find module 'passport-github'
[1]     at Function.Module._resolveFilename (module.js:536:15)
[1]     at Function.Module._load (module.js:466:25)
[1]     at Module.require (module.js:579:17)
[1]     at require (internal/module.js:11:18)
[1]     at PassportConfigurator.configureProvider (/home/user/tmt/TMT-Innovation-AngApp/node_modules/loopback-component-passport/lib/passport-configurator.js:158:22)
[1]     at Promise.then (/home/user/tmt/TMT-Innovation-AngApp/node_modules/composer-rest-server/server/server.js:133:38)
[1]     at <anonymous>
[1]     at process._tickCallback (internal/process/next_tick.js:188:7) code: 'MODULE_NOT_FOUND' }
[1] npm ERR! code ELIFECYCLE
[1] npm ERR! errno 1
[1] npm ERR! TMT-Innovation-AngApp@0.0.1 app: `composer-rest-server --card admin@some-network -n never -p 3000 -m true`
[1] npm ERR! Exit status 1
[1] npm ERR! 
Jun 16, 2018 in Blockchain by ariaholic
• 7,320 points
341 views

1 answer to this question.

0 votes

Try npm install -g passport-github

answered Jun 16, 2018 by charlie_brown
• 7,710 points

Related Questions In Blockchain

0 votes
1 answer

How do I use hyperledger fabric blockchain to build my own application?

To use fabric I would recommend you ...READ MORE

answered May 16, 2018 in Blockchain by Johnathon
• 9,070 points
58 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 27,620 points
54 views
+1 vote
1 answer
0 votes
1 answer

How to store picture(s) in a hyperledger blockchain channel

You can hold images as encrypted characters ...READ MORE

answered Jun 16, 2018 in Blockchain by charlie_brown
• 7,710 points
110 views