Javascript

Auto-Login Script for SonarCloud with GitHub Authentication

Akira Ueno

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:

  1. 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
  1. Login Page Handling
  • Detects when redirected to the login page
  • Automatically clicks the configured social authentication button (GitHub by default)
  1. Utilities
  • waitUntil: A utility function that waits for specific conditions to be met
  • findAndClick: Finds and clicks elements using XPath selectors
  • Built-in timeout mechanism to prevent infinite loops

Installation

  1. Install the Tampermonkey browser extension
  2. Create a new script
  3. Copy and paste the provided code
  4. Save the script

Configuration

The script includes two main configurable settings: