Not able to update the phone_number attribute for users with SMS connection

Every time I try to update an user phone_number with the management API I get this error:

Bad Request: Can only update phone_number for auth0 connections with attribute configuration enabled and options.attributes configured.

What am I missing here on the configuration?
Couldn’t find any docs talking about this.

Hey there @othecos welcome to the community!

Just to clarify, this is a passwordless user (sms) for which you are attempting to update the phone_number attribute - Are you using the /api/v2/users/{id} endpoint?

Hey @tyf ! Thank you for the quick response!

First, yes, I’m trying to update a passwordless user (sms) phone_number.

Secondly, I’m using the Node.js Sdk to make the call.

This is the code I’m running

import {  ManagementClient } from 'auth0';
const authzManagementClient = new ManagementClient({
        domain: this.configService.get<string>('auth0.managementApi.domain') || '',
        clientId: this.configService.get<string>('auth0.managementApi.clientId') || '',
        clientSecret: this.configService.get<string>('auth0.managementApi.clientSecret') || '',
        scope: this.configService.get<string>('auth0.managementApi.scope') || '',
      });
return authzManagementClient.updateUser({ id: auth0Id }, { phone_number });

It works for a development tenant that I have, but for the production tenant it throws the error message I described in the topic. I don’t recall doing any different setup for the development tenant, so I’m really confuse about the error message.

1 Like

No problem, happy to help!

Thanks for the additional context :slight_smile: The fact that you only get the error in the production tenant makes me believe it related to a feature flag of sorts. Let me dig into this a bit internally and get back to you!

1 Like

Hey @othecos , quick update here - We took at look at your tenants and don’t see any differences there that could be causing this. Do you mind sharing the ID of the user via DM? I’m also curious if you can update the phone number on the sms connection user using the Management API endpoint directly?

Thanks for your patience!

Following up on this:

This error could happen for an SMS Connection user under the following scenario:

  • User profile with two linked identities: 1) auth0 db connection as the primary identity 2) sms connection as the secondary identity
  • PATCH /api/v2/users/{id} with a phone_number in the payload, but no connection parameter specified.

When no connection parameter is specified in the payload, the primary identity’s connection is used. However, if that is a regular db connection without Attributes configured, this error would show up.

@tyf Hey! Thank you for the response!

I’ve been busy with other requests, thus I haven’t checked this in a while!

So, we saw that the users that are facing this have both SMS and DB connections.

To be able to update those users, what is the correct approach then?

Simply specifying the type of connection would solve the issue?

PATCH /api/v2/users/{id} with a phone_number in the payload, but and connection sms ?

And again, thank you for the response!

1 Like

@tyf Update! Tried the PATCH with the connection type equal SMS and it worked!!

Thank you for all the help!

1 Like

Hey @othecos that’s awesome! Happy to hear and thanks a bunch for following up to confirm here :slight_smile:

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