I just created a web hook for post user registration. In the user.id property I only get the GUID of the user and not the full user_id. (i.e. user_id on profile page: auth0|5d8b1128fe2e260e0d96e369, in the hook I only get the guid part (5d8b1128fe2e260e0d96e369). All after the pipeline |). Is this by design?
Is there an other way to get the full user_id field in the post registration hook?
Background:
In the id_token and access_token the sub claim use the whole user_id field (as shown in the profile page). We are using the sub claim in the token to get internal data. But if we cannot get the full user_id in the post registration we need to filter out the auth0 or text in front of the pipeline. It would be nice to know if the user are using auth0, google or other provider to signup.
From what I understand, this behavior is due to the fact that hooks only run with database connections, and it is safe to assume that the database prefix can be used.
I noticed this behavior as well. Unfortunately it is not documented anywhere in the post registration user hook guide or concepts. I was able to solve my issue by checking for the presence of "auth0|" in the user.id param and prefixing it manually in my code.
My problem was that we also uses social connector. When these are used the prefix will be “auth0|” or “google|” in the user_id based on the type authentication method selected on register. But I don’t know how to see if the user is a google user or a auth0 user. Perhaps there is a property I cannot see?
Our solution was to move the code from web hook to rules. The rules are triggered for every logon. We just fixed our code to handle this instead.
Glad you found a solution. I think my wording was a bit confusing. To clarify, you can’t use hooks with a social connection, only a db connection. This means you can assume the prefix is auth0|.