<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z00009n8mDpCAIOkta Classic EngineAdministrationAnswered2025-11-15T09:00:48.000Z2023-11-01T15:32:54.000Z2023-11-02T18:07:30.000Z

2n6tk (2n6tk) asked a question.

How to set a custom username format via API

I'm automating the addition of apps in Okta via the API. I've successfully created some OIDC apps but the active directory username that comes through isn't the right one (seems to be made up of the users internal OKTA user ID). I can manually change the mapping so that the username comes from active_directory.samAccountName and then Apache can use "OIDCRemoteUserClaim" to ask for "preferred_username".

 

This works but I'd like to be able to do this via the API. After making the change manually, the app definition is updated to have this block:

 

    "credentials": {

        "userNameTemplate": {

            "template": "active_directory.samAccountName",

            "type": "CUSTOM",

            "pushStatus": "NOT_CONFIGURED"

        },

 

.. but if I try to create an app with this block, I get an error 500. Is there a way I can do this via the API?


  • Hello @2n6tk (2n6tk)​ Thank you for reacting out to our Community!

     

    The reason for this could be the fact that the OIDC application by default does not have a Username section. What I would recommend is to create the app and user another API to update where the fields should be there end editable.

     

    My advice would be to leverage the Okta Developer forums for this type of questions and take advantage of their expertise.

    https://devforum.okta.com/

     

    Community members help others by clicking Like or Select as Best on responses. Try it today.

     

    What you missed: new product releases and other announcements

    Expand Post
This question is closed.
Loading
How to set a custom username format via API