How to generate JWT Key

You can use node to generate JWT key which further can be used for JWT authentication.

In the terminal, on the machine where node is installed, run the following command:

node -e "console.log(require('crypto').randomBytes(256).toString('base64'));"

The output will be like this:

8YlxFlrb1vDa/7pNaTkbuvNWLMfWZQ7bgrV3IU0nLulff2O536gQWkLdMbfDBOYLedB2QzsGQEuUTxWv79kVmiGgRBHN22vYId+g8O9g0kD+EI7TF/Lc66hAnrQ5wsPEwRSF0q3j3Bs9yEUAvxaXjkNEci4bqh8MG/fBzYT/w/x0ZDt56I3uCM8JKa90kaTbexDYynoVGbd6QJHVmpb0Zh6P2pWaC4nwBVnDRMmdmvRxPD1CgyczXnWXQvSr3ydXhe29n3ZNpFUSeD3vHTZPzkovQcMUAsG1N0Gq6zy0uPoc96foWBLvUhgBpubi1MwZqTiMC7UKGj2+vPOCMsMlIA==

You can use the generated key for your JWT authentication logic.