Back to README
By default, wk auth add requests access to the user services (see wk auth services for the current list and scopes).
wk auth add you@gmail.com --services drive,calendarWrite operations will fail with 403 insufficient scopes:
wk auth add you@gmail.com --services drive,calendar --readonlywk auth add you@gmail.com --services drive --drive-scope full # Default: full access
wk auth add you@gmail.com --services drive --drive-scope readonly # Read-only
wk auth add you@gmail.com --services drive --drive-scope file # Only files created/opened by this appNotes:
--drive-scope readonlyis enough for listing/downloading/exporting via Drive (write operations will 403).--drive-scope fileis write-capable (limited to files created/opened by this app) and can't be combined with--readonly.
If you need to add services later and Google doesn't return a refresh token, re-run with --force-consent:
wk auth add you@gmail.com --services user --force-consent
# Or add just Sheets
wk auth add you@gmail.com --services sheets --force-consent--services all is accepted as an alias for user for backwards compatibility.
Docs commands are implemented via the Drive API, and docs requests both Drive and Docs API scopes.
Auto-generated; run go run scripts/gen-auth-services-md.go to regenerate.
| Service | User | APIs | Scopes | Notes |
|---|---|---|---|---|
| gmail | yes | Gmail API | https://www.googleapis.com/auth/gmail.modifyhttps://www.googleapis.com/auth/gmail.settings.basichttps://www.googleapis.com/auth/gmail.settings.sharing |
|
| calendar | yes | Calendar API | https://www.googleapis.com/auth/calendar |
|
| chat | yes | Chat API | https://www.googleapis.com/auth/chat.spaceshttps://www.googleapis.com/auth/chat.messageshttps://www.googleapis.com/auth/chat.membershipshttps://www.googleapis.com/auth/chat.users.readstate.readonly |
|
| classroom | yes | Classroom API | https://www.googleapis.com/auth/classroom.courseshttps://www.googleapis.com/auth/classroom.rostershttps://www.googleapis.com/auth/classroom.coursework.studentshttps://www.googleapis.com/auth/classroom.coursework.mehttps://www.googleapis.com/auth/classroom.courseworkmaterialshttps://www.googleapis.com/auth/classroom.announcementshttps://www.googleapis.com/auth/classroom.topicshttps://www.googleapis.com/auth/classroom.guardianlinks.studentshttps://www.googleapis.com/auth/classroom.profile.emailshttps://www.googleapis.com/auth/classroom.profile.photos |
|
| drive | yes | Drive API | https://www.googleapis.com/auth/drive |
|
| docs | yes | Docs API, Drive API | https://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/documents |
Export/copy/create via Drive |
| slides | yes | Slides API, Drive API | https://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/presentations |
Create/edit presentations |
| contacts | yes | People API | https://www.googleapis.com/auth/contactshttps://www.googleapis.com/auth/contacts.other.readonlyhttps://www.googleapis.com/auth/directory.readonly |
Contacts + other contacts + directory |
| tasks | yes | Tasks API | https://www.googleapis.com/auth/tasks |
|
| sheets | yes | Sheets API, Drive API | https://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/spreadsheets |
Export via Drive |
| people | yes | People API | profile |
OIDC profile scope |
| forms | yes | Forms API | https://www.googleapis.com/auth/forms.bodyhttps://www.googleapis.com/auth/forms.responses.readonly |
|
| appscript | yes | Apps Script API | https://www.googleapis.com/auth/script.projectshttps://www.googleapis.com/auth/script.deploymentshttps://www.googleapis.com/auth/script.processes |
|
| groups | no | Cloud Identity API | https://www.googleapis.com/auth/cloud-identity.groups.readonly |
Workspace only |
| keep | no | Keep API | https://www.googleapis.com/auth/keep.readonly |
Workspace only; service account (domain-wide delegation) |
User column: yes means the service is included in the default user service set (what wk auth add requests by default). no means it must be explicitly requested via --services.
A service account is a non-human Google identity that belongs to a Google Cloud project. In Google Workspace, a service account can impersonate a user via domain-wide delegation (admin-controlled) and access APIs like Gmail/Calendar/Drive as that user.
In wk, service accounts are an optional auth method that can be configured per account email. If a service account key is configured for an account, it takes precedence over OAuth refresh tokens.
- Create (or pick) a Google Cloud project.
- Enable the APIs you'll use (e.g. Gmail, Calendar, Drive, Sheets, Docs, People, Tasks, Cloud Identity).
- Go to IAM & Admin -> Service Accounts and create a service account.
- In the service account details, enable Domain-wide delegation.
- Create a key (Keys -> Add key -> Create new key -> JSON) and download the JSON key file.
Domain-wide delegation is enforced by Workspace admin settings.
- Open Admin console -> Security -> API controls -> Domain-wide delegation.
- Add a new API client:
- Client ID: use the service account's "Client ID" from Google Cloud.
- OAuth scopes: comma-separated list of scopes you want to allow (copy from
wk auth servicesand/or yourwk auth add --services ...usage).
If a scope is missing from the allowlist, service-account token minting can fail (or API calls will 403 with insufficient permissions).
wk auth service-account set you@yourdomain.com --key ~/Downloads/service-account.jsonVerify:
wk --account you@yourdomain.com auth status
wk auth listSee docs/auth.md for complete authentication documentation.