I’m happy to help or improve the documentation where needed, but please let me know what you’ve already tried and what does not work
Thanks you so much for your support
I am trying to get LoRa END node data on ARM based Linux platform(Yocto Krogoth) without webui.
The LoRa gateway is directly connected to my board(platform) though Ethernet port and I have the debug console of my board to see the logs.
What I tried mentioned below in my Linux platform
1.Installed the dependencies like mosquito ,reddis ,postgres
2.Downloaded Gateway bridge,LoRa server ,LoRa app server
3.executed Gateway bridge,LoRa server ,LoRa app server in background
4. executed mqtt subscribe and checked whether receiving the Loral data or not and found getting data in encrypted fomat like below
mosquitto_sub -h 192.168.4.150 -p 1883 -t gateway/7276ff000b031979/rx
{“rxInfo”:{“mac”:“7276ff000b031979”,“time”:“0001-01-01T00:00:00Z”,“timestamp”:2970051204,“frequency”:868100000,“channel”:5,“rfChain”:1,“crcStatus”:1,“codeRate”:“4/5”,“rssi”:-54,“loRaSNR”:7.5,“size”:39,“dataRate”:{“modulation”:“LORA”,“spreadFactor”:12,“bandwidth”:125}},“phyPayload”:“QL0DACKACAAFMcRJDVWCbfqan3RwmeNE7Im2ZOQtHeS32AMjm5vS”}
What doesn’t work
1.I am getting one Error message in console, but I am not able to identify from which components the message is coming
Below is the message
ERRO[0132] processing rx packet error: get device-session error: device-session does not exist or invalid fcnt or mic data_base64=QL0DACKABQAF5rXxrJjaqkZ80uLvlhhTIunobh5OzAxsuR4RxKnw851k
- I understand that we need to create service profile device profile through webUI.But here I am trying to do Node registration and decrypting the data without the help of webUI.I am not getting the next step to register the LoRa END node without webUI
When you want to decrypt everything yourself, just use the LoRa Gateway Bridge and subscribe to the .../rx
topic. Else you really need to create the service- and device- profile and create the device through the web-UI. Alternatively use the gRPC or REST api (the web-UI is built on top of the REST api).
When you navigate your browser to /api
you will see the REST api documentation / console. (e.g. navigate to https://localhost:8080/api).
Anyway, don’t make it harder for yourself than needed. Try by using the web-interface first, if that works start using the API
Okay, Can you please comment that in what condition user will get such an error?
- The device-session does not exist (thus the device is not activated)
- Invalid frame-counter (possible replay-attack)
Is this issue will get resolved if I am registering the LoRa device in Application server?
To resolve the issue, I need to re-create the application after deleting the existing application(through web UI)
But this thread mainly for node registration without WebUI.
I am in holidays now. I will be back on the same activity on coming days,
if any one registered Lora device without webUI,please help me.
Hi,
I am trying to get available network servers in my system using curl.
So Fisrt I have created a network server from webUI ;got below message
INFO[8649] routing-profile created routing_profile_id=6d5db27e-4ce2-4b2b-b5d7-91f069397978
INFO[8648] network-server created id=1 name=“EU 865000” server=“192.168.4.150:8000”
Then , I tried to get the list of network server using below mentioned curl command
curl --capath /NU_Application/ --cacert cert.pem --interface 192.168.4.150 http://192.168.4.150:8080/api/network-servers
2018/01/11 12:21:30 http: TLS handshake error from 192.168.4.150:32819: tls: first record does not look like a TLS handshake
I have created cert.pem using below command
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout key.pem -out cert.pem
Can you please comment that where I am getting wrong.
Try with https:// instead of http://
Getting below message with https try
{“error”:“authentication failed: get token from context error: no authorization-data in metadata”,“code”:16}
With credential below message
curl -u admin:admin --capath /NU_Application/ --cacert cert.pem --interface 192.168.4.150 https://192.168.4.150:8080/api/network-servers
{“error”:“authentication failed: jwt parse error: token contains an invalid number of segments”,“code”:16}
That is because you need to set a JWT token instead of the -u admin:admin
.
https://forum.loraserver.io/t/using-rest-api-with-jwt-token/298
See also: https://docs.loraserver.io/lora-app-server/integrate/auth/
I have some confusion here about JWT tocken used with curl command.
I have given --gw-server-jwt-secret as well as --jwt-secret in loraserver and lora-app-server.(Option 1)
Do I need to pass that value as JWT tocken with curl?
In my another try , I have passed below command and got JWT (Option 2)
curl -X POST --header ‘Content-Type: application/json’ --header ‘Accept: application/json’ -d ‘{ “password”: “admin”,“username”: “admin”}’ ‘https://192.168.4.150:8080/api/internal/login’
{“jwt”:“eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJsb3JhLWFwcC1zZXJ2ZXIiLCJleHAiOjE1MTU3NTU0MjMsImlzcyI6ImxvcmEtYXBwLXNlcnZlciIsIm5iZiI6MTUxNTY2OTAyMywic3ViIjoidXNlciIsInVzZXJuYW1lIjoiYWRtaW4ifQ.Rg9ejF7YG7Kj7bmU4Fk1NjWn7gT5ClPYJYVXH1ZhENs”}
Which is JWT option need to be used for the authentication
I have tried with Option 2
ie,
I tried like below
curl -X GET --header ‘Accept: application/json’ --header ‘Grpc-Metadata-Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJsb3JhLWFwcC1zZXJ2ZXIiLCJleHAiOjE1MTU3NTM5OTEsImlzcyI6ImxvcmEtYXBwLXNlcnZlciIsIm5iZiI6MTUxNTY2NzU5MSwic3ViIjoidXNlciIsInVzZXJuYW1lIjoiYWRtaW4ifQ.JEvRzah9syjKL3kbNx9pJCnlw_xFn1loQpv8bJZElu4’ ‘https://192.168.4.150:8080/api/network-servers’
Response below
{“totalCount”:“1”,“result”:[]}
But I expected below JSON format.
{
“result”: [
{
“createdAt”: “string”,
“id”: “string”,
“name”: “string”,
“server”: “string”,
“updatedAt”: “string”
}
],
“totalCount”: “string”
}
Is there anything missed out from my side?
When you make a request using the API console (by pointing your browser to http://[IP]:8080/api
and make the request there, it will also print a curl
example that you can copy & paste to your terminal.
I have tired with webui API console too.JWT token is pasted at the top left corner text box.
But the api/network-servers results same as console.
{
“totalCount”:“1”,
“result”:[]
}
Attached screen shot for your reference.
I think I need to pass some value in “limit” parameter
Yes … its worked with limit value
Hi,
I am trying to create service profile from “LoRa App Server REST API” web console
Passing below mentioned JOSN to https://192.168.4.150:8080/api/service-profiles
{ “name”: “Test”, “networkServerID”: “10”,“organizationID”: “3”,“serviceProfile”: { “addGWMetadata”: true,“channelMask”: “string”,“devStatusReqFreq”: 0,“dlBucketSize”: 0,“dlRate”: 0,“dlRatePolicy”: “DROP”,“drMax”: 0,“drMin”: 0,“hrAllowed”: true, “minGWDiversity”: 0,“nwkGeoLoc”: true,“prAllowed”: true,“raAllowed”: true,“reportDevStatusBattery”: true,“reportDevStatusMargin”: true,“serviceProfileID”: “string”,“targetPER”: 0, “ulBucketSize”: 0,“ulRate”: 0,“ulRatePolicy”: “DROP”} }’
Getting below error code
{
“error”: “illegal base64 data at input byte 4”,
“code”: 3
}
Am I giving any wrong parameters in JSON?
Also I have a confusion that we need to pass serviceProfileID .But It is mentioned that serviceProfileID is the response. Is that mandatory to pass serviceProfileID?
I am able to create the Server profile from webGUI. and able to GET in web console. So I assume JWT tocken is working fine for me.