auth export
Export realm from source Keycloak, clean it, and save to .postkit/auth/.
Usage
postkit auth export
postkit auth export --force # Skip confirmation
postkit auth export --verbose # Show detailed output
Options
| Option | Description |
|---|---|
-f, --force | Skip confirmation prompts |
-v, --verbose | Enable verbose output |
What It Does
- Load configuration — Read auth config from
postkit.config.json - Confirm export — Prompt for confirmation (unless
--force) - Acquire admin token — Authenticate with source Keycloak via REST API
- Export realm — Fetch realm configuration via partial-export API
- Clean config — Strip IDs, secrets, keys, and credentials
- Save files — Write raw and cleaned configs to
.postkit/auth/
Output
.postkit/auth/
├── raw/
│ └── {realm}.json # Raw export (includes IDs, secrets)
└── realm/
└── {realm}.json # Cleaned config (safe for import)
Example
$ postkit auth export
Keycloak Realm Export
[1/4] Loading configuration...
info Source : https://keycloak-dev.example.com
info Realm : myapp-realm
[2/4] Confirming export...
? Export realm "myapp-realm" from https://keycloak-dev.example.com? (Y/n)
[3/4] Acquiring admin token...
✔ Token acquired
[4/4] Exporting and cleaning realm...
✔ Realm exported
✔ Config cleaned and saved
success Export complete!
info Raw → .postkit/auth/raw/myapp-realm.json
info Clean → .postkit/auth/realm/myapp-realm.json
Requirements
- Source Keycloak must be accessible
postkit.config.jsonmust have validauth.sourceconfiguration- Run
postkit initfirst to create.postkit/auth/directory