Actions Triggers: custom-phone-provider Event Object: organization is undefined

When using custom phone provider, in the trigger, the event object always have an organization set to undefined, context:

  • documentation explicitly says the organization field should be present (given an organization is sent to the /authorize endpoint) : https://auth0.com/docs/customize/phone-messages/configure-phone-messaging-providers/configure-a-custom-phone-provider/actions-triggers-custom-phone-provider-event-object
  • i’m using new universal login experience
  • client is set with the following terraform config:
  organization_usage             = "require"
  organization_require_behavior  = "no_prompt"
  • organization name is send to the /authorize endpoint (and allow_organization_name_in_authentication_api is enabled for the tenant)
  • i’ve tried using the organization id for the /authorize endpoint without more success
  • org login works well with other auth method (email, username/password, social, …) on the same client
1 Like

Trigger action code is dead simple:

exports.onExecuteCustomPhoneProvider = async (event, api) => {
  console.log(event);
};

then in “Actions Logs” event.organization is undefined (as well as event.connection… which might be a related bug :thinking:)

Hi @shurel

Welcome to the Auth0 Community!

I want to clarify some things before moving forward:

  • Inside the custom phone provider action settings, have you not configured the action with the provider’s settings or is the code provided above an example of how are you logging the event?
  • Are you trying to log in using SMS as an MFA factor?
  • The organization and connection details should be available in the CustomPhoneProvider action since it is being executed, however they should also show up whenever you trigger an send-phone-message action (which needsa to be set up with a custom phone provider)
  • Does the console log appear after the successfull login or during the Test on the custom phone provider page

Kind Regards,
Nik

hello @nik.baleca
thanks for your reply

Inside the custom phone provider action settings, have you not configured the action with the provider’s settings or is the code provided above an example of how are you logging the event?

i have configured Twillo inside the action handler (roughly the same as the example given in auth0’s documentation here: https://auth0.com/docs/customize/phone-messages/configure-phone-messaging-providers/configure-a-custom-phone-provider/configure-a-custom-phone-provider-with-twilio-verify)

Are you trying to log in using SMS as an MFA factor?

no, i’m trying to use passwordless authentication with SMS

The organization and connection details should be available in the CustomPhoneProvider action since it is being executed, however they should also show up whenever you trigger an send-phone-message action (which needsa to be set up with a custom phone provider)

passwordless auth works properly, the action is executed, i receive the SMS with the OTP code and can login properly, just the organization details are missing in the event received in the action

Does the console log appear after the successfull login or during the Test on the custom phone provider page

yes, the console.log given in my example successfully appears in the dashboard “Monitoring > Action logs (beta)”

Let me know if you need more details :slight_smile:

Hi again!

Just to make sure we are on the same page.
What action are you talking about?
Are you talking about the send-phone-message action? If yes, that action does not contain the event.organization or event.connection parameters

If you are talking about the code window when setting up the custom phone provider via Branding → Phone Provider → Custom, then this is the action window which will have event.connection and event.organization available, as mentioned in the documentation you have linked.

Otherwise, if you indeed log them inside the custom phone provider action window and they appear to be empty, could you please provide me through a DM the tenant name on which you have configured it so I can take a look for myself on the configuration?

Kind Regards,
Nik

Hello,
sorry, I thought the exports.onExecuteCustomPhoneProvider code was explicit enough, yes i’m referring to the Branding → Phone Provider → Custom code section page, i send you a dm right now

Hi again @shurel

I am very sorry about the delayed response to your inquiry on the matter!

I was able to fully reproduce the issue at hand on my personal tenant. Indeed, it appears that even though the documentation states that those properties are available, they seem to be returned as undefined.

I will reach out internally regarding this matter to get some additional information on the behaviour at hand, for the time being, if you wish to return those properties during a login, I would advise to create a PostLogin Trigger where you console log those properties and they should be visible.

In the case of the sms connection, it should contain only a connection_id, name and strategy, the latter two should be sms. In conclusion, these properties are available after the login is completed, however, the action window for the custom sms provider is not able to access them.

If you have any other questions on the matter, feel free to let me know!

Kind Regards,
Nik

Thanks for getting back to me,
The plan was to select different phone provider based on the organization to send the SMS OTP, so post-login action seems to be too late in the auth flow for that. Anyways, let me know if this is an issue that will be fixed or if the documention is misleading.

Got it. For your use case and for the time being, I would advise to set the orgnaization name or id inside the user metadata so that it can be accessed inside the event.user object. Let me know if the proposed solution is a valid workaround.

Currently, I am still waiting for the matter to be investigated, in case this topic is closed by that time (hopefully not), I will send you a DM with the update or open the topic again and post it here.

Kind Regards,
Nik

hello, given a not yet registered user trying to login with sms for the first time, the user does not exists, so I can’t use its metadata during the action :confused:

I see, I completely overlooked that. :sweat_smile:

Currently, I am still waiting for an update regarding the custom provider action window, I am sorry for the delay!

Kind Regards,
Nik