This article describes how to use Okta Expression Language (EL) to convert an email-based username from one domain to another (for example, username@domain1.com to username@domain2.com). It clarifies the process of replacing specific string patterns within a user attribute to modify the application username format.
- Okta Expression Language
- Application Username Format - Custom
- Single Sign-On (SSO)
Follow the video or the steps below:
To convert a username such as "jdoe@example1.com" to "jdoe@example2.com", use the String.replace expression.
- Navigate to the application settings.
- Locate the Application username format field.
- Select Custom from the dropdown menu.
- Enter the following expression into the field:
String.replace(user.email, "example1", "example2"). - Save the changes.
NOTE: The syntax for this function is String.replace(Attribute, match, replacement).
