cancel
Showing results for 
Search instead for 
Did you mean: 

bad credentials

Highlighted

bad credentials

 I am using magento2.3 and php7.1.  I did the following things but still get bad credentials.

 

1.  I am using the latest composer 1.8

2.  I added correctly my public and private keys into the auth.json. 

3.  I copied the file auth.json into /var/www/html/magento2/auth.json,  ~/.composer/auth.json, /var/www/html/magento2/var/composer_home/cache/repo/auth.json.

4. in all of the above locations the user is www-data and group is www-data.

5. I flushed Magento Cache and refreshed those 15 records in the Admin.

6. No empty spaces in the file auth.json between the less than(<) and the keys.         "username": "<Public key>", "password": "<Private key>"

I am using the correct credentials BUT still getting Invalid credentials.

Any help is appreciated!

10 REPLIES 10
Highlighted

Re: bad credentials

Hello @abagray3,

 

Please login https://marketplace.magento.com
then access below links https://marketplace.magento.com/customer/account/?_ga=2.203782032.1052303155.1543983820-348100322.15...

Now, Click on the Access keys and Create a New Access Key https://www.screencast.com/t/666xwNneH

After generate public and private key. Please use public key as username and private key as password then let me know if you still get an issue.

 

---

If my answer is useful, please Accept as Solution & give Kudos

 

 

 

Highlighted

Re: bad credentials

 

I have re-installed magento 2 again using composer and my public and private keys. The keys are working well. The problem arise when I am logged in as adminstrator in magento and trying to use the public and private keys in Extension Manager. Where does the extension manager expect the auth.json to be located? what should the file permission for the auth.json be ?

 

 

Highlighted

Re: bad credentials

 

I have re-installed magento 2 using composer and my public and private keys. The keys are working well. The problem arise when I am logged in as adminstrator in magento and trying to use the public and private keys in Extension Manager. Where does the extension manager expect the auth.json to be located? what should the file permission for the auth.json be ?

 

 

Highlighted

Re: bad credentials

Hello @abagray3,

 

You can update credential using below command also

 

$ composer config http-basic.repo.magento.com <public_key> <private_key>

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>"
        }
    }
}


You are good to go. Remember auth.json file contains standard json if you see any error just make sure that your auth file contains valid json, you can validate your json on JsonLint

If you don't want to add this information in above mentioned file (although it is handy, you don't need to open Marketplace dashboard repeatedly), then on run time just enter your Public key as username and Private key as your password, if you didn't add pair of keys in auth.json in previous step, don't worry Magento will ask you here whether to store this information or not, the choice is yours! Smiley Happy

 

--
If my answer is useful, please Accept as Solution & give Kudos

 

Highlighted

Re: bad credentials

Hi gelanivishal,

 

thank you for your guidance but after proceeding with your troubleshooting, no positive response was returned from Magento and the "Bad credentials" error still there... any other idea about why it is hapenning? Please let us know Ty

Regards

Ren

Highlighted

Re: bad credentials

It seems most errors I get has to do with permissions. I am beginner linux user and developing locally.During first time composer installation, I am asked if composer is to save the auth.json in my home directory at /home/.composer/auth.json. Since I said yes, the auth.json file will have my user-name permission. I need to make sure my user name permission is part of the apache group(www-data) by running sudo 

sudo usermod -g www-data MYUSERNAME
id -nG MYUSERNAME // to make sure my username is part of the apache www-data group.

I also copied the auth.json into magento root directory and made sure the permission is intact because during copying permissions can change. If the keys are created at later time, we need to make sure the less than and greater than signs "<" and ">" are removed.  Most problems I encounter have to do with permissions, especially during manual new module installation or upgrades, some directories change their permisssions. I noticed /var/cache changes permissions often during installation.

Re: bad credentials

Another observation when you apply COPY, the number come with an extra espace at the begining, so I simple delete that space and works fine. Smiley Happy

Highlighted

Re: bad credentials

It works in my case


@aivmx wrote:

Another observation when you apply COPY, the number come with an extra espace at the begining, so I simple delete that space and works fine. Smiley Happy


 

Highlighted

Re: bad credentials

I noticed that when I copied the keys using the "copy" link, it added an empty space to the beginning of the copied key. This counts as a character, and like adding a space to any password, will make it incorrect.