Skip to content

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.

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.

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.

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.

  • Run the curl command 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.

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.