Allow using Bitbucket Cloud API Token for authorization#1206
Allow using Bitbucket Cloud API Token for authorization#1206verbalius wants to merge 1 commit intofluxcd:mainfrom
Conversation
|
We do not need to establish these special values for username in order to branch off the code to comp := strings.Split(token, ":")
if len(comp) != 2 {
return nil, errors.New("invalid token format, expected to be <user>:<password>")
}
username := comp[0]
password := comp[1]This is very unfortunate, because we also support username+password inputs in the referenced secret. @verbalius How is bitbucket handling this deprecation? Has username+password stopped working completely? I ask this because I'd like to fix this code to do the right thing (if token is set, use @stefanprodan Thoughts? |
|
@matheuscscp Hi, Matheus! Thanks for looking at this pull request. |
|
Hi team, I'm having trouble getting notifications working with bitbucket right now and suspect that the app password deprecation is responsible. I'm not getting any log output even at the debug log level to indicate that the provider is working, not seeing any status updates in bitbucket, and also not seeing any denied traffic from the notification controller pod in my org's firewall. https://developer.atlassian.com/cloud/bitbucket/rest/intro/#app-passwords says that app passwords are deprecated from last September. I also found this elsewhere (emphasis is mine):
That being said, Bitbucket still supports HTTP basic auth for username+password, where the username is the user's email and the password is an api token. So I wonder, then, is the right thing to do, configure the secret to use key names I did try both token and username/password fields in the secret with a real user account in bitbucket but no success so far finding any status in bitbucket nor even logs in notification controller about the events I want to send to bitbucket. Incoming events are being processed by our bitbucket receiver without issues but the provider doesn't seem to be working in my case. |
Bitbucket deprecated app paswords and tells users to use API tokens instead. But API tokens (for example repo api tokens) they don't work with username:password scheme where username is the bot email. This pull request changes auth to NewOAuthbearerToken if the username is
x-api-token-authorx-bitbucket-api-token-authas Bitbucket tells in the documentation.https://developer.atlassian.com/cloud/bitbucket/rest/intro/#app-passwords
Before the change I was always getting the 401 error (tried various combinations of email, username, personal tokens and repo tokens)

After a change it works
