https://supertokens.com/ logo
#general
Title
# general
a

ankitzm

03/26/2022, 9:29 AM
I am trying to build a shopping cart in nextjs + supertoken auth(email+password and social login) I am able to do the authentication part successfully. I am just wondering how to store user data like address, previous purchases after authentication
r

rp

03/26/2022, 9:30 AM
Which recipe are you using?
a

ankitzm

03/26/2022, 9:31 AM
Email password + social login
A way to do something post sign up
a

ankitzm

03/26/2022, 9:33 AM
I wa t to store user specific data that will be visible to the authenticated user only
Like their address, mobile number
r

rp

03/26/2022, 9:34 AM
You mean to store info in a session?
So that it can be accessed on the frontend / backend?
a

ankitzm

03/26/2022, 9:34 AM
Yes, how can I store info and display that whenever needed. How to configure database
I have never done this thing
r

rp

03/26/2022, 9:35 AM
So i think there are multiple things here. One, you want to store info against the user ID in the db - that is something you will have to do yourself with your own db
Second, you want to access this info to display it to the user. I would advice not to store info like address in the session cause it's too large. Instead, make an API that does session verification and returns the user info that you want to display to them.
a

ankitzm

03/26/2022, 9:36 AM
Yes but how it can be done 🤕
Do I have to integrate some external db
r

rp

03/26/2022, 9:37 AM
That.. you will have to figure yourself. It's outside the scope of supertokens. We are working on a user metadata feature which will allow you to store info about a user in the db easily, but until then, it's up to you
a

ankitzm

03/26/2022, 9:40 AM
Can I update the postgres db that is used by supertoken
r

rp

03/26/2022, 9:42 AM
> you can. However, that db is only given to you during development env. In prod, you don't have access to supertoken's db (if you are using our managed service)
I would recommend spinning up your own db (you can use heroku or AWS RDS) and then put data in there
a

ankitzm

03/26/2022, 9:44 AM
It didn't have an option to add my own db. Probably that was there at first but I have selected the other option 😢
r

rp

03/26/2022, 9:44 AM
There isn't any option to add your own db anyway for managed service
So there will be two databases: One for supertokens (managed by us), and one for your application - managed by you
a

ankitzm

03/26/2022, 9:46 AM
Was talking about this option, I have selected 'managed by supertoken'
Is there any way to change it
r

rp

03/26/2022, 9:47 AM
The other option is to self host. In this case, you will need your own db + you will need to run the supertokens core yourself. This is more work than just using the managed service
a

ankitzm

03/26/2022, 9:49 AM
Okk, got that. So, I will need an external db that will store user id + other user data, then I can fetch the data from there.
r

rp

03/26/2022, 9:53 AM
yes. Exactly.
a

ankitzm

03/26/2022, 9:54 AM
Thanks a lot for the help ✨
2 Views