Initialize gitLab object when in logging in with token
Fix for #316 (closed)
Merge request reports
Activity
Of course.
In the case of a token login, we would go through :
login()
->connect(false)
->connectByToken()
->loadUser()
.
And nowhere on this path thegitLab
object is initialized.
This is a problem around line 403 where we can't get ahostNameVerifier
.At first I initialized the
gitLab
object inloadUser()
, which worked.
But then for auth login it would create the object twice becauseattemptLogin()
creates it and callsloadUser()
later.I did not know if it would be a problem, and it was not very clean anyway so I tried moving the init in
connectByToken()
without changing anything inloadUser()
.
It did not work. Then I found the comment on line 328 :// This seems useless - But believe me, it makes everything work! Don't remove it. // (OkHttpClientFactory caches the clients and needs a new account to recreate them)
So my guess is the caching in
OkHttpClientFactory
was messing things up when I calledcreate
twice.
So I decided to reuse thegitlabClientBuilder
by passing it through toloadUser()
.I renamed the local
gitLab
togitLabService
because it was masking the class object and I thought it was confusing.Auth login is OK as far as I tested.
Edited by username-removed-1593756Awesome @bschuhm thanks for the clarification. This login process could use some cleaning up, thanks for finding and resolving this issue, I am sure it will fix issues for a lot of others as well.
mentioned in commit c0e79242