How to Store Google authenticated users into a custom database?

Hi @devgiri0082,

There are a few ways to go about this.

  • After the user logs in your application receives a set of tokens. Your application will then query your DB for the user in the token and if it doesn’t exist, add the user to the DB.

OR

  • Use a Post Login Action to send a request to your backend/DB when a Google user logs in. This will require you to manage some state describing if the user has been added to the database or not. For this, you could add a flag to the user’s app_metadata after successfully making the request. You could also use this flow for all of your users if you want consistency.

Let me know if you have any questions.

1 Like