Faild to Get data from REST API of nRF Cloud : Invalid JWT

Hello everyone:

I'm following the tutorial in JWT authentication on nRF Cloud | nRF Cloud Docs

And I want to test the REST APIs by using curl command.

I have created my own UUID, CA certificates and Device certificates by using the python scripts in <nRFCloud/utils: Utility code/scripts for working with nRF Cloud (github.com)>

And I have provisioned the UUID to the nRF Cloud successfully, since I can see the UUID in the Device Pannel of the nRF Cloud portal. I used  "ProvisionDevices" Endpoint to do that.

I created the JWT in jwt.io, follow the steps in the tutorial, like this:

the HEADER is ES256, the PAYLOAD is UUID, and the signature is generated by Device certificate. All the same with the tutorial above.

But when I call the GetAssistanceData endpoint using the JWT, it always returns Error Code: 40100.

The command I use is:

curl --request GET \
  --url 'https://api.nrfcloud.com/v1/location/agps?requestType=custom&customTypes=1%2C3%2C4%2C6%2C7%2C8%2C9&mcc=310&mnc=410&tac=36874&eci=84485647' \
  --header 'Accept: application/octet-stream' \
  --header 'Authorization: Bearer eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2NDUyMGRlNC1lMGEwLTQ1Y2YtYmY1Ni0xZjQzZjgwYTRmMzcifQ.YxN91I3nAuG9WezQRmGRpWQLrMwZPMS1ewwWj72ORBR5HTCIEYUKgid7xBB_kYZiLPIkaveF3Y1wKROm2zUS2Q' \
  --header 'range: bytes=0-500'

The result is Always:

{"message":"Invalid JWT","code":40100}

I want to know what is missing or in wrong configuration. Thank you.

Parents Reply Children
Related