Google Workspace syncer
The Google Workspace syncer imports users from Google Workspace (formerly G Suite) into Casdoor using the Google Admin SDK Directory API.
Prerequisites
Set up a Google Cloud service account with domain-wide delegation and the Admin SDK enabled before configuring the syncer.
Step 1: Create a Service Account
Navigate to Google Cloud Console and create a service account:
- Go to IAM & Admin → Service Accounts → Create Service Account
- Enter a name and description for the service account
- Click Create and Continue
- Grant the service account the Service Account User role (optional)
- Click Done
Step 2: Generate a Service Account Key
After creating the service account, generate a JSON key:
- Click on the service account you just created
- Go to the Keys tab
- Click Add Key → Create new key
- Select JSON format
- Click Create and save the downloaded JSON file securely
Step 3: Enable Admin SDK API
Enable the Admin SDK API for your Google Cloud project:
- Go to APIs & Services → Library
- Search for "Admin SDK API"
- Click on it and click Enable
Step 4: Configure Domain-Wide Delegation
Set up domain-wide delegation in Google Workspace Admin:
- In the service account details, copy the Client ID
- Go to Google Workspace Admin Console
- Navigate to Security → Access and data control → API controls
- Click Manage Domain Wide Delegation
- Click Add new
- Paste the service account Client ID
- Add the OAuth scope:
https://www.googleapis.com/auth/admin.directory.user.readonly - Click Authorize
mẹo
The admin.directory.user.readonly scope allows the syncer to read user profiles in your Google Workspace domain in read-only mode.