ory / hydra-consent-app-express

A simple nodejs consent app based on express - for Hydra =< 1.0.0
Apache License 2.0
37 stars 18 forks source link

App does not start in docker #9

Closed kavuri closed 6 years ago

kavuri commented 6 years ago

I am following the instructions(https://www.ory.sh/run-oauth2-server-open-source-api-security/) to start the Oauth2 server along with the hydra-consent-app-express, but the container fails to start. The server does not start when I run this command: docker run -d \ --name ory-consent \ --link ory-hydra:hydra \ -p 9020:3000 \ -e HYDRA_CLIENT_ID=consent-app \ -e HYDRA_CLIENT_SECRET=consent-secret \ -e HYDRA_URL=https://hydra:4444 \ -e NODE_TLS_REJECT_UNAUTHORIZED=0 \ oryd/hydra-consent-app-express:latest

I checked with docker logs ory-consent --details -f, I see the following log output `npm info it worked if it ends with ok npm info using npm@3.8.6 npm info using node@v6.1.0 npm info lifecycle hydra-consent-app-express@0.0.1~prestart: hydra-consent-app-express@0.0.1 npm info lifecycle hydra-consent-app-express@0.0.1~start: hydra-consent-app-express@0.0.1

hydra-consent-app-express@0.0.1 start /usr/src/app node ./bin/www

Unable to refresh token, an error occurred: { Error: Bad Request name: 'Error', status: 400, message: 'Bad Request', context: { error: 'invalid_scope', error_description: 'The requested scope is invalid, unknown, or malformed', statusCode: 400 } }

npm info lifecycle hydra-consent-app-express@0.0.1~start: Failed to exec start script npm ERR! Linux 4.9.87-linuxkit-aufs npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" npm ERR! node v6.1.0 npm ERR! npm v3.8.6 npm ERR! code ELIFECYCLE npm ERR! hydra-consent-app-express@0.0.1 start: node ./bin/www npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the hydra-consent-app-express@0.0.1 start script 'node ./bin/www'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the hydra-consent-app-express package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node ./bin/www npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs hydra-consent-app-express npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls hydra-consent-app-express npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /usr/src/app/npm-debug.log`

Any hints on what could be going wrong?

aeneasr commented 6 years ago

I can't reproduce this, maybe you forgot to copy something or copied only half of the command. Anyways, the problem is that the client can not request the scope that's needed.

kavuri commented 6 years ago

The scope of the hydra policies set is as per the documentation: hydra policies create --skip-tls-verify \ --actions get \ --allow \ --id consent-app-policy \ --resources "rn:hydra:keys:hydra.consent.<.*>" \ --subjects consent-app

And in the code https://github.com/ory/hydra-consent-app-express/blob/520092c0d739391572df184f49e818aea5a24329/routes/index.js#L8 its the same value hydra.consent that is set. I have ensured that I used the same command to start the consent-app, but I still am facing the same problem

aeneasr commented 6 years ago

Oh you're using the guide from the website but apparently updated the versions to the most recent ones? Please don't, the guide on the website is specifically for versions 0.9.x

A guide for > 0.10.0 is here: https://www.ory.sh/docs/guides/1-hydra/3-install/0-readme

We'll update that so it's only on the website and always up to date

kavuri commented 6 years ago

@arekkas thanks. These instructions worked. Small error is the version of consent-app, which currently is 0.11.0, but is mentioned as oryd/hydra-consent-app-express:v0.10.10 in the documentation