Only sign up user if own backend allows it and send (sub, email, username)

Hey I got some questions regarding my usecase:
I want to gather data (auth0_sub, email, username) and send it to my backend to create a user with said fields. I then send back the associated internalId from my backend as a response and put it into app_metadata. If theres no correct response the user should not get signed up.

Two problems:

  • With the pre user registration hook I only get the email send to my backend, no auth0 sub? When I was using rules that worked though. Is it because rules run after registration when theres a auth0 sub created? Are you all querying data for your users based on their email?
  • Do pre user registration actions only run for Auth0 registrations? The calls made from the action are not being made for Spotify registrations. That way I literallly can’t track if a user signed up using Spotify for example…

I am stuck in a loop. I can use pre user registration actions for getting an internalId into the app_metadata of the user and use that to fetch data. But then Spotify users aren’t registered at my backend. For that I would need post user registrations I assume, but in that case, I can’t deny registration if something fails on my backend. Plus the @nextjs-auth0 useUser() hook doesn’t provide the app_metadata. Heavily disappointed by how all this is documented somehow… Googling and writing for days now. A seperated frontend/backend is industry standard though, how do these need custom actions and what not?

This is my current action: