You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ALTERNATIVE
Is the above solution the best way? I was hoping to read the cert file and provide it to Issuer.discover in the same way the cert file is specified in an options object and passed to https. The below code does not work, but this what I'd like to do:
import { Issuer } from "openid-client";
import { Agent } from "https";
import { readFileSync } from "fs";
// Read the certificate file
const rootCertificate = readFileSync("root.pem");
// Create an https agent with the root certificate
const httpsAgent = new Agent({
ca: rootCertificate,
rejectUnauthorized: true
});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
WORKING SOLUTION
From DOS shell, run this command:
SET NODE_EXTRA_CA_CERTS=root.pem
Run this js code with Node.js from same DOS shell:
import { Issuer } from "openid-client";
// Discover the OpenID Connect issuer
Issuer.discover("https://my-issuer.com", httpsAgent)
.then(issuer => {
console.log("Discovered issuer %s", issuer.issuer);
})
.catch(err => {
console.error("Error discovering issuer", err);
});
The following result displays in window:
Discovered issuer https://my-issuer.com/app
ALTERNATIVE
Is the above solution the best way? I was hoping to read the cert file and provide it to Issuer.discover in the same way the cert file is specified in an options object and passed to https. The below code does not work, but this what I'd like to do:
import { Issuer } from "openid-client";
import { Agent } from "https";
import { readFileSync } from "fs";
// Read the certificate file
const rootCertificate = readFileSync("root.pem");
// Create an https agent with the root certificate
const httpsAgent = new Agent({
ca: rootCertificate,
rejectUnauthorized: true
});
// Discover the OpenID Connect issuer
Issuer.discover("https://my-issuer.com", httpsAgent)
.then(issuer => {
console.log("Discovered issuer %s", issuer.issuer);
})
.catch(err => {
console.error("Error discovering issuer", err);
});
Is something like that possible with openid-client? Is there a better way to specify the root certificate for Issuer.discover?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions