How to display error if backend not available during Rules / Actions?

Hi there,

For my application (React / Golang), I’m using Auth0 with a Social authentification (using Github), and to create the user account into my database (and to do some init on this account like sending an e-mail, generating some settings and so one), I used the custom rules / flows.

So I implement the Post login flow with a custom action, that will send a callback to my API (with a specific token), including the user informations in the request.

My question is : now when my backend is not available, Auth0 will send a lot of request (infinite loop), and I can see it in my logs. I want to avoid this case.

There is a way to return an error with this custom rule, of display a Auth0 default page, or something like this, to avoid this infinite loop ? I can’t find anything related to this in the example provided.

This is my Rules / Action content :

exports.onExecutePostLogin = async (event, api) => {
  const axios = require('axios');

  await axios.post('https://mybackend.endpoint.fr', event.user,
                   { headers: { 'Authorization': MY_SECRET_TOKEN }}
                  );          
};

Thanks in advance for your help,

Regards,
Florian

Hey there!

As this topic is related to Rules - Hooks - Actions and Rules & Hooks are being deprecated soon, I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!