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

Environment variable COMPOSER_AUTH fails (bitbucket) #118

Closed
ItsReddi opened this issue Sep 1, 2020 · 2 comments
Closed

Environment variable COMPOSER_AUTH fails (bitbucket) #118

ItsReddi opened this issue Sep 1, 2020 · 2 comments

Comments

@ItsReddi
Copy link

ItsReddi commented Sep 1, 2020

https://getcomposer.org/doc/03-cli.md#composer-auth

docker run --rm --interactive --tty --env 'COMPOSER_AUTH={\"bitbucket.org\": {\"consumer-key\": \"myKey\", \"consumer-secret\": \"mySecret\"}}' -v D:\pathtoapp:/app composer:1.10.10 env

Result:

HOSTNAME=e34bb714a775
PHP_INI_DIR=/usr/local/etc/php
SHLVL=1
HOME=/root
PHP_LDFLAGS=-Wl,-O1 -pie
PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
PHP_MD5=
PHP_VERSION=7.4.9
COMPOSER_HOME=/tmp
GPG_KEYS=42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312
PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
PHP_ASC_URL=https://www.php.net/distributions/php-7.4.9.tar.xz.asc
COMPOSER_ALLOW_SUPERUSER=1
PHP_URL=https://www.php.net/distributions/php-7.4.9.tar.xz
TERM=xterm
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
COMPOSER_AUTH={"bitbucket.org": {"consumer-key": "myKey", "consumer-secret": "mySecret"}}
COMPOSER_VERSION=1.10.10
PHPIZE_DEPS=autoconf            dpkg-dev dpkg           file            g++             gcc             libc-dev                make            pkgconf                 re2c
PWD=/app
PHP_SHA256=23733f4a608ad1bebdcecf0138ebc5fd57cf20d6e0915f98a9444c3f747dc57b
docker run --rm --interactive --tty --env 'COMPOSER_AUTH={\"bitbucket.org\": {\"consumer-key\": \"myKey\", \"consumer-secret\": \"mySecret\"}}' -v D:\pathtoapp:/app composer:1.10.10 update

Result:

Reading ./composer.json
Loading auth config from COMPOSER_AUTH
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/app): git branch --no-color --no-abbrev -v
Failed to initialize global composer: Composer could not find the config file: /tmp/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /app/vendor/composer/installed.json
Loading plugin yii\composer\Plugin
Running 1.10.10 (2020-08-03 11:35:19) with PHP 7.4.9 on Linux / 4.19.76-linuxkit
You are using the deprecated option "dev". Dev packages are installed by default now.
Reading ./composer.lock
Loading composer repositories with package information
Downloading https://asset-packagist.org/packages.json
Writing /tmp/cache/repo/https---asset-packagist.org/packages.json into cache
Downloading https://api.bitbucket.org/2.0/repositories/repositoryXY?fields=-project%2C-owner
Executing command (CWD): git config bitbucket.accesstoken

Could not fetch https://api.bitbucket.org/2.0/repositories/repositoryXY?fields=-project%2C-owner, please create a bitbucket OAuth token to access private repos
Follow the instructions on https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html
to create a consumer. It will be stored in "/tmp/auth.json" for future use by Composer.
Ensure you enter a "Callback URL" (http://example.com is fine) or it will not be possible to create an Access Token (this callback url will not be used by composer)
Consumer Key (hidden):

Pasting in the consumer key and consumer secret from the JSON passed via environment variables anything works fine.

@ItsReddi
Copy link
Author

ItsReddi commented Sep 1, 2020

#31

@ItsReddi
Copy link
Author

ItsReddi commented Sep 2, 2020

Fixed. The Docs are confusing at this point. The ENV Variable should be like:
--env 'COMPOSER_AUTH={\"bitbucket-oauth\": {\"bitbucket.org\": {\"consumer-key\": \"myKey\",\"consumer-secret\": \"mySecret\"}}}'

@ItsReddi ItsReddi closed this as completed Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant