> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# User Provisioning and First Login | OpenMetadata SSO Guide

> Learn how OpenMetadata matches a user you created in the UI to their first SSO or LDAP login, which details it updates at sign-in, how roles are assigned, and what causes duplicate users.

# User Provisioning and First Login

You can create users in OpenMetadata before they sign in. This page explains what happens when one of those users signs in through SSO or LDAP for the first time: whether OpenMetadata reuses the account you created or makes a new one.

## How OpenMetadata Finds the User

At sign-in, OpenMetadata reads the user's email address from the identity provider and looks for an existing, active user with the **same email**. If it finds one, it signs the user in to that account and updates it. If it doesn't, it creates a new user, or rejects the sign-in. For more information, see [When No User Matches](#when-no-user-matches).

Where the email comes from depends on the provider:

| Provider | Where OpenMetadata reads the email |
| :- | :- |
| **LDAP** | The email the user enters at login, which OpenMetadata checks against the directory's **Mail Attribute Name**. |
| **OIDC** (Google, Okta, Azure AD, Auth0, Amazon Cognito, custom OIDC) | The token claim set in **Email Claim** (`emailClaim`). |
| **SAML** | The assertion attribute set in **Email Claim** (`emailClaim`). |

For the match to work, the email in the identity provider must be the same as the email you entered when you created the user in OpenMetadata.

> [!NOTE]
>
> Matching by email applies to OIDC and SAML only when **Email Claim** is set and no `jwtPrincipalClaimsMapping` is configured. Otherwise OpenMetadata uses the older behavior and matches on the **username** it builds from the token. A user you created with a different username then doesn't match, and OpenMetadata creates a second account. For more information, see [Configuration Parameters](https://docs.open-metadata.org/v2.1.x/deployment/security/configuration-parameters.md).

## What Is Updated at Login

When OpenMetadata reuses an existing user, it updates the account from what the identity provider sends:

| Detail | What happens |
| :- | :- |
| **Admin** | If the user's email or username is in the configured admin list, OpenMetadata makes them an admin. It never removes admin from this list. |
| **Display name** | For OIDC and SAML with **Email Claim** set, OpenMetadata replaces the display name with the one the provider sends. It keeps the current name when the provider sends none. |
| **Teams** | For OIDC and SAML, OpenMetadata adds the user to the teams named in the **Jwt Team Claim Mapping** claim, when you configure one. |
| **Profile picture** | For OIDC, OpenMetadata updates the picture from the provider. |
| **Roles** | For LDAP, OpenMetadata reassigns roles from the user's directory groups. For OIDC, it applies the roles claim when **Use Roles from Provider** is on. For more information, see [Role Assignment](#role-assignment). |

OpenMetadata doesn't change the email or username. Other details, such as the display name, teams, roles, and admin status, can change as described above.

## Role Assignment

How roles work at first login depends on the provider.

### LDAP

OpenMetadata reads the groups the user belongs to in the directory and applies the **Auth Roles Mapping** you configured. **Auth Reassign Roles** decides which roles that mapping can change at each login:

* A role in **Auth Reassign Roles** comes from the mapping on every login. If the user's groups no longer map to it, OpenMetadata removes it.
* A role you gave the user in OpenMetadata that is **not** in **Auth Reassign Roles** is kept.
* A mapped role that is not in **Auth Reassign Roles** is not assigned.
* Admin follows the same rule. OpenMetadata changes the admin flag at login only when **Auth Reassign Roles** contains the **Admin Role Name** (or `*`).

For example, you create a user with the `DataConsumer` role. If **Auth Reassign Roles** is `Admin` only, the user keeps `DataConsumer` and gets admin only when a mapped group grants it. If **Auth Reassign Roles** includes `DataConsumer`, the role is replaced by whatever the user's groups map to.

For more information, see [LDAP SSO](https://docs.open-metadata.org/v2.1.x/how-to-guides/admin-guide/sso/ldap.md).

### OIDC

When **Use Roles from Provider** (`useRolesFromProvider`) is on, OpenMetadata takes roles from the roles claim in the user's token at each login and replaces the roles the user had. If the token has no roles claim, the user loses those roles. A user who isn't in the configured admin list also loses admin when the token doesn't grant it. When it is off, roles you set in OpenMetadata stay as they are.

### SAML

OpenMetadata doesn't assign roles from the SAML response. Roles you set in OpenMetadata stay as they are. Teams from the **Jwt Team Claim Mapping** claim are applied.

## When No User Matches

If OpenMetadata finds no user with the email:

* **Enable Self Sign Up** is on: OpenMetadata creates a new user. It builds the username from the email prefix. If that username is taken, it adds a suffix.
* **Enable Self Sign Up** is off: The sign-in fails with `User not registered. Contact administrator to create an account.`

If **Enable Self Sign Up** is on but the email's domain isn't in **Allowed Email Registration Domains**, the sign-in fails with `Email domain not allowed for self-signup`.

If the matching user was deleted, the sign-in fails with `Your account has been deactivated. Contact your administrator.` Restore the user first.

## What Causes Duplicate Users

You get two accounts for one person when the first login doesn't match the user you created, and **Enable Self Sign Up** is on. The usual causes are:

* **Different email**: The email in the identity provider differs from the one you entered in OpenMetadata. Check for a different domain, an alias, or a typo. For LDAP, check the value of the mail attribute.
* **Different claim**: **Email Claim** points to a claim that holds something other than the email you used, such as a user principal name that differs from the mail address.
* **Older username matching**: **Email Claim** isn't set, or `jwtPrincipalClaimsMapping` is still configured, so OpenMetadata matches on the username it builds from the token.

To avoid duplicates, create each user with the email address their identity provider returns, and run [Test Login](https://docs.open-metadata.org/v2.1.x/how-to-guides/admin-guide/sso.md#test-login) to check the email OpenMetadata reads. If a duplicate already exists, ask the user to sign out, then delete the new account and fix the email on the original one.

## Related

* [Single Sign-On (SSO)](https://docs.open-metadata.org/v2.1.x/how-to-guides/admin-guide/sso.md)
* [LDAP SSO](https://docs.open-metadata.org/v2.1.x/how-to-guides/admin-guide/sso/ldap.md)
* [Invite Users](https://docs.open-metadata.org/v2.1.x/how-to-guides/admin-guide/teams-and-users/invite-users.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.