How to use Auth0 ?
Note:
The quickframe template uses the firebase authentication system by default.
-
Step-1 : Sign up for an account on Auth0 (opens in a new tab). After that, get the
client id and domain
from the dashboard and put them in the.env
file. -
Step-2 : Open the
src/hooks/useAuth.js
file. Thereupon, import the AuthContext fromsrc/contexts/auth0Context
then pass it as an argument in the useContext hook. -
Step-3 : Call the useAuth hook inside AuthGuard, GuestGuard components, Login, Register page etc.
Step 1
_10REACT_APP_AUTH0_CLIENT_ID= SET YOUR CLIENT ID_10REACT_APP_AUTH0_DOMAIN= SET YOUR DOMAIN
Step 2
_10import { AuthContext } from "contexts/auth0Context";_10_10const useAuth = () => useContext(AuthContext);_10export default useAuth;
Step 3
How to delete from app ?
- Delete the
auth0Context.jsx
file fromsrc/contexts
folder - You should also delete the AuthContext file from the
src/hooks/useAuth.js
file if you use this. - Also delete the REACT_APP_AUTH0_CLIENT_ID & REACT_APP_AUTH0_DOMAIN from
.env
file. - Uninstall dependecies @auth0/auth0-spa-js (opens in a new tab)