You must have an authentication key to access the Adobe Commerce repository and to enable install and update commands for your Adobe Commerce on cloud infrastructure project. There are two methods for specifying Composer authorization credentials.
Security note
Adobe recommends using the environment variable method with your cloud project to prevent accidental exposure of your authorization credentials.
The authentication file method is ideal when using Cloud Docker for Commerce as a local development tool, but be careful not to upload the auth.json
file to a public Git-based repository. You can add the auth.json
file to the .gitignore
file.
To create an auth.json
file:
If you do not have an auth.json
file in your project root directory, create one.
auth.json
file in your project root directory.auth.json
into the new auth.json
file.Replace <public-key>
and <private-key>
with your Adobe Commerce authentication credentials.
{
"http-basic": {
"repo.magento.com": {
"username": "<public-key>",
"password": "<private-key>"
}
}
}
Save your changes and exit the text editor.
The following method is the best way to prevent accidental exposure of sensitive credentials in a public Git-based repository.
To add authentication keys using an environment variable:
In the Project Web Interface, click the configuration icon in the upper left corner.
In the Configure Project view, click the Variables tab.
Click Add Variable.
In the Name field, enter env:COMPOSER_AUTH
.
In the Value field, add the following and replace <public-key>
and <private-key>
with your Adobe Commerce authentication credentials:
{
"http-basic": {
"repo.magento.com": {
"username": "<public-key>",
"password": "<private-key>"
}
}
}
Select Visible during build and deselect Visible at run.
Click Add Variable.
Remove the auth.json
file from each environment.