We are assigning a unique company id to users that register on our Auth0 and then put that id into access tokens that those users will then use to access our APIs.
The action flow is simple:
- Pre-registration: Auth0 calls an endpoint on our infrastructure which creates a new user in our database and returns the company id to Auth0. The action will store that company id as user_metadata.
- Login: The login flow will read the company from user_metadata and add it as custom claim to our access tokens.
Works pretty well and we have that company id available on the first login. However, as the pre-registration action flow doesn’t work with social logins, how can we implement that functionality there?