Skip to content

Commit

Permalink
Using selfSSummaryFlow in auth and other joke replacements
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Chestnut committed May 13, 2024
1 parent 8f9b1d9 commit 9cc4590
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions docs/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ You can use Firebase Auth to protect your flows defined with `onFlow()`:
import { firebaseAuth } from '@genkit-ai/firebase/auth';
import { onFlow } from '@genkit-ai/firebase/functions';

export const menuSuggestionFlow = onFlow({
name: 'menuSuggestionFlow',
export const selfSummaryFlow = onFlow({
name: 'selfSummaryFlow',
inputSchema: z.string(),
outputSchema: z.string(),
authPolicy: firebaseAuth((user) => {
Expand All @@ -140,7 +140,7 @@ above. When running this flow during development, you would pass the user object
in the same way:

```posix-terminal
genkit flow:run menuSuggestionFlow '"Banana"' --auth '{"admin": true}'
genkit flow:run selfSummaryFlow '{"uid": "abc-def"}' --auth '{"admin": true}'
```

By default the Firebase Auth plugin requires the auth header to be sent by the
Expand Down Expand Up @@ -169,14 +169,14 @@ indicate to the library that you are forgoing authorization checks by using the
```ts
import { onFlow, noAuth } from '@genkit-ai/firebase/functions';

export const menuSuggestionFlow = onFlow({
name: 'menuSuggestionFlow',
export const selfSummaryFlow = onFlow({
name: 'selfSummaryFlow',
inputSchema: z.string(),
outputSchema: z.string(),
// WARNING: Only do this if you have some other gatekeeping in place, like
// Cloud IAM!
authPolicy: noAuth(),
}, (joke) => {...})
}, (subject) => {...})
```

### Client integrity
Expand All @@ -190,8 +190,8 @@ the following configuration options to your `onFlow()`:
```ts
import { onFlow } from '@genkit-ai/firebase/functions';

export const menuSuggestionFlow = onFlow({
name: 'menuSuggestionFlow',
export const selfSummaryFlow = onFlow({
name: 'selfSummaryFlow',
inputSchema: z.string(),
outputSchema: z.string(),

Expand All @@ -202,7 +202,7 @@ export const menuSuggestionFlow = onFlow({
consumeAppCheckToken: true,

authPolicy: ...,
}, (joke) => {...})
}, (subject) => {...})
```

## Non-Firebase HTTP authorization
Expand Down
2 changes: 1 addition & 1 deletion docs/cloud-run.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ After deployment finishes, the tool will print the service URL. You can test
it with `curl`:

```posix-terminal
curl -X POST https://<service-url>/jokeFlow \
curl -X POST https://<service-url>/menuSuggestionFlow \
-H "Authorization: Bearer $(gcloud auth print-identity-token)" \
-H "Content-Type: application/json" -d '{"data": "banana"}'
```

0 comments on commit 9cc4590

Please sign in to comment.