Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When using composer with a private VCS it infinitely asks for authorization

In my composer.json i have a private vcs repository:

{
    "type": "vcs",
    "url": "https://github.com/username/repo.git"
}

When i call php composer.phar update i get the following:

Your GitHub credentials are required to fetch private repository metadata (https://github.com/username/repo.git)
The credentials will be swapped for an OAuth token stored in /root/.composer/config.json, your password will not be stored
To revoke access to this token you can visit https://github.com/settings/applications

Username: myusername
Password:
    Authentication required (api.github.com):
      Username: myusername
      Password:
    Authentication required (api.github.com):
      Username: myusername
      Password:
    Authentication required (api.github.com):
      Username:

Doesnt matter how many time I put in my my github credentials it keeps asking. If i put in incorrect ones it does the same thing, no errors or max attempts.

Any ideas what would cause this? I am using the latest version as retrievable by running:

php composer.phar self-update

WORK AROUND

As a work around for now i have gone to: https://github.com/settings/applications and generated a token manually then ran:

php composer.phar config -g github-oauth.github.com <token>

But i would still like to know why it couldnt do it automatically

like image 919
Chase Avatar asked Feb 20 '14 22:02

Chase


People also ask

Where do I put composer AUTH json?

In this authentication storage method, an auth. json file will be present in the same folder as the projects' composer. json file. You can either create and edit this file using the command line or manually edit or create it.

What is the use of composer Phar?

Composer: Enables you to declare the libraries you depend on. Finds out which versions of which packages can and need to be installed, and installs them (meaning it downloads them into your project). You can update all your dependencies in one command.

Where are composer dependencies defined?

Composer makes information about the environment Composer runs in available as virtual packages. This allows other packages to define dependencies (require, conflict, provide, replace) on different aspects of the platform, like PHP, extensions or system libraries, including version constraints.


1 Answers

This is because the current version of composer aa74818fe00c5f5eb57c1c38b807e9e2950c670c does not support GitHubs 2 factor authorization. So any account that have that setup will have this issue.

There has been a pull request created for it and it should be good to go in one of the upcoming version updates.

like image 126
Chase Avatar answered Sep 26 '22 16:09

Chase