Authenticators encapsulate the logic required to verify a user’s credentials. This could be a JWT token, an API key, or a session cookie.Documentation Index
Fetch the complete documentation index at: https://docs.apivalk.com/llms.txt
Use this file to discover all available pages before exploring further.
AuthenticatorInterface
All authenticators must implement theAuthenticatorInterface.
Methods
authenticate(string $token): ?AbstractAuthIdentity: Takes a raw token (or credential string) and returns an identity object if valid, ornullif authentication fails.
JwtAuthenticator
Apivalk provides a production-readyJwtAuthenticator that uses the firebase/php-jwt library. It is designed to work with OAuth2 providers (like Auth0, Okta, or Keycloak) that expose a JWKS (JSON Web Key Set) endpoint.
Features
- JWKS Support: Automatically fetches and parses public keys from a remote URL.
- Claim Validation: Validates the
iss(issuer),aud(audience), andexp(expiration) claims. - Scope Extraction: Automatically parses scopes from the
scopeorscpclaims. - Identity Creation: Returns a
JwtAuthIdentitypopulated with thesub,email,username,scopes, andpermissions.