2

Here's a weird question, is there a way to check if a given Magento2 access keys (authentication keys) are for the Enterprise edition or Community edition without actually trying a composer installation of a Magento2 Enterprise Edition and waiting for it successfully complete or fail.

2

You cannot see by the look of the keys (user hash and password hash) if it is for Enterprise Edition (Magento Commerce) or for Community Edition (Magento Open Source). They are just some random hashes...

What you can do:

1. Composer create-project

If you do not want to do a full install, you could try to do a Composer create project command with the --no-install option:

composer create-project --no-install --repository https://repo.magento.com/ magento/project-enterprise-edition

This will download the "project" package only and not install all (sub-)packages. This will succeed when your keys are for Enterprise Edition and this will fail (with an exception) if they aren't:

enter image description here

2. Fetching Magento's packages.json

What Composer will do before doing anything is downloading packages listings (packages.json files) from the repositories. So whatever you do (create-project, install, update, etc...), Composer will download the file https://repo.magento.com/packages.json provided with your access keys as authorisation. So only downloading that single file is faster than the create project command.

This JSON file will only contain Enterprise Edition packages if you have access keys that allow access to these packages. So you could test that, by downloading the packages.json file with cURL:

curl -s -H "Authorization: Basic <Base64EncodedAccessKeys>" \
    https://repo.magento.com/packages.json

You can base64 encode your keys inline like this and you can also test for the Enterprise Edition package with grep instead of searching through the unreadable JSON output you will get:

curl -s -H "Authorization: Basic $(php -r 'echo base64_encode("<userNameKey>:<passwordKey>");')" \
    https://repo.magento.com/packages.json | grep -o "\"magento\\\\/product-enterprise-edition\":{"

Will give you no output when the keys aren't for Enterprise and give you this output when they are:

"magento\/product-enterprise-edition":{
0

The following command can be used to get a response from the https://repo.magento.com/packages.json which be further parsed using grep to see if there is an enterprise package present.

curl -u [Public Key]:[Private Key] https://repo.magento.com/packages.json | grep --color="auto" -m 1 -ho "magento\\\\/product-enterprise-edition" | head -1

If you see a string magento/product-enterprise-edition in the output, means the keys have enterprise package access. Same can be done for the magento/product-community-edition package search as well.

  • % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 22 0 22 0 0 16 0 --:--:-- 0:00:01 --:--:-- 16 . I receive this – Ajwad Syed Jun 12 '19 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.