I am trying to build a shopping cart in nextjs + s...
# general
a
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
Which recipe are you using?
a
Email password + social login
A way to do something post sign up
a
I wa t to store user specific data that will be visible to the authenticated user only
Like their address, mobile number
r
You mean to store info in a session?
So that it can be accessed on the frontend / backend?
a
Yes, how can I store info and display that whenever needed. How to configure database
I have never done this thing
r
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
Yes but how it can be done 🤕
Do I have to integrate some external db
r
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
Can I update the postgres db that is used by supertoken
r
> 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
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
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
Was talking about this option, I have selected 'managed by supertoken'
Is there any way to change it
r
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
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
yes. Exactly.
a
Thanks a lot for the help ✨
6 Views