OAuth 2.0
An app acts for a pro after the pro approves it. Hometown supports the authorization code flow with PKCE (S256) and refresh tokens. No other grant exists.
Register the app
Make the app in the developer portal under Apps. Give its exact redirect URIs (https; only localhost may use http, on any port), the scopes it needs and the ones a pro may decline. The client secret shows once.
Ask for consent
Send the pro to:
https://myhomet.com/oauth/authorize?response_type=code&client_id=<client_id>&redirect_uri=<uri>&scope=jobs:read%20schedule:write&state=<state>&code_challenge=<challenge>&code_challenge_method=S256
The pro signs in, sees what the app asks for, and may uncheck the optional scopes. A request without an S256 code_challenge is refused before the consent screen.
Get the tokens
curl https://api.wfskills.com/oauth/token \
-d grant_type=authorization_code -d client_id=<client_id> -d client_secret=<secret> \
-d redirect_uri=<uri> -d code=<code> -d code_verifier=<verifier>
The access token lasts 60 minutes; the refresh token lasts 30 days and is replaced on each use. Send the access token as Authorization: Bearer <token> to any Business API route.
Reconsent
When the app needs a scope the pro did not grant, the answer is 403 scope_missing with reconsent_url. Send the pro there to approve the new scope.
Disconnect
POST /v1/app/disconnect ends the app's access to the pro. The pro can also disconnect it from their account. Either way the developer's webhook receives app.uninstalled with the install's id.