Magento 2.1 Composer – Composer Require Authentication Issue

composermagento-2.1

I'm trying to run a composer require worldpay/magento2-module-payments on Magento ver 2.1.8 and get this error:

[http]$ composer require worldpay/magento2-module-payments

  [Composer\Downloader\TransportException]
  The 'https://repo.magento.com/packages.json' URL required authentication.
  You must be using the interactive console to authenticate

In Magento devdocs I read that I need run this: composer update, however, I get the same error. It starts to load the repositories and then throw the error again:

[http]$ composer update
Loading composer repositories with package information


  [Composer\Downloader\TransportException]
  The 'https://repo.magento.com/packages.json' URL required authentication.
  You must be using the interactive console to authenticate

Anyone had a similar problem or know how to solve it?

Best Answer

What is your Command-line Environment? The problem may be caused by your Command-line Environment is not interactive.

I have never met the problem like you. I use the CentOS 7 via putty, when I composer require, it will ask my Magento authentication, input it and the composer will work.