Hi, I tried to override the `consumeCode` function...
# support-questions-legacy
b
Hi, I tried to override the
consumeCode
function and returned a custom id in
response.user.id
but still got a generated userId in my
passwordless_users
table. Is it okay to really override the stored userId or should I simply override
getUserByEmail
,
getUserById
,
getUserByPhoneNumber
and
updateUser
functions so they return the correct Id ?
r
hey! You would have to override all the recipe functions to return your mapped user ID.
In fact, we are building this feature (called user ID mapping) out now. You can see this PR for changes to the passwordless recipe functions: https://github.com/supertokens/supertokens-node/blob/adds-useridmapping/lib/ts/recipe/passwordless/recipeImplementation.ts Perhaps it will help you override the functions and get this to work until we release the feature ourselves.
Whats the requirement for doing this though?
b
Okay that is super helpful ! I am trying to match the id we have in our current
user
table in our new
passwordless_users
so we don’t have different values
r
ah fair enough
b
I am not really getting what
/recipe/userid/map
does ? Do you have any updated doc or is it not done yet ?
r
not done yet, but that essentially queries the core to get the mapping information for the given user ID. This mapping info is to be stored in your own table at the moment since we have not released this feature yet.
So instead of querying the core, you want to query your own db
b
It means that you are overriding the supertokens userid in your db with the external one ?
r
No. We maintain a mapping of supertokens user ID to an external one.
Just like how you would maintain a mapping
b
Okay, I think I get it now. Thank you πŸ™ Sorry for asking so many questions !
r
Happy to help πŸ™‚ Please feel free to ask more!
5 Views