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

Using "bearer" auth config with a self-hosted bitbucket instance #9100

Open
loliee opened this issue Aug 3, 2020 · 1 comment
Open

Using "bearer" auth config with a self-hosted bitbucket instance #9100

loliee opened this issue Aug 3, 2020 · 1 comment
Labels
Milestone

Comments

@loliee
Copy link

loliee commented Aug 3, 2020

Hello,

First I would like to congratulate for this project !

I have some troubles when I tried to use the bearer configuration with a self-hosted bitbucket instance, I don't know iif it's a bug or a misconfiguration, here my setup:

My composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://mybitbucket.net/scm/med/my-app.git"
    }
  ],
  "require": {
    "med/my-app": "master"
  }
}

Output of composer diagnose:

root@aacf9793f82e:/apps# composer diagnose
Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
require.med/myapp : unbound version constraints (master) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: You are not running the latest stable version, run `composer self-update` to update (1.10.5 => 1.10.10)
Composer version: 1.10.5
PHP version: 7.4.7
PHP binary path: /usr/local/bin/php
OpenSSL version: OpenSSL 1.1.1d  10 Sep 2019

When I run this command:

COMPOSER_AUTH='{"bearer":{"mybitbucket.net": "mypersonaltoken" }}' composer install

I get the following output:

[RuntimeException]
  Failed to execute git clone --mirror 'https://mypersonaltoken:***@mybitbucket.net/scm/med/myapp.git' '/root/.composer/cache/vcs/https---mybitbucket.net-scm-med-myapp/'

  Cloning into bare repository '/root/.composer/cache/vcs/https---mybitbucket.net-scm-med-myapp.git'...
  fatal: Authentication failed for 'https://mypersonaltoken:***@mybitbucket.net/scm/med/myapp.git/'

I noticed that my personal token was displayed in the error output.
And on the same host/config I am able to run the following commands with success:

git clone -c http.extraheader="Authorization: Bearer mypersonaltoken" https://mybitbucket.net/scm/med/myapp.git
curl -X GET -H "Authorization: Bearer mypersonaltoken" 'https://mybitbucket.net/rest/api/latest/projects/MED/repos/myapp/'

Thanks you for your help !

@Seldaek Seldaek added this to the Nice To Have milestone Aug 11, 2020
@Seldaek
Copy link
Member

Seldaek commented Aug 11, 2020

Bearer auth is currently only supported for API requests, so if you install with --prefer-dist I believe it should work. We don't support it for git but it's good to know about the -c http.extraheader option, that might allow Composer to support it for clones.

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

No branches or pull requests

2 participants