questsin / UBC-Rogers-CAMARA-Hackathon

UBC Rogers CAMARA Hackathon
Apache License 2.0
10 stars 8 forks source link

Device location verification API only checks longitude #5

Open korih opened 3 days ago

korih commented 3 days ago

For the Device Location Verification API, It can verify when the device's latitude and longitude is matching the query.

{
   "status":200,
   "method":"POST",
   "endpoint":"location-verification",
   "api":"verify",
   "accessToken":"Bearer xxxxx",
   "phoneNumber":"00000000",
   "message":"location-verification request successful",
   "datetime":"2024-10-05T19:13:36.170Z",
   "cell":{
      "phoneNumber":"00000000",
      "name":"team x",
      "message":"Hi",
      "accessToken":"Bearer xxxxx"
   },
   "device":{
      "phoneNumber":"00000000"
   },
   "area":{
      "type":"Circle",
      "location":{
         "latitude":49.261177,
         "longitude":-123.249161
      },
      "accuracy":12000
   },
   "verificationResult":true,
   "lastLocationTime":"2024-10-05T19:13:36.170Z"
}

And when I change the longitude something incorrect, it does return false for the verification result

{
   "status":200,
   "method":"POST",
   "endpoint":"location-verification",
   "api":"verify",
   "accessToken":"Bearer xxxxx",
   "phoneNumber":"00000000",
   "message":"location-verification request successful",
   "datetime":"2024-10-05T19:13:36.170Z",
   "cell":{
      "phoneNumber":"00000000",
      "name":"team x",
      "message":"Hi",
      "accessToken":"Bearer xxxxx"
   },
   "device":{
      "phoneNumber":"00000000"
   },
   "area":{
      "type":"Circle",
      "location":{
         "latitude":49.261177,
         "longitude":123.249161
      },
      "accuracy":50
   },
   "verificationResult":false,
   "lastLocationTime":"2024-10-05T19:13:36.170Z"
}

However, when I query it with the wrong latitude value it still returns true.

{
   "status":200,
   "method":"POST",
   "endpoint":"location-verification",
   "api":"verify",
   "accessToken":"Bearer xxxxx",
   "phoneNumber":"00000000",
   "message":"location-verification request successful",
   "datetime":"2024-10-05T19:13:36.170Z",
   "cell":{
      "phoneNumber":"00000000",
      "name":"team x",
      "message":"Hi",
      "accessToken":"Bearer xxxxx"
   },
   "device":{
      "phoneNumber":"00000000"
   },
   "area":{
      "type":"Circle",
      "location":{
         "latitude":1,
         "longitude":-123.249161
      },
      "accuracy":50
   },
   "verificationResult":true,
   "lastLocationTime":"2024-10-05T19:13:36.170Z"
}

So i think that it is currently only checking the longitude of the coordinates of the device for if it is in the correct location as it also does error if both longitude and latitude are incorrect

{
   "status":200,
   "method":"POST",
   "endpoint":"location-verification",
   "api":"verify",
   "accessToken":"Bearer xxxxx",
   "phoneNumber":"00000000",
   "message":"location-verification request successful",
   "datetime":"2024-10-05T19:24:52.281Z",
   "cell":{
      "phoneNumber":"00000000",
      "name":"team x",
      "message":"Hi",
      "accessToken":"Bearer xxxxxx"
   },
   "device":{
      "phoneNumber":"0000000"
   },
   "area":{
      "type":"Circle",
      "location":{
         "latitude":50.735851,
         "longitude":7.10066
      },
      "accuracy":50
   },
   "verificationResult":false,
   "lastLocationTime":"2024-10-05T19:24:52.281Z"
}
tolbooth commented 2 days ago

Try reducing your accuracy to the scale of 0.1 - 0.01. Your accuracy value is too large (the provided documentation is wrong, and doesn't specify the correct range of values) and I believe that is what is causing the problem. I've tested this with lower accuracy values and it correctly reports for different latitudes.

korih commented 2 days ago

Looks liked the accuracy is in degrees not meters