bolt-lightningQuickstart: PostgreSQL

A self-contained GL IAM quickstart using PostgreSQL - no external auth services required.

circle-info

When to use PostgreSQL: Choose the PostgreSQL provider when you want full control over user data, the fastest local setup, or don't need external identity provider features like SSO or social login.

circle-info

When to use this page: Use this Quickstart when you want the fastest "it works on my machine" proof. You can run GL IAM with PostgreSQL locally (no external IdP needed) and do the full lifecycle: register → login → validate.

circle-info

What you'll build: A minimal local setup that runs PostgreSQL using Docker, installs GL IAM, and runs a Python script that creates a user with password and authenticates them.

chevron-rightPrerequisiteshashtag

This example requires completion of all setup steps listed on the Prerequisites page. To summarize:

  • Python 3.11+

  • Docker (for PostgreSQL)

  • Access to the GDP Labs' Gen AI SDK repository (request via formarrow-up-right or ticket@gdplabs.id)

  • gcloud CLI: Installarrow-up-right, then run gcloud auth login

  • uvarrow-up-right — Install with: curl -LsSf https://astral.sh/uv/install.sh | sh

Setup PostgreSQL

Start PostgreSQL with Docker:

docker run -d --name gliam-postgres \
  -e POSTGRES_USER=postgres \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=gliam \
  -p 5432:5432 \
  postgres:16

Installation

Install GL IAM from the internal Google Artifact Registry (latest version).

Quick Start

1

Setup Provider

2

Create User with Password

3

Authenticate User

4

Expected Output

circle-check

Complete Example

This example includes user registration with password and authentication - the full auth lifecycle.

Create quickstart.py:

Run it:

Expected output (first run):

Expected output (subsequent runs):

Common Pitfalls

Pitfall
Solution

Port 5432 already in use

Map to another port: -p 5433:5432 and update DATABASE_URL

Wrong DB URL scheme

Keep asyncpg in the URL: postgresql+asyncpg://...

Org/Tenant confusion

organization_id="default" is a local placeholder—use your real tenant/org ID in production

Cleanup

Stop and remove the PostgreSQL container when done:

Other Providers

GL IAM supports multiple identity providers with the same application code. Only the configuration changes:

Last updated

Was this helpful?