argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.89k stars 5.46k forks source link

Bearer Authentication for Git Repos (enabled Bitbucket repository HTTP access tokens) #9667

Open benruland opened 2 years ago

benruland commented 2 years ago

Summary

Bitbucket Data Center and potentially other Git servers provide Bearer-Authentication to authenticate against Git Repositories. ArgoCD should support this kind of authentication for Git-over-HTTP.

Motivation

Project / repository HTTP access tokens are the preferred way to connect to Bitbucket repositories in Bitbucket Data Center.

For HTTP access tokens on a project and repository level, Bearer authentication seems to be the only working authentication method. While basic authentication works for user HTTP access tokens HTTP basic auth is not working for these project / repository HTTP access tokens:

git clone -c http.extraHeader='Authorization: Bearer MDM0MjM5NDc2MDxxxxxxxxxxxxxxxxxxxxx' https://bitbucketserver.com/scm/projectname/teamsinspace.git

see: https://confluence.atlassian.com/bitbucketserver/http-access-tokens-939515499.html#HTTPaccesstokens-UsingHTTPaccesstokens

nikban95 commented 1 year ago

Any update on this?? It is required in my current project as bitbucket repo access tokens are not working using the username/password mechanism. Please let us know if there is any plan to add this functionality.

stefan01 commented 1 year ago

This topic would also be interesting for my use case. Are there any updates?

Jena98 commented 1 year ago

When using the Project/Repository Access Token, configure the Argocd Repository connection as follows:

Repository URL: https://bitbucket.org/{workspace}/{repository}.git
Username: x-token-auth
Password: {repository_access_token}

ref: https://support.atlassian.com/bitbucket-cloud/docs/using-access-tokens/

eyearian commented 8 months ago

Did anyone get this working? Using x-token-auth as the user with the bitbucket data center bearer token is still throwing me an authentication required error. I've tried using a project based token as well as a repository based token.

mpsOxygen commented 7 months ago

When using the Project/Repository Access Token, configure the Argocd Repository connection as follows:

Repository URL: https://bitbucket.org/{workspace}/{repository}.git
Username: x-token-auth
Password: {repository_access_token}

ref: https://support.atlassian.com/bitbucket-cloud/docs/using-access-tokens/

This doesn't work! It looks like argo-cd just doesn't support bearer tokens.