Closed derekpovah closed 3 years ago
Hey @derekpovah , thanks for reporting this. :) I'm gonna take a look :)
Edit: @derekpovah do you know which oauth scopes you chose while creating the app password? :)
@craftamap I just let it do everything
Alright, that sounds strange :/
The username and app password should be stored in ~/.config/bb/configuration.toml
, You could check if both are set correctly there.
It looks like everything gets set up correctly by the bb auth login
command
Alright :) I'm gonna spent some time later on it :)
I can't reproduce this behavior on my side, sadly.
Do other bb commands still work / is only the issue command affected? bb repo view
would be an easy way to get started. :)
I found a command that outputs more than just the error message. I've updated the first comment with the output.
Sorry for not taking a deeper look into this until now - however, it looks like it's related to the access token itself and not the application :/
you can verify this by running:
curl -u username:token -X GET "https://api.bitbucket.org/2.0/repositories/org/repo"
if this works, the application itself should work too :)
It looks like the client username is getting set to my shell username and not the value in the config file. bb
worked as expected when my shell user matched my Bitbucket username. My guess is something here is finding $USERNAME
that's set by my shell and using it in place of the config. I wrote a fish function that always sets the --username flag to get around this for now, but it definitely feels like a hack.
echo $USERNAME
derek
(gdb) run issue list
...
:: An error occurred: 401 Unauthorized
...
(gdb) p c.Username
$1 = "derek"
(gdb) p c.Password
$2 = "xxxxxxxxxxxxxxxxxxxx"
I have never touched Go before, but I had success changing username
in the config to something else. This simple solution doesn't account for existing config files that use username
, though.
Ahh, that meakes sense - I'm using https://github.com/spf13/viper to read the configuration and environment variables. It automatically creates them from the config parameters, so if $USERNAME is set, it will take this username instead.
I found an easy fix which will prefix all environment variables with BB_
, so this should not happen anymore - I will release it within the next days :)
Sorry, didn't mean to close this until you tested it - release 0.4.1 should have fixed it, though. Can you confirm?
The prefix solution is super clean and it works! Thanks for all your work on this!
I ran the
bb auth login
command and entered the requested information and it looks like the API is now returning a401
for every request. For some context, listing issues in projects with public issue trackers previously worked, but now does not.I used
go get github.com/craftamap/bb
to installbb
on Pop!_OS 20.10 withgo1.16.5 linux/amd64
managed by goenv.