https://github.com/brickchain/oidc-demo
Simple demo of our OAuth2/OpenID Connect provider
https://github.com/brickchain/oidc-demo
Last synced: 2 months ago
JSON representation
Simple demo of our OAuth2/OpenID Connect provider
- Host: GitHub
- URL: https://github.com/brickchain/oidc-demo
- Owner: Brickchain
- License: bsd-2-clause
- Created: 2017-12-15T10:27:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-20T09:49:41.000Z (over 6 years ago)
- Last Synced: 2025-02-08T21:46:10.635Z (4 months ago)
- Language: CSS
- Size: 580 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# oidc-demo
![]()
Simple demo of our OAuth2/OpenID Connect provider
Try the demo: https://oidc-demo-fd28c.firebaseapp.com
This repository contains a simple frontend that first displays a button that will start the authentication flow towards the IDP.
When the login is completed it will display the content of the name scope and a button that uses the push_endpoint (claim received from the push scope) to send a push message to the logged in users device.## Frontend
The relevant bits of code for the frontend are located in frontend/src/app/show/show.component.ts.
The startOauth() function starts the oauth flow by doing an API call to the backend (one of the functions described below) and redirecting to the URL returned.
If we have an ?data= query parameter set when the page loads we will try to parse it as an OAuth IDToken.## Functions
Relevant code is in functions/src/index.ts.
We're using the openid-client package to talk to the IDP. The getClient() function shows how we use the OpenID Dynamic Discovery feature to get all the IDPs endpoints and settings.
The startOauth handler builds the authorization URL that we will send back to the frontend to start the OAuth flow.
The oauthCallback handler receives the callback from the IDP and does the token exchange.