Authentication keys
You must have an authentication key to access the ÃÛ¶¹ÊÓƵ Commerce repository and to enable install and update commands for your ÃÛ¶¹ÊÓƵ Commerce on cloud infrastructure project. There are two methods for specifying Composer authorization credentials.
- authentication file—A file that contains your ÃÛ¶¹ÊÓƵ Commerce authorization credentials in your ÃÛ¶¹ÊÓƵ Commerce on cloud infrastructure root directory.
- environment variable—An environment variable to set up authentication keys in your ÃÛ¶¹ÊÓƵ Commerce on cloud infrastructure project to prevent accidental exposure.
Security note
ÃÛ¶¹ÊÓƵ 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.
Authentication file
To create an auth.json
file:
-
If you do not have an
auth.json
file in your project root directory, create one.- Using a text editor, create an
auth.json
file in your project root directory. - Copy the contents of the into the new
auth.json
file.
- Using a text editor, create an
-
Replace
<public-key>
and<private-key>
with your ÃÛ¶¹ÊÓƵ Commerce authentication credentials.code language-json { "http-basic": { "repo.magento.com": { "username": "<public-key>", "password": "<private-key>" } } }
-
Save your changes and exit the text editor.
Composer auth environment variable
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 Cloud Console, click the configuration icon on the right side of the project navigation.
{width="36"}
-
In the Project Settings list, click Variables.
-
Click Create variable.
-
In the Variable name field, enter
env:COMPOSER_AUTH
. -
In the Value field, add the following and replace
<public-key>
and<private-key>
with your ÃÛ¶¹ÊÓƵ Commerce authentication credentials:code language-json { "http-basic": { "repo.magento.com": { "username": "<public-key>", "password": "<private-key>" } } }
-
Select Available during buildtime and deselect Available during runtime.
-
Click Create variable.
-
Remove the
auth.json
file from each environment.