Apps and clients
Mobile app setup
The mobile app is an Expo (React Native) project with its own repository (SharkhexClassifiedsApp) and build guide (docs/build-local.md there). This page covers what the backend provides for it and what to set on the server so an app build can talk to it.
What the app uses
- API: every screen talks to
https://your-domain/api/v1. The full description is at/api/doc(and/api/doc.jsonfor tools). - Sign-in:
POST /api/v1/users/loginwith email and password returns a short-lived access token and a refresh token;POST /api/v1/users/token/refreshrenews them. Tokens are signed withAPP_SECRET, so changing it signs everyone out of the app. - Facebook and Apple:
POST /api/v1/users/login/facebooktakes the app's Facebook access token (Android) or Limited Login token (iOS);POST /api/v1/users/login/appletakes the Sign in with Apple identity token. Both check the token with Facebook or Apple, create the account on first use (or link the account with the same email) and answer like the email sign-in.GET /api/v1/platformlists the ones that are on underfeatures.socialLogin, and the app shows only those. - Language: the app shows everything in the install's language,
localeinGET /api/v1/platform, and the API answers in it. The brand'slocales.defaultis used until the app has heard from the server. - Platform details:
GET /api/v1/platformreturns the name, language, currency and the other settings the app needs to look like the brand. - Push notifications: the app registers its Expo push token with
POST /api/v1/devices. The server sends through Expo whenEXPO_DSNis set.
Server settings for the app
| Setting | Where | Why |
|---|---|---|
EXPO_DSN | environment | Push notifications (expo://ACCESS_TOKEN@default; the token comes from the Expo account of the app). |
| Public URL | Admin, Settings, Platform | Links in emails and shared listings open the right address. |
| Facebook app id | FB_ID, FB_SECRET | Facebook sign-in, on the website and in the app (the same Facebook app; add the iOS and Android apps to it). |
| iOS bundle ID | Admin, Settings, Apps | The app's bundle ID (identity.bundleId in its brand.json): Sign in with Apple only accepts tokens issued to it. |
| Sign in with Apple | Admin, Settings, Apps | Turns the Apple button on in the iOS app. The App Store requires it when the app offers Facebook sign-in. |
Per brand
Each brand gets its own app build (name, icon, colours, store listing) pointing at its own install's address. Keep the API address, the brand name and the support email in the app build the same as on the server.
Found a mistake? Tell us.