Automatic

The easiest way to manage users in your app is to use the provided SignIn component. This will automatically show all the available login methods you've added in your dashboard, handle login, and show a signout button when the user is logged in (optional).

Use it anywhere like this:

import SignIn from '../components/SignIn'

...

<SignIn />

Then you can use the user information in any component or page with the currentUser provided by the app context

import { useAppContext } from '../Context' //If you're in a subfolder, adjust the path

...

const { currentUser } = useAppContext() 

...

const isAuthenticated = (currentUser != null)
if (isAuthenticated) {
    const firstName = currentUser.firstName
    const userId = currentUser.userId
}

Last updated