firebase-admin-edge 1.1.0 → 2.0.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 +102 -405
- package/dist/app-check/app-check-endpoints.d.ts +31 -0
- package/dist/app-check/app-check-endpoints.d.ts.map +1 -0
- package/dist/app-check/app-check-endpoints.js +75 -0
- package/dist/app-check/app-check-endpoints.js.map +1 -0
- package/dist/app-check/app-check-jwt.d.ts +16 -0
- package/dist/app-check/app-check-jwt.d.ts.map +1 -0
- package/dist/app-check/app-check-jwt.js +59 -0
- package/dist/app-check/app-check-jwt.js.map +1 -0
- package/dist/app-check/app-check.d.ts +43 -0
- package/dist/app-check/app-check.d.ts.map +1 -0
- package/dist/app-check/app-check.js +141 -0
- package/dist/app-check/app-check.js.map +1 -0
- package/dist/auth/auth-blocking-types.d.ts +44 -0
- package/dist/auth/auth-blocking-types.d.ts.map +1 -0
- package/dist/auth/auth-blocking-types.js +2 -0
- package/dist/auth/auth-blocking-types.js.map +1 -0
- package/dist/auth/auth-config-types.d.ts +146 -0
- package/dist/auth/auth-config-types.d.ts.map +1 -0
- package/dist/auth/auth-config-types.js +2 -0
- package/dist/auth/auth-config-types.js.map +1 -0
- package/dist/auth/auth-config.d.ts +15 -0
- package/dist/auth/auth-config.d.ts.map +1 -0
- package/dist/auth/auth-config.js +413 -0
- package/dist/auth/auth-config.js.map +1 -0
- package/dist/auth/auth-emulator.d.ts +7 -0
- package/dist/auth/auth-emulator.d.ts.map +1 -0
- package/dist/auth/auth-emulator.js +24 -0
- package/dist/auth/auth-emulator.js.map +1 -0
- package/dist/auth/auth-endpoint-errors.d.ts +2 -0
- package/dist/auth/auth-endpoint-errors.d.ts.map +1 -1
- package/dist/auth/auth-endpoint-errors.js +20 -1
- package/dist/auth/auth-endpoint-errors.js.map +1 -1
- package/dist/auth/auth-error-codes.d.ts +12 -0
- package/dist/auth/auth-error-codes.d.ts.map +1 -1
- package/dist/auth/auth-error-codes.js +12 -0
- package/dist/auth/auth-error-codes.js.map +1 -1
- package/dist/auth/email-action-request.d.ts +40 -0
- package/dist/auth/email-action-request.d.ts.map +1 -0
- package/dist/auth/email-action-request.js +80 -0
- package/dist/auth/email-action-request.js.map +1 -0
- package/dist/auth/email-link.d.ts +24 -0
- package/dist/auth/email-link.d.ts.map +1 -0
- package/dist/auth/email-link.js +103 -0
- package/dist/auth/email-link.js.map +1 -0
- package/dist/auth/firebase-admin-auth.d.ts +60 -12
- package/dist/auth/firebase-admin-auth.d.ts.map +1 -1
- package/dist/auth/firebase-admin-auth.js +455 -64
- package/dist/auth/firebase-admin-auth.js.map +1 -1
- package/dist/auth/firebase-auth-endpoints.d.ts +94 -4
- package/dist/auth/firebase-auth-endpoints.d.ts.map +1 -1
- package/dist/auth/firebase-auth-endpoints.js +304 -64
- package/dist/auth/firebase-auth-endpoints.js.map +1 -1
- package/dist/auth/firebase-auth.d.ts +78 -4
- package/dist/auth/firebase-auth.d.ts.map +1 -1
- package/dist/auth/firebase-auth.js +101 -8
- package/dist/auth/firebase-auth.js.map +1 -1
- package/dist/auth/firebase-jwt.d.ts +19 -10
- package/dist/auth/firebase-jwt.d.ts.map +1 -1
- package/dist/auth/firebase-jwt.js +176 -39
- package/dist/auth/firebase-jwt.js.map +1 -1
- package/dist/auth/firebase-types.d.ts +3 -0
- package/dist/auth/firebase-types.d.ts.map +1 -1
- package/dist/auth/google-oauth.d.ts +0 -1
- package/dist/auth/google-oauth.d.ts.map +1 -1
- package/dist/auth/google-oauth.js +16 -86
- package/dist/auth/google-oauth.js.map +1 -1
- package/dist/auth/project-config-manager.d.ts +10 -0
- package/dist/auth/project-config-manager.d.ts.map +1 -0
- package/dist/auth/project-config-manager.js +22 -0
- package/dist/auth/project-config-manager.js.map +1 -0
- package/dist/auth/provider-credential.d.ts +43 -0
- package/dist/auth/provider-credential.d.ts.map +1 -0
- package/dist/auth/provider-credential.js +107 -0
- package/dist/auth/provider-credential.js.map +1 -0
- package/dist/auth/provider-session.d.ts +10 -0
- package/dist/auth/provider-session.d.ts.map +1 -0
- package/dist/auth/provider-session.js +28 -0
- package/dist/auth/provider-session.js.map +1 -0
- package/dist/auth/tenant-manager.d.ts +17 -0
- package/dist/auth/tenant-manager.d.ts.map +1 -0
- package/dist/auth/tenant-manager.js +59 -0
- package/dist/auth/tenant-manager.js.map +1 -0
- package/dist/auth/user-batch.d.ts +21 -0
- package/dist/auth/user-batch.d.ts.map +1 -0
- package/dist/auth/user-batch.js +49 -0
- package/dist/auth/user-batch.js.map +1 -0
- package/dist/auth/user-import.d.ts +55 -0
- package/dist/auth/user-import.d.ts.map +1 -0
- package/dist/auth/user-import.js +208 -0
- package/dist/auth/user-import.js.map +1 -0
- package/dist/auth/user-request.d.ts +10 -0
- package/dist/auth/user-request.d.ts.map +1 -1
- package/dist/auth/user-request.js +56 -0
- package/dist/auth/user-request.js.map +1 -1
- package/dist/db/aggregate.d.ts +49 -0
- package/dist/db/aggregate.d.ts.map +1 -0
- package/dist/db/aggregate.js +115 -0
- package/dist/db/aggregate.js.map +1 -0
- package/dist/db/bulk-writer.d.ts +55 -0
- package/dist/db/bulk-writer.d.ts.map +1 -0
- package/dist/db/bulk-writer.js +257 -0
- package/dist/db/bulk-writer.js.map +1 -0
- package/dist/db/bundle-builder.d.ts +17 -0
- package/dist/db/bundle-builder.d.ts.map +1 -0
- package/dist/db/bundle-builder.js +118 -0
- package/dist/db/bundle-builder.js.map +1 -0
- package/dist/db/bytes.d.ts +12 -0
- package/dist/db/bytes.d.ts.map +1 -0
- package/dist/db/bytes.js +49 -0
- package/dist/db/bytes.js.map +1 -0
- package/dist/db/collection-group.d.ts +14 -0
- package/dist/db/collection-group.d.ts.map +1 -0
- package/dist/db/collection-group.js +43 -0
- package/dist/db/collection-group.js.map +1 -0
- package/dist/db/collection-reference.d.ts +21 -0
- package/dist/db/collection-reference.d.ts.map +1 -0
- package/dist/db/collection-reference.js +46 -0
- package/dist/db/collection-reference.js.map +1 -0
- package/dist/db/document-reference.d.ts +41 -0
- package/dist/db/document-reference.d.ts.map +1 -0
- package/dist/db/document-reference.js +125 -0
- package/dist/db/document-reference.js.map +1 -0
- package/dist/db/document-snapshot.d.ts +31 -0
- package/dist/db/document-snapshot.d.ts.map +1 -0
- package/dist/db/document-snapshot.js +103 -0
- package/dist/db/document-snapshot.js.map +1 -0
- package/dist/db/explain.d.ts +28 -0
- package/dist/db/explain.d.ts.map +1 -0
- package/dist/db/explain.js +61 -0
- package/dist/db/explain.js.map +1 -0
- package/dist/db/field-path.d.ts +10 -0
- package/dist/db/field-path.d.ts.map +1 -0
- package/dist/db/field-path.js +65 -0
- package/dist/db/field-path.js.map +1 -0
- package/dist/db/field-value.d.ts +17 -0
- package/dist/db/field-value.d.ts.map +1 -0
- package/dist/db/field-value.js +57 -0
- package/dist/db/field-value.js.map +1 -0
- package/dist/db/filter.d.ts +20 -0
- package/dist/db/filter.d.ts.map +1 -0
- package/dist/db/filter.js +48 -0
- package/dist/db/filter.js.map +1 -0
- package/dist/db/firestore-converter.d.ts +11 -0
- package/dist/db/firestore-converter.d.ts.map +1 -0
- package/dist/db/firestore-converter.js +14 -0
- package/dist/db/firestore-converter.js.map +1 -0
- package/dist/db/firestore-document.d.ts +62 -0
- package/dist/db/firestore-document.d.ts.map +1 -0
- package/dist/db/firestore-document.js +238 -0
- package/dist/db/firestore-document.js.map +1 -0
- package/dist/db/firestore-endpoints.d.ts +41 -0
- package/dist/db/firestore-endpoints.d.ts.map +1 -0
- package/dist/db/firestore-endpoints.js +735 -0
- package/dist/db/firestore-endpoints.js.map +1 -0
- package/dist/db/firestore-error-codes.d.ts +24 -0
- package/dist/db/firestore-error-codes.d.ts.map +1 -0
- package/dist/db/firestore-error-codes.js +24 -0
- package/dist/db/firestore-error-codes.js.map +1 -0
- package/dist/db/firestore-logging.d.ts +23 -0
- package/dist/db/firestore-logging.d.ts.map +1 -0
- package/dist/db/firestore-logging.js +41 -0
- package/dist/db/firestore-logging.js.map +1 -0
- package/dist/db/firestore-path.d.ts +4 -0
- package/dist/db/firestore-path.d.ts.map +1 -0
- package/dist/db/firestore-path.js +37 -0
- package/dist/db/firestore-path.js.map +1 -0
- package/dist/db/firestore-results.d.ts +12 -0
- package/dist/db/firestore-results.d.ts.map +1 -0
- package/dist/db/firestore-results.js +19 -0
- package/dist/db/firestore-results.js.map +1 -0
- package/dist/db/firestore-settings.d.ts +22 -0
- package/dist/db/firestore-settings.d.ts.map +1 -0
- package/dist/db/firestore-settings.js +83 -0
- package/dist/db/firestore-settings.js.map +1 -0
- package/dist/db/firestore-telemetry.d.ts +21 -0
- package/dist/db/firestore-telemetry.d.ts.map +1 -0
- package/dist/db/firestore-telemetry.js +84 -0
- package/dist/db/firestore-telemetry.js.map +1 -0
- package/dist/db/firestore-types.d.ts +25 -0
- package/dist/db/firestore-types.d.ts.map +1 -0
- package/dist/db/firestore-types.js +2 -0
- package/dist/db/firestore-types.js.map +1 -0
- package/dist/db/firestore.d.ts +151 -0
- package/dist/db/firestore.d.ts.map +1 -0
- package/dist/db/firestore.js +505 -0
- package/dist/db/firestore.js.map +1 -0
- package/dist/db/geo-point.d.ts +11 -0
- package/dist/db/geo-point.d.ts.map +1 -0
- package/dist/db/geo-point.js +29 -0
- package/dist/db/geo-point.js.map +1 -0
- package/dist/db/json-stream.d.ts +3 -0
- package/dist/db/json-stream.d.ts.map +1 -0
- package/dist/db/json-stream.js +117 -0
- package/dist/db/json-stream.js.map +1 -0
- package/dist/db/pipeline-expression.d.ts +293 -0
- package/dist/db/pipeline-expression.d.ts.map +1 -0
- package/dist/db/pipeline-expression.js +1436 -0
- package/dist/db/pipeline-expression.js.map +1 -0
- package/dist/db/pipeline-query.d.ts +6 -0
- package/dist/db/pipeline-query.d.ts.map +1 -0
- package/dist/db/pipeline-query.js +91 -0
- package/dist/db/pipeline-query.js.map +1 -0
- package/dist/db/pipeline.d.ts +120 -0
- package/dist/db/pipeline.d.ts.map +1 -0
- package/dist/db/pipeline.js +396 -0
- package/dist/db/pipeline.js.map +1 -0
- package/dist/db/query-document-snapshot.d.ts +2 -0
- package/dist/db/query-document-snapshot.d.ts.map +1 -0
- package/dist/db/query-document-snapshot.js +2 -0
- package/dist/db/query-document-snapshot.js.map +1 -0
- package/dist/db/query-partition.d.ts +14 -0
- package/dist/db/query-partition.d.ts.map +1 -0
- package/dist/db/query-partition.js +32 -0
- package/dist/db/query-partition.js.map +1 -0
- package/dist/db/query-request.d.ts +96 -0
- package/dist/db/query-request.d.ts.map +1 -0
- package/dist/db/query-request.js +283 -0
- package/dist/db/query-request.js.map +1 -0
- package/dist/db/query.d.ts +129 -0
- package/dist/db/query.d.ts.map +1 -0
- package/dist/db/query.js +468 -0
- package/dist/db/query.js.map +1 -0
- package/dist/db/recursive-delete.d.ts +6 -0
- package/dist/db/recursive-delete.d.ts.map +1 -0
- package/dist/db/recursive-delete.js +38 -0
- package/dist/db/recursive-delete.js.map +1 -0
- package/dist/db/snapshot-listener.d.ts +10 -0
- package/dist/db/snapshot-listener.d.ts.map +1 -0
- package/dist/db/snapshot-listener.js +71 -0
- package/dist/db/snapshot-listener.js.map +1 -0
- package/dist/db/timestamp.d.ts +29 -0
- package/dist/db/timestamp.d.ts.map +1 -0
- package/dist/db/timestamp.js +98 -0
- package/dist/db/timestamp.js.map +1 -0
- package/dist/db/transaction.d.ts +44 -0
- package/dist/db/transaction.d.ts.map +1 -0
- package/dist/db/transaction.js +177 -0
- package/dist/db/transaction.js.map +1 -0
- package/dist/db/value-equality.d.ts +3 -0
- package/dist/db/value-equality.d.ts.map +1 -0
- package/dist/db/value-equality.js +29 -0
- package/dist/db/value-equality.js.map +1 -0
- package/dist/db/vector-query.d.ts +38 -0
- package/dist/db/vector-query.d.ts.map +1 -0
- package/dist/db/vector-query.js +110 -0
- package/dist/db/vector-query.js.map +1 -0
- package/dist/db/vector-value.d.ts +8 -0
- package/dist/db/vector-value.d.ts.map +1 -0
- package/dist/db/vector-value.js +25 -0
- package/dist/db/vector-value.js.map +1 -0
- package/dist/db/write-batch.d.ts +25 -0
- package/dist/db/write-batch.d.ts.map +1 -0
- package/dist/db/write-batch.js +72 -0
- package/dist/db/write-batch.js.map +1 -0
- package/dist/db/write-request.d.ts +36 -0
- package/dist/db/write-request.d.ts.map +1 -0
- package/dist/db/write-request.js +257 -0
- package/dist/db/write-request.js.map +1 -0
- package/dist/firebase-edge-server.d.ts +143 -36
- package/dist/firebase-edge-server.d.ts.map +1 -1
- package/dist/firebase-edge-server.js +466 -257
- package/dist/firebase-edge-server.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/rest-fetch.d.ts +1 -1
- package/dist/rest-fetch.d.ts.map +1 -1
- package/dist/storage/storage-acl.d.ts +48 -0
- package/dist/storage/storage-acl.d.ts.map +1 -0
- package/dist/storage/storage-acl.js +101 -0
- package/dist/storage/storage-acl.js.map +1 -0
- package/dist/storage/storage-bucket-endpoints.d.ts +10 -0
- package/dist/storage/storage-bucket-endpoints.d.ts.map +1 -0
- package/dist/storage/storage-bucket-endpoints.js +514 -0
- package/dist/storage/storage-bucket-endpoints.js.map +1 -0
- package/dist/storage/storage-bucket-types.d.ts +183 -0
- package/dist/storage/storage-bucket-types.d.ts.map +1 -0
- package/dist/storage/storage-bucket-types.js +2 -0
- package/dist/storage/storage-bucket-types.js.map +1 -0
- package/dist/storage/storage-bucket.d.ts +122 -0
- package/dist/storage/storage-bucket.d.ts.map +1 -0
- package/dist/storage/storage-bucket.js +544 -0
- package/dist/storage/storage-bucket.js.map +1 -0
- package/dist/storage/storage-channel.d.ts +10 -0
- package/dist/storage/storage-channel.d.ts.map +1 -0
- package/dist/storage/storage-channel.js +15 -0
- package/dist/storage/storage-channel.js.map +1 -0
- package/dist/storage/storage-checksum.d.ts +35 -0
- package/dist/storage/storage-checksum.d.ts.map +1 -0
- package/dist/storage/storage-checksum.js +312 -0
- package/dist/storage/storage-checksum.js.map +1 -0
- package/dist/storage/storage-endpoints.d.ts +14 -0
- package/dist/storage/storage-endpoints.d.ts.map +1 -0
- package/dist/storage/storage-endpoints.js +721 -0
- package/dist/storage/storage-endpoints.js.map +1 -0
- package/dist/storage/storage-file.d.ts +126 -0
- package/dist/storage/storage-file.d.ts.map +1 -0
- package/dist/storage/storage-file.js +604 -0
- package/dist/storage/storage-file.js.map +1 -0
- package/dist/storage/storage-hmac-key.d.ts +26 -0
- package/dist/storage/storage-hmac-key.d.ts.map +1 -0
- package/dist/storage/storage-hmac-key.js +45 -0
- package/dist/storage/storage-hmac-key.js.map +1 -0
- package/dist/storage/storage-iam.d.ts +20 -0
- package/dist/storage/storage-iam.d.ts.map +1 -0
- package/dist/storage/storage-iam.js +43 -0
- package/dist/storage/storage-iam.js.map +1 -0
- package/dist/storage/storage-md5.d.ts +11 -0
- package/dist/storage/storage-md5.d.ts.map +1 -0
- package/dist/storage/storage-md5.js +96 -0
- package/dist/storage/storage-md5.js.map +1 -0
- package/dist/storage/storage-notification.d.ts +24 -0
- package/dist/storage/storage-notification.d.ts.map +1 -0
- package/dist/storage/storage-notification.js +40 -0
- package/dist/storage/storage-notification.js.map +1 -0
- package/dist/storage/storage-progress.d.ts +4 -0
- package/dist/storage/storage-progress.d.ts.map +1 -0
- package/dist/storage/storage-progress.js +17 -0
- package/dist/storage/storage-progress.js.map +1 -0
- package/dist/storage/storage-reference-endpoints.d.ts +63 -0
- package/dist/storage/storage-reference-endpoints.d.ts.map +1 -0
- package/dist/storage/storage-reference-endpoints.js +276 -0
- package/dist/storage/storage-reference-endpoints.js.map +1 -0
- package/dist/storage/storage-reference-helpers.d.ts +12 -0
- package/dist/storage/storage-reference-helpers.d.ts.map +1 -0
- package/dist/storage/storage-reference-helpers.js +72 -0
- package/dist/storage/storage-reference-helpers.js.map +1 -0
- package/dist/storage/storage-reference-signing.d.ts +40 -0
- package/dist/storage/storage-reference-signing.d.ts.map +1 -0
- package/dist/storage/storage-reference-signing.js +289 -0
- package/dist/storage/storage-reference-signing.js.map +1 -0
- package/dist/storage/storage-reference-types.d.ts +76 -0
- package/dist/storage/storage-reference-types.d.ts.map +1 -0
- package/dist/storage/storage-reference-types.js +2 -0
- package/dist/storage/storage-reference-types.js.map +1 -0
- package/dist/storage/storage-results.d.ts +8 -0
- package/dist/storage/storage-results.d.ts.map +1 -0
- package/dist/storage/storage-results.js +32 -0
- package/dist/storage/storage-results.js.map +1 -0
- package/dist/storage/storage-resumable.d.ts +18 -0
- package/dist/storage/storage-resumable.d.ts.map +1 -0
- package/dist/storage/storage-resumable.js +166 -0
- package/dist/storage/storage-resumable.js.map +1 -0
- package/dist/storage/storage-retry.d.ts +9 -0
- package/dist/storage/storage-retry.d.ts.map +1 -0
- package/dist/storage/storage-retry.js +104 -0
- package/dist/storage/storage-retry.js.map +1 -0
- package/dist/storage/storage-signed-url.d.ts +9 -0
- package/dist/storage/storage-signed-url.d.ts.map +1 -0
- package/dist/storage/storage-signed-url.js +96 -0
- package/dist/storage/storage-signed-url.js.map +1 -0
- package/dist/storage/storage-special-endpoints.d.ts +10 -0
- package/dist/storage/storage-special-endpoints.d.ts.map +1 -0
- package/dist/storage/storage-special-endpoints.js +394 -0
- package/dist/storage/storage-special-endpoints.js.map +1 -0
- package/dist/storage/storage-special-types.d.ts +154 -0
- package/dist/storage/storage-special-types.d.ts.map +1 -0
- package/dist/storage/storage-special-types.js +2 -0
- package/dist/storage/storage-special-types.js.map +1 -0
- package/dist/storage/storage-types.d.ts +251 -0
- package/dist/storage/storage-types.d.ts.map +1 -0
- package/dist/storage/storage-types.js +2 -0
- package/dist/storage/storage-types.js.map +1 -0
- package/dist/storage/storage-upload-stream.d.ts +41 -0
- package/dist/storage/storage-upload-stream.d.ts.map +1 -0
- package/dist/storage/storage-upload-stream.js +335 -0
- package/dist/storage/storage-upload-stream.js.map +1 -0
- package/dist/storage/storage-xml-signing.d.ts +17 -0
- package/dist/storage/storage-xml-signing.d.ts.map +1 -0
- package/dist/storage/storage-xml-signing.js +144 -0
- package/dist/storage/storage-xml-signing.js.map +1 -0
- package/dist/storage/storage.d.ts +152 -0
- package/dist/storage/storage.d.ts.map +1 -0
- package/dist/storage/storage.js +532 -0
- package/dist/storage/storage.js.map +1 -0
- package/dist/utils/token-cache.d.ts.map +1 -1
- package/dist/utils/token-cache.js +3 -2
- package/dist/utils/token-cache.js.map +1 -1
- package/package.json +22 -6
- package/dist/auth/auth-endpoint-errors.test.d.ts +0 -2
- package/dist/auth/auth-endpoint-errors.test.d.ts.map +0 -1
- package/dist/auth/auth-endpoint-errors.test.js +0 -411
- package/dist/auth/auth-endpoint-errors.test.js.map +0 -1
- package/dist/auth/errors.test.d.ts +0 -2
- package/dist/auth/errors.test.d.ts.map +0 -1
- package/dist/auth/errors.test.js +0 -123
- package/dist/auth/errors.test.js.map +0 -1
- package/dist/auth/firebase-admin-auth.test.d.ts +0 -2
- package/dist/auth/firebase-admin-auth.test.d.ts.map +0 -1
- package/dist/auth/firebase-admin-auth.test.js +0 -923
- package/dist/auth/firebase-admin-auth.test.js.map +0 -1
- package/dist/auth/firebase-auth-endpoints.test.d.ts +0 -2
- package/dist/auth/firebase-auth-endpoints.test.d.ts.map +0 -1
- package/dist/auth/firebase-auth-endpoints.test.js +0 -957
- package/dist/auth/firebase-auth-endpoints.test.js.map +0 -1
- package/dist/auth/firebase-auth.test.d.ts +0 -2
- package/dist/auth/firebase-auth.test.d.ts.map +0 -1
- package/dist/auth/firebase-auth.test.js +0 -167
- package/dist/auth/firebase-auth.test.js.map +0 -1
- package/dist/auth/firebase-jwt.test.d.ts +0 -2
- package/dist/auth/firebase-jwt.test.d.ts.map +0 -1
- package/dist/auth/firebase-jwt.test.js +0 -164
- package/dist/auth/firebase-jwt.test.js.map +0 -1
- package/dist/auth/github-oauth.d.ts +0 -19
- package/dist/auth/github-oauth.d.ts.map +0 -1
- package/dist/auth/github-oauth.js +0 -145
- package/dist/auth/github-oauth.js.map +0 -1
- package/dist/auth/github-oauth.test.d.ts +0 -2
- package/dist/auth/github-oauth.test.d.ts.map +0 -1
- package/dist/auth/github-oauth.test.js +0 -202
- package/dist/auth/github-oauth.test.js.map +0 -1
- package/dist/auth/google-oauth.test.d.ts +0 -2
- package/dist/auth/google-oauth.test.d.ts.map +0 -1
- package/dist/auth/google-oauth.test.js +0 -200
- package/dist/auth/google-oauth.test.js.map +0 -1
- package/dist/auth/oauth.d.ts +0 -3
- package/dist/auth/oauth.d.ts.map +0 -1
- package/dist/auth/oauth.js +0 -48
- package/dist/auth/oauth.js.map +0 -1
- package/dist/auth/oauth.test.d.ts +0 -2
- package/dist/auth/oauth.test.d.ts.map +0 -1
- package/dist/auth/oauth.test.js +0 -109
- package/dist/auth/oauth.test.js.map +0 -1
- package/dist/auth/user-record.test.d.ts +0 -2
- package/dist/auth/user-record.test.d.ts.map +0 -1
- package/dist/auth/user-record.test.js +0 -198
- package/dist/auth/user-record.test.js.map +0 -1
- package/dist/auth/user-request.test.d.ts +0 -2
- package/dist/auth/user-request.test.d.ts.map +0 -1
- package/dist/auth/user-request.test.js +0 -269
- package/dist/auth/user-request.test.js.map +0 -1
- package/dist/firebase-edge-errors.test.d.ts +0 -2
- package/dist/firebase-edge-errors.test.d.ts.map +0 -1
- package/dist/firebase-edge-errors.test.js +0 -72
- package/dist/firebase-edge-errors.test.js.map +0 -1
- package/dist/firebase-edge-server.test.d.ts +0 -2
- package/dist/firebase-edge-server.test.d.ts.map +0 -1
- package/dist/firebase-edge-server.test.js +0 -264
- package/dist/firebase-edge-server.test.js.map +0 -1
- package/dist/rest-fetch.test.d.ts +0 -2
- package/dist/rest-fetch.test.d.ts.map +0 -1
- package/dist/rest-fetch.test.js +0 -164
- package/dist/rest-fetch.test.js.map +0 -1
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { isLocalRedirectPath, parseProviderSession } from './auth/provider-session.js';
|
|
2
|
+
import { resolveProviderId, providerCredentialFromResponse, FIREBASE_PROVIDER_IDS } from './auth/provider-credential.js';
|
|
1
3
|
import { FirebaseAdminAuth } from './auth/firebase-admin-auth.js';
|
|
4
|
+
import { Firestore } from './db/firestore.js';
|
|
5
|
+
import { AppCheck } from './app-check/app-check.js';
|
|
6
|
+
import { Storage } from './storage/storage.js';
|
|
2
7
|
import { FirebaseAuth } from './auth/firebase-auth.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { exchangeCodeForGoogleIdToken } from './auth/google-oauth.js';
|
|
6
|
-
import { createGitHubOAuthLoginUrl, createGoogleOAuthLoginUrl } from './auth/oauth.js';
|
|
7
|
-
import { FirebaseEdgeError } from './auth/errors.js';
|
|
8
|
+
import { resolveAuthEmulatorHost } from './auth/auth-emulator.js';
|
|
9
|
+
import { FirebaseEdgeError, ensureError } from './auth/errors.js';
|
|
8
10
|
import { FirebaseEdgeServerErrorInfo } from './firebase-edge-errors.js';
|
|
11
|
+
import { createEmailLinkState, readEmailLinkState, parseEmailActionLink, parseEmailSignInLink } from './auth/email-link.js';
|
|
12
|
+
import { buildEmailActionRequest } from './auth/email-action-request.js';
|
|
9
13
|
const COOKIE_LIFETIME_SECONDS = 60 * 60 * 24 * 5; // 5 days
|
|
10
14
|
const COOKIE_OPTIONS = {
|
|
11
15
|
httpOnly: true,
|
|
@@ -14,26 +18,13 @@ const COOKIE_OPTIONS = {
|
|
|
14
18
|
path: '/',
|
|
15
19
|
maxAge: COOKIE_LIFETIME_SECONDS
|
|
16
20
|
};
|
|
17
|
-
|
|
18
|
-
* Official Firebase OAuth providers
|
|
19
|
-
*/
|
|
20
|
-
export const OFFICIAL_FIREBASE_OAUTH_PROVIDERS = [
|
|
21
|
-
'google',
|
|
22
|
-
'facebook',
|
|
23
|
-
'apple',
|
|
24
|
-
'twitter',
|
|
25
|
-
'github',
|
|
26
|
-
'microsoft',
|
|
27
|
-
'yahoo',
|
|
28
|
-
'playgames'
|
|
29
|
-
];
|
|
21
|
+
export const OFFICIAL_FIREBASE_OAUTH_PROVIDERS = Object.keys(FIREBASE_PROVIDER_IDS);
|
|
30
22
|
/**
|
|
31
23
|
* Creates a Firebase Edge Server for authentication and session management in edge environments.
|
|
32
24
|
*
|
|
33
25
|
* @param config Configuration object
|
|
34
26
|
* @param config.serviceAccount Firebase service account for admin operations
|
|
35
27
|
* @param config.firebaseConfig Firebase client configuration
|
|
36
|
-
* @param config.providers OAuth provider configurations (Google, GitHub, etc.)
|
|
37
28
|
* @param config.cookies Cookie management functions (getSession, saveSession)
|
|
38
29
|
* @param config.redirectUri OAuth callback redirect URI
|
|
39
30
|
* @param config.cache Optional cache implementation for token caching
|
|
@@ -43,9 +34,10 @@ export const OFFICIAL_FIREBASE_OAUTH_PROVIDERS = [
|
|
|
43
34
|
* @param config.tenantId Optional Firebase Auth tenant ID for multi-tenancy
|
|
44
35
|
* @param config.autoLinkProviders Optional flag to automatically link accounts with same email
|
|
45
36
|
* @param config.fetch Optional custom fetch implementation
|
|
46
|
-
* @
|
|
37
|
+
* @param config.authEmulatorHost Auth emulator host:port; null forces production, undefined reads the environment.
|
|
38
|
+
* @returns Object with auth, adminAuth, firestore, and session management methods
|
|
47
39
|
*/
|
|
48
|
-
export function createFirebaseEdgeServer({ serviceAccount, firebaseConfig,
|
|
40
|
+
export function createFirebaseEdgeServer({ serviceAccount, firebaseConfig, cookies, cookieName, cookieOptions, cache, cacheName, tenantId, redirectUri, autoLinkProviders, fetch, authEmulatorHost }) {
|
|
49
41
|
// Cookies
|
|
50
42
|
const _cookieName = cookieName || '__session';
|
|
51
43
|
const { getSession, saveSession } = cookies;
|
|
@@ -54,8 +46,369 @@ export function createFirebaseEdgeServer({ serviceAccount, firebaseConfig, provi
|
|
|
54
46
|
const fetchImpl = fetch ?? globalThis.fetch;
|
|
55
47
|
const cacheImpl = cache ?? undefined;
|
|
56
48
|
// Auth instances
|
|
57
|
-
const
|
|
58
|
-
|
|
49
|
+
const authOptions = {
|
|
50
|
+
emulatorHost: resolveAuthEmulatorHost(authEmulatorHost)
|
|
51
|
+
};
|
|
52
|
+
const auth = new FirebaseAuth(firebaseConfig, redirectUri, tenantId, fetchImpl, authOptions);
|
|
53
|
+
const adminAuth = new FirebaseAdminAuth(serviceAccount, tenantId, fetchImpl, cacheImpl, cacheName, authOptions);
|
|
54
|
+
const firestore = new Firestore(serviceAccount, undefined, fetchImpl, cacheImpl, cacheName);
|
|
55
|
+
const appCheck = new AppCheck(serviceAccount, fetchImpl, cacheImpl, cacheName);
|
|
56
|
+
const storage = new Storage(serviceAccount, firebaseConfig.storageBucket, fetchImpl, cacheImpl, cacheName);
|
|
57
|
+
/** Describe the confirmation form to render, without exchanging or consuming any code. */
|
|
58
|
+
function getCallbackAction(url) {
|
|
59
|
+
try {
|
|
60
|
+
const action = parseEmailActionLink(url, firebaseConfig.apiKey, tenantId);
|
|
61
|
+
if (!action)
|
|
62
|
+
return { data: null, error: null };
|
|
63
|
+
return {
|
|
64
|
+
data: {
|
|
65
|
+
hasLink: action.hasLink,
|
|
66
|
+
actionMode: action.actionMode
|
|
67
|
+
},
|
|
68
|
+
error: null
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
catch (cause) {
|
|
72
|
+
return { data: null, error: ensureError(cause) };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** Complete any supported callback after the framework has obtained user confirmation. */
|
|
76
|
+
async function handleCallback(url, options = {}) {
|
|
77
|
+
try {
|
|
78
|
+
const action = parseEmailActionLink(url, firebaseConfig.apiKey, tenantId);
|
|
79
|
+
if (!action || action.actionMode === 'signIn') {
|
|
80
|
+
const { error, data } = await signInWithCallback(url, options);
|
|
81
|
+
if (error)
|
|
82
|
+
return { data: null, error };
|
|
83
|
+
return {
|
|
84
|
+
data: { type: 'redirect', url: data },
|
|
85
|
+
error: null
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (!action.hasLink || !action.code)
|
|
89
|
+
return {
|
|
90
|
+
data: null,
|
|
91
|
+
error: new FirebaseEdgeError({
|
|
92
|
+
code: 'auth/invalid-action-code',
|
|
93
|
+
message: 'An email action code is required.'
|
|
94
|
+
})
|
|
95
|
+
};
|
|
96
|
+
if (action.actionMode === 'resetPassword' &&
|
|
97
|
+
options.confirmPassword !== undefined &&
|
|
98
|
+
options.newPassword !== options.confirmPassword)
|
|
99
|
+
return {
|
|
100
|
+
data: null,
|
|
101
|
+
error: new FirebaseEdgeError({
|
|
102
|
+
code: 'auth/password-mismatch',
|
|
103
|
+
message: 'Passwords do not match.'
|
|
104
|
+
})
|
|
105
|
+
};
|
|
106
|
+
const { error } = action.actionMode === 'resetPassword'
|
|
107
|
+
? await confirmPasswordReset(action.code, options.newPassword ?? '')
|
|
108
|
+
: await applyActionCode(action.code);
|
|
109
|
+
if (error)
|
|
110
|
+
return { data: null, error };
|
|
111
|
+
return {
|
|
112
|
+
data: {
|
|
113
|
+
type: 'complete',
|
|
114
|
+
message: action.actionMode === 'resetPassword'
|
|
115
|
+
? 'Your password has been reset. You can sign in again.'
|
|
116
|
+
: 'Your email has been updated or verified. Please sign in again.'
|
|
117
|
+
},
|
|
118
|
+
error: null
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
catch (cause) {
|
|
122
|
+
return { data: null, error: ensureError(cause) };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/** Send Firebase's password reset email using the configured callback. */
|
|
126
|
+
async function sendPasswordResetEmail(email, locale) {
|
|
127
|
+
return auth.sendPasswordResetEmail(email, redirectUri, locale);
|
|
128
|
+
}
|
|
129
|
+
/** Reset a password and clear the local session after success. */
|
|
130
|
+
async function confirmPasswordReset(oobCode, newPassword) {
|
|
131
|
+
const { error, data } = await auth.confirmPasswordReset(oobCode, newPassword);
|
|
132
|
+
if (error)
|
|
133
|
+
return { error, data };
|
|
134
|
+
signOut();
|
|
135
|
+
return { error, data };
|
|
136
|
+
}
|
|
137
|
+
/** Verify a new email before changing the currently signed-in account. */
|
|
138
|
+
async function verifyBeforeUpdateEmail(newEmail, locale) {
|
|
139
|
+
const { error: userError, data: userData } = await getUser(true);
|
|
140
|
+
if (userError)
|
|
141
|
+
return { data: null, error: userError };
|
|
142
|
+
if (!userData)
|
|
143
|
+
return {
|
|
144
|
+
data: null,
|
|
145
|
+
error: new FirebaseEdgeError({
|
|
146
|
+
code: 'auth/unauthenticated',
|
|
147
|
+
message: 'Sign in before changing your email.'
|
|
148
|
+
})
|
|
149
|
+
};
|
|
150
|
+
// getToken exchanges a custom token, so enforce recency on the original session first.
|
|
151
|
+
const age = Date.now() / 1000 - userData.auth_time;
|
|
152
|
+
if (!Number.isFinite(age) || age < 0 || age > 300)
|
|
153
|
+
return {
|
|
154
|
+
data: null,
|
|
155
|
+
error: new FirebaseEdgeError({
|
|
156
|
+
code: 'auth/requires-recent-login',
|
|
157
|
+
message: 'Sign out and sign in again before changing your email.'
|
|
158
|
+
})
|
|
159
|
+
};
|
|
160
|
+
const { error: tokenError, data: tokenData } = await getToken();
|
|
161
|
+
if (tokenError)
|
|
162
|
+
return { data: null, error: tokenError };
|
|
163
|
+
if (!tokenData?.idToken)
|
|
164
|
+
return {
|
|
165
|
+
data: null,
|
|
166
|
+
error: new FirebaseEdgeError({
|
|
167
|
+
code: 'auth/unauthenticated',
|
|
168
|
+
message: 'Sign in before changing your email.'
|
|
169
|
+
})
|
|
170
|
+
};
|
|
171
|
+
return auth.verifyBeforeUpdateEmail(tokenData.idToken, newEmail, redirectUri, locale);
|
|
172
|
+
}
|
|
173
|
+
/** Apply an email action and discard stale local session claims on success. */
|
|
174
|
+
async function applyActionCode(oobCode) {
|
|
175
|
+
const { error, data } = await auth.applyActionCode(oobCode);
|
|
176
|
+
if (error)
|
|
177
|
+
return { error, data };
|
|
178
|
+
signOut();
|
|
179
|
+
return { error, data };
|
|
180
|
+
}
|
|
181
|
+
/** Persist a successful Firebase login as the configured session cookie. */
|
|
182
|
+
async function saveSignInSession(signInData, next, expiresIn_ms) {
|
|
183
|
+
const { idToken } = signInData;
|
|
184
|
+
if (!idToken) {
|
|
185
|
+
return {
|
|
186
|
+
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_ID_TOKEN)
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
const { data: sessionCookie, error: sessionError } = await adminAuth.createSessionCookie(idToken, {
|
|
190
|
+
expiresIn: expiresIn_ms
|
|
191
|
+
});
|
|
192
|
+
if (sessionError) {
|
|
193
|
+
return {
|
|
194
|
+
error: sessionError
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
if (!sessionCookie) {
|
|
198
|
+
return {
|
|
199
|
+
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_SESSION_COOKIE)
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
await saveSession(_cookieName, sessionCookie, _cookieOptions);
|
|
203
|
+
return {
|
|
204
|
+
data: next,
|
|
205
|
+
error: null
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/** Send a magic link with an optional email inside encrypted continuation state. */
|
|
209
|
+
async function sendSignInLinkToEmail(email, next = '/', options = {}) {
|
|
210
|
+
if (!isLocalRedirectPath(next))
|
|
211
|
+
return {
|
|
212
|
+
error: new FirebaseEdgeError({
|
|
213
|
+
code: 'auth/invalid-continue-uri',
|
|
214
|
+
message: 'The next path must be a local absolute path.'
|
|
215
|
+
})
|
|
216
|
+
};
|
|
217
|
+
const callbackUrl = options.callbackUrl ?? redirectUri;
|
|
218
|
+
const { error: validatedError } = buildEmailActionRequest('EMAIL_SIGNIN', email, {
|
|
219
|
+
url: callbackUrl,
|
|
220
|
+
handleCodeInApp: true
|
|
221
|
+
});
|
|
222
|
+
if (validatedError)
|
|
223
|
+
return { error: validatedError };
|
|
224
|
+
try {
|
|
225
|
+
const state = await createEmailLinkState({ next, ...(options.includeEmailInLink && { email }) }, serviceAccount.private_key, firebaseConfig.projectId, tenantId);
|
|
226
|
+
const continuation = new URL(callbackUrl);
|
|
227
|
+
continuation.searchParams.set('emailLinkState', state);
|
|
228
|
+
const { error } = await auth.sendSignInLinkToEmail(email, continuation.toString(), options.locale);
|
|
229
|
+
if (error)
|
|
230
|
+
return { error };
|
|
231
|
+
return { data: { sent: true }, error: null };
|
|
232
|
+
}
|
|
233
|
+
catch (cause) {
|
|
234
|
+
return { error: ensureError(cause) };
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/** Complete a magic link with explicit email or email carried in encrypted state. */
|
|
238
|
+
async function signInWithEmailLink(url, options = {}) {
|
|
239
|
+
try {
|
|
240
|
+
const link = parseEmailSignInLink(url, firebaseConfig.apiKey, tenantId);
|
|
241
|
+
const state = await readEmailLinkState(link.state, serviceAccount.private_key, firebaseConfig.projectId, tenantId);
|
|
242
|
+
const email = options.email ?? state.email;
|
|
243
|
+
if (!email)
|
|
244
|
+
return {
|
|
245
|
+
error: new FirebaseEdgeError({
|
|
246
|
+
code: 'auth/missing-email',
|
|
247
|
+
message: 'Enter the email address this sign-in link was sent to.'
|
|
248
|
+
})
|
|
249
|
+
};
|
|
250
|
+
if (state.email && options.email && state.email !== options.email)
|
|
251
|
+
return {
|
|
252
|
+
error: new FirebaseEdgeError({
|
|
253
|
+
code: 'auth/invalid-email',
|
|
254
|
+
message: 'The email does not match this sign-in link.'
|
|
255
|
+
})
|
|
256
|
+
};
|
|
257
|
+
const { error, data } = await auth.signInWithEmailLink(email, link.code);
|
|
258
|
+
if (error)
|
|
259
|
+
return { error };
|
|
260
|
+
return await saveSignInSession(data ?? {}, state.next, options.expiresInMs ?? COOKIE_LIFETIME_SECONDS * 1000);
|
|
261
|
+
}
|
|
262
|
+
catch (cause) {
|
|
263
|
+
return { error: ensureError(cause) };
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/** Begin a provider flow using the provider configuration in Firebase Console. */
|
|
267
|
+
async function startProviderAuthorization(provider, next, intent, options) {
|
|
268
|
+
const providerId = resolveProviderId(provider);
|
|
269
|
+
if (providerId === 'playgames.google.com')
|
|
270
|
+
throw new FirebaseEdgeError({
|
|
271
|
+
code: 'auth/operation-not-supported-in-this-environment',
|
|
272
|
+
message: 'Use a native Play Games server authorization code with signInWithProviderToken.'
|
|
273
|
+
});
|
|
274
|
+
if (!isLocalRedirectPath(next))
|
|
275
|
+
throw new FirebaseEdgeError({
|
|
276
|
+
code: 'auth/invalid-continue-uri',
|
|
277
|
+
message: 'The next path must be a local absolute path.'
|
|
278
|
+
});
|
|
279
|
+
if (intent === 'link') {
|
|
280
|
+
const { error: userError, data: userData } = await getUser();
|
|
281
|
+
if (userError)
|
|
282
|
+
throw userError;
|
|
283
|
+
if (!userData)
|
|
284
|
+
throw new FirebaseEdgeError({
|
|
285
|
+
code: 'auth/user-not-found',
|
|
286
|
+
message: 'Sign in before linking a provider.'
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
const { error, data } = await auth.createProviderAuthorization(providerId, options);
|
|
290
|
+
if (error)
|
|
291
|
+
throw error;
|
|
292
|
+
if (!data?.authUri || !data.sessionId)
|
|
293
|
+
throw new FirebaseEdgeError({
|
|
294
|
+
code: 'auth/internal-error',
|
|
295
|
+
message: 'Firebase returned an incomplete authorization response.'
|
|
296
|
+
});
|
|
297
|
+
await saveSession(_cookieName + '_oauth', JSON.stringify({ sessionId: data.sessionId, next, intent }), {
|
|
298
|
+
..._cookieOptions,
|
|
299
|
+
httpOnly: true,
|
|
300
|
+
secure: true,
|
|
301
|
+
sameSite: 'none',
|
|
302
|
+
maxAge: 600
|
|
303
|
+
});
|
|
304
|
+
if (intent === 'signin')
|
|
305
|
+
deleteSession();
|
|
306
|
+
return data.authUri;
|
|
307
|
+
}
|
|
308
|
+
async function getProviderLoginURL(provider, next, options) {
|
|
309
|
+
return startProviderAuthorization(provider, next, 'signin', options);
|
|
310
|
+
}
|
|
311
|
+
async function getProviderLinkURL(provider, next, options) {
|
|
312
|
+
return startProviderAuthorization(provider, next, 'link', options);
|
|
313
|
+
}
|
|
314
|
+
/** Complete GET or form POST callbacks from Firebase-managed provider authorization. */
|
|
315
|
+
async function signInWithProviderCallback(url, postBody, expiresIn_ms = COOKIE_LIFETIME_SECONDS * 1000) {
|
|
316
|
+
const stored = await getSession(_cookieName + '_oauth');
|
|
317
|
+
if (!stored)
|
|
318
|
+
return {
|
|
319
|
+
error: new FirebaseEdgeError({
|
|
320
|
+
code: 'auth/invalid-credential',
|
|
321
|
+
message: 'The provider authorization session is missing or expired.'
|
|
322
|
+
})
|
|
323
|
+
};
|
|
324
|
+
await saveSession(_cookieName + '_oauth', '', {
|
|
325
|
+
..._cookieOptions,
|
|
326
|
+
maxAge: 0
|
|
327
|
+
});
|
|
328
|
+
const flow = parseProviderSession(stored);
|
|
329
|
+
if (!flow)
|
|
330
|
+
return {
|
|
331
|
+
error: new FirebaseEdgeError({
|
|
332
|
+
code: 'auth/invalid-credential',
|
|
333
|
+
message: 'Invalid provider authorization session.'
|
|
334
|
+
})
|
|
335
|
+
};
|
|
336
|
+
let idToken;
|
|
337
|
+
if (flow.intent === 'link') {
|
|
338
|
+
const { error: tokenError, data: tokenData } = await getToken();
|
|
339
|
+
if (tokenError)
|
|
340
|
+
return { error: tokenError };
|
|
341
|
+
if (!tokenData?.idToken)
|
|
342
|
+
return {
|
|
343
|
+
error: new FirebaseEdgeError({
|
|
344
|
+
code: 'auth/user-not-found',
|
|
345
|
+
message: 'Sign in before linking a provider.'
|
|
346
|
+
})
|
|
347
|
+
};
|
|
348
|
+
idToken = tokenData.idToken;
|
|
349
|
+
}
|
|
350
|
+
const { error, data } = await auth.signInWithProviderCallback({ requestUri: url.toString(), sessionId: flow.sessionId, postBody }, idToken);
|
|
351
|
+
if (error)
|
|
352
|
+
return { error };
|
|
353
|
+
if (!data)
|
|
354
|
+
return {
|
|
355
|
+
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_SIGN_IN_DATA)
|
|
356
|
+
};
|
|
357
|
+
const signInData = data;
|
|
358
|
+
const { error: completedError, data: completedData } = flow.intent === 'link'
|
|
359
|
+
? { error, data }
|
|
360
|
+
: await completeProviderSignIn(signInData, async (existingIdToken) => {
|
|
361
|
+
if (signInData.pendingToken)
|
|
362
|
+
return auth.signInWithProviderCallback({
|
|
363
|
+
requestUri: url.toString(),
|
|
364
|
+
pendingToken: signInData.pendingToken
|
|
365
|
+
}, existingIdToken);
|
|
366
|
+
try {
|
|
367
|
+
const { providerId, credential } = providerCredentialFromResponse(signInData);
|
|
368
|
+
return await auth.linkWithCredential(existingIdToken, credential, providerId);
|
|
369
|
+
}
|
|
370
|
+
catch (cause) {
|
|
371
|
+
return { error: ensureError(cause) };
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
if (completedError)
|
|
375
|
+
return { error: completedError };
|
|
376
|
+
if (!completedData?.idToken)
|
|
377
|
+
return {
|
|
378
|
+
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_ID_TOKEN)
|
|
379
|
+
};
|
|
380
|
+
return saveSignInSession(completedData, flow.next, expiresIn_ms);
|
|
381
|
+
}
|
|
382
|
+
async function getFacebookLoginURL(next, options) {
|
|
383
|
+
return getProviderLoginURL('facebook', next, options);
|
|
384
|
+
}
|
|
385
|
+
async function getFacebookLinkURL(next, options) {
|
|
386
|
+
return getProviderLinkURL('facebook', next, options);
|
|
387
|
+
}
|
|
388
|
+
async function getAppleLoginURL(next, options) {
|
|
389
|
+
return getProviderLoginURL('apple', next, options);
|
|
390
|
+
}
|
|
391
|
+
async function getAppleLinkURL(next, options) {
|
|
392
|
+
return getProviderLinkURL('apple', next, options);
|
|
393
|
+
}
|
|
394
|
+
async function getTwitterLoginURL(next, options) {
|
|
395
|
+
return getProviderLoginURL('twitter', next, options);
|
|
396
|
+
}
|
|
397
|
+
async function getTwitterLinkURL(next, options) {
|
|
398
|
+
return getProviderLinkURL('twitter', next, options);
|
|
399
|
+
}
|
|
400
|
+
async function getMicrosoftLoginURL(next, options) {
|
|
401
|
+
return getProviderLoginURL('microsoft', next, options);
|
|
402
|
+
}
|
|
403
|
+
async function getMicrosoftLinkURL(next, options) {
|
|
404
|
+
return getProviderLinkURL('microsoft', next, options);
|
|
405
|
+
}
|
|
406
|
+
async function getYahooLoginURL(next, options) {
|
|
407
|
+
return getProviderLoginURL('yahoo', next, options);
|
|
408
|
+
}
|
|
409
|
+
async function getYahooLinkURL(next, options) {
|
|
410
|
+
return getProviderLinkURL('yahoo', next, options);
|
|
411
|
+
}
|
|
59
412
|
/**
|
|
60
413
|
* Clears the session cookie by setting its maxAge to 0.
|
|
61
414
|
*/
|
|
@@ -109,53 +462,29 @@ export function createFirebaseEdgeServer({ serviceAccount, firebaseConfig, provi
|
|
|
109
462
|
error: null
|
|
110
463
|
};
|
|
111
464
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Generates a Google OAuth login URL and clears any existing session.
|
|
114
|
-
*
|
|
115
|
-
* @param next State parameter for the OAuth flow (typically the redirect path after login)
|
|
116
|
-
* @param options Optional configuration object
|
|
117
|
-
* @param options.languageCode ISO 639-1 language code (e.g., 'en', 'es', 'fr')
|
|
118
|
-
* @param options.customParameters Custom OAuth parameters (e.g., { login_hint: 'user@example.com', hd: 'example.com' })
|
|
119
|
-
* @param options.addScopes Additional OAuth scopes (e.g., ['https://www.googleapis.com/auth/calendar.readonly'])
|
|
120
|
-
* @returns Promise resolving to Google OAuth login URL string
|
|
121
|
-
* @throws {FirebaseEdgeError} If Google provider is not configured
|
|
122
|
-
*/
|
|
465
|
+
/** Begin Google sign-in using the provider configured in Firebase Console. */
|
|
123
466
|
async function getGoogleLoginURL(next, options) {
|
|
124
|
-
|
|
125
|
-
if (!providers.google) {
|
|
126
|
-
throw new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_GOOGLE_PROVIDER_NOT_CONFIGURED);
|
|
127
|
-
}
|
|
128
|
-
const { client_id } = providers.google;
|
|
129
|
-
return createGoogleOAuthLoginUrl(redirectUri, next, client_id, 'signin', options?.languageCode, options?.customParameters, options?.addScopes);
|
|
467
|
+
return getProviderLoginURL('google', next, options);
|
|
130
468
|
}
|
|
131
|
-
/**
|
|
132
|
-
* Generates a GitHub OAuth login URL and clears any existing session.
|
|
133
|
-
* Note: GitHub doesn't support language parameters - language is determined by user's browser/account settings.
|
|
134
|
-
*
|
|
135
|
-
* @param next State parameter for the OAuth flow (typically the redirect path after login)
|
|
136
|
-
* @param options Optional configuration object
|
|
137
|
-
* @param options.customParameters Custom OAuth parameters (e.g., { login: 'username', allow_signup: 'false' })
|
|
138
|
-
* @param options.addScopes Additional OAuth scopes (e.g., ['repo', 'gist'])
|
|
139
|
-
* @returns Promise resolving to GitHub OAuth login URL string
|
|
140
|
-
* @throws {FirebaseEdgeError} If GitHub provider is not configured
|
|
141
|
-
*/
|
|
469
|
+
/** Begin GitHub sign-in using the provider configured in Firebase Console. */
|
|
142
470
|
async function getGitHubLoginURL(next, options) {
|
|
143
|
-
|
|
144
|
-
if (!providers.github) {
|
|
145
|
-
throw new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_GITHUB_PROVIDER_NOT_CONFIGURED);
|
|
146
|
-
}
|
|
147
|
-
const { client_id } = providers.github;
|
|
148
|
-
return createGitHubOAuthLoginUrl(redirectUri, next, client_id, 'link', options?.customParameters, options?.addScopes);
|
|
471
|
+
return getProviderLoginURL('github', next, options);
|
|
149
472
|
}
|
|
150
473
|
/**
|
|
151
474
|
* Signs a user in using an already-obtained provider token.
|
|
152
475
|
*
|
|
153
|
-
* @param provider
|
|
476
|
+
* @param provider Firebase provider slug or ID
|
|
154
477
|
* @param oauthToken Provider token (Google `id_token` or GitHub `access_token`)
|
|
155
478
|
* @returns Promise resolving to an object containing sign-in data and/or an error
|
|
156
479
|
*/
|
|
157
480
|
async function signInWithProviderToken(provider, oauthToken) {
|
|
158
|
-
|
|
481
|
+
let providerId;
|
|
482
|
+
try {
|
|
483
|
+
providerId = resolveProviderId(provider);
|
|
484
|
+
}
|
|
485
|
+
catch (error) {
|
|
486
|
+
return { data: null, error: error };
|
|
487
|
+
}
|
|
159
488
|
const { data: signInData, error: signInError } = await auth.signInWithProvider(oauthToken, providerId);
|
|
160
489
|
if (signInError) {
|
|
161
490
|
return {
|
|
@@ -167,195 +496,77 @@ export function createFirebaseEdgeServer({ serviceAccount, firebaseConfig, provi
|
|
|
167
496
|
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_SIGN_IN_DATA)
|
|
168
497
|
};
|
|
169
498
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (!signInData.email) {
|
|
178
|
-
return {
|
|
179
|
-
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_EMAIL_FOR_AUTO_LINKING)
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
const { data, error: getEmailError } = await adminAuth.getUserByEmail(signInData.email);
|
|
183
|
-
if (getEmailError) {
|
|
184
|
-
return {
|
|
185
|
-
error: getEmailError
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
if (!data?.localId) {
|
|
189
|
-
return {
|
|
190
|
-
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_USER_RECORD)
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
const { data: customTokenData, error: tokenError } = await adminAuth.createCustomToken(data.localId);
|
|
194
|
-
if (tokenError) {
|
|
195
|
-
return {
|
|
196
|
-
data: null,
|
|
197
|
-
error: tokenError
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
const { data: customSignInData, error: customSignInError } = await auth.signInWithCustomToken(customTokenData);
|
|
201
|
-
if (customSignInError) {
|
|
202
|
-
return {
|
|
203
|
-
data: null,
|
|
204
|
-
error: customSignInError
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
if (!customSignInData?.idToken) {
|
|
208
|
-
return {
|
|
209
|
-
data: null,
|
|
210
|
-
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_ID_TOKEN)
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
const { data: linkData, error: linkError } = await auth.linkWithCredential(customSignInData.idToken, oauthToken, providerId);
|
|
214
|
-
if (linkError) {
|
|
215
|
-
return {
|
|
216
|
-
data: null,
|
|
217
|
-
error: linkError
|
|
218
|
-
};
|
|
219
|
-
}
|
|
499
|
+
return completeProviderSignIn(signInData, (idToken) => auth.linkWithCredential(idToken, oauthToken, providerId));
|
|
500
|
+
}
|
|
501
|
+
/** Resolve same-email collisions consistently for credential and managed flows. */
|
|
502
|
+
async function completeProviderSignIn(signInData, linkCredential) {
|
|
503
|
+
if (!signInData.needConfirmation)
|
|
504
|
+
return { data: signInData, error: null };
|
|
505
|
+
if (!autoLinkProviders) {
|
|
220
506
|
return {
|
|
221
|
-
|
|
222
|
-
error: null
|
|
507
|
+
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_ACCOUNT_EXISTS_DIFFERENT_METHOD)
|
|
223
508
|
};
|
|
224
509
|
}
|
|
225
|
-
|
|
226
|
-
data: signInData,
|
|
227
|
-
error: signInError
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Completes OAuth flow by exchanging authorization code for a session.
|
|
232
|
-
*
|
|
233
|
-
* @param url URL containing authorization code and state from OAuth callback
|
|
234
|
-
* @param expiresIn_ms Session cookie expiration time in milliseconds (defaults to 5 days)
|
|
235
|
-
* @returns Promise resolving to object with next redirect path and error if any
|
|
236
|
-
*/
|
|
237
|
-
async function signInWithCallback(url, expiresIn_ms = COOKIE_LIFETIME_SECONDS * 1000) {
|
|
238
|
-
const code = url.searchParams.get('code');
|
|
239
|
-
const state = url.searchParams.get('state');
|
|
240
|
-
if (!code) {
|
|
510
|
+
if (!signInData.email) {
|
|
241
511
|
return {
|
|
242
|
-
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.
|
|
512
|
+
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_EMAIL_FOR_AUTO_LINKING)
|
|
243
513
|
};
|
|
244
514
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
let intent = null;
|
|
248
|
-
try {
|
|
249
|
-
const parsed = state && JSON.parse(state);
|
|
250
|
-
next = parsed?.next ?? '/';
|
|
251
|
-
provider = parsed?.provider ?? null;
|
|
252
|
-
intent = parsed?.intent ?? null;
|
|
253
|
-
}
|
|
254
|
-
catch { }
|
|
255
|
-
if (!provider) {
|
|
515
|
+
const { data, error: getEmailError } = await adminAuth.getUserByEmail(signInData.email);
|
|
516
|
+
if (getEmailError) {
|
|
256
517
|
return {
|
|
257
|
-
error:
|
|
518
|
+
error: getEmailError
|
|
258
519
|
};
|
|
259
520
|
}
|
|
260
|
-
|
|
261
|
-
if (providers.google && provider === 'google') {
|
|
262
|
-
const { client_id, client_secret } = providers.google;
|
|
263
|
-
const { data: googleData, error: exchangeError } = await exchangeCodeForGoogleIdToken(code, redirectUri, client_id, client_secret, fetchImpl);
|
|
264
|
-
if (exchangeError) {
|
|
265
|
-
return {
|
|
266
|
-
error: exchangeError
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
if (!googleData) {
|
|
270
|
-
return {
|
|
271
|
-
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_EXCHANGE_DATA)
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
oauthToken = googleData.id_token;
|
|
275
|
-
}
|
|
276
|
-
else if (providers.github && provider === 'github') {
|
|
277
|
-
const { client_id, client_secret } = providers.github;
|
|
278
|
-
const { data: githubData, error: exchangeError } = await exchangeCodeForGitHubIdToken(code, redirectUri, client_id, client_secret, fetchImpl);
|
|
279
|
-
if (exchangeError) {
|
|
280
|
-
return {
|
|
281
|
-
error: exchangeError
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
if (!githubData) {
|
|
285
|
-
return {
|
|
286
|
-
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_EXCHANGE_DATA)
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
oauthToken = githubData.access_token;
|
|
290
|
-
}
|
|
291
|
-
if (!oauthToken) {
|
|
521
|
+
if (!data?.localId) {
|
|
292
522
|
return {
|
|
293
|
-
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.
|
|
523
|
+
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_USER_RECORD)
|
|
294
524
|
};
|
|
295
525
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
const { error: linkError } = await linkProvider(oauthToken, providerId);
|
|
299
|
-
if (linkError) {
|
|
300
|
-
return {
|
|
301
|
-
error: linkError
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
const { data: userData, error: userError } = await getUser();
|
|
305
|
-
if (userError) {
|
|
306
|
-
return {
|
|
307
|
-
error: userError
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
if (!userData?.user_id) {
|
|
311
|
-
return {
|
|
312
|
-
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_USER_FOR_LINKING)
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
const { error: revokeError } = await adminAuth.revokeRefreshTokens(userData.user_id);
|
|
316
|
-
if (revokeError) {
|
|
317
|
-
return {
|
|
318
|
-
error: revokeError
|
|
319
|
-
};
|
|
320
|
-
}
|
|
526
|
+
const { data: customTokenData, error: tokenError } = await adminAuth.createCustomToken(data.localId);
|
|
527
|
+
if (tokenError) {
|
|
321
528
|
return {
|
|
322
|
-
data:
|
|
323
|
-
error:
|
|
529
|
+
data: null,
|
|
530
|
+
error: tokenError
|
|
324
531
|
};
|
|
325
532
|
}
|
|
326
|
-
|
|
327
|
-
if (signInError) {
|
|
533
|
+
if (!customTokenData)
|
|
328
534
|
return {
|
|
329
|
-
error:
|
|
535
|
+
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_CUSTOM_TOKEN_SIGNED)
|
|
330
536
|
};
|
|
331
|
-
}
|
|
332
|
-
if (
|
|
537
|
+
const { data: customSignInData, error: customSignInError } = await auth.signInWithCustomToken(customTokenData);
|
|
538
|
+
if (customSignInError) {
|
|
333
539
|
return {
|
|
334
|
-
|
|
540
|
+
data: null,
|
|
541
|
+
error: customSignInError
|
|
335
542
|
};
|
|
336
543
|
}
|
|
337
|
-
|
|
338
|
-
if (!idToken) {
|
|
544
|
+
if (!customSignInData?.idToken) {
|
|
339
545
|
return {
|
|
546
|
+
data: null,
|
|
340
547
|
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_ID_TOKEN)
|
|
341
548
|
};
|
|
342
549
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
550
|
+
return linkCredential(customSignInData.idToken);
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Completes provider or magic-link sign-in and saves a session.
|
|
554
|
+
*
|
|
555
|
+
* @param url Full provider callback or email action URL
|
|
556
|
+
* @param options Callback options, or a legacy numeric session duration in milliseconds
|
|
557
|
+
* @returns Promise resolving to object with next redirect path and error if any
|
|
558
|
+
*/
|
|
559
|
+
async function signInWithCallback(url, options = {}) {
|
|
560
|
+
const settings = typeof options === 'number' ? { expiresInMs: options } : options;
|
|
561
|
+
try {
|
|
562
|
+
const action = parseEmailActionLink(url, firebaseConfig.apiKey, tenantId);
|
|
563
|
+
if (action)
|
|
564
|
+
return signInWithEmailLink(url, settings);
|
|
348
565
|
}
|
|
349
|
-
|
|
350
|
-
return {
|
|
351
|
-
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_SESSION_COOKIE)
|
|
352
|
-
};
|
|
566
|
+
catch (cause) {
|
|
567
|
+
return { error: ensureError(cause) };
|
|
353
568
|
}
|
|
354
|
-
|
|
355
|
-
return {
|
|
356
|
-
data: next,
|
|
357
|
-
error: null
|
|
358
|
-
};
|
|
569
|
+
return signInWithProviderCallback(url, settings.postBody, settings.expiresInMs);
|
|
359
570
|
}
|
|
360
571
|
/**
|
|
361
572
|
* Generates fresh Firebase client tokens for the authenticated user.
|
|
@@ -377,8 +588,7 @@ export function createFirebaseEdgeServer({ serviceAccount, firebaseConfig, provi
|
|
|
377
588
|
error: null
|
|
378
589
|
};
|
|
379
590
|
}
|
|
380
|
-
const
|
|
381
|
-
const { data: signJWTData, error: signJWTError } = await signJWTCustomToken(verifiedToken.sub, serviceAccount, claims);
|
|
591
|
+
const { data: signJWTData, error: signJWTError } = await adminAuth.createCustomToken(verifiedToken.sub);
|
|
382
592
|
if (signJWTError) {
|
|
383
593
|
return {
|
|
384
594
|
data: null,
|
|
@@ -448,7 +658,9 @@ export function createFirebaseEdgeServer({ serviceAccount, firebaseConfig, provi
|
|
|
448
658
|
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_ID_TOKEN)
|
|
449
659
|
};
|
|
450
660
|
}
|
|
451
|
-
const { data: sessionCookie, error: sessionError } = await adminAuth.createSessionCookie(idToken.idToken,
|
|
661
|
+
const { data: sessionCookie, error: sessionError } = await adminAuth.createSessionCookie(idToken.idToken, {
|
|
662
|
+
expiresIn: expiresIn_ms
|
|
663
|
+
});
|
|
452
664
|
if (sessionError) {
|
|
453
665
|
return {
|
|
454
666
|
error: sessionError
|
|
@@ -459,46 +671,19 @@ export function createFirebaseEdgeServer({ serviceAccount, firebaseConfig, provi
|
|
|
459
671
|
error: new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_NO_SESSION_COOKIE)
|
|
460
672
|
};
|
|
461
673
|
}
|
|
462
|
-
saveSession(_cookieName, sessionCookie, _cookieOptions);
|
|
674
|
+
await saveSession(_cookieName, sessionCookie, _cookieOptions);
|
|
463
675
|
return {
|
|
464
676
|
data: unlinkData,
|
|
465
677
|
error: null
|
|
466
678
|
};
|
|
467
679
|
}
|
|
468
|
-
/**
|
|
469
|
-
* Generates a Google OAuth URL for linking an additional provider to the current user.
|
|
470
|
-
*
|
|
471
|
-
* @param next State parameter for the OAuth flow (typically the redirect path after linking)
|
|
472
|
-
* @param options Optional configuration object
|
|
473
|
-
* @param options.languageCode ISO 639-1 language code (e.g., 'en', 'es', 'fr')
|
|
474
|
-
* @param options.customParameters Custom OAuth parameters (e.g., { login_hint: 'user@example.com' })
|
|
475
|
-
* @param options.addScopes Additional OAuth scopes (e.g., ['https://www.googleapis.com/auth/calendar.readonly'])
|
|
476
|
-
* @returns Promise resolving to Google OAuth link URL string
|
|
477
|
-
* @throws {FirebaseEdgeError} If Google provider is not configured
|
|
478
|
-
*/
|
|
680
|
+
/** Begin Google linking for the currently authenticated user. */
|
|
479
681
|
async function getGoogleLinkURL(next, options) {
|
|
480
|
-
|
|
481
|
-
throw new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_GOOGLE_PROVIDER_NOT_CONFIGURED);
|
|
482
|
-
}
|
|
483
|
-
const { client_id } = providers.google;
|
|
484
|
-
return createGoogleOAuthLoginUrl(redirectUri, next, client_id, 'link', options?.languageCode, options?.customParameters, options?.addScopes);
|
|
682
|
+
return getProviderLinkURL('google', next, options);
|
|
485
683
|
}
|
|
486
|
-
/**
|
|
487
|
-
* Generates a GitHub OAuth URL for linking an additional provider to the current user.
|
|
488
|
-
*
|
|
489
|
-
* @param next State parameter for the OAuth flow (typically the redirect path after linking)
|
|
490
|
-
* @param options Optional configuration object
|
|
491
|
-
* @param options.customParameters Custom OAuth parameters (e.g., { login: 'username', allow_signup: 'false' })
|
|
492
|
-
* @param options.addScopes Additional OAuth scopes (e.g., ['repo', 'gist'])
|
|
493
|
-
* @returns Promise resolving to GitHub OAuth link URL string
|
|
494
|
-
* @throws {FirebaseEdgeError} If GitHub provider is not configured
|
|
495
|
-
*/
|
|
684
|
+
/** Begin GitHub linking for the currently authenticated user. */
|
|
496
685
|
async function getGitHubLinkURL(next, options) {
|
|
497
|
-
|
|
498
|
-
throw new FirebaseEdgeError(FirebaseEdgeServerErrorInfo.EDGE_GITHUB_PROVIDER_NOT_CONFIGURED);
|
|
499
|
-
}
|
|
500
|
-
const { client_id } = providers.github;
|
|
501
|
-
return createGitHubOAuthLoginUrl(redirectUri, next, client_id, 'signin', options?.customParameters, options?.addScopes);
|
|
686
|
+
return getProviderLinkURL('github', next, options);
|
|
502
687
|
}
|
|
503
688
|
/**
|
|
504
689
|
* Links an OAuth provider to the currently authenticated user.
|
|
@@ -536,8 +721,32 @@ export function createFirebaseEdgeServer({ serviceAccount, firebaseConfig, provi
|
|
|
536
721
|
return {
|
|
537
722
|
auth,
|
|
538
723
|
adminAuth,
|
|
724
|
+
firestore,
|
|
725
|
+
appCheck,
|
|
726
|
+
storage,
|
|
727
|
+
sendSignInLinkToEmail,
|
|
728
|
+
getCallbackAction,
|
|
729
|
+
handleCallback,
|
|
730
|
+
sendPasswordResetEmail,
|
|
731
|
+
confirmPasswordReset,
|
|
732
|
+
verifyBeforeUpdateEmail,
|
|
733
|
+
applyActionCode,
|
|
539
734
|
signOut,
|
|
540
735
|
getUser,
|
|
736
|
+
getProviderLoginURL,
|
|
737
|
+
getProviderLinkURL,
|
|
738
|
+
signInWithProviderCallback,
|
|
739
|
+
signInWithProviderToken,
|
|
740
|
+
getFacebookLoginURL,
|
|
741
|
+
getFacebookLinkURL,
|
|
742
|
+
getAppleLoginURL,
|
|
743
|
+
getAppleLinkURL,
|
|
744
|
+
getTwitterLoginURL,
|
|
745
|
+
getTwitterLinkURL,
|
|
746
|
+
getMicrosoftLoginURL,
|
|
747
|
+
getMicrosoftLinkURL,
|
|
748
|
+
getYahooLoginURL,
|
|
749
|
+
getYahooLinkURL,
|
|
541
750
|
getGoogleLoginURL,
|
|
542
751
|
getGitHubLoginURL,
|
|
543
752
|
getGoogleLinkURL,
|