http://localhost:3000
.http://localhost:3000
.http://localhost:3000
.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 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.authorizationParams.redirect_uri
: The URL in your application that you would like Auth0 to
redirect users to after they have authenticated. This corresponds to the callback URL you set up earlier in
this quickstart. You can also find this value in the Auth0 Dashboard under your Application’s Settings in the
Callback URLs field. Make sure what you enter in your code matches what you set up earlier or your users will
see an error.useAuth0()
custom React Hook. If you are using class
components, check out these samples using thewithAuth0()higher-order component.login.js
for the login button component, and copy in
the code from the interactive panel to the right, which contains the logic needed for login. Then, update your
index.js
file to include the new login button.authorizationParams.redirect_uri
you used to configure the Auth0Provider.
logout.js
for the logout button component, and copy in
the code from the interactive panel, which contains the logic needed for logout. Then, update your
index.js
file to include the logout button.user
property. Review the
profile.js
code in the interactive panel to see an example of how to use it.Because the user
property contains sensitive information related to the user’s identity, its
availability depends on the user’s authentication status. To prevent render errors, you should always:isAuthenticated
property to determine whether Auth0 has authenticated the user before
React renders any component that consumes the user
property.isLoading
is false before accessing
the isAuthenticated
property.user.name
or any other user property within a component correctly
after you have logged in.