Gusto OAuth callback of a directory source
GET /v1/directory_sources/oauth/gusto/callback: Gusto OAuth callback of a directory source.
GET /
The redirect URI registered on the OhAuthCat Gusto app. Consumes the state (single use, 30 minutes, bound to one environment and directory), exchanges the code with the PKCE verifier, stores the tokens sealed, reads the companies the grant reaches and saves the source (scheduling a sync) when there is exactly one. Then redirects to the start request’s return_url with ohauthcat_oauth (connected, choose_company or error), directory_id and, on error, error_code. An expired, unused state (kept 24 hours past expiry) redirects to return_url with ohauthcat_oauth=error and error_code=directory_source_oauth_expired, and is used up by it. An unknown or already used state answers directory_source_oauth_state_invalid (400) without redirecting: an HTML page for a browser, JSON otherwise.
- Scope
public- Auth
- None
- Since
- 1.0
Query parameters
Section titled “Query parameters”
Absent when Gusto reports an error.codestringmax length 2048
statestringmax length 256
Gusto’s error (RFC 6749 §4.1.2.1), e.g.errorstringaccess_denied.max length 256
Headers
Section titled “Headers”
Minor version; defaults to the environment’s pin.OhAuthCat-Versionstring
Responses
Section titled “Responses”- 302 Redirect to the start request’s return_url.
- 400
<a href="/: the state is unknown, already used or malformed. A browser (Accept text/html) gets a short self-contained HTML page ("This link can’t be used") naming only the request ID; API clients get the JSON error. Errorerrors/ directory_source_oauth_state_invalid/ "> directory_source_oauth_state_invalid</ a> - 429 Code: rate_limited. Retry-After is set. Error
- 503 Code: service_unavailable. Retry-After is set; writes are paused. Error
- default Any other error, including internal_error. Every code is in the error catalogue. Error
Errors share one shape; see the error code catalogue.
curl -X GET \ "https://api.ohauthcat.com/v1/directory_sources/oauth/gusto/callback"const response = await fetch("https://api.ohauthcat.com/v1/directory_sources/oauth/gusto/callback", { method: "GET",});const data = await response.json();import osimport requests
response = requests.get( "https://api.ohauthcat.com/v1/directory_sources/oauth/gusto/callback",)data = response.json()