How to use JWT authentication system ?
Note: The essence template uses the firebase authentication system by default.
-
Step-1 : Open the
src/app/layout.jsxfile then import the AuthProvider fromsrc/contexts/jwtContextand wrap the Root Layout component with it. -
Step-2 : Open the
src/hooks/useAuth.jsfile. Thereupon, import the AuthContext fromsrc/contexts/jwtContextthen pass AuthContext as a argument in useContext hook. -
Step-3 : Call the useAuth hook inside AuthGuard, GuestGuard components, Login, Register page etc.
Step 1
Step 2
Step 3
How to delete from app ?
- Delete the
jwtContext.jsxfile fromsrc/contextsfolder - In addition, if you use this, remove it from the
src/hooks/useAuth.jsfile.