ngx-all-auth
v1.0.0
Published
The project aims at adding authentication to angular application.
Readme
NgxAllauth
The project aims at adding authentication to angular application.
Installation
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
ng generate component component-nameFor a complete list of available schematics (such as components, directives, or pipes), run:
ng generate --helpBuilding
To build the library, run:
ng build ngx-allauthThis command will compile your project, and the build artifacts will be placed in the dist/ directory.
Publishing the Library
Once the project is built, you can publish your library by following these steps:
Navigate to the
distdirectory:cd dist/ngx-allauthRun the
npm publishcommand to publish your library to the npm registry:npm publish
Configuration
To fetch config when the application is bootstraped add the following in the providers array.
provideAppInitializer(() => {
const configService = inject(ConfigService);
return initializeApp(configService);
}),Provide responseHandlerInterceptor to the httpClient
withInterceptors([yourInterceptor, responseHandlerInterceptor])If CSRF Token is be sent in a header provide the following to the httpClient:
withXsrfConfiguration({
cookieName: 'csrftoken',
headerName: 'X-CSRFToken',
})Add Routes:
const routes: Routes = [
// App routes
{ path: '', component: HomeComponent },
// Include auth routes
...withBaseUrl(
getAuthRoutes([
// Override only the routes you want to customize
{ path: 'login', component: CustomLoginComponent, data: { redirectTo: '/dashboard' } }
]),
'auth'
)
];Additional Resources
For more information on using the Angular CLI, including detailed command references, visit the Angular CLI Overview and Command Reference page.
