Spanish Total.js
English
Documentation For AI agents
Contents

Start a sign-in

POST / creates a sign-in session and returns the address to send the user to.

.md GitHub
On this page
POST /
x-token: YOUR_APP_TOKEN
Content-Type: application/json

Token

Send an app token in the x-token header, or as the token query argument (POST /?token=YOUR_APP_TOKEN). The header keeps the token out of server logs.

Body

FieldRequiredMeaning
serviceidyesThe ID of the extension, for example facebook.
sessionidyesYour own ID for this sign-in. OpenAuth returns it to you and you use it to read the profile. Make it unique and hard to guess, for example a UUID.
urlnoWhere OpenAuth sends the user after signing in. OpenAuth adds sessionid to it: ?sessionid=..., or &sessionid=... when the address already has a query.

Answer

200 with the sign-in address as a JSON string:

curl -H "x-token: YOUR_APP_TOKEN" -H "Content-Type: application/json" \
  -d '{"serviceid":"facebook","sessionid":"7f3a9c21","url":"https://www.example.com/auth/"}' \
  https://auth.example.com/
"https://auth.example.com/login/mwn8jzivbyr19ogt6g/"

Redirect the user's browser to that address within 15 minutes.

When the user comes back

  • With url: the browser arrives at https://www.example.com/auth/?sessionid=7f3a9c21. Check that the session ID is one your app started for this browser (for example, keep it in a cookie), then read the profile.
  • Without url: the user sees this page, which also tries to close itself after a moment. Use it when you open the sign-in in a popup window. Your app then reads the profile with its session ID.

The page that says You have logged in successfully and Close this page

Errors

StatusAnswerWhy
400[{"name":"serviceid","error":"The field \"serviceid\" is invalid",...}]serviceid or sessionid is missing.
400[{"error":"Service not found"}]No extension has that ID.
401An HTML error pageThe token is wrong or missing.

See Errors for the other addresses.

Made in Europe