Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPS mutual certificate example #154

Closed
DJDaveMark opened this issue Mar 15, 2023 · 1 comment
Closed

HTTPS mutual certificate example #154

DJDaveMark opened this issue Mar 15, 2023 · 1 comment

Comments

@DJDaveMark
Copy link

Do you have any examples of using HTTPS while supplying certificates?

I found an example using the https node module, but I'd like to use o.js to avoid crafting the odata URLs manually.

const https = require("https");
const fs = require("fs");

const requestParams = {
    hostname: "<the hostname>",
    port: 44300,
    key: fs.readFileSync("path/to/client-key.pem"),
    cert: fs.readFileSync("path/to/client-crt.pem"),
    ca: fs.readFileSync("path/to/ca-crt.pem"),
    rejectUnauthorized : false,
    path: "<the OData URL>",
    method: "<GET/POST/DELETE etc>"
};

const httpsReq = https.request(requestParams, httpsRes => {
    // Handle the response here
});

httpsReq.end();
@DJDaveMark
Copy link
Author

I got an answer over on Stack Overflow:
https://stackoverflow.com/a/75745957/344029

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants