The OpenID Connect Handbook

A preview of our new ebook about OIDC, the de facto standard for handling authentication in the modern world.

Read on :orange_book:

Brought to you by @bruno.krebs :man_technologist:t5:

Please let us know if you have any questions!

Trying to follow the example code provided in the handbook, but encountering an error with the first example app already.

This code snippet:

const {OIDC_PROVIDER} = process.env;
const discEnd = ‘https://${OIDC_PROVIDER}/.well-known/openid-configuration’;
request(discEnd).then((res) => {
oidcProviderInfo = JSON.parse(res);
app.listen(3000, () => {
console.log(‘Server running on http://localhost:3000’);
});
}).catch((error) => {
console.error(error);
console.error(‘Unable to get OIDC endpoints for ${OIDC_PROVIDER}’);
process.exit(1);
});

Throws an error that the OIDC_PROVIDER can’t be resolved"

Unable to get OIDC endpoints for ${OIDC_PROVIDER}

While the OIDC_PROVIDER is correctly read from the .env file, the value is not correctly propagated through the code, for example examining the discEnd constant yields this:

https://${OIDC_PROVIDER}/.well-known/openid-configuration’

instead of “https://‘actual value of OIDC_PROVIDER’/.well-known/openid-configuration” …

Any ideas?

Can you try using back ticks? For example:

const discEnd = `https://${OIDC_PROVIDER}/.well-known/openid-configuration`;
3 Likes

Thanks, that did the trick …

There seem to be ‘issues’ when copying text fragments from the PDF version of the handbook into the editor I am using … ‘backticks’ are not carried across correctly … :slightly_frowning_face:

1 Like

Thanks for helping on this one @mraible !