Use this application to configure your first OIDC application for client authentication. You can also toggle on more advanced use cases to learn about how to protect your APIs with stronger controls.
This application is built with Node.js and uses openid-client. All UI assets can be found under views and public. All views are written using vanilla HTML and JS and templated using Handlebars.
In this app, you can do the following -
- Authenticating the client using a configured OIDC OP
- Logging out of the client
- Viewing the authenticated user's profile by unpacking the id_token
You can also run this in two modes:
- Using standard authorization code flow with the
client_secret_post
authentication method. - Using pushed authorization request with the
private_key_jwt
authentication method, which is more suited for Open Banking use cases.
- Install Node and Git on your machine
- Clone this repo to your machine
There are two possible configurations supported:
- Standard authorization code flow
- More tailored and secure Open Banking compliant flow
-
Generate client credentials on a OIDC OP server. Choose the grant type as authorization code and set redirect_uri to
http://localhost:3000/auth/callback
. -
Copy
dotenv
file to.env
and populate the values as belowDISCOVERY_URL
: Set the Open ID Connect discovery (well-known) endpoint hereCLIENT_ID
: The OIDC client ID generated on step 1CLIENT_SECRET
: The OIDC client secret generated on step 1SCOPE
: If you aren't sure what to set here, just set this asopenid profile email
-
Generate client credentials on a OIDC OP server with the following settings:
Authorization code
grant type allowedprivate_key_jwt
client authentication method- Pushed authorization request supported and allowed
-
Copy
dotenv
file to.env
and populate the values as belowDISCOVERY_URL
: Set the Open ID Connect discovery (well-known) endpoint hereCLIENT_ID
: The OIDC client ID generated on step 1CLIENT_SECRET
: The OIDC client secret generated on step 1SCOPE
: If you aren't sure what to set here, just set this asopenid profile email
USE_PAR
: Set to "true"
-
Install node dependencies
npm install
-
Run the application. You should see
Server started and listening on port 3000
after executing the command below.npm start
-
Open the browser and go to http://localhost:3000 and you should be able to use the application. Click Login and away you go.