9.5.3 • Published 10 months ago

@firebase-web-authn/functions v9.5.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 months ago

@firebase-web-authn/functions

A Firebase Extension for authentication with WebAuthn passkeys.

This package contains a Firebase Function that registers and authenticates WebAuthn passkeys, manages public key credentials in Firestore, and cleans up data if the user cancels the process or unlinks a passkey.

FirebaseWebAuthn version Firebase SDK for Cloud Functions version

Firebase Extension deployment

See @firebase-web-authn/extension for simplified installation using firebase ext:install.

Custom deployment

If you would rather deploy FirebaseWebAuthn from your existing Firebase Functions package, 1. Run:

% npm install @firebase-web-authn/functions --save-dev

  1. Export the API from your Firebase Functions package's main file by calling getFirebaseWebAuthnApi with a config object.
import { initializeApp }          from "firebase-admin/app";
import { HttpsFunction }          from "firebase-functions";
import { getFirebaseWebAuthnApi } from "@firebase-web-authn/functions";


getApps().length === 0 && initializeApp();

export const firebaseWebAuthnAPI: HttpsFunction = getFirebaseWebAuthnApi({...});

// Other functions...
interface FirebaseWebAuthnConfig {
  authenticatorAttachment: AuthenticatorAttachment,          // Preferred authenticator attachment modality. "cross-platform" allows security keys. "platform" allows passkey managers.
  relyingPartyName: string,                                  // Your app's display name in the passkey popup on some browsers.
  userVerificationRequirement?: UserVerificationRequirement, // Your app's user verification requirement. "preferred" is default.
}
  1. Deploy your Firebase Functions:

% firebase deploy --only functions

Additional setup

  1. The browser must reach FirebaseWebAuthn from the same domain as your website. Modify your firebase.json to include a rewrite on each app where you'd like to use passkeys:
    {
      "hosting": [
        {
          "target": "...",
          "rewrites": [
            {
              "source": "/firebase-web-authn-api",
              "function": "firebaseWebAuthnAPI"
            }
          ]
        }
      ]
    }
  2. Set up these services in your Firebase project:
    • App Check
    • Authentication with the anonymous provider
    • Firestore Database
    • Functions
  3. Grant the Cloud Datastore User and Service Account Token Creator roles to the App Engine default service account principal in Service accounts under App Engine default service account > Permissions.
  4. Grant the Cloud Functions Invoker role to the allUsers principal in Cloud Functions under firebaseWebAuthnAPI > Permissions.
9.5.3

10 months ago

9.5.2

11 months ago

9.5.1

11 months ago

9.5.0

11 months ago

9.4.23

11 months ago

9.4.22

11 months ago

9.4.21

11 months ago

9.4.20

11 months ago

9.4.19

11 months ago

9.4.18

11 months ago

9.4.17

12 months ago

9.4.16

12 months ago

9.4.15

12 months ago

9.4.14

12 months ago

9.4.13

12 months ago

9.4.12

12 months ago

9.4.11

12 months ago

9.4.10

12 months ago

9.4.9

12 months ago

9.4.8

1 year ago

9.4.7

1 year ago

9.4.6

1 year ago

9.4.5

1 year ago

9.4.4

1 year ago

9.4.3

1 year ago

9.4.2

1 year ago

9.4.1

1 year ago

9.4.0

1 year ago

9.3.1

1 year ago

9.3.0

1 year ago

9.2.3

1 year ago

9.2.2

1 year ago

9.2.1

1 year ago

9.2.0

1 year ago

9.1.9

1 year ago

9.1.8

1 year ago

9.1.7

1 year ago

9.1.6

1 year ago

9.1.5

1 year ago

9.1.4

1 year ago

9.1.3

1 year ago

9.1.2

1 year ago

9.1.1

1 year ago

9.1.0

1 year ago

9.0.4

1 year ago

9.0.3

1 year ago

9.0.2

1 year ago

9.0.1

1 year ago

9.0.0

1 year ago