Moving users from Okta to Keycloak
An Okta org keeps each user as a profile (login, email, first and last name and any attributes you added), a status in Okta’s lifecycle, and credentials: a password, a recovery question, or a federated provider. Keycloak keeps a user as a username, an email, names, attributes, groups and credentials of its own.
This converter reads Okta users in two shapes: the JSON of Okta’s List Users API, or a CSV whose header uses Okta’s profile attribute names. It writes a Keycloak partial import or realm import file, in your browser, with no passwords and with a set-password step for every password user.
For the whole move, from inventory to rollback, see moving from Okta.
Getting users out of Okta
Okta’s Users API is the reliable way out. GET /api/v1/users returns users page by page, each with id, status, created, profile and credentials. A short script that follows the next links collects them into one JSON array, which the tool reads as it is.
curl -s "https://<your-org>.okta.com/api/v1/users?limit=200" \
-H "Authorization: SSWS <api-token>" \
-H "Accept: application/json" > users-page-1.jsonOkta’s admin console has a CSV template for importing users, not for exporting them. A CSV still works here if you make one from a report or a script: name the columns after Okta’s profile attributes (login, email, firstName, lastName, and your own attribute names), with an optional status and id. The tool also accepts the spreadsheet labels Username, First name, Last name and Primary email.
Groups are not part of a user record. List them with GET /api/v1/users/{id}/groups or per group with GET /api/v1/groups/{id}/users, and add a groups column with names separated by semicolons.
Why passwords do not move
Okta never returns a password. Its API documentation says that when a user has a password, an imported hash or a password hook, the password object in a response is a bare object with no value: "password": {}. There is no hash export, so no hash reaches Keycloak.
Every Okta user who signs in with an Okta password sets a new password after the move. The tool gives them Keycloak’s UPDATE_PASSWORD required action, and the set-password email goes out from Keycloak after the import, through the realm’s SMTP connection.
Users whose credentials provider is FEDERATION or SOCIAL sign in through another identity provider. They get no password step. Set up the same provider in Keycloak, and on their first sign-in Keycloak finds the account with the same email and asks them to confirm the link.
What the tool does with each field
| Okta | Keycloak user | Notes |
|---|---|---|
profile.email | email, in lower case | Also the username by default |
profile.login | username when you choose the id | Okta logins are often emails too |
profile.firstName, profile.lastName | firstName, lastName | |
status | enabled | SUSPENDED and DEPROVISIONED become disabled |
created | createdTimestamp | |
id | The okta_id attribute | Keep it to match records later |
| Other profile attributes | Attributes of the same name | Such as department or costCenter |
A groups column you add | groups, as paths | Names become /Name |
credentials.provider.type | Who sets a password, who re-links | Not written to the file |
Okta’s profile has no per-user “email verified” flag. The tool writes emailVerified: false unless you tick “Mark every email as verified”. Tick it if your users confirmed their address when Okta activated them; otherwise Keycloak may ask them to verify it, depending on the realm’s settings.
Statuses
| Okta status | In Keycloak |
|---|---|
| ACTIVE, PASSWORD_EXPIRED, LOCKED_OUT, RECOVERY | Enabled, with a set-password step |
| STAGED, PROVISIONED | Enabled: they never set a password, and the link lets them |
| SUSPENDED | Disabled |
| DEPROVISIONED | Disabled, or left out with the option on |
The output
{
"users": [
{
"username": "[email protected]",
"email": "[email protected]",
"emailVerified": false,
"firstName": "Sample",
"lastName": "One",
"enabled": true,
"attributes": {
"department": ["Sales"],
"okta_id": ["00u000000000000001"]
},
"groups": ["/Staff"],
"requiredActions": ["UPDATE_PASSWORD"]
}
]
}Partial import adds these users and their groups to an existing realm; the realm import file starts a new one. The page previews 20 users and the saved file holds all of them.
Apps, policies and factors
Users are one part of an Okta move. Each Okta app integration becomes a Keycloak client: OIDC apps with their redirect URIs and grant types, SAML apps with their ACS URL, entity id and attribute statements. Okta authorization servers and their custom claims become client scopes and protocol mappers. Sign-on policies become Keycloak authentication flows and, where you need them, conditional steps.
Factors do not move. We found no documented Okta export of TOTP secrets, and Okta Verify push has no Keycloak counterpart. Users who used an authenticator app set it up again at their first sign-in, through Keycloak’s Configure OTP required action, or with a passkey if you turn passkeys on in the realm.
One file from many pages
The Users API returns at most a page of users per call and links the next page in the Link header with rel="next". Collect every page and join them into one JSON array before you load it here. A short loop is enough.
URL="https://<your-org>.okta.com/api/v1/users?limit=200"
: > pages.ndjson
while [ -n "$URL" ]; do
curl -s -D headers.txt "$URL" -H "Authorization: SSWS <api-token>" \
-H "Accept: application/json" | jq -c '.[]' >> pages.ndjson
URL=$(grep -i '^link:.*rel="next"' headers.txt | sed -E 's/.*<([^>]+)>; rel="next".*/\1/')
done
jq -s . pages.ndjson > users.jsonOkta rate-limits the Users API per org. A loop like this one stays under the limit for most orgs; for very large ones, add a pause between pages and watch the X-Rate-Limit-Remaining header.
The tool also reads newline-delimited JSON, one user per line, so pages.ndjson works as it is. Use an API token from an admin account made for the move, with read access only, and revoke it when the export is done.
SAML apps
Okta orgs often hold many SAML app integrations: one per SaaS tool or partner. Each becomes a SAML client in Keycloak, and each needs a change on the other side, because the identity provider’s entity id, sign-in URL and signing certificate change. That change is made by the app’s admin, so list the owner of each app early.
Plan the certificate change with each app’s admin. Many SaaS tools accept only one identity provider certificate at a time, so the switch for that app happens at one moment: the app’s admin uploads Keycloak’s certificate, and from then on sign-in goes through Keycloak. Agree that moment with each of them, inside your cut-over window.
For each SAML app, write down the ACS URL, the audience (entity id), the NameID format and the attribute statements. The SAML client generator turns those into a Keycloak client, and the SAML metadata viewer helps compare what the app expects with what Keycloak publishes.
What your users see
Password users get one email from Keycloak with a link to set a new password. Users who used Okta Verify or an authenticator app set up an authenticator again at their first sign-in. Users who came through another identity provider confirm the link to their account once.
Everyone signs in once after the switch, because Okta sessions do not carry over. The sign-in page looks different too: clusters run Keycloak’s own themes, and custom themes are not supported yet. Tell users in the announcement where the new page is and what it looks like.
The Okta dashboard of app tiles has no direct counterpart in Keycloak. Users start sign-in from each app, or from links you publish yourself. Say so in your announcement if your users rely on the dashboard.
Mistakes to avoid
- Stopping at the first page of the Users API. Follow the
nextlinks until there are none. - Leaving deprovisioned users enabled. Use the option to leave them out, or check the disabled count.
- Forgetting attributes in the realm’s user profile, so Keycloak drops them.
- Sending set-password emails to federated users. The tool skips them; keep it that way.
- Switching every app on the same day without a dry run on a staging realm.
Where we come in
On Premium and Enterprise, our team does the move with you within the plan’s 10 service hours a month. On Starter you use these tools and guides, with written support. Very large orgs are scoped as Custom through the contact form. The readiness checklist lists every step for an Okta move.