vsql_oauth2 lets an account sign in with a JWT instead of a password. The
extension verifies the token’s signature, against keys fetched from a JWKS
endpoint or one static public key, checks that the token has not expired, and
maps a claim inside it to a VillageSQL account. Your identity provider stays the only place that issues
credentials.
Install
vsql_oauth2.veb is already in the server’s lib/veb/ directory if you
installed VillageSQL with the install script, the Docker image, or a release
tarball. Install it into the server with one statement:
What it adds
It adds an authentication plugin rather than SQL functions. Name the plugin when you create the account, and that account then authenticates by presenting a token:username_claim, sub by default, supplies that name.
When its value is analyst, the statement above is all you need. When it names
something else, such as an email address, create that account too and let the
connecting account proxy onto it:
alice@example.com directly, so it needs no password of its
own. A server running validate_password refuses to create an account without
one, answering
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements. Where that applies, give the account a password nobody holds, or
an authentication plugin that permits no login at all.
Without the proxy grant the login is refused with
ERROR 6126 (HY000): Access denied for user 'oidc_user'@'localhost', missing proxy privilege.
Everything else is configuration.
RSA signatures are accepted as RS256, RS384, and RS512, and ECDSA as ES256,
ES384, and ES512.
A setting written with
SET PERSIST survives a restart, but
UNINSTALL EXTENSION deletes it. After an uninstall and reinstall every
setting is back at its default, and no restart brings the old value back.See also
- Managing extensions — how extension settings are read and written
- Preview capabilities — what the preview flag turns on and what it promises
- Available extensions — the full catalog
- villagesql/vsql-oauth2 — source, a worked provider setup, and the known limitations

