Skip to content

Commit

Permalink
Remove authPolicy section
Browse files Browse the repository at this point in the history
  • Loading branch information
jhuleatt authored Feb 14, 2025
1 parent 3634178 commit 19d8e56
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions docs/firebase.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,31 +91,6 @@ import { onCallGenkit } from 'firebase-functions/https';
export generatePoem = onCallGenkit(generatePoemFlow);
```

### Define an authorization policy

All deployed flows, whether deployed to Firebase or not, should have an
authorization policy; without one, anyone can invoke your potentially-expensive
generative AI flows. To define an authorization policy, use the
`authPolicy` parameter of `onCallGenkit`:

```ts
export const generatePoem = onCallGenkit({
authPolicy: (auth) => auth?.token?.email_verified,
}, generatePoemFlow);
```

This sample uses a manual function as its auth policy. In addition, the https
library exports the `signedIn()` and `hasClaim()` helpers. Here is the same code
using one of those helpers:

```ts
import { hasClaim } from 'firebase-functions/https';

export const generatePoem = onCallGenkit({
authPolicy: hasClaim('email_verified'),
}, generatePoemFlow);
```

### Make API credentials available to deployed flows

Once deployed, your flows need some way to authenticate with any remote services
Expand Down Expand Up @@ -393,4 +368,4 @@ the Dev UI).

To see traces from Firestore in the Dev UI, you can navigate to the _Inspect_
tab and toggle the *Dev/Prod* switch. When toggled to _prod_ it loads
traces from firestore.
traces from firestore.

0 comments on commit 19d8e56

Please sign in to comment.