Skip to main content
Route two read-only Google Drive API requests through Forge. One returns metadata for a synthetic file. Forge blocks the other before it reaches Google Drive.

Prepare the sandbox

  • Use an online Resource Gateway that can reach www.googleapis.com:443.
  • Use an approved test app and a dedicated test Drive account. Request a short-lived Google OAuth access token with the https://www.googleapis.com/auth/drive.file scope. Drive API scopes
  • Create two synthetic files through that app and copy their file IDs. Use the same app and account for the rest of the test.

Configure the Resource and credential

  1. Open Policies → Resources and choose New resource.
  2. Name the Resource Google Drive API sandbox. Choose HTTP, set the host to www.googleapis.com and the port to 443, then turn on Use HTTPS.
  3. Assign the Resource Gateway and save. Leave Automatic routing off for the first run.
  4. Open Credentials and add a Bearer token with the Google access token. Expand Credential assignment, select the test user, and leave Use for everyone else off.
  5. Run Test connection. Verify access to the Drive files with the requests below.
The Gateway adds the Google bearer token after policy allows a request. Use Bearer token for this short test and replace the Google access token after it expires. Forge’s OAuth temporary access uses the client credentials grant. Google’s user authorization flow renews access with a refresh token. Forge credential methods · Google OAuth token refresh

Block one file read

Run both requests in Verify direct access before you create the policy. Both requests should return 200 with the corresponding file IDs.
  1. Choose New policy → Resource policy and name it Block sandbox Drive file.
  2. Scope the policy to Google Drive API sandbox.
  3. Set Condition type to Match all and add both conditions.
    • HTTP method equals GET.
    • HTTP path equals /drive/v3/files/BLOCKED_FILE_ID. Replace BLOCKED_FILE_ID with the second file’s ID.
  4. Set the action to Block and the user message to This sandbox Drive file is blocked.
  5. Set enforcement to Enforce, enable the policy, and save.
This policy matches the exact file metadata endpoint path. It also matches requests for that file at the same path with query parameters. HTTP policy fields

Verify direct access

Open Connect directly on the Resource page. Download the trust certificate and select Generate access. Substitute your gateway hostname and file IDs in the commands. Enter the short-lived Forge token when prompted.
The first request returns 200 with the synthetic file’s ID and name. The second returns 403 with the Forge policy ID and the message you set. In Live → Resources, filter to Google Drive API sandbox and check the caller, path, and Allow and Block outcomes. Drive files.get · Resource Activity

Verify automatic routing and MCP

For a test device that already has active automatic routing and trusts the organization inspection CA, turn on Automatic routing for the Resource. Repeat the same two GET requests in fresh connections to https://www.googleapis.com using the device’s managed identity. Omit the Proxy-Authorization header. Check the same outcomes and the device in Live → Resources. The device route matches the hostname. www.googleapis.com also hosts other Google APIs, so use a dedicated test device for this check. To test both interfaces, use an approved Drive MCP tool that reads file metadata. Route the MCP server’s outbound Drive calls through this Resource Gateway under an assigned identity. Then check both synthetic file IDs through the tool and through direct HTTPS from the test device. Verify that both interfaces can read the allowed file and that Forge blocks both reads of the restricted file. In Live → Resources, check all four operations. Confirm the caller identity on each path and the policy name on both blocked reads. Send a request from the same device to an unrelated approved destination. Confirm that it still succeeds.