Post-user-registration trigger for actions not called

Yes I was still able to reproduce this issue :thinking: I did it a couple times, in the screen shot you can confirm that only the login action was triggered, but it’s okay because I liked that workaround!!!

In the other hand, that workaround worked perfectly! I’ll stick to that giveen that it works with social login too, thanks a lot🙌🏽

I’m sharing the code I used in a post-login action, since it uses the api object to update user app metadata, might help someone

const axios = require('axios')
exports.onExecutePostLogin = async (event, api) => {
  // if user has app_metadata and signupProcessed = true, then we don't need to create the user
  if (event.user.app_metadata && event.user.app_metadata.signupProcessed) {
    console.log('User sign up has been processed already')
    return
  }

  try {
    // query app api to store user info
    const { data } = await axios.post('https://yourapi.test/api/user', {
      auth0UserId: event.user.user_id,
      email: event.user.email,
      name: event.user.name,
      picture: event.user.picture
    })
    console.log('User created', data)
    // if everything went well then update signupProcessed to true
    api.user.setAppMetadata('signupProcessed', true)
  } catch (err) {
    console.error(err)
  }
};
3 Likes