Authentication system is a boilerplate code that can be used to implement login functionality to your angular application.
- Codebase was written with SOLID and DRY principles in mind
- NgRx state management support
- User Factory
- Build-in user models
- Http Interceptor
- Authenticated & Not-authenticated guard
- Extracted API url
-
Copy authentication module to your application.
-
Go to
environment.ts
andenvironment.ts
file and change API url to your own. If you're missing these files create them inside a new folder calledenvironments
located in the root of your project. Don't forget to add following code to your production configuration inangular.json
.
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
-
Configure authentication api service. Go to
authentication.service.ts
and setupAuthenticationResponse
type - it should match a response data from your backend service. -
Go to
app-user.model.ts
and configure yourAppUser
model along withisAppUser
function. -
Go to
user.factory.ts
and configure your user factory. User factory is a service that parses authentication response to user model. -
Enjoy your authentication system :)