README.md
September 26, 2022 ยท View on GitHub
OAuth2.0 & OIDC integrations with clients using different grant flows
Will be using Ory Hydra as an Identity and Authorization server to mimic IdP service. You can feel free to use okta or AuthO etc. as well.
These are just sample applications to help you get started with OAuth2.0 and OIDC quickly. Not following any best practices or coding guidelines.
These samples can be used in different contexts:
- You are building an Identity Provider for you organization(THE COMPANY) using ory hydra (could be others like okta etc.). Think of
trusted-appsas your own applications/apis (like Google Services) andexternal-appsas 3rd party clients who want to access your apis. - Your organization (THE COMPANY) is using the services of an external-app (SAAS, PAAS) and have integrated it into your trusted-app, a user can go to the external-app from your trusted-app without filling his/her credentials again on external-app and start using it straight away thanks to Single Sign On.
Setting up Ory Hydra quickly
You can follow the steps laid out here on the Ory Hydra Documentation
Authorization Grant Flows
If you are new to this, then you can read about it here
Authorization Code Grant Flow
external-app-one A server side node express application demonstrating Auth code flow grant
- Confidential
Implicit Grant Flow
external-app-two A React.js App demonstrating Implicit flow grant
- Public Client
Authorization Code Grant Flow with PKCE
external-app-three A React.js App demonstrating Auth Code with PKCE
- Public Client
Auto-refresh tokens on receiving 401 HTTP status
external-app-four A React.js App demonstrating Auth Code with PKCE. Using axios library to catch 401 response code in interceptors and initiating a refresh token request.
- Public Client
- Same as external-app-three
Other Projects
trusted-app-one An API server to emulate a Resource Server.
Accepts access_tokens and validates them at /introspect endpoint of Authorization Server
How to get started?
- You need docker and docker-compose
- Run
docker-compose upin ory-hydra folder - Run
npm run build && npm startin ory-hydra-login-consent-node - Run
npm run startin trusted-app-one folder - Check the npm scripts in any of the external-app folders you want to test
- For client registration with ory-hydra, register-client.json has been provided in the folders.
TODOs
- Front-channel Logout
- Back-channel Logout