Your own token service
When your app already talks to your own backend, its users can get a token your service issued as soon as they sign in: Thing Edges signs the user in, calls your service, and hands the app the token you return. Thing Edges does not read it.
Set it up in the project, under Integrations → Service token → Set up. The app then exchanges its sign-in for that token.
Describe your endpoint
Section titled “Describe your endpoint”You do not need to build an endpoint to our specification: describe the one you have.
| Field | What it is |
|---|---|
| Method and URL | How your endpoint is called. It must have a public address; use https:// |
| Headers, Query parameters, Body | The request, with placeholders such as {{phone}} |
| Content type | JSON, form or plain text |
| Secret | What your service checks. Put {{apiKey}} where it belongs; by default it goes in an x-api-key header |
| Token path | Where the token is in your JSON answer, such as token or data.accessToken |
| Timeout (ms) | How long a sign-in waits for your service |
Have a curl command that works? Paste it in Fill from curl and the form fills itself in. The form
shows the request it will send as a curl command, so you can run it yourself first.
Placeholders
Section titled “Placeholders”| Placeholder | Is replaced by |
|---|---|
{{phone}} |
The phone number of the user signing in |
{{externalUserId}} |
Your id for that user, if Thing Edges has one |
{{requestId}} |
A unique id for this sign-in, for your logs |
{{apiKey}} |
The secret above |
Any other name is refused when you save, so a field can never be sent empty by mistake.
What your service returns
Section titled “What your service returns”JSON with the token at the token path. A status other than 2xx, a timeout, or no token at that path makes the exchange fail; the app never gets a token you did not issue.
Before turning it on
Section titled “Before turning it on”- Run the
curlcommand and check the token is where you said. - Keep the timeout short: it is how long a user waits.
- The secret is never shown again. Leave the field empty to keep it; type a new one to replace it.
Turning it off
Section titled “Turning it off”Choose Remove. Apps get their token from Thing Edges again, and apps that expect your token may stop working. The settings and the secret are deleted.