Unable to connect to GitHub Apps via SonarQube Community Edition. It keeps returning Unauthorized

I am working on integrating SonarQube within my Organizations’ CI pipeline, and getting last this huddle is the last step to doing that. I need help with the problem below:

I am trying to connect my SonarQube Community Edition deployment to GitHub, and I did set up a GitHub app, and used the credentials to set up a GitHub Project on SonarQube. However, whenever I try to initiate the project, I keep getting returned unauthorized: ‘You’re not authorized to access this page. Please contact the administrator.’. This is at the URL: https:///sessions/unauthorized.

I get this in the logs:

WARN web[AYNny08VYY7aX7LCAAXh][o.s.s.a.AuthenticationError] No provider key found in URI

Hey there.

How have you configured your GitHub application (specifically, what have you configured for the **User authorization callback URL)?

ANd just in case – make sure you’re following the documentation to the letter.

Thanks for your reply Colin.
I configured: SonarQube as the authorization callback URL

https://<base-url>/oauth2/callback

Change it to just https://<base-url>, as noted in the docs

Creating a dedicated app for authentication

If you want to use a dedicated app for GitHub authentication, you can create a GitHub OAuth app. You’ll find general instructions for creating a GitHub OAuth App here. Specify the following settings in your OAuth App:

  • Homepage URL – the public URL of your SonarQube server. For example, https://sonarqube.mycompany.com. For security reasons, HTTP is not supported, and you must use HTTPS. The public URL is configured in SonarQube at Administration > General > Server base URL.
  • Authorization callback URL – your instance’s base URL. For example, https://yourinstance.sonarqube.com.

Thank you Colin! This worked.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.