Steps to reproduce:
- Install SonarQube 8.5.1-community with oteemocharts/sonarqube Helm chart version 9.5.1.
- Create a GitHub App (not an OAuth app) with details/permissions as shown in this docs page (GitHub Enterprise 2.22.5)
- Attempt to login to SonarQube using GitHub.
Expected result:
Users can login.
Actual result:
User receives an unauthorised error when trying to login. SonarQube logs show:
2021.03.19 12:53:53 WARN web[***][o.s.s.a.AuthenticationError] Fail to callback authentication with 'github'
java.lang.IllegalStateException: Fail to execute request 'https://example.com/api/v3/user/emails'. HTTP code: 403, response: {"message":"Resource not accessible by integration","documentation_url":"https://docs.github.com/enterprise/2.22/rest/reference/users#list-email-addresses-for-the-authenticated-user"}
Workaround:
Configure the GitHub app with the users:email permission set to read-only (not mentioned in the docs page).