繁体   English   中英

如何在Hyperledger Angular应用程序中启用身份验证

[英]How to enable authentication in hyperledger Angular application

通过成功完成教程,我已将Hyperledger作曲家区块链部署到多个组织。

我已经通过使用命令yo hyperledger-composer:angular通过选择选项使用现有网络并生成新的rest api生成了angular2应用程序。

当我启动应用程序时,它成功了,我可以使用URL http:// localhost:4200从hyperledgercomposer浏览资产和参与者。

现在,我想通过遵循教程并按如下所示编辑angular2应用程序的package.json文件来启用已安装passport-github和配置导出选项的其余身份验证,以便在启动时启用身份验证

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

我添加了-m true选项,以便在使用npm start命令启动angular2应用程序时默认启用身份验证。

当我启动应用程序时,出现以下错误。 如何解决呢?

[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! 

尝试npm install -g passport-github

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM