https://github.com/ory/hydra-login-consent-node
This is an ExpressJS reference implementation for the ORY Hydra User Login and Consent interface written in TypeScript and ExpressJS.
https://github.com/ory/hydra-login-consent-node
Last synced: about 1 year ago
JSON representation
This is an ExpressJS reference implementation for the ORY Hydra User Login and Consent interface written in TypeScript and ExpressJS.
- Host: GitHub
- URL: https://github.com/ory/hydra-login-consent-node
- Owner: ory
- License: apache-2.0
- Created: 2018-05-03T14:19:57.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-09-23T07:50:20.000Z (over 1 year ago)
- Last Synced: 2024-10-29T14:55:25.363Z (over 1 year ago)
- Language: TypeScript
- Homepage: https://www.ory.sh/hydra
- Size: 708 KB
- Stars: 304
- Watchers: 17
- Forks: 126
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# hydra-user-and-consent-provider-node
This is a reference implementation for the User Login and Consent flow of Ory
OAuth2 service (Hydra) in NodeJS. The application is bootstrapped using the
`express` cli.
---
- [Overview](#overview)
- [Running](#running)
---
## Overview
Apart from additions (`./routes/login.ts`, `./routes/consent.ts`) and their
respective templates, only a [CSRF Middleware] has been added. Everything else
is the standard express template.
Also, a simple helper that makes HTTP requests has been added to
`./services/hydra.js` which uses the `node-fetch` library.
To set this example up with ORY Hydra, please refer to the
[official documentation](https://www.ory.sh/docs).
## Running
Please head over to the
[ORY Hydra 5 Minute Tutorial](https://www.ory.sh/docs/hydra/5min-tutorial) to
see how this works.
## FAQ
### TLS Termination
You can mock TLS Termination by setting environment variable
`MOCK_TLS_TERMINATION` to any value, for example `MOCK_TLS_TERMINATION=y`. This
will add `X-Forwarded-Proto: https` to each HTTP Request Header.
### Integrating with Ory Network
To integrate this example app with Ory Cloud Oauth2 Service set variable
`ORY_API_KEY` with value of your
[Ory API Key / Ory Personal Access Token](https://www.ory.sh/docs/concepts/personal-access-token)
and set `HYDRA_ADMIN_URL` to the value of you Ory Cloud API URL which you can
find in your
[Ory Cloud Project](https://www.ory.sh/docs/concepts/terminology#ory-cloud-project)