Guides
Using the API from the phone app
Sign-in tokens for people, in beta.
The phone apps call the same /api/v1 as everyone else, but as a person rather than as a company key. A person signs in with their email and password:
curl -X POST "https://dev.siteswap.pro/api/v1/auth/session" -H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"your password","device":"iPhone"}'const res = await fetch("https://dev.siteswap.pro/api/v1/auth/session", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email, password, device: "iPhone" }),
});
const { data } = await res.json();
await secureStore.set("siteswap_token", data.token);import requests
r = requests.post("https://dev.siteswap.pro/api/v1/auth/session", json={"email": "[email protected]", "password": "your password", "device": "test"})
token = r.json()["data"]["token"]- The token (
sst_...) goes inAuthorization: Bearer, like a key. It works for 30 days, for that person in their first company, with every scope their role allows. DELETE /auth/sessionwith the token signs out.- Sign-in tries are limited to 12 every 15 minutes per address. A wrong email or password answers
401 wrong_password, the same for both. - The person must have accepted the current Terms on the site, or signing in answers
403 terms_required. Signing up and accepting new Terms happen on the site. - Keep the token in the phone's secure storage, never in plain files.
SiteSwap API v1Support