K
Kindeβ€’3mo ago
Mario_Luigie

How can I change Kinde user ID in my code?

I create user in my MongoDB after creating user in Kinde Auth with register with Google. I get token from webhook, decode, verify and get payload.data.user. I can not see 'picture' field in user from token. By using getKindeServerSession and getUser I see picture field with path string to picture in google. I would like to create newUser with values from token and save this newUser in MongoDB. Next I want to change kinde user ID for _ID from MongoDB. How can I see 'picture' field in user from token and How can I change kinde user id in my code. Help me, Thank you πŸ™‚
3 Replies
Oli - Kinde
Oli - Kindeβ€’3mo ago
Hey @Mario_Luigie, I can replicate your issue where the user's 'picture' value is not in the payload of a user.created webhook event. I will speak to my team on this and get back to you.
Next I want to change kinde user ID for _ID from MongoDB
Do you want to store your own custom user ID against each user in Kinde? Hey @Mario_Luigie, We have put it on our backlog to add 'picture' value to the user.created webhook event. In the meantime, you can get the 'picture' value of a created user via the Get User API call. Let me know if you have any questions on this.
Mario_Luigie
Mario_Luigieβ€’3mo ago
Thank you so much for your help πŸ™‚ . "Do you want to store your own custom user ID against each user in Kinde?" - Yes, I would like to add my own userId to user in Kinde.
Oli - Kinde
Oli - Kindeβ€’2mo ago
No worries @Mario_Luigie.
"Do you want to store your own custom user ID against each user in Kinde?" - Yes, I would like to add my own userId to user in Kinde.
There are 2 ways to do this. You can either import your IDs against each user through the import feature and add your own userID as provided_id in the import - see here: https://docs.kinde.com/manage-users/add-and-edit/import-users-in-bulk/#other-user-data You can add data to existing users with the import feature as long as you add the identifier of the user (e.g. email). Or, you can add each userID as a property in Kinde - see here: https://docs.kinde.com/properties/about-properties/ You can choose for the property value to be added as a claim to the user tokens when authenticated. Let me know if you have any further questions on this.
Kinde docs
About properties
Our developer tools provide everything you need to get started with Kinde.
Kinde docs
Import users in bulk
Our developer tools provide everything you need to get started with Kinde.
Want results from more Discord servers?
Add your server