Ws_id not set in oauth2_credentials when using Admin API with Kong 3.8

Hi everyone,

I’m currently using Kong Gateway 3.8 Enterprise, and I’ve encountered a behavior I wasn’t expecting.

When creating an oauth2_credentials entry via the Admin API, even with the Kong-Workspace header properly set (e.g., Kong-Workspace: default), the resulting record in the database is created without the ws_id field being populated — it ends up as null.

Here’s an example of the curl request I’m using:

curl --location 'http://<admin-api>:8001/default/consumers/<consumer-id>/oauth2' \
  --header 'Kong-Admin-Token: <token>' \
  --header 'Content-Type: application/json' \
  --header 'Kong-Workspace: default' \
  --data '{
    "name": "Test Credential",
    "redirect_uris": ["http://example.com"]
}'

Despite using the correct workspace header, ws_id remains null in the oauth2_credentials table.

My questions are:

  • Is this expected behavior in Kong 3.8?
  • Does oauth2_credentials officially support workspaces in this version?
  • Could this be a configuration issue, or is the workspace logic not applied to this entity by design?

Thanks in advance to anyone who can shed some light on this!