Oauth2 login returns invalid grant on GitLab 16.5.2
Hi
I have been using the gitlab4j-api library with an internal tool and it has been working no problem until I upgraded GitLab to the latest release 16.5.2
I am now not able to login with OAUTH2 (it works with standard users though)
org.gitlab4j.api.GitLabApiException: invalid_grant
at org.gitlab4j.api.AbstractApi.validate(AbstractApi.java:678)
at org.gitlab4j.api.AbstractApi.post(AbstractApi.java:360)
at org.gitlab4j.api.GitLabApi.oauth2Login(GitLabApi.java:299)
at org.gitlab4j.api.GitLabApi.oauth2Login(GitLabApi.java:195)
Is anyone aware if this is a known bug or if I missed something or if gitlab4j-api is compatible with GitLab 16.5.2?
Thanks in advance
We did not update to that version yet… so I can't tell if it works for us or not.
I am not aware of this this bug, but it would be interesting to have more details to know if this is something we need to fix in the gitlab4j-api client or not.
Searching for invalid_grant in Google indicates that this issue can have multiple causes.
Thank you @jmini for the reply
I am currently upgrading my GitLab instance to latest version in a test account, and will stop at each upgrade step to test the gitlab-4j api and see which exact version breaks the OAUTH2 login
The issue can indeed have multiple causes, but I haven't gone deep into the code yet to get more details
All I know is that my live instance is gitlab-15.4.6 and the testing instance is at 16.5.2 and we had no problem last week when it was at 15.11.3. It is possible that it is the major upgrade that introduce additional OAUTH2 functionality that breaks the oauth2 login, unless is I (us) who misuses the library
I will update my findings here and hopefully we can help each other out :)
I also met this problem. It seems it is related with Gitlab and they fixed at 16.7 version: https://gitlab.com/gitlab-org/gitlab/-/commit/79942aa5735e73cca6bbf71ca44db60e8fb1ee55
Thank you for sharing the link