1.start the server
OAUTH2_CONSENT_URL=http://localhost:3000/consent \
OAUTH2_LOGIN_URL=http://localhost:3000/login \
OAUTH2_ISSUER_URL=http://localhost:4444 \
OAUTH2_SHARE_ERROR_DEBUG=1 \
LOG_LEVEL=debug \
DATABASE_URL=memory \
hydra serve all --dangerous-force-http
OAUTH2_CONSENT_URL = http://localhost:3000/同意这将设置同意提供者的URL(必需)。
OAUTH2_LOGIN_URL = http://localhost:3000/login这将设置登录提供程序的URL(必需)。
OAUTH2_ISSUER_URL = https:// localhost:4444/此值必须设置为ORY Hydra的公共URL(必需)。
2.create a new client that we can use to perform the OAuth 2.0 Authorization Code Flow
hydra clients create \
--endpoint http://localhost: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
3.download and cd "hydra-login-consent-node-master"
npm i
HYDRA_ADMIN_URL=http://localhost:4445 npm start
4.
hydra token user
--endpoint http://localhost:4444/
--scope openid,offline
--client-id test-client
--client-secret test-secret