spomky-labs/oauth2-server-authorization-endpoint
Authorization endpoint implementation for the Spomky-Labs OAuth2 server. Handles incoming authorization requests, validates request parameters, and integrates with the OAuth2 server to issue authorization codes or return proper error responses.
This is a component, not an application. It implements the OAuth2 authorization endpoint, but depends on the spomky-labs/oauth2-server core for the server object, repositories, and response types. Budget for the whole stack, not just this package.
composer require spomky-labs/oauth2-server-authorization-endpoint spomky-labs/oauth2-servernyholm/psr7 is the smallest modern option; the package's README will likely suggest zendframework/zend-diactoros from its era).composer.json first — check the PHP constraint and last release date before you design anything around it.src/ and enumerate every interface the endpoint type-hints. That list is your integration contract: client repository, scope repository, resource-owner/account provider, authorization-code repository. You will implement all of them.GET|POST /oauth/authorize route. GET validates the authorization request and renders a login/consent screen; POST issues an authorization code and 302s back to the client's registered redirect_uri.Laravel wiring has no service provider. Bind the endpoint in a provider, convert Illuminate\Http\Request to a PSR-7 request, invoke the endpoint, and synthesize an Illuminate\Http\Response from the PSR-7 response (copy status and Location/Content-Type headers; the body is usually empty for redirects).
client_id/redirect_uri. On POST, look up the stashed request, apply the user's decision, and only then issue a code.response_type=code and nothing else. The implicit (token) and hybrid responses are legacy; if the endpoint registers them, prune them from the grant/response-type list.client_id, redirect_uri, scope, code_challenge, code_challenge_method, expires_at, used_at. The token endpoint must re-check all of these.invalid_scope, access_denied, unsupported_response_type) versus "render locally" (unknown client_id, unregistered redirect_uri). Never redirect to an unvalidated URI, even to report an error.code_challenge, wrap it: a decorator validates and persists the challenge before delegating, and the token endpoint verifies code_verifier. This is the most common thing you'll need to add yourself./oauth/authorize with a full query string, assert 302 and parse code/state from Location. Assert the DB row exists, then assert a denial POST returns error=access_denied with the same state.client_id from your DB inside the client repository; cache the registered redirect URI list.invalid_request support tickets.state must be echoed verbatim on both success and error redirects. Dropping it silently breaks every client relying on it for CSRF protection.error=access_denied redirect. Don't let that fall through to a 500.redirect_uri is absent, disable that fallback. Registered-URI-only.Location (code redacted) at debug level, and capture the PSR-7 response in tests rather than trusting the browser.league/oauth2-server (with a PSR-7 bridge) or Laravel Passport implement the same authorization-code flow and are actively maintained. Stay on this package only if you're already committed to the Spomky-Labs core elsewhere.How can I help you explore Laravel packages today?