Skip to content

Getting the token in your app

For a project with your own token service, the app exchanges its sign-in for your token once, right after the user signs in, and uses it on your API from then on.

POST https://api-prod.rogo.com.vn/api/v1/authen/service-token
Authorization: Bearer <access token from signing in>
x-appkey: <app key>
x-appsecret: <app secret>

No body. The answer:

{ "serviceToken": "eyJhbGciOiJFUzI1NiJ9..." }

Pass serviceToken to your API unchanged. Its format is your service’s; Thing Edges does not read it.

Status Means Do
401 The sign-in is missing or expired Sign the user in again, then retry
404 No account for this sign-in Finish sign-up first
409 The account has no phone number Ask for the phone number and verify it, then retry
501 The project has no token service, or it is off Do not retry: it is a setting, not a user problem
502 Your service answered without a token Retry once, then show a generic error
503 Your service could not be reached in time Retry after a short delay

The body also has an error code.

When your API refuses the token with 401, exchange again once and retry. One exchange per sign-in, one retry per 401, and none on 501.