OpenID Connect Relying Party (RP) web client (like a web site) example
This example needs an OIDC Server (OP) and optionally an OAuth2 Resource Server (https://github.com/madarche/oauth2-resource-server-example).
It is assumed that this application will run as https://oidc-rp-web-example.local.test/. One can change this URL with whatever other URL.
First, write the config.tom config file.
Optionally set the resources.url property with the URL of the OAuth2 Resource Server route.
cp config.toml.example config.toml
vim config.tomlNext, register the RP in the OP with the following properties:
client_id: the same as theclient_idset in theconfig.tomlredirect_uris:https://oidc-rp-web-example.local.test/logged_inpost_logout_redirect_uris:https://oidc-rp-web-example.local.test/logged_outapplication_type:webtoken_endpoint_auth_method:client_secret_basicclient_secret: the same as theclient_secretset inconfig.toml
Then, install the needed packages and start the application:
npm ci
npm startFinally, visit the application at https://oidc-rp-web-example.local.test/
If the OP uses a self-signed certificate, one gets the following error:
RequestError: self signed certificate
The solution is, prior to the npm start command, to specify the certificate
to Node.js, for example:
export NODE_EXTRA_CA_CERTS=/etc/nginx/ssl/cert/local.test.crt