Showing results for 
Search instead for 
Did you mean: 

Magento 2 & auth.json

Magento 2 & auth.json

I've been working some Mage2 builds locally and I can't fathom the correct way to handle auth.json and Composer access details.

I run all of my projects from ~/webdev/vhosts/ with each project having it's own virtualhost and folder.

As everything is run under the same user (it's my local machine) they all look to ~/.composer/auth.json for access details and this breaks as each project has it's own access keys for different repositories.

Magento comes with an auth.json in the root and also uses var/composer_home/auth.json but it seems that neither of these are loaded when using the composer command.

I've been unable to find an option for Composer to use a specific auth.json file.

How does everyone else deal with Composer access details?


Re: Magento 2 & auth.json

Hello @kushalmale07a2 


Magento comes with a sample file in your root as auth.json.sample you need to copy it to auth.json.

It contains 2 key sets: 1 for Github and 1 for the Magento Repo


You can remove all and Enter the following data to your auth.json file to login. Please use the Public Key and the Private Key:

    "http-basic": {
        "": {
            "username":"<your public key>",
            "password":"<your private key>"
Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy