Skip to content
Get started
Bastionary › Knowledge base › Migration

Migrating off Okta: a self-hosted exit plan

By Bastionary · Migration

Know what Okta will not hand back

Start with the hard constraint that shapes everything else: Okta does not export password hashes. You can pull every user profile, every group, every app assignment, and every factor enrollment through the API, but the actual credential material stays locked in Okta's Universal Directory. That single fact decides your migration strategy, so confront it on day one rather than discovering it during cutover week.

Your two realistic options are a lazy migration (rehash-on-login against Okta while users trickle over) or a hard reset (force everyone through a password reset at cutover). For consumer and B2B SaaS userbases, lazy migration almost always wins because it is invisible to users.

Inventory before you export

You cannot migrate what you have not catalogued. Build a complete picture of the Okta org first:

  • Users and profiles — including custom profile attributes you added to the Universal Directory schema.
  • Groups and rules — static groups are easy; group rules (dynamic membership) encode logic you must reimplement.
  • Applications — every SAML and OIDC integration, with its ACS URLs, entity IDs, client IDs, and redirect URIs.
  • Policies — sign-on policies, MFA enrollment rules, and password policies.
  • Factors — which users enrolled which MFA methods, so you can tell them what to re-enroll.

Exporting users through the API

The Users API paginates with a link header; walk it to the end rather than trusting a single page. A minimal export loop looks like this:

url="https://your-org.okta.com/api/v1/users?limit=200"
while [ -n "$url" ]; do
  resp=$(curl -s -D headers.txt \
    -H "Authorization: SSWS $OKTA_API_TOKEN" \
    -H "Accept: application/json" "$url")
  echo "$resp" >> users.ndjson
  # Okta returns the next page in a Link header: rel="next"
  url=$(grep -i '^link:' headers.txt | sed -n 's/.*<\(.*\)>; rel="next".*/\1/p')
done

Transform the resulting profiles into your target schema. Keep the Okta id as an external reference column during the transition — you will need it to reconcile users who authenticate through the lazy-migration bridge.

Groups deserve their own pass. Static memberships export cleanly as a list of user-to-group edges, but Okta group rules — expressions that add or remove users dynamically based on profile attributes — are logic, not data. Export the rule expressions for reference, reimplement each as an equivalent rule on the target platform, and verify membership matches before you trust it. Everything downstream rides on groups: app assignments, roles, and entitlements all resolve through them, so a group that computes differently after migration silently changes who can access what.

Rate limits are per-org and generous but not infinite. Run the export against a point-in-time and then do a delta pass just before cutover for users created or changed in the interim, rather than trying to export a moving target in one shot.

Rehash-on-login: the bridge that avoids a reset

Because you cannot bring the hashes, your new platform verifies the first login through Okta, then captures and rehashes the password locally. The flow on the new system:

def authenticate(email, password):
    user = db.find_by_email(email)
    if user.local_hash:                       # already migrated
        return verify_argon2(user.local_hash, password)

    # Not migrated yet: delegate this one login to Okta
    ok = okta_primary_auth(email, password)   # /api/v1/authn
    if not ok:
        return False

    # Okta accepted it, so we now hold a known-good password:
    user.local_hash = hash_argon2(password)
    user.okta_id = None                       # cut the tether
    db.save(user)
    return True

After a few weeks the long tail of inactive accounts is all that remains on the bridge. Sweep those with a reset email near the end, then revoke the Okta API token and decommission the org.

Re-homing SAML and OIDC apps

Each downstream application trusts Okta as its identity provider, so each one needs its trust re-pointed. For SAML apps, you are recreating the IdP metadata: new sign-on URL, new signing certificate, and the same NameID format and attribute statements the service provider expects. For OIDC apps, you issue new client credentials and update discovery/issuer URLs, redirect URIs, and scopes.

Do this app-by-app, not all at once. Where a service provider supports multiple IdP connections, add the new one alongside Okta, test it with a pilot group, then remove Okta. Where it supports only one, schedule a brief, announced switch per app during a low-traffic window.

SCIM provisioning is the step teams forget. If Okta was pushing user lifecycle events into downstream apps over SCIM, those apps will stop receiving deprovisioning signals the moment you cut Okta. Stand up SCIM from the new platform before you disable it on Okta, or you will leave orphaned accounts in every connected app.

Cut over in stages, keep a rollback

Run both systems in parallel. Route new signups to the new platform immediately, migrate existing users lazily as they log in, and keep the Okta org live but read-only for the duration. Watch your authentication success rate and support queue as the leading indicators; a spike in either means a misconfigured app or a profile-mapping gap, not a reason to panic-revert. Only after the active population has crossed and the app connections are stable do you schedule the final reset sweep and the Okta shutdown.

Run it yourself

Bastionary is free, open-source software. Follow the quick start to have it running on your own server, or browse the releases on Git.

Get started