A Chrome extension that automatically adds the authuser parameter to Google domains, allowing you to set your preferred Google account for each service.
If you use multiple Google accounts (personal, work, school), you know the frustration of constantly being logged into the wrong account when visiting different Google services. This extension solves that problem by automatically adding the appropriate authuser parameter to URLs based on the domain, ensuring you're always using your preferred account for each Google service.
- Domain-Specific Account Selection: Set different preferred accounts for different Google domains (e.g., YouTube, Gmail, Drive)
- Auto-Redirect: Automatically redirects to add the
authuserparameter when you visit a configured Google domain - Smart Loop Prevention: Intelligently prevents redirect loops
- Google Domain Autocomplete: Includes autocomplete suggestions for popular Google domains
- User-Friendly Interface: Clean, modern UI with toggle to quickly enable/disable the extension
- Multiple Account Support: Easily manage multiple Google accounts across different services
- Privacy-Focused: No data collection, all settings stored locally in your browser
- Download or clone this repository:
git clone https://github.com/altersquareio/preferred-google-login.git
- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" in the top-right corner
- Click "Load unpacked" and select the directory containing the extension files
- Click the extension icon in your browser toolbar
- Toggle the extension on/off using the switch in the header
- Add domain and email pairs:
- Click "Add Domain" to create a new entry
- Enter a Google domain (or select from autocomplete suggestions)
- Enter the Gmail address you prefer to use for that domain
- Click "Save Changes" to apply your settings
- Visit any Google service - the extension will automatically redirect you to use your preferred account
| Domain | Result | |
|---|---|---|
| youtube.com | [email protected] | YouTube always uses your work account |
| mail.google.com | [email protected] | Gmail always opens with your personal account |
| drive.google.com | [email protected] | Google Drive defaults to your school account |
The extension supports numerous Google domains, including:
- google.com
- youtube.com
- mail.google.com
- drive.google.com
- docs.google.com
- cloud.google.com
- meet.google.com
- photos.google.com
- gemini.google.com
- classroom.google.com
- and many more!
The extension:
- Checks if the current website is a Google domain
- Determines if you've configured a preferred account for that domain
- Adds the appropriate
authuserparameter to the URL - Implements safeguards to prevent redirect loops
- Provides an intuitive UI for managing your preferences
- Built with vanilla JavaScript, HTML, and CSS
- Uses Chrome's Storage API for persistent settings
- Content script runs at document start to ensure timely redirects
- Modern ES6+ JavaScript features for clean, maintainable code
- Responsive UI design that works across different screen sizes
- Code formatting with Prettier and linting with ESLint
This extension:
- Does NOT collect any user data
- Does NOT send any information to external servers
- Stores your domain-email preferences only in your browser's local storage
- Requires minimal permissions (only storage and scripting)
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
├── .vscode # VS Code configuration
├── icons # Extension icons in various sizes
├── src # Source code
│ ├── content.js # Content script for adding authuser parameter
│ ├── popup.html # Extension popup interface
│ └── popup.js # Popup functionality
├── .gitignore # Git ignore file
├── .prettierrc.js # Prettier configuration
├── eslint.config.mjs # ESLint configuration
├── LICENSE # MIT License
├── manifest.json # Chrome extension manifest
├── package.json # NPM package configuration
└── README.md # This file
# Install dependencies
npm install
# Run lint checks
npm run lint
# Format code
npm run formatMIT License
Copyright (c) 2025 Rohan Dhamapurkar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Rohan Dhamapurkar - [email protected]
Project: https://github.com/altersquareio/preferred-google-login