# Recipe: deliver to Google Drive

Each finished card lands in one Google Drive folder. Markdown becomes a Google Doc by default, or the result is uploaded as a file. BakedBrie asks Google for the `drive.file` scope only, so it can see only the files it creates.

There are two ways to connect:

- **Google consent (OAuth)**, the default: the person opens a BakedBrie link once, in a browser signed in to BakedBrie, and allows access at Google. The connection finishes in that same browser, so a link someone else sends you cannot connect your destination to their Google account.
- **Service account**: for teams that manage one. The person shares the folder with the service account's email.

## Before you run it

Fill in `{{BOARD_NAME}}` and `{{FOLDER_ID}}`. The folder id is the last part of the folder's URL: `https://drive.google.com/drive/folders/<folder id>`.

For a service account, put its key JSON in the `GOOGLE_SA_KEY` environment variable (for example `export GOOGLE_SA_KEY="$(cat key.json)"`) and share the folder with the service account's email as an editor.

## The prompt (Google consent)

```text
In BakedBrie, make the board "{{BOARD_NAME}}" deliver finished cards to my Google Drive folder {{FOLDER_ID}} as Google Docs. Use only the BakedBrie MCP tools. Start with whoami and stop if destinations is off.

1. Find the board with list_boards.
2. Create a destination with manage_destination: action create, type google_drive, name "Google Drive", google_drive {"folder_id": "{{FOLDER_ID}}", "auth": "oauth", "mode": "doc"}.
3. The result has oauth.consent_url. Give me that link and ask me to open it in a browser where I am signed in to BakedBrie, sign in with the Google account that owns the folder, and allow access. BakedBrie finishes the connection in that browser when Google sends me back; there is nothing to paste.
4. When I say I am done, call manage_destination action get and check that has_credential is true. If it is not, give me the link from oauth.consent_url again (it starts a fresh sign-in each time it is opened).
5. Test it with manage_destination action test, then make it the board's default with action set_board_default.
6. Read it back with manage_destination action get and tell me the folder, the mode and whether the board default is set.
```

## The prompt (service account)

```text
In BakedBrie, make the board "{{BOARD_NAME}}" deliver finished cards to the Google Drive folder {{FOLDER_ID}} with a service account. Use only the BakedBrie MCP tools. Start with whoami and stop if destinations is off.

1. Find the board with list_boards.
2. Call prepare_secret with kind google, purpose destination and env_var GOOGLE_SA_KEY. Run the command it returns in my shell exactly as given, then use the drop_id. Never print the key.
3. Create a destination with manage_destination: action create, type google_drive, name "Google Drive", google_drive {"folder_id": "{{FOLDER_ID}}", "auth": "service_account", "mode": "doc"}, credential {"drop_id": "<the drop id>"}.
4. Test it with manage_destination action test, then make it the board's default with action set_board_default.
5. Read it back with manage_destination action get.
```

## What to expect

- `list_results` shows each delivery with the Drive file id.
- A test that fails with a permission error usually means the folder is not shared with the account that connected (the consenting Google account, or the service account's email).
- Every code: [Refusals](/docs/refusals).
