March 4, 2022 . 1 MIN READ
Previous examples are correct. In addition it is also possible by composer’s config command.
Inside the Magento project directory execute the following Composer command:
$ composer config http-basic.repo.magento.com <public_key> <private_key>
Just replace the placeholders with the actual values (public_key will become the username and private_key the password in HTTP authentication with repo.magento.com).
The auth settings can be tested by using fetching latest version with a faked update:
$ composer update –dry-run
Or
Login to Magento Marketplace.
Go to My Account.
Under My Products click Access Keys.
Select ver of Magento (1 or 2).
Click Create A New Access Key, in popup box name your key.
Clicking on Ok will generate pair of keys, Public and Private.
Now in Magento root or open ~/.composer/auth.json and put following lines
{ “http-basic”: { “repo.magento.com”: { “username”:”<your public key>”, “password”:”<your private key>” } }}
Reference:
https://magento.stackexchange.com/questions/90983/how-to-use-the-new-repo-magento-com
http://www.weicot.com/dev/guides/v2.0/comp-mgr/prereq/prereq_auth-token.html