1. OAuth 2.0 Desktop Flow (Recommended)
This method allows you to log in with your Google account via a browser, just like any other desktop application.Security Features
- System Keychain: Tokens are stored in your OS’s native credential manager (macOS Keychain, Windows Credential Manager, Linux Secret Service).
- Hardware-Bound Encryption: Fallback storage uses AES-256-GCM with a key derived from your unique machine ID. Tokens cannot be decrypted on other devices.
- Multi-Account Support: Easily switch between multiple Google accounts.
How to Login
Run the following command in your terminal:- A local secure server will start.
- Your browser will open to the Google Authorization page.
- Grant access to your Search Console data.
- The CLI will automatically fetch your email and securely store your credentials.
Logout & Management
You can manage your sessions directly from the CLI:2. Service Account (Advanced / Headless)
For server-side environments or automated tasks where interactive login isn’t possible, you can use a Google Cloud Service Account.Step 1: Create a Service Account
- Go to the Google Cloud Console.
- Create a new project (or select an existing one).
- Go to IAM & Admin > Service Accounts.
- Click Create Service Account.
- Give it a name (e.g.,
seo-agent) and click Create and Continue. - Click Done.
Step 2: Generate a JSON Key
- In the Service Accounts list, click on your new account.
- Select the Keys tab.
- Click Add Key > Create new key.
- Select JSON and click Create.
- A JSON file will download to your computer. Keep this file secure.
Step 3: Grant Access in Search Console
You must give your Service Account permission to see your data:- Open the Google Search Console.
- Go to Settings > Users and permissions.
- Click Add User.
- Enter the Service Account Email (e.g.,
seo-agent@your-project.iam.gserviceaccount.com). - Select Permissions (Full or Restricted) and click Add.
Step 4: Configure the Server
Set theGOOGLE_APPLICATION_CREDENTIALS environment variable to point to your key file: