From 2498bc1ffe06b09aa9943817e8bcdbed8aa50655 Mon Sep 17 00:00:00 2001 From: MortenTobiasNielsen <48355480+MortenTobiasNielsen@users.noreply.github.com> Date: Tue, 15 Oct 2024 09:56:16 +0200 Subject: [PATCH] Update README.md Updated to be a little more correct. --- .../example_nodejs/README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/authentication/oauth2-certificate-flow/example_nodejs/README.md b/authentication/oauth2-certificate-flow/example_nodejs/README.md index 8538998..250ec3c 100644 --- a/authentication/oauth2-certificate-flow/example_nodejs/README.md +++ b/authentication/oauth2-certificate-flow/example_nodejs/README.md @@ -3,21 +3,25 @@ Within [SaxoTraderGo on SIM](https://www.saxotrader.com/sim/account/) (or [Live](https://www.saxotrader.com/account/)) (use Chrome and English language) the certificate can be downloaded, which can be used to generate a JWT to get server2server access. This is the message you see after generation: -> The certificate with serial number 6B000007CA3413AA65FEA7F1230002000007CA has been created and saved on your computer.\ -> The certificate is valid until: 08-December-2024\ -> The certificate password is GdhqABCD +> The certificate with serial number {serial number} has been created and saved on your computer.\ +> The certificate is valid until: {expiry}\ +> The certificate password is {password} -The password is required when generating the PKCS private key, using the command: +The password is required when generating the private key, using the command: ```cmd - openssl pkcs12 -in 6B000007CA3413AA65FEA7F1230002000007CA.p12 -out private-key-with-cert.pem -clcerts -nodes -passin pass:GdhqABCD +path_to_downloaded="path/to/your/downloaded/file.p12" +output_file="path/to/your/output/certificate.pem" +password="your_password" + +openssl pkcs12 -in "$path_to_downloaded" -out "$output_file" -clcerts -nodes -passin pass:"$password" ``` This PEM file will be the input for the NodeJs example, together with the userId generating this certificate, the appKey and appSecret. Setup and run: 1. Download the dependencies with the command ``` npm install ```, from within this folder. -2. Change the 5 constants in the example.js, so your app and secrets are used. +2. Create a .env file with the variables required for example.js (all the variables instantiated with process.env.) 3. Run the sample with ``` node example.js ```. This example reads the certificate from a file, but better is to install the certificate on the host itself. There is a [C# example](https://github.com/SaxoBank/openapi-samples-csharp/tree/master/authentication/Authentication_Cba) on that.