Home > Article > Development Tools > Why does Composer require you to enter the authorized username and password when installing it?
The following tutorial column of composer will introduce to you the problem of requiring the user name and password to be entered during Composer installation. I hope it will be helpful to friends in need!
D:\work\dreamland-yii>composer require "saviorlv/yii2-dysms:dev-master" Authentication required (packagist.phpcomposer.com): Username: Password: [Composer\Downloader\TransportException] Invalid credentials for 'https://packagist.phpcomposer.com/p/saviorlv/yii2-dysms%24045b85ee8f7a846caecdf82efa78fb4927e19868940b05fbb3ddb6383a10d41f.json', aborting.require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
Needs to be changed to Chinese composer source. The request interface displays "There is an arrear problem with this JSS account that prevents the operation from completing successfully" which is translated as: "This JSS account has an arrears problem, resulting in The operation could not be completed successfully"....
Just use the domestic mirror source https://pkg.phpcomposer.com/
composer config -g repo.packagist composer https://packagist.phpcomposer.com
Then another one appeared here Question
D:\work\dreamland-yii>composer require "saviorlv/yii2-dysms:dev-master" ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Could not fetch https://api.github.com/repos/bestiejs/punycode.js/tags?per_page=100, please create a GitHub OAuth token to go over the API rate limit Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+JL-HOST-008-PC+2018-10-13+0916 to retrieve a token. It will be stored in "C:/Users/niuben/AppData/Roaming/Composer/auth.json" for future use by Composer. Token (hidden):
It asks me to enter a token? ? ?
After checking online, this is because Composer did not add the github key
Solution
Enter https://github.com/settings/tokens and click "Generate new token" (Remember to log in first)
Create a new Token, enter the description, and select New by default. Then you will get a Token, and then paste the value and it will be OK.
The above is the detailed content of Why does Composer require you to enter the authorized username and password when installing it?. For more information, please follow other related articles on the PHP Chinese website!