Auto-Login Script for SonarCloud with GitHub Authentication
Overview
This Tampermonkey script automatically handles the SonarCloud login process when you encounter authentication errors. It detects error pages and automatically initiates GitHub login, making the authentication process seamless.
Script
Create a new Tampermonkey script and paste the following code:
How it Works
The script performs the following tasks:
- Error Page Detection
- Waits for the error message “The requested project does not exist, or you have not authenticated with SonarQube Cloud”
- Automatically clicks the “Login” button when found
- Login Page Handling
- Detects when redirected to the login page
- Automatically clicks the configured social authentication button (GitHub by default)
- Utilities
waitUntil: A utility function that waits for specific conditions to be metfindAndClick: Finds and clicks elements using XPath selectors- Built-in timeout mechanism to prevent infinite loops
Installation
- Install the Tampermonkey browser extension
- Create a new script
- Copy and paste the provided code
- Save the script
Configuration
The script includes two main configurable settings: