---
title: Deploy Dex with AI on Blossom
url: "/deploy/dex/"
canonical_url: https://blossom88.com/deploy/dex/
markdown_url: https://blossom88.com/deploy/dex.md
summary: Sign in to a sample app with Dex and renew the same session after an update.
categories:
- deployment
- security
stack:
- Go
- PostgreSQL
- OpenID Connect
---

# Deploy Dex with AI on Blossom

[Dex](https://dexidp.io/) gives your apps an OpenID Connect endpoint
for sign-in. This recipe uses its local connector so you can test a
client before connecting a separate identity provider.

## Ask Your Agent

> **Ask your AI agent:** Deploy Dex on Blossom and help me sign in to a sample app.
>
> Follow this guide: https://blossom88.com/deploy/dex/

[Install the Blossom CLI and skill](https://docs.blossom88.com/learn/getting-started/install/) on your agent's machine and [choose a Location in your cloud account](https://docs.blossom88.com/learn/getting-started/choose-your-cloud/#connect-your-provider).

## Have Ready

- **Stable Dex HTTPS address** (Required): Use one issuer URL for your app and browser sessions.
- **App callback URL** (Required): Register the exact callback used by your test client.

## How It Runs

| Part | Role | Where |
|---|---|---|
| Dex | Handle sign-in and issue tokens | App Capacity behind Blossom Account access |
| PostgreSQL | Keep signing keys and session state | Private Persistent Service |

## Deploy Dex

Start a private PostgreSQL container on a
[Persistent Service Volume](/docs/apps/persistent-services/), then
run Dex on App Capacity behind Blossom Account access.

<details class="optional-reading" markdown="1">
<summary>Notes for your agent</summary>

Set the Dex issuer to the stable HTTPS address followed by `/dex`.
Use the database's private Service address in the
[PostgreSQL storage configuration](https://dexidp.io/docs/configuration/storage/).
Keep the config and the client secret in the app's private settings.

    blossom environment:deploy --id environment-100 --follow
    blossom service:scale --id service-dex-100 --desired-size 1 --follow

</details>

## Register the Workshop Client

Add a test user with the built-in password connector. Register the
sample app's callback and allow a code exchange and refresh requests.

> **Ask your AI agent:** Set up a sample Dex user and register my app's callback.

> Follow this guide: https://blossom88.com/deploy/dex/



![Sign in to the Workshop Reader app.](/deploy/assets/images/dex/dex-workshop-sign-in.webp)

## Sign In and Check the Session

Sign in through Dex and exchange the callback code. Have your app
check the ID token and save the refresh token for the update test.

> **Ask your AI agent:** Help me sign in through Dex and verify the identity in my sample client.

> Follow this guide: https://blossom88.com/deploy/dex/



## Renew the Session After an Update

Replace the Dex Container while PostgreSQL stays online. Use the
original refresh token and check that the response keeps the same
identity and signing key.

> **Ask your AI agent:** Replace Dex and check that my sample client can still renew its session.

> Follow this guide: https://blossom88.com/deploy/dex/



![Renew the sample session after replacing Dex.](/deploy/assets/images/dex/dex-session-renewed.webp)

## What You Get

- A Dex workshop with a local sign-in connector
- A sample client that checks the signed identity
- Renewed sessions after replacing Dex
- PostgreSQL-backed signing keys and refresh tokens

Tested on Blossom: The original refresh token renewed the same identity on a new Dex Container.
