Tenant-specific API credentials management
Problem
OAuth applications were previously created via the Rails console and stored in the public PostgreSQL schema. Because PostgreSQL's search_path includes both the tenant schema and the public schema, these public-schema applications were visible from every tenant, breaking multi-tenant isolation. There was no admin-facing UI for managing API credentials.
How it works
API Access tab in Organisation Settings
A new API Access tab appears under Settings > Organisation for admins with the "manage integrations" permission. This tab lists all OAuth applications belonging to the current tenant and provides controls to create and delete them.
Creating an API credential
Clicking New API Credential opens a form where the admin enters a name for the application. The system automatically configures the application for the client_credentials OAuth grant type, which is the only grant flow enabled.
After creation, the admin is shown the Client ID and Client Secret along with the token endpoint URL and a curl example demonstrating how to obtain an access token.
Credential display
The show page displays:
Client ID — the public identifier for the application
Client Secret — the secret key (admins should store this securely)
Token Endpoint — the URL to POST to for obtaining tokens
Usage example — a ready-to-use
curlcommand
Deleting an API credential
Deleting an application revokes all associated access tokens before removing the application record.
Tenant isolation
Because Apartment switches the PostgreSQL search_path per request, all Doorkeeper::Application records are created within the tenant's schema. This ensures each organisation's API credentials are isolated from other tenants.
Last updated
Was this helpful?