How to add more custom fields to response of okta API

I am using okta o login and here is the api end point I am calling.

https://xxxxxx.okta.com/api/v1/authn

On the Body

    {
      "username": "xxxxx.merchops.user@gmail.com",
      "password": "Y8m78wZ4",
      "options": {
        "multiOptionalFactorEnroll": true,
        "warnBeforePasswordExpired": true
      }  
    }

I am getting this response.

{
    "stateToken": "00Son-f5Lqr7DxW7cssyVXpLvrqk8Nk8EUPtNP8jpF3m",
    "expiresAt": "2021-05-18T07:21:21.000Z",
    "status": "PASSWORD_EXPIRED",
    "_embedded": {
        "user": {
            "id": "xxurml4yuzhZe5h2A5d6",
            "passwordChanged": "2021-05-18T06:01:57.000Z",
            "profile": {
                "login": "xxxxx.merchops.user@gmail.com",
                "firstName": "chewy",
                "lastName": "Merchops",
                "locale": "en",
                "timeZone": "America/Los_Angeles"
            }
        },
        "policy": {
            "complexity": {
                "minLength": 8,
                "minLowerCase": 1,
                "minUpperCase": 1,
                "minNumber": 1,
                "minSymbol": 0,
                "excludeUsername": true
            },
            "age": {
                "minAgeMinutes": 0,
                "historyCount": 4
            }
        }
    },
    "_links": {
        "next": {
            "name": "changePassword",
            "href": "https://xxxxxxx.okta.com/api/v1/authn/credentials/change_password",
            "hints": {
                "allow": [
                    "POST"
                ]
            }
        },
        "cancel": {
            "href": "https://xxxxxxxx.okta.com/api/v1/authn/cancel",
            "hints": {
                "allow": [
                    "POST"
                ]
            }
        }
    }
}

If I want to add phone number also to the response json what I have to do?

I am expecting something like this. Note that the phone number field on the response json which I am expecting from okta api.

        "profile": {
            "login": "xxxxx.merchops.user@gmail.com",
            "firstName": "chewy",
            "lastName": "Merchops",
            "locale": "en",
            "timeZone": "America/Los_Angeles"
            "Ph":"814744444xx"
        }

How can I do that?

@amadhu Hi, are you trying to add a phone number for the user?
Did you try to add it via profile editor?
Alternatively, you can try PUT method with your attribute. Please see the below API doc.
https://developer.okta.com/docs/reference/api/users/#update-user

I have added etc columns using profile editor but those columns are not coming on result json object.

@amadhu You can do a request to /api/v1/users/:userId The response will contain phone info in profile.

What could be the request json Which i have to put on body?

@amadhu You can do a second call with GET user. The api sample is in the below link.
https://developer.okta.com/docs/reference/api/users/#get-user-with-id

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.