Problems with 'Post User Registration' action

I have set up two ‘flows’ each of which calls the same AWS lambda via an API Gateway.
The ‘Login / Post Login’ flow works perfectly.

However, the ‘Post User Registration’ one does not. If I login ‘using Google’ Autho creates an entry in the user table but the action is not triggered. Is it meant to be?

If not, how do I catch the first login using a social login?

Hi @clarotech :wave:

Thanks for reaching out on the Community!

The Post User Registration action will only run after a user has been created for a Database or Passwordless connection. You can find details on this restriction in the following documentation:

To achieve similar with a social connection, I would recommend leveraging a Post Login Action and checking against the number of logins and the connection type.

E.g. something along the lines of:

exports.onExecutePostLogin = async (event, api) => {
  if (event.stats.logins_count === 1 && event.connection.name === CONNECTION_NAME) {
   // Do something here..
 }
};

You can find a full list of the properties exposed on the event object for the Post Login Action via the following link:

I hope this is helpful! Let me know how you get on.

2 Likes

Thanks @james.merrigan your suggested approach is very similar to the one I implemented as a temporary workaround, looks like it might become permanent.

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