Download the PHP package kyzegs/supabase-auth-bundle without Composer
On this page you can find all versions of the php package kyzegs/supabase-auth-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kyzegs/supabase-auth-bundle
More information about kyzegs/supabase-auth-bundle
Files in kyzegs/supabase-auth-bundle
Package supabase-auth-bundle
Short Description A reusable Symfony bundle for stateless authentication via Supabase-issued JWTs.
License MIT
Informations about the package supabase-auth-bundle
SupabaseAuthBundle
Stateless Symfony authentication via Supabase-issued JWTs.
The bundle verifies a Supabase JWT (signature against the project JWKS, plus
exp and iss checks) and hands the verified claims to an application-provided
resolver that maps the Supabase identity to your own user. Verification logic
lives here once; the only application glue is the resolver.
Installation
If you don't use Symfony Flex, register the bundle manually in
config/bundles.php:
Configuration
config/packages/supabase_auth.yaml:
| Option | Default | Description |
|---|---|---|
url |
(required) | Supabase project URL, e.g. https://xxxx.supabase.co. Must be an absolute http(s) URL. |
jwks_ttl |
600 |
Seconds to cache the JWKS (matches the Supabase edge cache). |
leeway |
0 |
Allowed clock skew (seconds) for the exp, iat and nbf checks. |
audience |
null |
When set, the token aud claim must contain this value (Supabase uses authenticated). |
algorithms |
[RS256, ES256] |
Signature algorithms accepted from the JWKS. Must be a subset of RS256, ES256. |
test_mode |
false |
Swap the handler for one accepting {prefix}{identifier} tokens. |
test_token_prefix |
test-user- |
Bearer-token prefix recognised in test mode. |
Invalid configuration (an unsupported algorithm, a negative jwks_ttl/leeway)
fails fast at container compile time. The url is validated at runtime instead,
so an %env(SUPABASE_URL)% value — which is unresolved during compilation — is
accepted; a non-http(s) URL is rejected on first token verification.
Wiring the firewall
Point your firewall's access-token handler at the public service id
supabase_auth.token_handler:
Provide a user resolver
Implement SupabaseUserResolverInterface to map verified claims (typically the
sub claim) to your security user, and alias the interface to it:
Returning null from resolve() produces an authentication failure.
Testing your application
With test_mode: true, send Authorization: Bearer test-user-{identifier} and
the bundle calls your resolver with ['sub' => '{identifier}'] — no real JWT
required.
License
MIT
All versions of supabase-auth-bundle with dependencies
psr/clock Version ^1.0
web-token/jwt-library Version ^4.1.4
symfony/cache-contracts Version ^3.4
symfony/clock Version ^7.2|^8.0
symfony/config Version ^7.2|^8.0
symfony/dependency-injection Version ^7.2|^8.0
symfony/http-client Version ^7.2|^8.0
symfony/http-client-contracts Version ^3.4
symfony/http-kernel Version ^7.2|^8.0
symfony/security-core Version ^7.2|^8.0
symfony/security-http Version ^7.2|^8.0