Overview
Google mounts and thegws CLI accept an access token or OAuth refresh
credentials. The steps below obtain refresh credentials for the services you
enable.
Setup
1. Create a Google Cloud Project
- Go to https://console.cloud.google.com/
- Click the project selector dropdown -> New Project
- Name it (e.g., “Mirage”) -> Create
- Select it from the dropdown
2. Enable APIs
Enable the API for each service you plan to use:
Keep the Drive API and scope when using Google file mounts. The
gws create
commands also need Drive when placing new files inside a configured folder.
For read-only use, select the corresponding read-only scopes.
3. Configure Google Auth Platform
The OAuth settings are under Google Auth Platform in the Cloud Console left sidebar (or go to https://console.cloud.google.com/auth/overview). A) Branding (left sidebar):- Fill in: App name (e.g., “Mirage”), support email, developer contact email
- Save
- Set user type to External
- Add your own Google email as a test user
- Save
- Click Add or Remove Scopes
- Add the scopes for the services you enabled in Step 2.
- Select them -> Save
4. Create OAuth2 Client
- Go to Clients in the left sidebar (or click Create OAuth client on the Overview page)
- Application type: Desktop app
- Name it -> Create
- Copy the Client ID and Client Secret
5. Get the Refresh Token
A) Build and open the authorization URL. ReplaceYOUR_CLIENT_ID and add
the scopes selected above to scope. This example requests Drive and Docs:
access_type=offline- required to receive a refresh tokenprompt=consent- forces refresh token issuance on re-auth
http://localhost:1?code=4/0AXXXX... (page won’t load - expected). Copy the code value from the URL bar.
D) Exchange for tokens:
refresh_token - save it.
6. Save the credentials
Token Lifetime
You can complete setup in Testing mode. To publish, go to Audience and
click Publish App.
The
TokenManager exchanges a valid refresh token for short-lived access
tokens automatically. Refresh tokens can still be revoked or expire; repeat
authorization when that happens. See
Google’s token lifecycle documentation.
Troubleshooting
For Python configuration, see Gmail, Drive, Docs, Sheets, Slides, and Calendar.
For TypeScript configuration, see Gmail, Drive, Docs, Sheets, Slides, and Calendar.
For Forms and service command trees, see GWS setup.