git-bug icon indicating copy to clipboard operation
git-bug copied to clipboard

Bridge wizard fails on gitlab token

Open vtexier opened this issue 3 years ago • 4 comments

I was stuck on git-bug bridge wizard, failing to connect with the Gitlab personal access token:

git-bug bridge configure
[1]: github
[2]: gitlab
[3]: jira
[4]: launchpad-preview
target: 2
name [default]: 
Gitlab server URL [https://gitlab.com/]: 
Gitlab project URL: https://gitlab.com/myproject
Gitlab login: mylogin
You can generate a new token by visiting https:/gitlab.com/profile/personal_access_tokens.
Choose 'Create personal access token' and set the necessary access scope for your repository.

'api' access scope: to be able to make api calls

Enter token: glpat-xxxxx
token has incorrect format
Enter token: xxxxx
token is invalid: GET https://gitlab.com/api/v4/user: 401 {message: 401 Unauthorized}

The string given is not accepted (it should). If I truncate the prefix, it fails.

Then I tried the command line with the full token with success:

 git-bug bridge configure --name=default --target=gitlab --url=https://gitlab.com/myproject --login=mylogin --token=glpat-xxxxx
Gitlab server URL [https://gitlab.com/]: 
Current identity dc710e2 tagged with login mylogin
Successfully configured bridge: default

vtexier avatar Nov 03 '21 13:11 vtexier

Also, the URL of new token is https://gitlab.com/-/profile/personal_access_tokens.

m2crypto@stitny (master)$ git bug bridge auth add-token --target=gitlab --login=mcepl
Building identity cache... Done.
Building bug cache... Done.
Enter the token:
glpat-somethingsecret
token something added
m2crypto@stitny (master)$ git bug bridge auth
Error: unknown credential type ""
m2crypto@stitny (master)$

mcepl avatar Nov 27 '21 18:11 mcepl

For me using the latest version in master and using "interactive token creation" worked.

mohe2015 avatar Nov 27 '21 23:11 mohe2015

For me using the latest version in master and using "interactive token creation" worked.

For me it doesn’t:

vis-fzf-open@stitny (master)$ git remote -v
github	https://github.com/mcepl/vis-fzf-open.git (fetch)
github	[email protected]:mcepl/vis-fzf-open.git (push)
sourcehut	https://git.sr.ht/~mcepl/vis-fzf-open (fetch)
sourcehut	[email protected]:~mcepl/vis-fzf-open (push)
vis-fzf-open@stitny (master)$ rm -rf ~/.config/dotfiles/.git/modules/vis/plugins/vis-fzf-open/git-bug/
vis-fzf-open@stitny (master)$ git bug user create
Name [Matěj Cepl]:
Email [[email protected]]:
Avatar URL: https://avatars.githubusercontent.com/u/198999?s=400&v=4

de2aa1ef8534eec8d6cbed6d0932c760a8830842
vis-fzf-open@stitny (master)$ git bug bridge auth add-token --target=github -l mcepl
Enter the token:
ghp_something
token somethingelse added
vis-fzf-open@stitny (master)$ git bug bridge auth show
Error: accepts 1 arg(s), received 0
vis-fzf-open@stitny (master)$ git bug bridge configure
[1]: github
[2]: gitlab
[3]: jira
[4]: launchpad-preview
target: 1
name [default]:

Detected projects:
[1]: github.com/mcepl/vis-fzf-open

[0]: Another project

Select option: 1
Github login: mcepl
Error: unknown credential type ""
vis-fzf-open@stitny (master)$

mcepl avatar Nov 29 '21 06:11 mcepl

@mcepl I only used the bridge configure without adding a token before and there was a interactive auth option there.

mohe2015 avatar Nov 29 '21 12:11 mohe2015

Same thing for me, version 0.7.2. Full token gives "incorrect format", removing its prefix gives a 401. git-bug happily configured things when I passed the token non-interactively, using the command line --token option.

pawamoy avatar Oct 20 '22 11:10 pawamoy

Ah, seems it's fixed in master: https://github.com/MichaelMure/git-bug/issues/838. This issue should probably be closed then.

pawamoy avatar Oct 20 '22 11:10 pawamoy

Indeed. Sorry about that, I'm working my way there but i'm pretty busy on other life things.

MichaelMure avatar Oct 20 '22 12:10 MichaelMure

No problem of course 🙂 Thank you for your work on git-bug. I don't often check it out, but it's there in a corner of my mind and today I wanted to try it again 😄 I'll keep an eye on the releases 😉

pawamoy avatar Oct 20 '22 12:10 pawamoy