cloudfire-auth 0.1.0 → 0.2.0
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 +12 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,17 +19,20 @@ npm install cloudfire-auth
|
|
|
19
19
|
## Quick Start
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
|
-
import { CloudFireAuth
|
|
22
|
+
import { CloudFireAuth } from "cloudfire-auth";
|
|
23
|
+
|
|
24
|
+
// It is best practice to store your service account key separately and
|
|
25
|
+
// load it from a secure source.
|
|
26
|
+
const serviceAccountKey = {
|
|
27
|
+
// Your Firebase service account key
|
|
28
|
+
private_key: "-----BEGIN PRIVATE KEY-----\n...",
|
|
29
|
+
client_email: "firebase-adminsdk-...@your-project.iam.gserviceaccount.com",
|
|
30
|
+
// ... other service account fields
|
|
31
|
+
};
|
|
23
32
|
|
|
24
33
|
// Initialize with your Firebase project credentials
|
|
25
34
|
const auth = new CloudFireAuth(
|
|
26
|
-
|
|
27
|
-
{
|
|
28
|
-
// Your Firebase service account key
|
|
29
|
-
private_key: "-----BEGIN PRIVATE KEY-----\n...",
|
|
30
|
-
client_email: "firebase-adminsdk-...@your-project.iam.gserviceaccount.com",
|
|
31
|
-
// ... other service account fields
|
|
32
|
-
},
|
|
35
|
+
serviceAccountKey,
|
|
33
36
|
env.YOUR_KV_NAMESPACE // Optional: KV namespace for token caching
|
|
34
37
|
);
|
|
35
38
|
|
|
@@ -51,10 +54,9 @@ console.log("User email:", user.email);
|
|
|
51
54
|
### Constructor
|
|
52
55
|
|
|
53
56
|
```typescript
|
|
54
|
-
new CloudFireAuth(
|
|
57
|
+
new CloudFireAuth(serviceAccountKey: ServiceAccountKey, kvNamespace?: KVNamespace)
|
|
55
58
|
```
|
|
56
59
|
|
|
57
|
-
- `projectId`: Your Firebase project ID
|
|
58
60
|
- `serviceAccountKey`: Firebase service account credentials
|
|
59
61
|
- `kvNamespace`: Optional KV namespace for OAuth2 token caching
|
|
60
62
|
|
|
@@ -81,7 +83,6 @@ new CloudFireAuth(projectId: string, serviceAccountKey: ServiceAccountKey, kvNam
|
|
|
81
83
|
|
|
82
84
|
Your Cloudflare Worker needs these environment variables:
|
|
83
85
|
|
|
84
|
-
- `FIREBASE_PROJECT_ID`: Your Firebase project ID
|
|
85
86
|
- `FIREBASE_SERVICE_ACCOUNT_KEY`: JSON string of your service account key
|
|
86
87
|
- `AUTH_KV_NAMESPACE`: (Optional) KV namespace for token caching
|
|
87
88
|
|