OAuth Callback
POST/api/magento2/oauth/callback
Public, unauthenticated endpoint — Magento Admin POSTs the OAuth 1.0a activation payload here when the merchant clicks Activate on a Magento Integration.
Flow on success:
- We immediately return
200 { success: true, oauth_verifier: ... }so Magento marks the integration Active. - We then asynchronously POST to
{store_base_url}/oauth/token/requestto get a temporary request token, and{store_base_url}/oauth/token/access(with the verifier) to upgrade it into the permanent access token + secret. This deferred-exchange pattern (viafastcgi_finish_request()orregister_shutdown_function) avoids deadlocking Magento's PHP-FPM worker pool — Magento's own Laminas HTTP client expects to read our response before it can serve our outbound OAuth calls. - Structured outcomes (success/failure + last-4-of-token) are logged to
laravel.logso install operations can be debugged.
Body parameters (form-urlencoded, as Magento Admin POSTs):
oauth_consumer_key(required, string) — Magento Integration consumer key.oauth_consumer_secret(required, string) — Magento Integration consumer secret.oauth_verifier(required, string) — one-time verifier for the token exchange.store_base_url(required, string) — Magento storefront URL.
Behavior:
- If any field is missing, the endpoint still returns HTTP 200 (so Magento Admin doesn't surface a misleading 'post to consumer failed' error) but with
success: falseand a message; the OAuth exchange is skipped. - The endpoint never throws — exchange failures are logged but not propagated to the response (Magento has already left the conversation by then).
Authentication: None — this is a public webhook. CSRF is bypassed by the wildcard */callback rule in bootstrap/app.php.
Request
Responses
- 200
- 401
- 403
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Validation failed — the body is a field → messages map (Laravel shape) or the platform envelope with a stable machine-readable code. Fix the payload and resubmit.
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.