OpenID Connect certified OAuth2 Server - cloud native, security-first, open source API security for your infrastructure. Written in Go. SDKs for any language.
# The system secret can only be set against a fresh database. Key rotation is currently not supported. This# secret is used to encrypt the database and needs to be set to the same value every time the process (re-)starts.# You can use /dev/urandom to generate a secret. But make sure that the secret must be the same anytime you define it.# You could, for example, store the value somewhere.$ exportSYSTEM_SECRET=$(exportLC_CTYPE=C; cat /dev/urandom | tr -dc 'a-zA-Z0-9'| fold -w 32| head -n 1)## Alternatively you can obviously just set a secret:# $ export SYSTEM_SECRET=this_needs_to_be_the_same_always_and_also_very_$3cuR3-._# The database url points us at the postgres instance. This could also be an ephermal in-memory database (`export DATABASE_URL=memory`)# or a MySQL URI.$ exportDATABASE_URL=postgres://hydra:secret@ory-hydra-example--postgres:5432/hydra?sslmode=disable
# MySQL的配置,host.docker.internal为宿主机IP,mysql容器的内部IP或者hydra-mysql也可以用$ exportDATABASE_URL=mysql://root:123@tcp(host.docker.internal/mysql容器的内部IP/hydra-mysql:3306)/hydra?parseTime=true
常见问题:“Could not fetch private signing key for OpenID Connect - did you forget to run "hydra migrate sql" or forget to set the SYSTEM_SECRET?” error=“unexpected end of JSON input”
确认一下SYSTEM_SECRET有没有正常设置呀,实在不行直接在docker run的时候带入.
正常启动的话,日志如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Thank you for using ORY Hydra!
Take security seriously and subscribe to the ORY newsletter. Stay on top of new patches and security insights.
>> Subscribe now: http://eepurl.com/di390P <<
time="2018-08-09T10:23:50Z" level=info msg="Connected to SQL!"
time="2018-08-09T10:23:50Z" level=info msg="JSON Web Key Set hydra.openid.id-token does not exist yet, generating new key pair..."
time="2018-08-09T10:23:51Z" level=info msg="Setting up Prometheus middleware"
time="2018-08-09T10:23:51Z" level=info msg="Transmission of telemetry data is enabled, to learn more go to: https://www.ory.sh/docs/guides/latest/telemetry/"
time="2018-08-09T10:23:51Z" level=info msg="Detected local environment, skipping telemetry commit"
time="2018-08-09T10:23:51Z" level=info msg="Detected local environment, skipping telemetry commit"
time="2018-08-09T10:23:51Z" level=info msg="JSON Web Key Set hydra.https-tls does not exist yet, generating new key pair..."
time="2018-08-09T10:23:55Z" level=info msg="Setting up http server on :4444"
Welcome to the example OAuth 2.0 Consumer
This example requests an OAuth 2.0 Access, Refresh, and OpenID Connect ID Token from the OAuth 2.0 Server (ORY Hydra). To initiate the flow, click the "Authorize Application" button.
Authorize application