Skip to content

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

@loliee

Description

@loliee

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 !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions