How to use JWT authentication system ?
Note:
The uko template uses the firebase authentication system by default.
-
Step-1 : Open the
src/app/layout.jsx
file then import the AuthProvider fromsrc/contexts/jwtContext
and wrap the Root Layout component with it. -
Step-2 : Open the
src/hooks/useAuth.js
file. Thereupon, import the AuthContext fromsrc/contexts/jwtContext
then 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.jsx
file fromsrc/contexts
folder - In addition, if you use this, remove it from the
src/hooks/useAuth.js
file.