OpnForm intentionally uses three authentication mechanisms. They serve different clients and should not be substituted for one another without a dedicated migration.
Do not migrate first-party login to Passport. Passport is for delegated access by external clients. A future first-party authentication migration should evaluate Sanctum’s stateful cookie authentication as a separate project.
Delegated OAuth flow
The OAuthServiceProvider owns Passport configuration, routes, token lifetimes, consent rendering, and scope descriptions. MCP adds its own dynamic client registration policy, login bridge, metadata, and mcp:use scope requirement on top of that generic layer.
- The client dynamically registers an allowed redirect URI for the MCP integration.
- The authorization request must use Authorization Code with PKCE and the
S256 challenge method.
- OpnForm authenticates the account through the existing first-party login flow.
- The generic consent screen displays the callback destination and every requested scope description.
- Passport issues a scoped access token and refresh token.
- The MCP endpoint accepts the token only when it includes
mcp:use and the account is not blocked.
Guest MCP requests remain available without a bearer token. A bearer token that is invalid or missing the required scope is rejected rather than treated as a guest request.
Configuration
These values are independent of JWT_TTL. Changing a delegated OAuth token lifetime must not change first-party sessions.
Adding another delegated client
When you add another OAuth consumer:
- Add a narrowly defined scope and a user-readable description to
config/oauth.php.
- Keep redirect URI validation specific to the client registration endpoint.
- Require PKCE
S256 for public clients.
- Enforce the scope at the protected resource boundary.
- Add consent, token, insufficient-scope, account-blocking, and revocation tests.
Do not add product-specific permissions directly to the generic OAuth consent template. The template renders the scopes requested and validated by Passport.