Add user to the database
You probably want to know how to add a user to your database after they authenticate. With Doorman, that's simple.
If you already have your own logic set up for adding users to your database, then you might not need this guide, but we still recommend reading through it.
Want to skip to the real code example? Click here.
Core Concepts
There are typically two separate steps to a user signing in to an app:
Authenticate: Let the user verify their identity and securely enter your app (this is what Doorman does).
Add user to database: Most apps want to collect information from users after they authenticate, like a name, profile picture, etc. In order to do so, once a user has authenticated, you will probably do the following steps:
Make a request to your database, and check if the user exists/has completed onboarding.
If the user exists, send them into your app.
If the user does not exist, send them to an onboarding flow.
Visualization
How to add user to DB
Adding your user to the database with Doorman is easy. It just requires a few extra steps after the initial set up.
Oversimplified example
This is an oversimplified version of the logic we want to create:
In a component, this oversimplified code might look like this:
This screen would show up after your user has authenticated.
Real code example
Let's continue to the next page to see how to implement this in real code with Doorman:
Last updated