davido / gerrit-oauth-provider

OAuth2 authentication provider for Gerrit Code Review. Please upload changes for review to: https://gerrit-review.googlesource.com/#/admin/projects/plugins/oauth
Apache License 2.0
140 stars 84 forks source link

Plugin is unable to authenticate Gitlab/Github oauth #162

Closed aman20010sinha closed 2 years ago

aman20010sinha commented 2 years ago

Hi Team,

I have used the gerrit 3.5.0 war file and have taken the plugin from the release artifacts - https://github.com/davido/gerrit-oauth-provider/releases/download/v3.5.1/gerrit-oauth-provider.jar. When I am trying the init operation after adding the plugin, the installer is unable to verify the passwords for both github or gitlab. I have registered gerrit as a new application in both github and gitlab and I am using the generated client ID and client secret. After providing the above keys, the installer prompts for a "confirm password". I am using my github/gerrit account password which is not matching. Below is the snippet for the same.

*** OAuth Authentication Provider
***

Use Google OAuth provider for Gerrit login ? [y/N]?
Use GitHub OAuth provider for Gerrit login ? [y/N]? y
Application client id          : 8e0c165a5e81e57da608
Application client secret      :
              confirm password :
error: Passwords did not match; try again
Application client secret      :
              confirm password :
error: Passwords did not match; try again
Application client secret      :
              confirm password :
Fix legacy user id, without oauth provider prefix? [false]: true
Use Bitbucket OAuth provider for Gerrit login ? [y/N]?
Use CAS OAuth provider for Gerrit login ? [y/N]?
Use Facebook OAuth provider for Gerrit login ? [y/N]?
Use GitLab OAuth provider for Gerrit login ? [y/N]? y
Application client id          : a79bfa4bbc2a51a04c7efb9df77171aa9ccbbc5ea7dc3e198f4ff5e402697b72
Application client secret      :
              confirm password :
error: Passwords did not match; try again
Application client secret      :
              confirm password :
error: Passwords did not match; try again
Application client secret      :
              confirm password :
error: Passwords did not match; try again
Application client secret      :
              confirm password :
error: Passwords did not match; try again
Application client secret      :
              confirm password :
error: Passwords did not match; try again
Application client secret      :
davido commented 2 years ago

Is this really related to this plugin? I have not tried to reproduce it, but may be replicate this issue rather to main gerrit issue tracker: [1].

[1] https://bugs.chromium.org/p/gerrit/issues/list

aman20010sinha commented 2 years ago

Thanks, I have raised a new issue - https://bugs.chromium.org/p/gerrit/issues/detail?id=15653 Also, Below is my gerrit.config file. Please check if there's any issue which could lead to the above error.

[gerrit] basePath = git canonicalWebUrl = https://ec2-52-91-78-134.compute-1.amazonaws.com:8443/ serverId = e1d03375-d4be-44f7-9d8f-675f555647f7 [container] javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance" javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance" user = gerrit javaHome = /usr/lib/jvm/java-11-openjdk-amd64 [index] type = lucene [auth] type = HTTP httpHeader = aman20010sinha logoutUrl = /oauth/reset [receive] enableSignedPush = true [sendemail] smtpServer = localhost [sshd] listenAddress = :29418 [httpd] listenUrl = https://:8443/ [cache] directory = cache [plugin "gerrit-oauth-provider-github-oauth"] client-id = 8e0c165a5e81e57da608 fix-legacy-user-id = true

Just to confirm, Which password is the installer prompting after providing the client secret? I assume its my github account password

davido commented 2 years ago

Just to confirm, Which password is the installer prompting after providing the client secret? I assume its my github account password

Nope. Client Secret is provided by GitHub/GitLab during application registration process.

Please check the documentation in WIKI:

https://github.com/davido/gerrit-oauth-provider/wiki/Getting-Started