mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-11-01 15:53:03 -06:00
When OAUTH2_SCOPE contains 'openid' but OAUTH2_SERVER_METADATA_URL is not set, Authlib fails deep inside id_token verification with a cryptic `Missing "jwks_uri" in metadata` error that names neither the config knob nor the fix. Add a pre-flight check at the entry of _authorize_access_token: if the scope includes 'openid' and no (non-whitespace) metadata URL is set, raise a RuntimeError with actionable guidance before any network round-trip. server_metadata_url is the only way pgAdmin feeds JWKS to Authlib, so this carries no regression risk for correctly-configured providers. Clarify the OAUTH2_SERVER_METADATA_URL comment in config.py and add regression coverage.