com.auth0samples.auth0://{yourDomain}/ios/com.auth0samples/callback
com.auth0samples.auth0://{yourDomain}/android/com.auth0samples/callback
yarn
, check their official documentation.react-native-auth0
plugin will be added in the Expo config.useAuth0
hook relies on a React Context to provide state management. This context is provided by
the Auth0Provider
component.Import the useAuth0
hook and Auth0Provider
component from the
react-native-auth0
package:Auth0Provider
component, and
set the following properties:domain
: The domain of your Auth0 tenant. Generally, you can find this in the Auth0 Dashboard
under your Application’s Settings in the Domain field. If you are using a custom domain, you should set this to the value of your
custom domain instead.clientId
: The client ID of the Auth0 Application you set up earlier in this quickstart. You can
find this in the Auth0 Dashboard under your Application’s Settings in the Client ID field.Auth0Provider
component should now be properly configured. Run your application to
verify that:authorize
method provided by the useAuth0
hook.
This redirects the user to the Auth0 Universal Login page
for authentication, then back to your app.For confirmation that the user was logged in successfully, check that the user
property provided by
the hook is not null
.authorize
when clicked. Verify that you are redirected to
the login page and then back to your application.clearSession
. This will
remove their session from the authorization server and log the user out of the application.clearSession
and observe that you are redirected to the Auth0
logout endpoint and back again. You should no longer be logged in to your application.useAuth0
hook exposes a user
object that contains information about the
authenticated user. You can use this to access user profile information about the authenticated user that has been
decoded from the ID token.If a user has not been authenticated, this property will be null
.user
property on the result. Verify the current user’s profile
information, such as email
or name
.