Getting Authentication error while trying to login using GitHub credentials

Getting the error for all our users:

You’re not authorized to access this page. Please contact the administrator.

Hey there.

When configuring GitHub authentication, did you limit access to specific organizations?

None… I dont have any setup for specific org. I created new oauth in my profile and added the clientID and secret as well. None of this helps

Okay. I would suggest bumping up the log level of your SonarQube instance to DEBUG (Global Administration > System) and check your web.log file for any more clues related to why authentication is failing.

2022.07.15 14:15:56 WARN  web[AYH9hR3W75jZc+J0AAsY][o.s.s.a.AuthenticationError] Fail to callback authentication with 'github'
java.lang.IllegalStateException: java.net.ConnectException: Connection timed out (Connection timed out)
	at org.sonar.auth.github.GitHubIdentityProvider.callback(GitHubIdentityProvider.java:99)
	at org.sonar.server.authentication.OAuth2CallbackFilter.handleOAuth2Provider(OAuth2CallbackFilter.java:92)
	at org.sonar.server.authentication.OAuth2CallbackFilter.handleProvider(OAuth2CallbackFilter.java:75)
	at org.sonar.server.authentication.OAuth2CallbackFilter.doFilter(OAuth2CallbackFilter.java:68)
	at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:139)
	at org.sonar.server.authentication.DefaultAdminCredentialsVerifierFilter.doFilter(DefaultAdminCredentialsVerifierFilter.java:89)
	at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:139)
	at org.sonar.server.plugins.PluginsRiskConsentFilter.doFilter(PluginsRiskConsentFilter.java:77)
	at org.sonar.server.platform.web.MasterServletFilter$GodFilterChain.doFilter(MasterServletFilter.java:139)
	at org.sonar.server.platform.web.MasterServletFilter.doFilter(MasterServletFilter.java:108)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:194)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:167)
	at org.sonar.server.platform.web.UserSessionFilter.doFilter(UserSessionFilter.java:81)
	at org.sonar.server.platform.web.UserSessionFilter.doFilter(UserSessionFilter.java:68)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:194)

It looks like your SonarQube instance isn’t able to contact the URL defined for sonar.auth.github.apiUrl.

Out of curiosity, is this GitHub.com or self-hosted GitHub Enterprise?