Google Workspace CLI OAuth setup
Configure Google Workspace CLI OAuth so mikan can store and project Google Workspace credentials.
Note: mikan stores the Google authorized_user JSON in the vault as
gws.json, and the runtime target is inferred from that file name. Theimageandgondolinsandboxes automatically project the file to that target inside the runtime.container,firecracker, andcloudflarecannot mount files at all and fail the run rather than proceed without the credential, so do not use this flow on those modes.
1. Create a Google OAuth Client
Section titled “1. Create a Google OAuth Client”In Google Cloud Console, go to:
APIs & Services → Credentials → Create Credentials → OAuth client IDConfigure:
- Application type:
Web application - Authorized redirect URI:
<LINK_URL>/oauth/callback
Example:
LINK_URL=https://mikan.example.comRedirect URI=https://mikan.example.com/oauth/callbackIf the OAuth app is still in testing mode, add users at:
OAuth consent screen → Test users2. Set environment variables
Section titled “2. Set environment variables”export LINK_URL="https://mikan.example.com"export GOOGLE_WORKSPACE_CLI_CLIENT_ID="<client-id>"export GOOGLE_WORKSPACE_CLI_CLIENT_SECRET="<client-secret>"If LINK_PORT is not set, mikan listens on 8181 by default when LINK_URL exists.
Optional: override default scopes:
export GOOGLE_WORKSPACE_CLI_OAUTH_SCOPES="https://www.googleapis.com/auth/drive https://mail.google.com/ https://www.googleapis.com/auth/calendar"3. Use /login
Section titled “3. Use /login”If you want later runtime executions to automatically project this credential file to /root/.config/gws/credentials.json, start mikan with the image sandbox (or gondolin:default):
mikan --sandbox=image:mikan-sandbox:tools /path/to/workspaceIn a DM with the bot, type:
/loginOpen the link returned by mikan and choose Google Workspace CLI OAuth.
After success, mikan stores the authorized user credential as a vault file, for example:
{ "client_id": "...", "client_secret": "...", "refresh_token": "...", "type": "authorized_user"}The target path inferred from the gws.json name is:
/root/.config/gws/credentials.json- mikan uses a web OAuth callback, so the Google OAuth client must be
Web application, not a desktop app. - If Google does not return a
refresh_token, revoke the existing consent and run/loginagain. mikan requestsaccess_type=offlineandprompt=consent, but Google may still omit the refresh token because of existing authorization. - To make
gws.jsonappear automatically at/root/.config/gws/credentials.json, use theimageorgondolinsandbox. Oncontainer,firecracker, andcloudflarea file credential in the vault makes the run fail withdoes not support vault file mounts— remove it and useenv-only credentials there.