Authentication
Every product API call needs a token that says which user and organisation it is for. This page shows what the code accepts and what we have not defined for outside programs yet.
Preview, can change These pages describe calls that can change. They are not a separate public product.
Send the token#
Send the token in the Authorization header as Bearer <token>. Every route under /secure/ needs it.
Unknown. How an outside reader learns the real API host. The app reads it from its own server settings. Examples here use the placeholder https://<api-host> and never a real address.
export SOLSAT_API="https://<api-host>" export TOKEN="<token>"
curl -sS "$SOLSAT_API/secure/pro/rec-verify/summary" \ -H "Authorization: Bearer $TOKEN"
| Status | Body | Meaning |
|---|---|---|
401 | {"error":"Unauthorized"} | The header is missing or does not start with Bearer. |
401 | {"error":"Invalid token"} | The token is not valid, or it has expired. |
403 | {"error":"Forbidden: ..."} | The user has no organisation, or the organisation is not an Enterprise account. The text after Forbidden says which. |
Scroll sideways to see all columns
Which tokens work#
Two kinds of token are accepted: a SOLSAT token and a Firebase ID token. The server checks a SOLSAT token first. If that fails, it tries to verify the string as a Firebase ID token and finds the user for it, creating one if none exists yet.
Exchange a Firebase ID token#
- What it does
- Trades a Firebase ID token for a SOLSAT token. This step is optional, because a Firebase ID token is accepted directly.
- Inputs
- JSON body with
id_tokenandfirebase_id. Thefirebase_idmust be the user id inside the token. - Result
access_token,token_type,expires_inanduser. A SOLSAT token lasts 24 hours, soexpires_inis 86400 seconds.- Limits
- 401
Invalid Firebase ID token, or 503Firebase verification unavailablewhen the check cannot run. - API call
- POST
/auth/firebase/loginChecked in code
curl -sS -X POST "$SOLSAT_API/auth/firebase/login" \
-H "Content-Type: application/json" \
-d '{"id_token":"<firebase-id-token>","firebase_id":"<firebase-uid>"}'Get a new token#
- What it does
- Returns a new SOLSAT token for the same user and organisation.
- Inputs
- JSON body with
refresh_token. The login answer has no separate refresh token field, so send a SOLSAT token that is still valid. - Result
- A new
access_tokenthat lasts 24 hours. - Limits
- 401 when the token is not valid or has expired.
- API call
- POST
/auth/refreshChecked in code
curl -sS -X POST "$SOLSAT_API/auth/refresh" \
-H "Content-Type: application/json" \
-d '{"refresh_token":"<token-that-is-still-valid>"}'What is not defined yet#
Unknown. How a program outside the app gets a Firebase ID token. Today the token comes from signing in through the SOLSAT app. We have not defined a supported way for a program to get one.
Unverified. The code has a sign in with an organisation key: POST /auth/b2b/login with an X-API-Key header and a user_id in the body, for a key that holds the auth:login permission. We have not tested it with REC Verify or the portfolio import. Whether the Forecast and Roof console can give a key that permission is Unknown. Do not rely on it.
The API and white-label page says organisation accounts can sign in with a key. That matches the code. This guide does not promise that such a key reaches the routes documented here.
Calls that need no token#
The sign in calls POST /auth/firebase/login and POST /auth/refresh need no token, because they are how you get one. The page behind an invite link also reads GET /public/rec-invites/{token} without signing in. It is described in Find roofs and invite owners.