mobilePhone not being returned in oktaAuth.getUser

Hello,

I’m currently instantiating an oktaAuth as follows:

const oktaAuth = new OktaAuth({
  issuer: `https://dev-xxx.okta.com/oauth2/default`,
  clientId: 'xxx',
  scopes: ['openid', 'profile', 'email', 'phone'],
  restoreOriginalUri: async () => {
    window.location.href = window.location.origin + DASHBOARD;
  }
})

For signup, the self registration form has a non-required mobile phone field. During testing, I entered a number in this field and it’s showing up on the okta user profile, however, for the logged in user, when trying the following:

oktaAuth.getUser().then((res) => console.log(res))

phone_number does not show up (other fields such as email and name do).

In your self service registration configuration, did you use primaryPhone for the field or did you add a custom attribute?

@okra-okta I’m using the mobilePhone field as follows:

I think I tried with primaryPhone as well, and the same issue happened. but we want to use mobilePhone if possible

Can you check if either of those user profile attributes are mapped to the phone_number attribute on the app user profile?