S256 challenge method is accepted.
Prerequisites
- Your
client_idandclient_secret, issued by Everbility during onboarding. - Your registered
redirect_uri. Every request must use it exactly as registered — there is no wildcard or path matching. - The approving user must be an organisation admin in Everbility. Other users see the consent page but cannot approve.
Generate the PKCE pair and state
For every connection attempt, generate a fresh Store
state and a fresh code_verifier (43–128 characters from A–Z a–z 0–9 - . _ ~), then derive the challenge:state and code_verifier server-side against the pending attempt — you need both when the callback arrives.Send the admin to the consent page
Redirect the practice admin’s browser to:The admin signs in to Everbility if needed, reviews what your app will be able to do, and approves. Links missing valid PKCE parameters show an error card and cannot be approved.
Handle the callback
On approval, the browser is redirected to your If the admin cancels, you receive
redirect_uri:?error=access_denied&state=<your state> instead.Verify that state matches a pending attempt before continuing, then look up its code_verifier. The code is single-use and expires after 5 minutes.Exchange the code for tokens
Call the token endpoint from your server. It accepts form-encoded or JSON bodies.Store both tokens securely, keyed by practice. Exchanging a code revokes any tokens previously issued for the same connection.
Response
Refresh tokens and rotation
Access tokens last 1 hour; refresh tokens last 90 days. Refresh before or after expiry with:- Each refresh token is single use. Always persist the new pair from the response before discarding the old one.
- The previous access token is revoked when you refresh.
- Presenting an already-used refresh token is treated as theft: every token for the connection is revoked, open launch sessions are expired, and the connection status becomes
reauthorization_required. The response is401 Refresh token reuse detected. - After 90 days without a successful refresh, the refresh token expires with
401 Refresh token expired, and the connection likewise requires re-authorization.
Re-authorization
When a connection reachesreauthorization_required (refresh expiry or token reuse), or a practice admin revokes it from Everbility, all API calls return 401. To recover, send a practice admin through the consent flow again — approving reactivates the same connection, and existing client mappings are preserved.
Revoking a connection
Either side can end a connection:- Your platform:
POST /v1/partner/oauth/revokewithclient_id,client_secret, and anytokenfrom the connection (access or refresh). This revokes the entire connection, not just the presented token, and always returns{"revoked": true}. - The practice: an organisation admin disconnects your app from within Everbility.
Errors
| Status | Detail | Cause |
|---|---|---|
400 | Invalid redirect_uri | redirect_uri does not exactly match the registered value. |
400 | Invalid authorization code | Code is unknown, expired (5 min), already used, or was issued for a different redirect_uri. |
400 | Invalid code_verifier | Verifier is malformed or does not match the code_challenge from the consent request. |
400 | Unsupported grant_type | grant_type is not authorization_code or refresh_token. |
401 | Invalid OAuth client | Unknown client_id or wrong client_secret. |
401 | Invalid refresh token | Refresh token unknown, revoked, or belongs to another app. |
401 | Refresh token reuse detected | An already-consumed refresh token was presented; the connection now requires re-authorization. |
401 | Refresh token expired | The 90-day window lapsed; the connection now requires re-authorization. |