Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: configure gitlab produces Fatal error #189

Open
JasCodes opened this issue Feb 7, 2018 · 5 comments
Open

Bug: configure gitlab produces Fatal error #189

JasCodes opened this issue Feb 7, 2018 · 5 comments

Comments

@JasCodes
Copy link

JasCodes commented Feb 7, 2018

Do you want to configure the gitlab service?
    [Yn]> Y
Is your service self-hosted?
    [yN]> N
Please enter your credentials to connect to the service:
username> xxxxxx
password> 
Fatal error: 404: b'{"error":"404 Not Found"}'
@guyzmo
Copy link
Owner

guyzmo commented May 30, 2018

Sorry for the time to get back to you, days are currently flying fast for me.

Could you try again with the -v option?

@bochecha
Copy link

bochecha commented Jun 6, 2018

Just had this same error, here's the output with -v:

$ git repo config -v
[...]
Do you want to configure the gitlab service?
    [Yn]> y
Is your service self-hosted?
    [yN]> n
Please enter your credentials to connect to the service:
username> bochecha
password> 
Fatal error: 404: b'{"error":"404 Not Found"}'
------------------------------------
Traceback (most recent call last):
  File "/home/mathieu/.local/lib/python3.6/site-packages/git_repo/repo.py", line 581, in main
    return GitRepoRunner(args).run()
  File "/home/mathieu/.local/lib/python3.6/site-packages/git_repo/kwargparse.py", line 68, in run
    return self._action_dict[frozenset(args)](self)
  File "/home/mathieu/.local/lib/python3.6/site-packages/git_repo/repo.py", line 573, in do_config
    setup_service(service)
  File "/home/mathieu/.local/lib/python3.6/site-packages/git_repo/repo.py", line 545, in setup_service
    new_conf['token'] = service.get_auth_token(username, password, prompt=loop_input)
  File "/home/mathieu/.local/lib/python3.6/site-packages/git_repo/services/ext/gitlab.py", line 130, in get_auth_token
    gl.auth()
  File "/home/mathieu/.local/lib/python3.6/site-packages/gitlab/__init__.py", line 226, in auth
    self._credentials_auth()
  File "/home/mathieu/.local/lib/python3.6/site-packages/gitlab/__init__.py", line 236, in _credentials_auth
    r = self.http_post('/session', data)
  File "/home/mathieu/.local/lib/python3.6/site-packages/gitlab/__init__.py", line 825, in http_post
    post_data=post_data, files=files, **kwargs)
  File "/home/mathieu/.local/lib/python3.6/site-packages/gitlab/__init__.py", line 731, in http_request
    response_body=result.content)
gitlab.exceptions.GitlabHttpError: 404: b'{"error":"404 Not Found"}'

Adding some prints to the code, I can see it tried to do a POST on https://gitlab.com/api/v4/session, with the params {'email': 'bochecha', 'password': '************'}.

It's interesting that it sends an email but asks me for a username, but I still get the 404 error if I try with my email instead.

This seems to be the root cause: https://gitlab.com/gitlab-org/gitlab-ce/issues/42324

@bochecha
Copy link

bochecha commented Jun 6, 2018

Ok, so the API endpoint was removed in Gitlab 10.2: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG.md#1020-2017-11-22

Remove Session API now that private tokens are removed from user API endpoints.

The python-gitlab author decided to fix the issue with documentation: python-gitlab/python-gitlab#380 (comment)

https://github.com/python-gitlab/python-gitlab/blob/master/docs/api-usage.rst#note-on-password-authentication

@nascarsayan
Copy link

nascarsayan commented Jun 28, 2018

Can we use access token based authentication in gitlab, since /session was removed?
How do we configure python-gitlab like this :

import gitlab

# private token or personal token authentication
gl = gitlab.Gitlab('http://10.0.0.1', private_token='JVNSESs8EwWRx5yDxM5q')

for git-repo ?

source: https://github.com/python-gitlab/python-gitlab/blob/master/docs/api-usage.rst#gitlabgitlab-class

@guyzmo
Copy link
Owner

guyzmo commented Aug 26, 2019

ok, I haven't had a look for that.
I'll look into that once I finish the current issue.

AFAICT, it still is working when configuring manually the token in the configuration (at least it does for me). But the change of scheme totally breaks the autoconfiguration tool.

PR are welcome to fix the issue 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants