gws CLI.
Drive becomes its folder tree, Docs, Sheets and Slides become JSON files, and
Gmail becomes folders of labels and days.
Google Calendar uses the same credentials.
Setup
Create a Google Cloud project, turn on the APIs, configure the consent screen, create a Desktop OAuth client and trade one sign-in for a refresh token.1. Create a Google Cloud project
1. Create a Google Cloud project
- Open the Google Cloud console.
- Open the project selector and click New Project.
- Name it (for example “Mirage”) and click Create.
- Select the new project in the selector.
2. Enable the APIs
2. Enable the APIs
In the API Library, enable
the API for each service in use:
- Keep the Drive API and scope for every Google file mount.
- The
gwscreate commands also need Drive to place new files inside a configured folder. - For read-only use, pick the matching read-only scopes.
3. Configure Google Auth Platform
3. Configure Google Auth Platform
The OAuth settings live under Google Auth Platform in the console
sidebar (overview).
- Branding: enter an app name (for example “Mirage”), a support email and a developer contact email, then save.
- Audience: set the user type to External and add the Google account that will sign in as a test user, then save.
- Data Access: click Add or Remove Scopes, add the scopes from step 2, then save.
4. Create an OAuth client
4. Create an OAuth client
- Open Clients in the sidebar (or Create OAuth client on the Overview page).
- Set the application type to Desktop app.
- Name it and click Create.
- Copy the Client ID and Client Secret.
5. Get the refresh token
5. Get the refresh token
Open this URL in a browser. Replace The JSON reply holds
YOUR_CLIENT_ID and put the scopes
from step 2 in scope, separated by %20. This one asks for Drive and
Docs:access_type=offlineasks for a refresh token.prompt=consentissues a new refresh token on every sign-in.
http://localhost:1/?code=4/0A..., a page that does
not load. Copy the code value from the address bar and exchange it
right away:refresh_token. Save it.Token lifetime
Token lifetime
- Setup works in Testing. To publish, open Audience and click Publish App.
- Mirage trades the refresh token for short-lived access tokens on its own.
- A refresh token can still be revoked or expire; sign in again when that happens. See Google’s token expiration notes.
Troubleshooting
Troubleshooting
Connect
- YAML
- Python
- TypeScript
workspace.yaml
Layout
/gdrivemirrors My Drive plus one folder per Shared Drive. Docs, Sheets and Slides there read as.gdoc.json,.gsheet.jsonand.gslide.json./gdocs,/gsheetsand/gslidessplit files intoowned/andshared/, named<date>_<title>__<id>, holding the API’s JSON./gmailis read only: one folder per label and day, a.gmail.jsonper message and a folder of its attachments.
Sample runs
write mount, Drive takes cp, mv, rm, mkdir and tee on regular
files; a Docs, Sheets or Slides file is read only as bytes, and /gdocs,
/gsheets and /gslides take mv (rename) and rm. Edit their content with
the gws CLI, which also covers Forms.
SDK guides
Drive (Python)
Every config field, the VFS.md and write support.
Drive (TypeScript)
Every config field, the VFS.md and write support.
Docs (Python)
Every config field, the VFS.md and write support.
Docs (TypeScript)
Every config field, the VFS.md and write support.
Sheets (Python)
Every config field, the VFS.md and write support.
Sheets (TypeScript)
Every config field, the VFS.md and write support.
Slides (Python)
Every config field, the VFS.md and write support.
Slides (TypeScript)
Every config field, the VFS.md and write support.
Gmail (Python)
Every config field, the VFS.md and write support.
Gmail (TypeScript)
Every config field, the VFS.md and write support.