Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Updated to be a little more correct.
  • Loading branch information
MortenTobiasNielsen authored Oct 15, 2024
1 parent 9b3d22d commit 2498bc1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions authentication/oauth2-certificate-flow/example_nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2498bc1

Please sign in to comment.