Signing out

To sign a user out, we use the signOut function returned from withDoormanUser or useDoormanUser.

For a full walkthrough of these functions, see accessing the current user.


import React from 'react'
import { Text } from 'react-native'
import { useDoormanUser } from 'react-native-doorman'

const UserDetails = () => {
  const { signOut } = useDoormanUser()
  return <Text onPress={signOut}>Sign Out!</Text>

export default UserDetails

withDoormanUser and useDoormanUser should only be used on screens that show up after a user has signed in. If you use either one in a component when the user hasn't authenticated yet, it will throw an error.

Last updated