@apchh/apc-auth-rxjs v0.1.3
APC Authentication using RXJS
This library's purpose is to make authentication of Angular 2+ applications fast an easy with a prebuilt, library that directly integrates with APC's authentication API.
Peer dependencies
This project requires the following packages besides the default Angular packages.
jwt-decode
- For decoding Json Web Tokens.
Installation
You can add the package to your Angular application by either
npm install --save @apchh/apc-auth-rxjs
or
yarn add @apchh/apc-auth-rxjs
Update your app.module.ts
Update yoru app.module.ts
file by integrating the code below into your pre-existing code.
const appConf: IConfig = {
applicationId: 'apc applicationId'
};
@ngModule({
imports: [
APCAuthRXJSModule.forRoot(appConf)
],
providers: [AuthService]
});
The purpose of the IConfig
typechecked variable is to specify to the Authentication library, an ApplicationId, and in the future, more application information that the Auth API will need to determine where the login requests are coming from, and properly authenticate the requests.
Implementing Authentication Guards
You can use the Auth Guard within the APC-Auth-RXJS library to protect your routes by simply adding the AuthGuard
to the canActivate
route field. Then add a route to login
using the SignInComponent
provided by the library.
import { AuthGuard, SignInComponent } from 'apc-auth-rxjs';
const routes: Routes = [
{
path: '',
component: HomeComponent,
canActivate: [AuthGuard]
}, {
path: 'login',
component: SignInComponent
}
]
TODOs
- Implement JWT Token Interceptors to verify active session
- Implenent JWT Token Interceptor to append token to any and all requests
- Questioning whether or not to make Registration and change user information components or leave that to developers.
- Finish Profile Component features
- Change Email and Password modal components
- Test Profile Tool redirect to Custom Profile Component
- Develop API integration for User Information for profile page