https://supertokens.com/ logo
Get user metadata
d

devcoelho

03/20/2023, 6:14 PM
@rp I trying to get a user by the metadata value. For example, my users have a metadata field "stripe_customer_id" and I want to get a user by this value. I'm using ThirdPartyEmailPassword recibe but I can see only
getUserById
and
getUsersByEmail
n

nkshah2

03/21/2023, 3:57 AM
Hi @devcoelho, You need to use the user metadata recipe for this. Refer to this part of the docs: https://supertokens.com/docs/thirdpartyemailpassword/common-customizations/usermetadata/get-data
d

devcoelho

03/21/2023, 3:59 AM
Hi @rp . This will retrieve the user's metadata only. I need the user itself. For example:
ThirdPartyEmailPassword.getUserByMetadata("field", "value")
n

nkshah2

03/21/2023, 3:59 AM
Is the stripe customer id the same as the user id that SuperTokens creates?
d

devcoelho

03/21/2023, 4:01 AM
No
n

nkshah2

03/21/2023, 5:29 AM
Right so at the moment it is not possible to search for a user with a property in the user meta data.
d

devcoelho

03/21/2023, 6:54 AM
Do you have plans to implement the feature? I'm migrating 200K users from Auth0 to SuperTokens, but it won't be possible because of these limitations.
r

rp

03/21/2023, 6:55 AM
You could store the metadata in your own db against the user ID and search in there. > Do you have plans to implement the feature? Perhaps in the next few months, but not earlier.
d

devcoelho

03/21/2023, 6:56 AM
ok, thanks!