@nauth-toolkit/client-angular 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,14 +2,65 @@
|
|
|
2
2
|
|
|
3
3
|
Angular SDK for [nauth-toolkit](https://nauth.dev).
|
|
4
4
|
|
|
5
|
-
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.
|
|
5
|
+
Wraps the framework-agnostic [`@nauth-toolkit/client`](https://www.npmjs.com/package/@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+.
|
|
6
|
+
|
|
7
|
+
**[Documentation](https://nauth.dev/docs/frontend-sdk)** · **[GitHub](https://github.com/noorixorg/nauth)**
|
|
8
|
+
|
|
9
|
+
> Part of [nauth-toolkit](https://www.npmjs.com/package/@nauth-toolkit/core). Requires `@nauth-toolkit/client`.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @nauth-toolkit/client @nauth-toolkit/client-angular
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick start (NgModule)
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { NAuthModule } from '@nauth-toolkit/client-angular';
|
|
23
|
+
|
|
24
|
+
@NgModule({
|
|
25
|
+
imports: [
|
|
26
|
+
NAuthModule.forRoot({
|
|
27
|
+
baseUrl: 'https://api.example.com/auth',
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
})
|
|
31
|
+
export class AppModule {}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Use the `AuthService` in your components:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { AuthService } from '@nauth-toolkit/client-angular';
|
|
38
|
+
|
|
39
|
+
@Component({ /* ... */ })
|
|
40
|
+
export class LoginComponent {
|
|
41
|
+
constructor(private auth: AuthService) {}
|
|
42
|
+
|
|
43
|
+
async login(): Promise<void> {
|
|
44
|
+
await this.auth.login({ email: this.email, password: this.password });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
6
48
|
|
|
7
49
|
## What's included
|
|
8
50
|
|
|
9
|
-
- **NAuthModule** — Angular module
|
|
51
|
+
- **NAuthModule** — Angular module with `forRoot()` configuration
|
|
10
52
|
- **AuthService** — reactive auth state, login, signup, logout, token refresh
|
|
11
53
|
- **AuthGuard** — route protection with automatic redirect
|
|
12
54
|
- **HTTP interceptor** — attaches tokens to outgoing requests, handles 401 refresh
|
|
13
|
-
- **
|
|
55
|
+
- **Social redirect guard** — handles OAuth callback routes
|
|
56
|
+
- **reCAPTCHA service** — Angular-integrated reCAPTCHA token generation
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Framework-agnostic
|
|
61
|
+
|
|
62
|
+
For non-Angular frontends (React, Vue, Svelte), use [`@nauth-toolkit/client`](https://www.npmjs.com/package/@nauth-toolkit/client) directly.
|
|
63
|
+
|
|
64
|
+
---
|
|
14
65
|
|
|
15
|
-
|
|
66
|
+
Free to use. See [license](https://nauth.dev/docs/license).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nauth-toolkit/client-angular",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Angular SDK for nauth-toolkit — services, guards, interceptors",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nauth",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@angular/common": ">=17.0.0",
|
|
29
29
|
"@angular/core": ">=17.0.0",
|
|
30
|
-
"@nauth-toolkit/client": "^0.2.
|
|
30
|
+
"@nauth-toolkit/client": "^0.2.2",
|
|
31
31
|
"rxjs": "^7.0.0 || ^8.0.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|