ngx-auth

Angular 4.3.0+ Authentication

This package provides authentication module with interceptor

Package is given in completely 100% pure TypeScript.

Authentication module

Authentication modules provides ability to attach authentication token automatically to the headers (through http interceptors), refresh token functionality, guards for protected or public pages and more.

Usage

  1. Import AuthService interface to implement it with your custom Authentication service, e.g.:
  1. Specify PublicGuard for public routes and ProtectedGuard for protected respectively, e.g.:
  1. Create additional AuthenticationModule and provide important providers and imports, e.g.:

where, * PROTECTED_FALLBACK_PAGE_URI - main protected page to be redirected to, in case if user will reach public route, that is protected by PublicGuard and will be authenticated

  • PUBLIC_FALLBACK_PAGE_URI - main public page to be redirected to, in case if user will reach protected route, that is protected by ProtectedGuard and won't be authenticated

  • AUTH_SERVICE - Authentication service token providers

  1. Provide your AuthenticationModule in your AppModule
comments powered by Disqus
This page was last updated about 1 month ago.