Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: remove authPolicy section #1981

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should we be telling developers to do instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are drafting a solution that aligns better with existing Genkit SDK (ContextProvider), and I suggest we omit this section until that solution is fully hashed and released.


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.
Loading