If you're using Google Colab, authentication is handled by colab via a browser pop-up when you initialize a SyftClient, you can stop reading here. Once authenticated, Syft Client uses Google Drive as its communication protocol — all messages, events, and files are synced through the Drive API.
To use Syft Client outside of Google Colab, you need to set up a Google Cloud project with OAuth credentials.
- Go to Google Cloud Console
- Click Click a project in the top navigation bar
- Click New Project in the dialog that appears
- Enter a project name (e.g., "Syft Client")
- Click Create
- Wait for the project to be created, then select it
- In your project, go to APIs & Services > Library
- Search for "Google Drive API"
- Click on Google Drive API
- Click Enable
- In case you are using notifications (Data owner only), do the same for Gmail
- In case you are using email approval (Data owner only), do the same for Cloud Pub/Sub API
- Go to APIs & Services > OAuth consent screen
- press Get started
- Fill in the required fields:
- App name: "Syft Client" (or your preferred name)
- User support email: Your email address
- click next
- Select External user type (unless you have a Google Workspace organization), click next
- Fill in your email, click next
- Mark the policy checkbox, click Continue and Create
- On the data access section for the Oauth Consent screen. As a data scientist, you only ever need gdrive, but if you are using syft-client as a data owner, you may also need Gmail, specifically if you use email features like notifications or email approval.
- GDrive:
- Click Add or Remove Scopes
- Search for and select
https://www.googleapis.com/auth/drive - Scroll down and click Update
- Scroll down and click Save
- Gmail (data owner only for email features):
- Click Add or Remove Scopes
- Search for and select
https://www.googleapis.com/auth/gmail.modify - Scroll down and click Update
- Scroll down and click Save
- GDrive:
- On the Audience section for the oauth consent screen under Test users:
- Click Add Users
- Add you email adress
- Click Save and Continue
- In the main navigation menu, go to APIs & Services > Credentials
- In the top bar, click Create Credentials > OAuth client ID
- Select Desktop app as the application type
- Enter a name (e.g., "Syft Client Desktop")
- Click Create
- Download the JSON file - this contains your client credentials
- Save this file securely (e.g., as
credentials.json)
**If your app is Interal (see step 3.4) you can skip this step. **If your app is external and not published (i.e., remains in "Testing" mode), OAuth tokens expire every 7 days and users will need to re-authenticate. Publishing the app removes this limitation.
- Go to APIs & Services > OAuth consent screen
- navigate to the Audience section
- Under Testing header, Click Publish App
- Click confirm
Note: Publishing may require verification for apps requesting sensitive scopes like Google Drive access.
Once you've completed the Google Cloud Console setup, generate a token and log in:
token_path = sc.credentials_to_token(credentials_path)
do_client = login_do(email="your@email.com", token_path=token_path) # or login_ds