Location Services Quickstart
This guide explains how to authenticate requests to nRF Cloud Location Services using a Memfault Organization Auth Token.
Organization Auth Tokens replace the legacy nRF Cloud Service Tokens and Evaluation Tokens, which are deprecated. If you were previously using either of those token types, follow this guide to migrate to OATs.
Prerequisites
- A Memfault account with Organization Admin access.
- A project with Location Services enabled.
- Your Organization Slug, found in Admin > General > Organization Slug.
- Your Project Slug, found in Project Settings > General > Project Slug.
Step 1: Create an Organization Auth Token
- Log in to the Memfault dashboard.
- Navigate to Admin > Organization Auth Tokens.
- Click Create Token.
- Enter a description (e.g., "Location Services") and click Create.
- Copy the token and store it somewhere secure. You will not be able to view it again.
For more details, see Organization Auth Tokens.
Step 2: Make a Location Services request
Use the token in the Authorization header when calling nRF Cloud Location
Services REST endpoints. The token should be sent as a Bearer token.
The base URL for all Location Services endpoints is:
https://api.nrfcloud.com/v1/organizations/<YOUR_ORG>/projects/<YOUR_PROJECT>/location
Replace <YOUR_ORG> with your Organization Slug and <YOUR_PROJECT> with your
Project Slug.
Example: Wi-Fi location
curl -v -X POST \
https://api.nrfcloud.com/v1/organizations/<YOUR_ORG>/projects/<YOUR_PROJECT>/location/wifi \
-H "Authorization: Bearer $NRFCLOUD_OAT" \
-H "Content-Type: application/json" \
-d '{
"accessPoints": [
{
"macAddress": "30:86:2d:c4:29:d0",
"signalStrength": -45
},
{
"macAddress": "3c:37:86:5d:75:d4",
"signalStrength": -45
}
]
}'
Migrating from Service Tokens or Evaluation Tokens
If you were previously using nRF Cloud Service Tokens or Evaluation Tokens:
- Create an OAT as described in Step 1.
- Replace the
Authorization: Bearer <service_token>header in your API calls withAuthorization: Bearer <YOUR_OAT>. - Update your request URLs to include your Organization and Project slugs. For
example,
https://api.nrfcloud.com/v1/location/ground-fixbecomeshttps://api.nrfcloud.com/v1/organizations/<YOUR_ORG>/projects/<YOUR_PROJECT>/location/ground-fix.
Existing Service Tokens will continue to work during the deprecation period, but you should migrate as soon as possible. Evaluation Tokens are no longer available for creation.