# https://www.ory.sh/docs/hydra/cli/hydra-clients-create
hydra create client \
--endpoint
http://127.0.0.1:4445 \
--grant-type authorization_code,refresh_token \
--response-type code,id_token \
--format json \
--name ory-hydra \
--scope openid --scope offline \
--client-uri
https://test.example.com \
--redirect-uri
https://test.example.com/callback \
--request-uri
https://test.example.com
# https://www.ory.sh/docs/hydra/cli/hydra-perform-authorization-code
hydra perform authorization-code \
--client-id 37733e88-5356-4209-8d64-28caab99274b \
--client-secret WKva5ZKis1GO15GHscIRZLt958 \
--endpoint
https://oauth.example.com/ \
--port 5555 \
--scope openid --scope offline
# nginx (oauth.eample.com)
server {
listen 443 ssl http2;
listen [:
]443 ssl http2;
server_name
oauth.example.com;
ssl_certificate /etc/letsencrypt/live/oauth.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/oauth.example.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
add_header Strict-Transport-Security max-age=2592000;
location / {
proxy_pass
http://127.0.0.1:4444;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
}
}
# nginx (test.example.com)
server {
listen 443 ssl http2;
listen [:
]443 ssl http2;
server_name
test.example.com;
ssl_certificate /etc/letsencrypt/live/test.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/test.example.com/privkey.pem;
add_header Strict-Transport-Security max-age=2592000;
location / {
proxy_pass
http://localhost:5555/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
}
}