This guide assumes that you've already got your MessageMedia API credentials. If you don't, you can sign up for them for free over here.
Make sure the SMS Passwordless connection is enabled by going to Connections → Passwordless in your Auth0 account and switch it on. You can configure everything through the UI except for choosing a different provider. You can enter dummy values for Twilio SID and AuthToken.
To change the provider to MessageMedia, you need to use the Management API. To get an access token, go to the API Explorer tab of your Auth0 Management API. You can use the API Explorer directly, curl or Postman.
If you use the API Explorer, you need to add the access token and tenant URL to it:
Using your access token, make a GET request to https://{YOURTENANT}.auth0.com/api/v2/connections
to find out the ID for your SMS connection. You can make that request in the API Explorer by clicking Try.
Go through the returned JSON to find the connection named sms
and take note of the ID to use in the next step. Also, copy the options
object.
Next, make a PATCH request to https://{YOURTENANT}.auth0.com/api/v2/connections/{CONNECTION_ID}
, using the connection ID you found. You can do that in the API Explorer. The body of the request must be the existing options
object with these edits: remove twilio_sid
and twilio_token
and instead add the following entries.
"provider": "sms_gateway",
"gateway_url": "https://auth0-api.messagemedia.com/messages",
"gateway_authentication": {
"method": "bearer",
"subject": "{YOUR_API_KEY}",
"audience": "{YOUR_API_SECRET}",
"secret": "MessageMedia"
},
"from": "{SENDER_PHONE_NUMBER}",
Enter your Message Media API key and secret as subject
and audience
in the gateway_authentication
section. The secret
is hardcoded to the string MessageMedia
. from
is the sender's phone number.
Send the request (Try in the API explorer) to store the configuration.
Once that's done, you can change to the Try tab in the Auth0 UI for the SMS Connection, enter your phone number and hit Try. An authentication code message should arrive on your phone.