@quatrain/auth-firebase 1.1.22 → 1.1.24

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.
Files changed (2) hide show
  1. package/README.md +18 -70
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -1,94 +1,42 @@
1
1
  # @quatrain/auth-firebase
2
2
 
3
- An authentication adapter for Firebase Authentication. This package integrates Quatrain's auth system with Google's managed authentication service.
3
+ The Firebase Authentication adapter for `@quatrain/auth`.
4
4
 
5
- ## Features
5
+ ## Introduction
6
6
 
7
- - Implements the `@quatrain/auth` abstract adapter.
8
- - Supports email/password, social logins (Google, Facebook, etc.), and custom tokens.
9
- - Integrates with Firebase security rules.
10
- - Uses the `firebase-admin` SDK for server-side operations.
7
+ Firebase Authentication provides backend services to authenticate users. This adapter implements the Quatrain Auth interface using the `firebase-admin` SDK to verify JWTs and manage users.
11
8
 
12
9
  ## Installation
13
10
 
14
11
  ```bash
15
12
  npm install @quatrain/auth-firebase firebase-admin
13
+ # or
14
+ yarn add @quatrain/auth-firebase firebase-admin
16
15
  ```
17
16
 
18
- ## Usage
17
+ ## Configuration
19
18
 
20
- ### Setup
19
+ Register the adapter using your Firebase service account credentials.
21
20
 
22
21
  ```typescript
23
22
  import { Auth } from '@quatrain/auth'
24
23
  import { FirebaseAuthAdapter } from '@quatrain/auth-firebase'
25
24
 
26
- const adapter = new FirebaseAuthAdapter({
27
- config: {
28
- projectId: 'your-project-id',
29
- // Other Firebase Admin SDK config
30
- apiKey: 'your-api-key', // Required for token refresh
31
- },
25
+ const firebaseAuth = new FirebaseAuthAdapter({
26
+ config: {
27
+ projectId: 'your-project-id',
28
+ clientEmail: 'firebase-adminsdk-xxx@your-project-id.iam.gserviceaccount.com',
29
+ privateKey: '-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n'
30
+ }
32
31
  })
33
- Auth.addProvider(adapter, 'default', true)
34
- ```
35
-
36
- ### Register a New User
37
-
38
- ```typescript
39
- import { User } from '@quatrain/backend'
40
-
41
- const user = new User({
42
- uid: 'unique-user-id',
43
- _: {
44
- name: 'John Doe',
45
- email: 'john@example.com',
46
- phone: '+1234567890',
47
- },
48
- })
49
-
50
- const userId = await adapter.register(user, 'password123')
51
- console.log('User registered with ID:', userId)
52
- ```
53
-
54
- ### Verify Auth Token
55
-
56
- ```typescript
57
- const decodedToken = await adapter.getAuthToken('firebase-id-token')
58
- console.log('Token verified for user:', decodedToken.uid)
59
- ```
60
-
61
- ### Update User Profile
62
32
 
63
- ```typescript
64
- await adapter.update(user, {
65
- email: 'newemail@example.com',
66
- displayName: 'Jane Doe',
67
- phoneNumber: '+0987654321',
68
- })
33
+ Auth.addAdapter('firebase', firebaseAuth, true)
69
34
  ```
70
35
 
71
- ### Delete User
36
+ ## Documentation
72
37
 
73
- ```typescript
74
- await adapter.delete(user)
75
- console.log('User deleted')
76
- ```
77
-
78
- ### Refresh Token
38
+ For concrete examples and usage guides, please refer to the [How-To Guide](HOWTO.md).
79
39
 
80
- ```typescript
81
- const newTokens = await adapter.refreshToken(refreshToken)
82
- console.log('New access token:', newTokens.access_token)
83
- ```
40
+ ## License
84
41
 
85
- > [!WARNING] > **Incomplete Implementation**
86
- >
87
- > The following methods are currently not implemented (empty stubs):
88
- >
89
- > - `signup()` - Client-side sign in
90
- > - `signout()` - Sign out user
91
- > - `revokeAuthToken()` - Revoke tokens
92
- > - `setCustomUserClaims()` - Set custom claims
93
- >
94
- > These methods exist to satisfy the interface but do not perform any operations.
42
+ AGPL-3.0-only
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quatrain/auth-firebase",
3
- "version": "1.1.22",
3
+ "version": "1.1.24",
4
4
  "license": "AGPL-3.0-only",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,12 +13,12 @@
13
13
  ],
14
14
  "author": "Quatrain Développement SAS <developers@quatrain.com>",
15
15
  "peerDependencies": {
16
- "@quatrain/core": "^1.1.48"
16
+ "@quatrain/core": "^1.1.49"
17
17
  },
18
18
  "dependencies": {
19
- "@quatrain/auth": "^1.1.27",
20
- "@quatrain/backend": "^1.1.33",
21
- "@quatrain/core": "^1.1.48",
19
+ "@quatrain/auth": "^1.1.29",
20
+ "@quatrain/backend": "^1.1.34",
21
+ "@quatrain/core": "^1.1.49",
22
22
  "firebase-admin": "^13.0.1",
23
23
  "node-fetch-native": "^1.6.4"
24
24
  },