GitHub App integration fails with "Authentication Failed"

Overview

When you connect CodeScene using a GitHub App, repository analysis or pull request integration can fail with an "Authentication Failed" error. This can happen even when the App is fully installed on the organization and the same setup works elsewhere. This article explains the most common cause and how to fix it.

Symptoms

  • Analysis or PR integration fails with the message "Authentication Failed" when using the GitHub App.

  • In your GitHub organization settings, the App shows as fully installed (not pending) on the relevant repositories.

  • The App ID and private key are correct and belong to the App installed on this organization.

  • The same configuration may work on a different GitHub organization.

  • Connecting with SSH keys instead works, but then only analysis features are available. PR and project management integrations are not.

Root cause

The GitHub App doesn't have the Contents repository permission. CodeScene needs read access to repository contents to clone and analyze code. Without it, GitHub rejects the request, and CodeScene reports this as an authentication failure, even though the App itself is installed correctly.

This often happens when the App is created from scratch, or created under a personal account and then installed on the organization, and Contents is left at "No access".

Resolution steps

  1. In GitHub, open the App's settings. Go to Settings → Developer settings → GitHub Apps, then click Edit next to the CodeScene App. If the App was created under a personal account, these are that account's settings, not the organization's.

  2. Under Permissions & events → Repository permissions, set Contents to Read-only.

  3. Click Save changes.

  4. Approve the permission change for the organization. After an App's permissions change, an organization owner must accept the new permissions before they take effect. Go to Organization settings → GitHub Apps, open the CodeScene App, and review and accept the pending permission request.

  5. Return to CodeScene and re-run the analysis, or trigger a new PR check, to confirm the connection now works.

  6. If the error continues, contact support with your CodeScene version, the App name and the affected repository URL.

Prevention

When you create a GitHub App for CodeScene, check that Contents: Read-only is set before you install it on the organization. Whenever you change the App's permissions later, make sure an organization owner approves the change. Until they do, the installation keeps the old permissions. Repository analysis through the GitHub App requires CodeScene 7.5.9 or later on self-hosted instances.