I follow the instructions but got 404 at the last step
dragonly opened this issue · comments
Yilong Li commented
Describe the bug
I followed all the instructions in section Using Docker, and got 404 error in hydra server
Reproducing the bug
Steps to reproduce the behavior:
- start the server
$ docker run -it --rm --name login-consent-hydra -p 4444:4444 -p 4445:4445 \
-e OAUTH2_SHARE_ERROR_DEBUG=1 \
-e LOG_LEVEL=debug \
-e OAUTH2_CONSENT_URL=http://localhost:3000/consent \
-e OAUTH2_LOGIN_URL=http://localhost:3000/login \
-e OAUTH2_ISSUER_URL=http://localhost:4444 \
-e DATABASE_URL=memory \
oryd/hydra:v1.0.0-beta.9 serve all --dangerous-force-http
- create client
$ docker run --link login-consent-hydra:hydra oryd/hydra:v1.0.0-beta.9 clients create \
--endpoint http://hydra:4445 \
--id test-client \
--secret test-secret \
--response-types code,id_token \
--grant-types refresh_token,authorization_code \
--scope openid,offline \
--callbacks http://127.0.0.1:4446/callback
- start node server
$ npm i
$ HYDRA_ADMIN_URL=http://localhost:4445 npm start
- start OAuth 2.0 authorization code flow
$ docker run -p 4446:4446 --link login-consent-hydra:hydra oryd/hydra:v1.0.0-beta.9 token user \
--token-url http://hydra:4444/oauth2/token \
--auth-url http://localhost:4444/oauth2/auth \
--scope openid,offline \
--client-id test-client \
--client-secret test-secret
Server logs
- login-consent-hydra
~/work/vendor/ory docker run -it --rm --name login-consent-hydra -p 4444:4444 -p 4445:4445 \
-e OAUTH2_SHARE_ERROR_DEBUG=1 \
-e LOG_LEVEL=debug \
-e OAUTH2_CONSENT_URL=http://localhost:3000/consent \
-e OAUTH2_LOGIN_URL=http://localhost:3000/login \
-e OAUTH2_ISSUER_URL=http://localhost:4444 \
-e DATABASE_URL=memory \
oryd/hydra:v1.0.0-beta.9 serve all --dangerous-force-http
Unable to find image 'oryd/hydra:v1.0.0-beta.9' locally
v1.0.0-beta.9: Pulling from oryd/hydra
7a9e492be799: Pull complete
3f904d834ef1: Pull complete
Digest: sha256:c40da90aaba14fc184d89173c265f843c8dbb46df19c1f5e998cddb0b507504f
Status: Downloaded newer image for oryd/hydra:v1.0.0-beta.9
Thank you for using ORY Hydra v1.0.0-beta.9!
Take security seriously and subscribe to the ORY Security Newsletter. Stay on top of new patches and security insights.
>> Subscribe now: http://eepurl.com/di390P <<
WARN[0000] Expected system secret to be at least 32 characters long, got 0 characters.
INFO[0000] Generating a random system secret...
INFO[0000] Generated system secret: xaJzVovJvZdWzEiLHR79fk5G-26JBSdQ
WARN[0000] WARNING: DO NOT generate system secrets in production. The secret will be leaked to the logs.
INFO[0000] JSON Web Key Set hydra.openid.id-token does not exist yet, generating new key pair...
INFO[0003] Setting up Prometheus middleware
INFO[0003] Transmission of telemetry data is enabled, to learn more go to: https://www.ory.sh/docs/guides/latest/telemetry/
INFO[0003] JSON Web Key Set hydra.https-tls does not exist yet, generating new key pair...
INFO[0003] Detected local environment, skipping telemetry commit
INFO[0003] Detected local environment, skipping telemetry commit
INFO[0010] Setting up http server on :4445
WARN[0010] HTTPS disabled. Never do this in production.
INFO[0010] Setting up http server on :4444
WARN[0010] HTTPS disabled. Never do this in production.
INFO[0025] started handling request method=POST remote="172.17.0.3:56168" request=/clients
INFO[0025] completed handling request measure#http://localhost:4444.latency=95587137 method=POST remote="172.17.0.3:56168" request=/clients status=201 text_status=Created took=95.587137ms
INFO[0098] started handling request method=GET remote="172.17.0.1:39264" request="/oauth2/auth?client_id=test-client&redirect_uri=http%3A%2F%2F127.0.0.1%3A4446%2Fcallback&response_type=code&scope=openid+offline&state=tntagkckkiqpvkhmyltsgegh&nonce=rojiodtcvexgoribgovimgwk&prompt=&max_age=0"
INFO[0098] completed handling request measure#http://localhost:4444.latency=543406 method=GET remote="172.17.0.1:39264" request="/oauth2/auth?client_id=test-client&redirect_uri=http%3A%2F%2F127.0.0.1%3A4446%2Fcallback&response_type=code&scope=openid+offline&state=tntagkckkiqpvkhmyltsgegh&nonce=rojiodtcvexgoribgovimgwk&prompt=&max_age=0" status=302 text_status=Found took="543.406µs"
INFO[0098] started handling request method=GET remote="172.17.0.1:56732" request="/oauth2/auth/requests/login?login_challenge=15ea40a86e7143249cc76ece1bc3b8a1"
INFO[0098] completed handling request measure#http://localhost:4444.latency=161943 method=GET remote="172.17.0.1:56732" request="/oauth2/auth/requests/login?login_challenge=15ea40a86e7143249cc76ece1bc3b8a1" status=404 text_status="Not Found" took="161.943µs"
- create client
~/work/vendor/ory docker run --link login-consent-hydra:hydra oryd/hydra:v1.0.0-beta.9 clients create \
--endpoint http://hydra:4445 \
--id test-client \
--secret test-secret \
--response-types code,id_token \
--grant-types refresh_token,authorization_code \
--scope openid,offline \
--callbacks http://127.0.0.1:4446/callback
You should not provide secrets using command line flags. The secret might leak to bash history and similar systems.
OAuth2 client id: test-client
OAuth2 client secret: test-secret
- node server
~/work/vendor/ory/hydra-login-consent-node git:(master) HYDRA_ADMIN_URL=http://localhost:4445 npm start
> hydra-login-consent-logout@0.0.0 start /home/dragonly/work/vendor/ory/hydra-login-consent-node
> node ./bin/www
GET /login?login_challenge=15ea40a86e7143249cc76ece1bc3b8a1 500 163.650 ms - 641
GET /favicon.ico 404 21.326 ms - 1312
- hydra token user flow
~/work/vendor/ory docker run -p 4446:4446 --link login-consent-hydra:hydra oryd/hydra:v1.0.0-beta.9 token user \
--token-url http://hydra:4444/oauth2/token \
--auth-url http://localhost:4444/oauth2/auth \
--scope openid,offline \
--client-id test-client \
--client-secret test-secret
Setting up home route on http://127.0.0.1:4446/
Setting up callback listener on http://127.0.0.1:4446/callback
Press ctrl + c on Linux / Windows or cmd + c on OSX to end the process.
If your browser does not open automatically, navigate to:
http://127.0.0.1:4446/
Server configuration
Expected behavior
Environment
- Environment: Docker, ...
Additional context
José Angel González Rojas commented
Same here!
Yilong Li commented
it turns out that following https://www.ory.sh/docs/hydra/5min-tutorial will do the trick :D
so I take this as an unsync between official docs and github repo
hackerman commented
Ah yeah that's totally possible. I will probably just link to the 5min tutorial in the readme instead.