Back
Auth0 Wrapper

Auth0 Wrapper

Overview

Auth0 Wrapper

Auth0 is a flexible identity platform for web and mobile applications, developed by Okta. It provides authentication, authorization, and user management with support for password-based login, passwordless authentication, MFA, social identity providers, and enterprise SSO via SAML and OIDC.

The Auth0 Wrapper brings your tenant's user data into Postgres as a queryable foreign table. Query users with plain SQL and join them against your application data. It is read-only and works with Supabase Vault for secure API key management.

Preparation

Before you get started, make sure the wrappers extension is installed on your database:


_10
create extension if not exists wrappers with schema extensions;

and then create the foreign data wrapper:


_10
create foreign data wrapper auth0_wrapper
_10
handler auth0_fdw_handler
_10
validator auth0_fdw_validator;

Secure your credentials (optional)

By default, Postgres stores FDW credentials inside pg_catalog.pg_foreign_server in plain text. Anyone with access to this table will be able to view these credentials. Wrappers is designed to work with Vault, which provides an additional level of security for storing credentials. We recommend using Vault to store your credentials.


_10
select vault.create_secret(
_10
'<Auth0 API key or Personal Access Token>',
_10
'auth0',
_10
'Auth0 API key for Wrappers'
_10
);

Connecting to Auth0

We need to provide Postgres with the credentials to connect to Auth0, and any additional options. We can do this using the create server command:

With Vault:


_10
create server auth0_server
_10
foreign data wrapper auth0_wrapper
_10
options (
_10
url 'https://dev-<tenant-id>.us.auth0.com/api/v2/users',
_10
api_key_id '<key_ID>' -- The Key ID from above.
_10
);

Without Vault:


_10
create server auth0_server
_10
foreign data wrapper auth0_wrapper
_10
options (
_10
url 'https://dev-<tenant-id>.us.auth0.com/api/v2/users',
_10
api_key '<your_api_key>'
_10
);

Resources

Details

DeveloperSupabase
DocumentationLearn

Third-party integrations and docs are managed by Supabase partners.

Get started with Auth0 Wrapper and Supabase.