docs: add Python tutorial for refresh token OAuth in multi-tenant Apify Actors
Summary
Adds a new tutorial under sources/academy/tutorials/python/ covering the refresh token OAuth pattern for Apify Actors that call per-user Google APIs (Gmail, Calendar, Drive) without hosting an OAuth callback URL or storing user identity on the Apify side.
The tutorial walks through:
- Google Cloud setup using the Desktop app OAuth client type (which removes the redirect URL requirement)
- Generating the refresh token via
google-auth-oauthlib'srun_local_serverflow - Exchanging the refresh token for a short-lived access token at runtime
- Defining
INPUT_SCHEMAwithisSecret: trueon the credential fields - An optional
dry_runboolean so first-time users can preview the dataset shape before committing to the full OAuth setup
Motivation
This pattern is used in production today for Actors that call per-user Google APIs, but the docs don't yet cover it. Currently a developer searching "Apify actor Gmail OAuth" finds no end-to-end tutorial. Related: apify/apify-mcp-server#741 asks for server-level OAuth/SSO between MCP client and Apify (a different layer than what this tutorial covers), but readers landing on that issue may also be looking for the Actor-level credential delegation pattern.
Pattern correctness
Verified against a production Actor running this exact pattern: foxck016077/apify-gmail-inbox-intel (MIT, listed on Apify Store as foxck/gmail-inbox-intel).
Standards checklist
- [x] Sentence case headings, no gerund headings
- [x] Front matter complete: title, description (154 chars), sidebar_position (3), slug
- [x] Bold used only for UI elements (Apify Console buttons, Google Cloud sections)
- [x] All code blocks have language tags (python, json)
- [x] US English, active voice, imperative tone, no sales language
- [x] No em dashes (hyphen with spaces only)
- [x] Internal links use relative paths (e.g.
/platform/actors/development/actor-definition/input-schema) - [x] No new images required
Compatibility
- No changes to existing tutorials
- New file only; no rename or move
sidebar_position: 3slots afterprocess_data_using_python.md(position 2)- Slug
/python/refresh-token-oauth-multi-tenant-actorsis unique
Happy to revise scope, tone, file placement, or pull cross-references if there's a better home for it in the Academy structure.