Skip to content

we’re gonna JWT Authentication system example with LocalStorage, React Router, Axios and Bootstrap (without Redux).

Notifications You must be signed in to change notification settings

thamerh/authentification-with-JWT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

authentification with jwt

we’re gonna JWT Authentication system example with LocalStorage, React Router, Axios and Bootstrap (without Redux). I will show you:

  • JWT Authentication for User Signup & User Login
  • Project Structure for React JWT Authentication (without Redux) with LocalStorage, React Router & Axios
  • Creating protect route in react components (requires a token for open)
  • for accessing protected Resources in react component (Authorization) :
const axiosJWT = axios.create();
 axiosJWT.interceptors.request.use(async (config) => {
         const Token = JSON.parse(localStorage.getItem("token"));
         config.headers.Authorization = `Bearer ${Token}`;
     return config;
 }, (error) => {
     return Promise.reject(error);
 });

 const GetResources= async () => {
     const response = await axiosJWT.get('server Resources routes', {
         headers: {
             Authorization: `Bearer ${token}`
         }
     });

Technologies

  • React
  • Node
  • Express
  • mysql
  • sequelize

Author

  • Thamer Hamdi

About

we’re gonna JWT Authentication system example with LocalStorage, React Router, Axios and Bootstrap (without Redux).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published