Slack provisioning flow fails with the following error visible in the Okta dashboard:
Automatic provisioning of user <user> to app Slack failed: Error while trying to push profile update for <user>: Errors during execution: Error executing pushUserProfile: Bad Request. Errors reported by the connector : {"Errors":{"description":"long_username (user=<user>)","code":400}}. Error Code: null.
- Slack
- Provisioning Error
- Okta Expression Language (OEL)
Use a custom Okta expression that shortens the username to 21 characters or less. If the "Slack Username" is seen in the attribute list, this will need to be updated to reflect the same 21-character limit.
For example:
String.len(String.substringBefore(user.email, "@")) > 21 ? String.substring(String.substringBefore(user.email, "@"),0,21) : String.substringBefore(user.email, "@")
If authenticating Slack via SAML, it may also be necessary to apply this same expression to the Application username format in the Sign-on settings to avoid the Slack Display Name attribute being overwritten by the old 22+ character username.
NOTE: This expression will not work if multiple users are assigned to Slack whose email addresses start with the same 21 characters. Manual intervention will be required to ensure uniqueness for these users.
Please try manually entering the app username to a unique Slack username of a maximum of 21 characters and retry the failed app assignment/provisioning task from the Tasks page.
If the above method is not preferred, please perform the following:
- Unassign the user from the application temporarily.
- Ensure the username correction is within the user profile.
- Reassign the user to Slack for a profile creation push downstream.
