首页 文章

使用持久性数据存储配置Hyperledger Composer REST服务器

提问于
浏览
0

我正在关注这个教程https://hyperledger.github.io/composer/integrating/deploying-the-rest-server.html

我已经完成了所有步骤 . 但是当我通过github运行rest-server时,它会打印下面的堆栈跟踪 .

Error 404 Cannot GET /auth/github status: 404 Error: Cannot GET /auth/github at raiseUrlNotFoundError (/home/praval/.nvm/versions/node/v6.11.1/lib/node_modules/composer-rest-server/node_modules/loopback/server/middleware/url-not-found.js:21:17)

2 回答

  • 0

    我假设您通过npm install -g passport-github安装了Github策略?

    如果是这样,它创建一个文件夹/ auth / github?

    您需要按照文档转到此文件夹:“通过导航到环境变量COMPOSER_PROVIDERS中指定的authPath属性的值来验证REST服务器 . 在上面的示例中,这是http://localhost:3000/auth/github

    在我的情况下,没有创建该文件夹 . 我在Github网站上看到:https://github.com/cfsghost/passport-github "The author of Passport-Github has not maintained the original module for a long time. Features in his module don't work since Github upgraded their API to version 3.0. We forked it and re-published it to NPM with a new name passport-github2"

    我正在寻找这方面的指导 .

  • 0

    在创建私有api之前,只需在终端中执行此命令 .

    export COMPOSER_PROVIDERS='{ "github": { "provider": "github", "module": "passport-github", "clientID": "<your id>", "clientSecret": "<your secret>", "authPath": "/auth/github", "callbackURL": "/auth/github/callback", "successRedirect": "http://localhost(domain of angular app):4200(port)/home(page to redirect)", "failureRedirect": "http://localhost(domain of angular app):4200(port)/login-github(page to redirect)"" } }'

    检查是否所有都运行良好 - 运行命令

    echo $COMPOSER_PROVIDERS
    

    在此之后,您将看到COMPOSER_PROVIDERS值 .

    在github配置文件应用程序(https://github.com/settings/applications/)之后,您必须配置“ Homepage URL ”(例如http://APIdomain:3000/)和“ Authorization callback URL ”(例如http://APIdomain:3000/auth/github/callback

相关问题