Auth0 Home Blog Docs

External API call to create user in my own service after user login via Social IDPs

Hi,

I’m looking for a perfect solution to create user in an external microservice after user login via Social IDPs. I found 2 solutions after some research

  1. Use post registration hook, but it is not available for login via Social IDPs
  2. Use rules, i.e to add a custom rule to call the external API.

Using a rule will be the ideal solution right? Also need to know whether rules will work as expected if we are using embedded login (custom UI hosted on our own domain and then calling auth0 API for auth)

As you mentioned, hooks would need to be excluded from the list of possible solutions because at this time they will not be triggered social connections.

Due to the above, using a rule, which is triggered for all connection types after initial authentication is performed would be an adequate place to perform this operation. Just have in mind that the rule should have logic to guarantee that this call is only performed once, for example, it could use a flag stored within user app_metadata that indicates if the user was already created externally.