{"id":26179560,"url":"https://github.com/bezkoder/angular-8-jwt-authentication","last_synced_at":"2025-08-19T00:19:46.809Z","repository":{"id":39273603,"uuid":"231711215","full_name":"bezkoder/angular-8-jwt-authentication","owner":"bezkoder","description":"Demo project for Angular 8 JWT Authentication with HttpInterceptor and Router","archived":false,"fork":false,"pushed_at":"2023-01-07T13:23:16.000Z","size":657,"stargazers_count":42,"open_issues_count":29,"forks_count":51,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-14T22:38:40.804Z","etag":null,"topics":["angular","angular8","authentication","httpinterceptor","jwt","jwt-authentication"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/bezkoder.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}},"created_at":"2020-01-04T05:00:48.000Z","updated_at":"2023-07-13T20:11:24.000Z","dependencies_parsed_at":"2023-02-07T06:45:36.528Z","dependency_job_id":null,"html_url":"https://github.com/bezkoder/angular-8-jwt-authentication","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bezkoder/angular-8-jwt-authentication","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezkoder%2Fangular-8-jwt-authentication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezkoder%2Fangular-8-jwt-authentication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezkoder%2Fangular-8-jwt-authentication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezkoder%2Fangular-8-jwt-authentication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bezkoder","download_url":"https://codeload.github.com/bezkoder/angular-8-jwt-authentication/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezkoder%2Fangular-8-jwt-authentication/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271079229,"owners_count":24695597,"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","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["angular","angular8","authentication","httpinterceptor","jwt","jwt-authentication"],"created_at":"2025-03-11T21:50:26.915Z","updated_at":"2025-08-19T00:19:46.780Z","avatar_url":"https://github.com/bezkoder.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular 8 JWT Authentication example\n\n## Flow for User Registration and User Login\nFor JWT – Token based Authentication with Web API, we’re gonna call 2 endpoints:\n- POST `api/auth/signup` for User Registration\n- POST `api/auth/signin` for User Login\n\nYou can take a look at following flow to have an overview of Requests and Responses that Angular 10 Client will make or receive.\n\n![angular-8-jwt-authentication-flow](angular-8-jwt-authentication-flow.png)\n\n## Angular JWT App Diagram with Router and HttpInterceptor\n![angular-8-jwt-authentication-overview](angular-8-jwt-authentication-overview.png)\n\nFor more detail, please visit:\n\u003e [Angular 8 JWT Authentication with Web API](https://bezkoder.com/angular-jwt-authentication/)\n\n\u003e [Angular 10 JWT Authentication with Web API](https://bezkoder.com/angular-10-jwt-auth/)\n\n## With Spring Boot back-end\n\n\u003e [Angular 8 + Spring Boot: JWT Authentication \u0026 Authorization example](https://bezkoder.com/angular-spring-boot-jwt-auth/)\n\n\u003e [Angular 10 + Spring Boot: JWT Authentication \u0026 Authorization example](https://bezkoder.com/angular-10-spring-boot-jwt-auth/)\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`.\n\n## With Node.js Express back-end\n\n\u003e [Node.js Express + Angular 8: JWT Authentication \u0026 Authorization example](https://bezkoder.com/node-js-express-angular-jwt-auth/)\n\n\u003e [Node.js Express + Angular 10: JWT Authentication \u0026 Authorization example](https://bezkoder.com/node-js-express-angular-10-jwt-auth/)\n\nOpen `app/_helpers/auth.interceptor.js`, modify the code to work with **x-access-token** like this:\n```js\n...\n\n// const TOKEN_HEADER_KEY = 'Authorization'; // for Spring Boot back-end\nconst TOKEN_HEADER_KEY = 'x-access-token';   // for Node.js Express back-end\n\n@Injectable()\nexport class AuthInterceptor implements HttpInterceptor {\n  ...\n\n  intercept(req: HttpRequest\u003cany\u003e, next: HttpHandler) {\n    ...\n    if (token != null) {\n      // for Spring Boot back-end\n      // authReq = req.clone({ headers: req.headers.set(TOKEN_HEADER_KEY, 'Bearer ' + token) });\n\n      // for Node.js Express back-end\n      authReq = req.clone({ headers: req.headers.set(TOKEN_HEADER_KEY, token) });\n    }\n    return next.handle(authReq);\n  }\n}\n\n...\n```\n\nRun `ng serve --port 8081` for a dev server. Navigate to `http://localhost:8081/`.\n\n## More Practice\n\n\u003e [Angular 8 CRUD application example with Web API](https://bezkoder.com/angular-crud-app/)\n\n\u003e [Angular 8 Pagination example | ngx-pagination](https://bezkoder.com/ngx-pagination-angular-8/)\n\n\u003e [Angular 8 Multiple Files upload example](https://bezkoder.com/angular-multiple-files-upload/)\n\nFullstack with Node.js Express:\n\u003e [Angular 8 + Node.js Express + MySQL](https://bezkoder.com/angular-node-express-mysql/)\n\n\u003e [Angular 8 + Node.js Express + PostgreSQL](https://bezkoder.com/angular-node-express-postgresql/)\n\n\u003e [Angular 8 + Node.js Express + MongoDB](https://bezkoder.com/angular-mongodb-node-express/)\n\nFullstack with Spring Boot:\n\u003e [Angular 8 + Spring Boot + MySQL](https://bezkoder.com/angular-spring-boot-crud/)\n\n\u003e [Angular 8 + Spring Boot + PostgreSQL](https://bezkoder.com/angular-spring-boot-postgresql/)\n\n\u003e [Angular 8 + Spring Boot + MongoDB](https://bezkoder.com/angular-spring-boot-mongodb/)\n\nFullstack with Django:\n\u003e [Angular 8 + Django Rest Framework](https://bezkoder.com/django-angular-crud-rest-framework/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbezkoder%2Fangular-8-jwt-authentication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbezkoder%2Fangular-8-jwt-authentication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbezkoder%2Fangular-8-jwt-authentication/lists"}