@nauth-toolkit/client-angular
v0.2.3
Published
Angular SDK for nauth-toolkit — services, guards, interceptors
Maintainers
Readme
@nauth-toolkit/client-angular
Angular SDK for nauth-toolkit.
Wraps the framework-agnostic @nauth-toolkit/client with Angular services, guards, and HTTP interceptors. Integrates with Angular dependency injection and handles token refresh, auth state, and route protection. Supports Angular 17+.
Part of nauth-toolkit. Requires
@nauth-toolkit/client.
Install
npm install @nauth-toolkit/client @nauth-toolkit/client-angularQuick start (NgModule)
import { NAuthModule } from '@nauth-toolkit/client-angular';
@NgModule({
imports: [
NAuthModule.forRoot({
baseUrl: 'https://api.example.com/auth',
}),
],
})
export class AppModule {}Use the AuthService in your components:
import { AuthService } from '@nauth-toolkit/client-angular';
@Component({ /* ... */ })
export class LoginComponent {
constructor(private auth: AuthService) {}
async login(): Promise<void> {
await this.auth.login({ email: this.email, password: this.password });
}
}What's included
- NAuthModule — Angular module with
forRoot()configuration - AuthService — reactive auth state, login, signup, logout, token refresh
- AuthGuard — route protection with automatic redirect
- HTTP interceptor — attaches tokens to outgoing requests, handles 401 refresh
- Social redirect guard — handles OAuth callback routes
- reCAPTCHA service — Angular-integrated reCAPTCHA token generation
Framework-agnostic
For non-Angular frontends (React, Vue, Svelte), use @nauth-toolkit/client directly.
Free to use. See license.
