Skip to content

REST API Authentication #13

Answered by sbender9
fahrsoft asked this question in Q&A
Feb 23, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

If you're just using the curl commands from the README, then they will fail when security is turned on.

Same is true if you're using node-red to make POST requests.

You need to pass a token along with the http POST request.

You can create a token for this by running this command on the sk server:

signalk-generate-token -u YourUserName -e 1y -s ~/.signalk/security.json

(Note that this creates a token that will work for one year, you could use 100y or 30d depending on your preference)

Now that you have a token, you can pass that on wth a http header via curl or a node-red node.

curl -X POST -H "Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InNiZW5dsdsdskZXIiLCJpYXQiOjE2MTM…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fahrsoft
Comment options

Answer selected by fahrsoft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants