{"id":21838831,"url":"https://github.com/douglasmatosdev/barber-shop-01","last_synced_at":"2025-03-21T15:19:40.150Z","repository":{"id":108345292,"uuid":"494874628","full_name":"douglasmatosdev/barber-shop-01","owner":"douglasmatosdev","description":null,"archived":false,"fork":false,"pushed_at":"2022-10-22T22:15:38.000Z","size":516,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-19T12:55:21.773Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://barbershop-01.netlify.app/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/douglasmatosdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-21T19:17:39.000Z","updated_at":"2023-03-04T01:58:03.000Z","dependencies_parsed_at":"2023-03-26T16:02:43.246Z","dependency_job_id":null,"html_url":"https://github.com/douglasmatosdev/barber-shop-01","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douglasmatosdev%2Fbarber-shop-01","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douglasmatosdev%2Fbarber-shop-01/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douglasmatosdev%2Fbarber-shop-01/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/douglasmatosdev%2Fbarber-shop-01/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/douglasmatosdev","download_url":"https://codeload.github.com/douglasmatosdev/barber-shop-01/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244819801,"owners_count":20515646,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-27T21:14:44.236Z","updated_at":"2025-03-21T15:19:40.142Z","avatar_url":"https://github.com/douglasmatosdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## React JWT Authentication (without Redux) example\n\nIn this tutorial, we’re gonna build a React JWT Authentication example with LocalStorage, React Router, Axios and Bootstrap (without Redux). I will show you:\n\n- JWT Authentication Flow for User Signup \u0026 User Login\n- Project Structure for React JWT Authentication (without Redux) with LocalStorage, React Router \u0026 Axios\n- Creating React Components with Form Validation\n- React Components for accessing protected Resources (Authorization)\n- Dynamic Navigation Bar in React App\n\n## User Registration and User Login Flow\nFor JWT Authentication, we’re gonna call 2 endpoints:\n\n- POST `api/auth/signup` for User Registration\n- POST `api/auth/signin` for User Login\n\nThe following flow shows you an overview of Requests and Responses that React Client will make or receive. This React Client must add a JWT to HTTP Header before sending request to protected resources.\n\n![react-jwt-authentication-flow](react-jwt-authentication-flow.png)\n\n## Demo Video\nThis is full React + Node.js Express JWT Authentication \u0026 Authorization demo (with form validation, check signup username/email duplicates, test authorization with 3 roles: Admin, Moderator, User):\n\n[![react-express-authentication-jwt-example-feature-image](http://img.youtube.com/vi/tNcWX9qPcCM/0.jpg)](http://www.youtube.com/watch?v=tNcWX9qPcCM \"React + Node.js Express JWT Authentication \u0026 Authorization demo\")\n\nOr React with Spring Boot Server:\n\n[![Spring Boot Reactjs JWT Authentication example](http://img.youtube.com/vi/CsgtYvlR7xk/0.jpg)](http://www.youtube.com/watch?v=CsgtYvlR7xk \"Spring Boot Reactjs JWT Authentication example\")\n\n## React Component Diagram with Router, Axios \u0026 LocalStorage\n\n![react-jwt-authentication-project-overview](react-jwt-authentication-project-overview.png)\n\nFor more detail, please visit:\n\u003e [React (without Redux) JWT Authentication \u0026 Authorization example](https://bezkoder.com/react-jwt-auth/)\n\n\u003e [React - How to Logout when Token is expired](https://www.bezkoder.com/react-logout-token-expired/)\n\n\u003e [React Redux JWT Authentication \u0026 Authorization example](https://bezkoder.com/react-redux-jwt-auth/)\n\n\u003e [React Hooks: JWT Authentication \u0026 Authorization example](https://bezkoder.com/react-hooks-jwt-auth/)\n\n\u003e [React + Redux + Hooks: JWT Authentication \u0026 Authorization example](https://bezkoder.com/react-hooks-redux-login-registration-example/)\n\nThis project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).\n\n### Set port\n.env\n```\nPORT=8081\n```\n\n## Note:\nOpen `src/services/auth-header.js` and modify `return` statement for appropriate back-end (found in the tutorial).\n\n```js\nexport default function authHeader() {\n  const user = JSON.parse(localStorage.getItem('user'));\n\n  if (user \u0026\u0026 user.accessToken) {\n    // return { Authorization: 'Bearer ' + user.accessToken }; // for Spring Boot back-end\n    return { 'x-access-token': user.accessToken };             // for Node.js Express back-end\n  } else {\n    return {};\n  }\n}\n```\n\n## Project setup\n\nIn the project directory, you can run:\n\n```\nnpm install\n# or\nyarn install\n```\n\nor\n\n### Compiles and hot-reloads for development\n\n```\nnpm start\n# or\nyarn start\n```\n\nOpen [http://localhost:8081](http://localhost:8081) to view it in the browser.\n\nThe page will reload if you make edits.\n\n## Related Posts\n\u003e [In-depth Introduction to JWT-JSON Web Token](https://bezkoder.com/jwt-json-web-token/)\n\n\u003e [React.js CRUD example to consume Web API](https://bezkoder.com/react-crud-web-api/)\n\n\u003e [React Pagination example](https://bezkoder.com/react-pagination-material-ui/)\n\n\u003e [React File Upload with Axios and Progress Bar to Rest API](https://bezkoder.com/react-file-upload-axios/)\n\nFullstack (JWT Authentication \u0026 Authorization example):\n\u003e [React + Spring Boot](https://bezkoder.com/spring-boot-react-jwt-auth/)\n\n\u003e [React + Node.js Express](https://bezkoder.com/react-express-authentication-jwt/)\n\nCRUD with Node.js Express:\n\u003e [React.js + Node.js Express + MySQL](https://bezkoder.com/react-node-express-mysql/)\n\n\u003e [React.js + Node.js Express + PostgreSQL](https://bezkoder.com/react-node-express-postgresql/)\n\n\u003e [React.js + Node.js Express + MongoDB](https://bezkoder.com/react-node-express-mongodb-mern-stack/)\n\nCRUD with Spring Boot:\n\u003e [React.js + Spring Boot + MySQL](https://bezkoder.com/react-spring-boot-crud/)\n\n\u003e [React.js + Spring Boot + PostgreSQL](https://bezkoder.com/spring-boot-react-postgresql/)\n\n\u003e [React.js + Spring Boot + MongoDB](https://bezkoder.com/react-spring-boot-mongodb/)\n\nCRUD with Django:\n\u003e [React.js + Django Rest Framework](https://bezkoder.com/django-react-axios-rest-framework/)\n\nServerless:\n\u003e [React Firebase CRUD App with Realtime Database](https://bezkoder.com/react-firebase-crud/)\n\n\u003e [React Firestore CRUD App example | Firebase Cloud Firestore](https://bezkoder.com/react-firestore-crud/)\n\nIntegration (run back-end \u0026 front-end on same server/port)\n\u003e [Integrate React with Spring Boot](https://bezkoder.com/integrate-reactjs-spring-boot/)\n\n\u003e [Integrate React with Node.js Express](https://bezkoder.com/integrate-react-express-same-server-port/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdouglasmatosdev%2Fbarber-shop-01","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdouglasmatosdev%2Fbarber-shop-01","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdouglasmatosdev%2Fbarber-shop-01/lists"}