Question about using Auth0 login and storing associated user data into external database for website project

Hi, I’m developing a website using auth0 as my login authenticator. My website allows users to create an account and sign in, where they’re able to create a list of items. Currently, my project is deployed on heroku, with my cleardb mysql as the database for my backend data (like the list). I know this question is quite broad and may sound silly to some (I’m very new at web dev), but once a user signs in and creates a list, how can I have the website store and remember the list they made the next time they sign in? Do I just pass the auth0 id as a primary key to my cleardb mySQL database with the list data they created while signed in?

If so, how can I do this? Is this possible using the free plan? This is different from the paid plan custom database connection correct?

Hi @zanderphi

There are two approaches: you can add the Auth0 user ID to your clearDB, or your can put your clearDB user ID in Auth0.

When you log in with Auth0, you get an ID token back. That ID token will have the Auth0 user ID in it. You can then use that with clearDB.

Or you can add an action that calls an API (that you would write) when a user is first created, grabs your clearDB user ID and adds that to the user’s app_metadata. Then a second action that adds that field to the ID token. Then it is available after login.

Both methods should be feasible with the free plan.



Thanks John for helping on this one!

Thanks for sharing that @Moore69 !

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.