cloudfire-auth 0.3.2 → 0.4.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/LICENSE +21 -21
- package/NOTICE +12 -12
- package/README.md +129 -129
- package/dist/CloudFireAuth.d.ts +56 -2
- package/dist/CloudFireAuth.js +54 -2
- package/dist/types/firebase-admin/auth-config.d.ts +7 -7
- package/dist/types/firebase-admin/identifier.d.ts +4 -4
- package/dist/types/firebase-admin/index.d.ts +9 -7
- package/dist/types/firebase-admin/token-verifier.d.ts +1 -1
- package/dist/types/firebase-admin/user-import.d.ts +3 -3
- package/dist/types/firebase-admin/user-record.d.ts +4 -4
- package/dist/types/google-auth.d.ts +1 -2
- package/dist/types.d.ts +3 -6
- package/package.json +68 -56
- package/third_party/firebase-admin-license.txt +200 -200
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025-Present Connor Skelland
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-Present Connor Skelland
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
This software incorporates code from the following third-party components:
|
|
2
|
-
|
|
3
|
-
-------------------------------------------------------------------------
|
|
4
|
-
|
|
5
|
-
1. Component: firebase-admin
|
|
6
|
-
Copyright 2021 Google Inc.
|
|
7
|
-
|
|
8
|
-
This component is licensed under the Apache License, Version 2.0.
|
|
9
|
-
The full text of the license can be found in the LICENSE file
|
|
10
|
-
distributed with this software.
|
|
11
|
-
|
|
12
|
-
The original source code can be found at:
|
|
1
|
+
This software incorporates code from the following third-party components:
|
|
2
|
+
|
|
3
|
+
-------------------------------------------------------------------------
|
|
4
|
+
|
|
5
|
+
1. Component: firebase-admin
|
|
6
|
+
Copyright 2021 Google Inc.
|
|
7
|
+
|
|
8
|
+
This component is licensed under the Apache License, Version 2.0.
|
|
9
|
+
The full text of the license can be found in the LICENSE file
|
|
10
|
+
distributed with this software.
|
|
11
|
+
|
|
12
|
+
The original source code can be found at:
|
|
13
13
|
https://github.com/firebase/firebase-admin-node
|
package/README.md
CHANGED
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
# Cloudfire Auth
|
|
2
|
-
|
|
3
|
-
A library to make Firebase Auth work in Cloudflare Workers, using native Cloudflare APIs for caching and persistence. The library handles OAuth2 token generation and interactions with the Firebase Auth REST API.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- 🔥 Firebase Auth compatibility for Cloudflare Workers
|
|
8
|
-
- ⚡ Native Cloudflare KV integration for token caching
|
|
9
|
-
- 🛡️ Full TypeScript support
|
|
10
|
-
- 📦 One dependency, jose for JWT handling
|
|
11
|
-
- 🌐 ESM-only for modern JavaScript environments
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install cloudfire-auth
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Quick Start
|
|
20
|
-
|
|
21
|
-
```typescript
|
|
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
|
-
};
|
|
32
|
-
|
|
33
|
-
// Initialize with your Firebase project credentials
|
|
34
|
-
const auth = new CloudFireAuth(
|
|
35
|
-
serviceAccountKey,
|
|
36
|
-
env.YOUR_KV_NAMESPACE // Optional: KV namespace for token caching
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
// Verify an ID token
|
|
40
|
-
try {
|
|
41
|
-
const decodedToken = await auth.verifyIdToken(idToken);
|
|
42
|
-
console.log("User ID:", decodedToken.uid);
|
|
43
|
-
} catch (error) {
|
|
44
|
-
console.error("Token verification failed:", error);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Get user data
|
|
48
|
-
const user = await auth.getUser("user-uid");
|
|
49
|
-
console.log("User email:", user.email);
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## API Reference
|
|
53
|
-
|
|
54
|
-
### Constructor
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
new CloudFireAuth(serviceAccountKey: ServiceAccountKey, kvNamespace?: KVNamespace)
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
- `serviceAccountKey`: Firebase service account credentials
|
|
61
|
-
- `kvNamespace`: Optional KV namespace for OAuth2 token caching
|
|
62
|
-
|
|
63
|
-
### Methods
|
|
64
|
-
|
|
65
|
-
#### Authentication
|
|
66
|
-
|
|
67
|
-
| Method | Status | Description |
|
|
68
|
-
| ---------------------------------------------------------------------------------- | ------ | ----------------------------------- |
|
|
69
|
-
| `verifyIdToken(idToken: string, checkRevoked?: boolean)` | ✅ | Verify Firebase ID tokens |
|
|
70
|
-
| `verifySessionCookie(sessionCookie: string, checkRevoked?: boolean)` |
|
|
71
|
-
| `createSessionCookie(idToken: string, sessionCookieOptions: SessionCookieOptions)` | ❌ | Create session cookie from ID token |
|
|
72
|
-
| `createCustomToken(uid: string, developerClaims?: object)` | ❌ | Create custom token for client SDK |
|
|
73
|
-
|
|
74
|
-
#### User Management
|
|
75
|
-
|
|
76
|
-
| Method | Status | Description |
|
|
77
|
-
| --------------------------------------------------------------------- | ------ | -------------------------------------- |
|
|
78
|
-
| `getUser(uid: string)` | ✅ | Get user by UID |
|
|
79
|
-
| `getUserByEmail(email: string)` | ❌ | Get user by email |
|
|
80
|
-
| `getUserByPhoneNumber(phoneNumber: string)` | ❌ | Get user by phone number |
|
|
81
|
-
| `getUserByProviderUid(providerId: string, uid: string)` | ❌ | Get user by provider UID |
|
|
82
|
-
| `getUsers(identifiers: UserIdentifier[])` | ❌ | Get users by identifiers |
|
|
83
|
-
| `createUser(properties: CreateRequest)` | ❌ | Create a new user |
|
|
84
|
-
| `updateUser(uid: string, properties: UpdateRequest)` | ✅ | Update existing user |
|
|
85
|
-
| `deleteUser(uid: string)` | ✅ | Delete a user |
|
|
86
|
-
| `deleteUsers(uids: string[])` | ❌ | Delete multiple users |
|
|
87
|
-
| `listUsers(maxResults?: number, pageToken?: string)` | ❌ | List users with pagination |
|
|
88
|
-
| `importUsers(users: UserImportRecord[], options?: UserImportOptions)` | ❌ | Bulk import users with password hashes |
|
|
89
|
-
|
|
90
|
-
#### Token Management
|
|
91
|
-
|
|
92
|
-
| Method | Status | Description |
|
|
93
|
-
| -------------------------------------------------------------------- | ------ | ------------------------------------ |
|
|
94
|
-
| `revokeRefreshTokens(uid: string)` | ✅ | Revoke all refresh tokens for a user |
|
|
95
|
-
| `setCustomUserClaims(uid: string, customUserClaims: object \| null)` | ✅ | Set custom claims |
|
|
96
|
-
|
|
97
|
-
#### Email Actions
|
|
98
|
-
|
|
99
|
-
| Method | Status | Description |
|
|
100
|
-
| ------------------------------------------------------------------------------------------------------------ | ------ | --------------------------------------- |
|
|
101
|
-
| `generatePasswordResetLink(email: string, actionCodeSettings?: ActionCodeSettings)` | ❌ | Generate password reset link |
|
|
102
|
-
| `generateEmailVerificationLink(email: string, actionCodeSettings?: ActionCodeSettings)` | ❌ | Generate email verification link |
|
|
103
|
-
| `generateVerifyAndChangeEmailLink(email: string, newEmail: string, actionCodeSettings?: ActionCodeSettings)` | ❌ | Generate email change verification link |
|
|
104
|
-
| `generateSignInWithEmailLink(email: string, actionCodeSettings: ActionCodeSettings)` | ❌ | Generate sign-in with email link |
|
|
105
|
-
|
|
106
|
-
#### Provider Configuration
|
|
107
|
-
|
|
108
|
-
| Method | Status | Description |
|
|
109
|
-
| ------------------------------------------------------------------------------------ | ------ | -------------------------------------- |
|
|
110
|
-
| `listProviderConfigs(options: AuthProviderConfigFilter)` | ❌ | List SAML/OIDC provider configurations |
|
|
111
|
-
| `getProviderConfig(providerId: string)` | ❌ | Get provider configuration by ID |
|
|
112
|
-
| `createProviderConfig(config: AuthProviderConfig)` | ❌ | Create new provider configuration |
|
|
113
|
-
| `updateProviderConfig(providerId: string, updatedConfig: UpdateAuthProviderRequest)` | ❌ | Update provider configuration |
|
|
114
|
-
| `deleteProviderConfig(providerId: string)` | ❌ | Delete provider configuration |
|
|
115
|
-
|
|
116
|
-
## Environment Setup
|
|
117
|
-
|
|
118
|
-
Your Cloudflare Worker needs these environment variables:
|
|
119
|
-
|
|
120
|
-
- `FIREBASE_SERVICE_ACCOUNT_KEY`: JSON string of your service account key
|
|
121
|
-
- `AUTH_KV_NAMESPACE`: (Optional) KV namespace for token caching
|
|
122
|
-
|
|
123
|
-
## License
|
|
124
|
-
|
|
125
|
-
MIT © Connor Skelland
|
|
126
|
-
|
|
127
|
-
## Contributing
|
|
128
|
-
|
|
129
|
-
Issues and pull requests are welcome!
|
|
1
|
+
# Cloudfire Auth
|
|
2
|
+
|
|
3
|
+
A library to make Firebase Auth work in Cloudflare Workers, using native Cloudflare APIs for caching and persistence. The library handles OAuth2 token generation and interactions with the Firebase Auth REST API.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔥 Firebase Auth compatibility for Cloudflare Workers
|
|
8
|
+
- ⚡ Native Cloudflare KV integration for token caching
|
|
9
|
+
- 🛡️ Full TypeScript support
|
|
10
|
+
- 📦 One dependency, `jose` for JWT handling
|
|
11
|
+
- 🌐 ESM-only for modern JavaScript environments
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install cloudfire-auth
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
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
|
+
};
|
|
32
|
+
|
|
33
|
+
// Initialize with your Firebase project credentials
|
|
34
|
+
const auth = new CloudFireAuth(
|
|
35
|
+
serviceAccountKey,
|
|
36
|
+
env.YOUR_KV_NAMESPACE // Optional: KV namespace for token caching
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// Verify an ID token
|
|
40
|
+
try {
|
|
41
|
+
const decodedToken = await auth.verifyIdToken(idToken);
|
|
42
|
+
console.log("User ID:", decodedToken.uid);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error("Token verification failed:", error);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Get user data
|
|
48
|
+
const user = await auth.getUser("user-uid");
|
|
49
|
+
console.log("User email:", user.email);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## API Reference
|
|
53
|
+
|
|
54
|
+
### Constructor
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
new CloudFireAuth(serviceAccountKey: ServiceAccountKey, kvNamespace?: KVNamespace)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- `serviceAccountKey`: Firebase service account credentials
|
|
61
|
+
- `kvNamespace`: Optional KV namespace for OAuth2 token caching
|
|
62
|
+
|
|
63
|
+
### Methods
|
|
64
|
+
|
|
65
|
+
#### Authentication
|
|
66
|
+
|
|
67
|
+
| Method | Status | Description |
|
|
68
|
+
| ---------------------------------------------------------------------------------- | ------ | ----------------------------------- |
|
|
69
|
+
| `verifyIdToken(idToken: string, checkRevoked?: boolean)` | ✅ | Verify Firebase ID tokens |
|
|
70
|
+
| `verifySessionCookie(sessionCookie: string, checkRevoked?: boolean)` | ❌ | Verify session cookies |
|
|
71
|
+
| `createSessionCookie(idToken: string, sessionCookieOptions: SessionCookieOptions)` | ❌ | Create session cookie from ID token |
|
|
72
|
+
| `createCustomToken(uid: string, developerClaims?: object)` | ❌ | Create custom token for client SDK |
|
|
73
|
+
|
|
74
|
+
#### User Management
|
|
75
|
+
|
|
76
|
+
| Method | Status | Description |
|
|
77
|
+
| --------------------------------------------------------------------- | ------ | -------------------------------------- |
|
|
78
|
+
| `getUser(uid: string)` | ✅ | Get user by UID |
|
|
79
|
+
| `getUserByEmail(email: string)` | ❌ | Get user by email |
|
|
80
|
+
| `getUserByPhoneNumber(phoneNumber: string)` | ❌ | Get user by phone number |
|
|
81
|
+
| `getUserByProviderUid(providerId: string, uid: string)` | ❌ | Get user by provider UID |
|
|
82
|
+
| `getUsers(identifiers: UserIdentifier[])` | ❌ | Get users by identifiers |
|
|
83
|
+
| `createUser(properties: CreateRequest)` | ❌ | Create a new user |
|
|
84
|
+
| `updateUser(uid: string, properties: UpdateRequest)` | ✅ | Update existing user |
|
|
85
|
+
| `deleteUser(uid: string)` | ✅ | Delete a user |
|
|
86
|
+
| `deleteUsers(uids: string[])` | ❌ | Delete multiple users |
|
|
87
|
+
| `listUsers(maxResults?: number, pageToken?: string)` | ❌ | List users with pagination |
|
|
88
|
+
| `importUsers(users: UserImportRecord[], options?: UserImportOptions)` | ❌ | Bulk import users with password hashes |
|
|
89
|
+
|
|
90
|
+
#### Token Management
|
|
91
|
+
|
|
92
|
+
| Method | Status | Description |
|
|
93
|
+
| -------------------------------------------------------------------- | ------ | ------------------------------------ |
|
|
94
|
+
| `revokeRefreshTokens(uid: string)` | ✅ | Revoke all refresh tokens for a user |
|
|
95
|
+
| `setCustomUserClaims(uid: string, customUserClaims: object \| null)` | ✅ | Set custom claims |
|
|
96
|
+
|
|
97
|
+
#### Email Actions
|
|
98
|
+
|
|
99
|
+
| Method | Status | Description |
|
|
100
|
+
| ------------------------------------------------------------------------------------------------------------ | ------ | --------------------------------------- |
|
|
101
|
+
| `generatePasswordResetLink(email: string, actionCodeSettings?: ActionCodeSettings)` | ❌ | Generate password reset link |
|
|
102
|
+
| `generateEmailVerificationLink(email: string, actionCodeSettings?: ActionCodeSettings)` | ❌ | Generate email verification link |
|
|
103
|
+
| `generateVerifyAndChangeEmailLink(email: string, newEmail: string, actionCodeSettings?: ActionCodeSettings)` | ❌ | Generate email change verification link |
|
|
104
|
+
| `generateSignInWithEmailLink(email: string, actionCodeSettings: ActionCodeSettings)` | ❌ | Generate sign-in with email link |
|
|
105
|
+
|
|
106
|
+
#### Provider Configuration
|
|
107
|
+
|
|
108
|
+
| Method | Status | Description |
|
|
109
|
+
| ------------------------------------------------------------------------------------ | ------ | -------------------------------------- |
|
|
110
|
+
| `listProviderConfigs(options: AuthProviderConfigFilter)` | ❌ | List SAML/OIDC provider configurations |
|
|
111
|
+
| `getProviderConfig(providerId: string)` | ❌ | Get provider configuration by ID |
|
|
112
|
+
| `createProviderConfig(config: AuthProviderConfig)` | ❌ | Create new provider configuration |
|
|
113
|
+
| `updateProviderConfig(providerId: string, updatedConfig: UpdateAuthProviderRequest)` | ❌ | Update provider configuration |
|
|
114
|
+
| `deleteProviderConfig(providerId: string)` | ❌ | Delete provider configuration |
|
|
115
|
+
|
|
116
|
+
## Environment Setup
|
|
117
|
+
|
|
118
|
+
Your Cloudflare Worker needs these environment variables:
|
|
119
|
+
|
|
120
|
+
- `FIREBASE_SERVICE_ACCOUNT_KEY`: JSON string of your service account key
|
|
121
|
+
- `AUTH_KV_NAMESPACE`: (Optional) KV namespace for token caching
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
MIT © Connor Skelland
|
|
126
|
+
|
|
127
|
+
## Contributing
|
|
128
|
+
|
|
129
|
+
Issues and pull requests are welcome!
|
package/dist/CloudFireAuth.d.ts
CHANGED
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
*
|
|
33
33
|
* - getOauth2AccessToken
|
|
34
34
|
*
|
|
35
|
+
* All of the method documentation beneath the @returns tag is under the MIT
|
|
36
|
+
* License for this project also.
|
|
35
37
|
*/
|
|
36
38
|
import type { DecodedIdToken, UserRecord, UserIdentifier, GetUsersResult, ListUsersResult, CreateRequest, UpdateRequest, DeleteUsersResult, ServiceAccountKey, SessionCookieOptions, ActionCodeSettings, AuthProviderConfig, UpdateAuthProviderRequest, AuthProviderConfigFilter, ListProviderConfigResults, UserImportRecord, UserImportOptions, UserImportResult } from "./types.js";
|
|
37
39
|
export declare class CloudFireAuth {
|
|
@@ -55,6 +57,8 @@ export declare class CloudFireAuth {
|
|
|
55
57
|
*
|
|
56
58
|
* @returns A promise fulfilled with a custom token for the
|
|
57
59
|
* provided `uid` and payload.
|
|
60
|
+
*
|
|
61
|
+
* @category Authentication
|
|
58
62
|
*/
|
|
59
63
|
createCustomToken(uid: string, developerClaims?: object): Promise<string>;
|
|
60
64
|
/**
|
|
@@ -80,6 +84,8 @@ export declare class CloudFireAuth {
|
|
|
80
84
|
* @returns A promise fulfilled with the
|
|
81
85
|
* token's decoded claims if the ID token is valid; otherwise, a rejected
|
|
82
86
|
* promise.
|
|
87
|
+
*
|
|
88
|
+
* @category Authentication
|
|
83
89
|
*/
|
|
84
90
|
verifyIdToken(idToken: string, checkRevoked?: boolean): Promise<DecodedIdToken>;
|
|
85
91
|
/**
|
|
@@ -92,6 +98,8 @@ export declare class CloudFireAuth {
|
|
|
92
98
|
*
|
|
93
99
|
* @returns A promise fulfilled with the user
|
|
94
100
|
* data corresponding to the provided `uid`.
|
|
101
|
+
*
|
|
102
|
+
* @category User Management
|
|
95
103
|
*/
|
|
96
104
|
getUser(uid: string): Promise<UserRecord>;
|
|
97
105
|
/**
|
|
@@ -105,6 +113,8 @@ export declare class CloudFireAuth {
|
|
|
105
113
|
*
|
|
106
114
|
* @returns A promise fulfilled with the user
|
|
107
115
|
* data corresponding to the provided email.
|
|
116
|
+
*
|
|
117
|
+
* @category User Management
|
|
108
118
|
*/
|
|
109
119
|
getUserByEmail(email: string): Promise<UserRecord>;
|
|
110
120
|
/**
|
|
@@ -119,6 +129,8 @@ export declare class CloudFireAuth {
|
|
|
119
129
|
*
|
|
120
130
|
* @returns A promise fulfilled with the user
|
|
121
131
|
* data corresponding to the provided phone number.
|
|
132
|
+
*
|
|
133
|
+
* @category User Management
|
|
122
134
|
*/
|
|
123
135
|
getUserByPhoneNumber(phoneNumber: string): Promise<UserRecord>;
|
|
124
136
|
/**
|
|
@@ -133,6 +145,8 @@ export declare class CloudFireAuth {
|
|
|
133
145
|
*
|
|
134
146
|
* @returns A promise fulfilled with the user data corresponding to the
|
|
135
147
|
* given provider id.
|
|
148
|
+
*
|
|
149
|
+
* @category User Management
|
|
136
150
|
*/
|
|
137
151
|
getUserByProviderUid(providerId: string, uid: string): Promise<UserRecord>;
|
|
138
152
|
/**
|
|
@@ -149,6 +163,8 @@ export declare class CloudFireAuth {
|
|
|
149
163
|
* @returns A promise that resolves to the corresponding user records.
|
|
150
164
|
* @throws FirebaseAuthError If any of the identifiers are invalid or if more than 100
|
|
151
165
|
* identifiers are specified.
|
|
166
|
+
*
|
|
167
|
+
* @category User Management
|
|
152
168
|
*/
|
|
153
169
|
getUsers(identifiers: UserIdentifier[]): Promise<GetUsersResult>;
|
|
154
170
|
/**
|
|
@@ -165,6 +181,8 @@ export declare class CloudFireAuth {
|
|
|
165
181
|
* users starting without any offset.
|
|
166
182
|
* @returns A promise that resolves with
|
|
167
183
|
* the current batch of downloaded users and the next page token.
|
|
184
|
+
*
|
|
185
|
+
* @category User Management
|
|
168
186
|
*/
|
|
169
187
|
listUsers(maxResults?: number, pageToken?: string): Promise<ListUsersResult>;
|
|
170
188
|
/**
|
|
@@ -178,6 +196,8 @@ export declare class CloudFireAuth {
|
|
|
178
196
|
*
|
|
179
197
|
* @returns A promise fulfilled with the user
|
|
180
198
|
* data corresponding to the newly created user.
|
|
199
|
+
*
|
|
200
|
+
* @category User Management
|
|
181
201
|
*/
|
|
182
202
|
createUser(properties: CreateRequest): Promise<UserRecord>;
|
|
183
203
|
/**
|
|
@@ -190,6 +210,8 @@ export declare class CloudFireAuth {
|
|
|
190
210
|
*
|
|
191
211
|
* @returns An empty promise fulfilled once the user has been
|
|
192
212
|
* deleted.
|
|
213
|
+
*
|
|
214
|
+
* @category User Management
|
|
193
215
|
*/
|
|
194
216
|
deleteUser(uid: string): Promise<void>;
|
|
195
217
|
/**
|
|
@@ -213,6 +235,8 @@ export declare class CloudFireAuth {
|
|
|
213
235
|
* @returns A Promise that resolves to the total number of successful/failed
|
|
214
236
|
* deletions, as well as the array of errors that corresponds to the
|
|
215
237
|
* failed deletions.
|
|
238
|
+
*
|
|
239
|
+
* @category User Management
|
|
216
240
|
*/
|
|
217
241
|
deleteUsers(uids: string[]): Promise<DeleteUsersResult>;
|
|
218
242
|
/**
|
|
@@ -227,6 +251,8 @@ export declare class CloudFireAuth {
|
|
|
227
251
|
*
|
|
228
252
|
* @returns A promise fulfilled with the
|
|
229
253
|
* updated user data.
|
|
254
|
+
*
|
|
255
|
+
* @category User Management
|
|
230
256
|
*/
|
|
231
257
|
updateUser(uid: string, properties: UpdateRequest): Promise<UserRecord>;
|
|
232
258
|
/**
|
|
@@ -251,6 +277,8 @@ export declare class CloudFireAuth {
|
|
|
251
277
|
* separate storage systems.
|
|
252
278
|
* @returns A promise that resolves when the operation completes
|
|
253
279
|
* successfully.
|
|
280
|
+
*
|
|
281
|
+
* @category Token Management
|
|
254
282
|
*/
|
|
255
283
|
setCustomUserClaims(uid: string, customUserClaims: object | null): Promise<void>;
|
|
256
284
|
/**
|
|
@@ -263,7 +291,7 @@ export declare class CloudFireAuth {
|
|
|
263
291
|
* While this will revoke all sessions for a specified user and disable any
|
|
264
292
|
* new ID tokens for existing sessions from getting minted, existing ID tokens
|
|
265
293
|
* may remain active until their natural expiration (one hour). To verify that
|
|
266
|
-
* ID tokens are revoked, use {@link
|
|
294
|
+
* ID tokens are revoked, use {@link CloudFireAuth.verifyIdToken}
|
|
267
295
|
* where `checkRevoked` is set to true.
|
|
268
296
|
*
|
|
269
297
|
* @param uid - The `uid` corresponding to the user whose refresh tokens
|
|
@@ -271,6 +299,8 @@ export declare class CloudFireAuth {
|
|
|
271
299
|
*
|
|
272
300
|
* @returns An empty promise fulfilled once the user's refresh
|
|
273
301
|
* tokens have been revoked.
|
|
302
|
+
*
|
|
303
|
+
* @category Token Management
|
|
274
304
|
*/
|
|
275
305
|
revokeRefreshTokens(uid: string): Promise<void>;
|
|
276
306
|
/**
|
|
@@ -289,6 +319,8 @@ export declare class CloudFireAuth {
|
|
|
289
319
|
* the operation completes with the result of the import. This includes the
|
|
290
320
|
* number of successful imports, the number of failed imports and their
|
|
291
321
|
* corresponding errors.
|
|
322
|
+
*
|
|
323
|
+
* @category User Management
|
|
292
324
|
*/
|
|
293
325
|
importUsers(users: UserImportRecord[], options?: UserImportOptions): Promise<UserImportResult>;
|
|
294
326
|
/**
|
|
@@ -307,6 +339,8 @@ export declare class CloudFireAuth {
|
|
|
307
339
|
*
|
|
308
340
|
* @returns A promise that resolves on success with the
|
|
309
341
|
* created session cookie.
|
|
342
|
+
*
|
|
343
|
+
* @category Authentication
|
|
310
344
|
*/
|
|
311
345
|
createSessionCookie(idToken: string, sessionCookieOptions: SessionCookieOptions): Promise<string>;
|
|
312
346
|
/**
|
|
@@ -325,7 +359,7 @@ export declare class CloudFireAuth {
|
|
|
325
359
|
* for code samples and detailed documentation
|
|
326
360
|
*
|
|
327
361
|
* @param sessionCookie - The session cookie to verify.
|
|
328
|
-
* @param
|
|
362
|
+
* @param checkRevoked - Whether to check if the session cookie was
|
|
329
363
|
* revoked. This requires an extra request to the Firebase Auth backend to
|
|
330
364
|
* check the `tokensValidAfterTime` time for the corresponding user.
|
|
331
365
|
* When not specified, this additional check is not performed.
|
|
@@ -333,6 +367,8 @@ export declare class CloudFireAuth {
|
|
|
333
367
|
* @returns A promise fulfilled with the
|
|
334
368
|
* session cookie's decoded claims if the session cookie is valid; otherwise,
|
|
335
369
|
* a rejected promise.
|
|
370
|
+
*
|
|
371
|
+
* @category Authentication
|
|
336
372
|
*/
|
|
337
373
|
verifySessionCookie(sessionCookie: string, checkRevoked?: boolean): Promise<DecodedIdToken>;
|
|
338
374
|
/**
|
|
@@ -383,6 +419,8 @@ export declare class CloudFireAuth {
|
|
|
383
419
|
* The Android package name and iOS bundle ID are respected only if they
|
|
384
420
|
* are configured in the same Firebase Auth project.
|
|
385
421
|
* @returns A promise that resolves with the generated link.
|
|
422
|
+
*
|
|
423
|
+
* @category Email Actions
|
|
386
424
|
*/
|
|
387
425
|
generatePasswordResetLink(email: string, actionCodeSettings?: ActionCodeSettings): Promise<string>;
|
|
388
426
|
/**
|
|
@@ -432,6 +470,8 @@ export declare class CloudFireAuth {
|
|
|
432
470
|
* The Android package name and iOS bundle ID are respected only if they
|
|
433
471
|
* are configured in the same Firebase Auth project.
|
|
434
472
|
* @returns A promise that resolves with the generated link.
|
|
473
|
+
*
|
|
474
|
+
* @category Email Actions
|
|
435
475
|
*/
|
|
436
476
|
generateEmailVerificationLink(email: string, actionCodeSettings?: ActionCodeSettings): Promise<string>;
|
|
437
477
|
/**
|
|
@@ -457,6 +497,8 @@ export declare class CloudFireAuth {
|
|
|
457
497
|
* The Android package name and iOS bundle ID are respected only if they
|
|
458
498
|
* are configured in the same Firebase Auth project.
|
|
459
499
|
* @returns A promise that resolves with the generated link.
|
|
500
|
+
*
|
|
501
|
+
* @category Email Actions
|
|
460
502
|
*/
|
|
461
503
|
generateVerifyAndChangeEmailLink(email: string, newEmail: string, actionCodeSettings?: ActionCodeSettings): Promise<string>;
|
|
462
504
|
/**
|
|
@@ -506,6 +548,8 @@ export declare class CloudFireAuth {
|
|
|
506
548
|
* The Android package name and iOS bundle ID are respected only if they
|
|
507
549
|
* are configured in the same Firebase Auth project.
|
|
508
550
|
* @returns A promise that resolves with the generated link.
|
|
551
|
+
*
|
|
552
|
+
* @category Email Actions
|
|
509
553
|
*/
|
|
510
554
|
generateSignInWithEmailLink(email: string, actionCodeSettings: ActionCodeSettings): Promise<string>;
|
|
511
555
|
/**
|
|
@@ -519,6 +563,8 @@ export declare class CloudFireAuth {
|
|
|
519
563
|
* @param options - The provider config filter to apply.
|
|
520
564
|
* @returns A promise that resolves with the list of provider configs meeting the
|
|
521
565
|
* filter requirements.
|
|
566
|
+
*
|
|
567
|
+
* @category Provider Configuration
|
|
522
568
|
*/
|
|
523
569
|
listProviderConfigs(options: AuthProviderConfigFilter): Promise<ListProviderConfigResults>;
|
|
524
570
|
/**
|
|
@@ -535,6 +581,8 @@ export declare class CloudFireAuth {
|
|
|
535
581
|
* config to return.
|
|
536
582
|
* @returns A promise that resolves
|
|
537
583
|
* with the configuration corresponding to the provided ID.
|
|
584
|
+
*
|
|
585
|
+
* @category Provider Configuration
|
|
538
586
|
*/
|
|
539
587
|
getProviderConfig(providerId: string): Promise<AuthProviderConfig>;
|
|
540
588
|
/**
|
|
@@ -549,6 +597,8 @@ export declare class CloudFireAuth {
|
|
|
549
597
|
* @param providerId - The provider ID corresponding to the provider
|
|
550
598
|
* config to delete.
|
|
551
599
|
* @returns A promise that resolves on completion.
|
|
600
|
+
*
|
|
601
|
+
* @category Provider Configuration
|
|
552
602
|
*/
|
|
553
603
|
deleteProviderConfig(providerId: string): Promise<void>;
|
|
554
604
|
/**
|
|
@@ -565,6 +615,8 @@ export declare class CloudFireAuth {
|
|
|
565
615
|
* config to update.
|
|
566
616
|
* @param updatedConfig - The updated configuration.
|
|
567
617
|
* @returns A promise that resolves with the updated provider configuration.
|
|
618
|
+
*
|
|
619
|
+
* @category Provider Configuration
|
|
568
620
|
*/
|
|
569
621
|
updateProviderConfig(providerId: string, updatedConfig: UpdateAuthProviderRequest): Promise<AuthProviderConfig>;
|
|
570
622
|
/**
|
|
@@ -577,6 +629,8 @@ export declare class CloudFireAuth {
|
|
|
577
629
|
*
|
|
578
630
|
* @param config - The provider configuration to create.
|
|
579
631
|
* @returns A promise that resolves with the created provider configuration.
|
|
632
|
+
*
|
|
633
|
+
* @category Provider Configuration
|
|
580
634
|
*/
|
|
581
635
|
createProviderConfig(config: AuthProviderConfig): Promise<AuthProviderConfig>;
|
|
582
636
|
/**
|