Start a sign-in
POST / creates a sign-in session and returns the address to send the user to.
On this page
POST /
x-token: YOUR_APP_TOKEN
Content-Type: application/jsonToken
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
| Field | Required | Meaning |
|---|---|---|
serviceid | yes | The ID of the extension, for example facebook. |
sessionid | yes | Your 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. |
url | no | Where 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 athttps://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.

Errors
| Status | Answer | Why |
|---|---|---|
400 | [{"name":"serviceid","error":"The field \"serviceid\" is invalid",...}] | serviceid or sessionid is missing. |
400 | [{"error":"Service not found"}] | No extension has that ID. |
401 | An HTML error page | The token is wrong or missing. |
See Errors for the other addresses.