Home > Development Tools > composer > Why does Composer require you to enter the authorized username and password when installing it?

Why does Composer require you to enter the authorized username and password when installing it?

藏色散人
Release: 2021-06-15 11:28:42
forward
2464 people have browsed 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 &#39;https://packagist.phpcomposer.com/p/saviorlv/yii2-dysms%24045b85ee8f7a846caecdf82efa78fb4927e19868940b05fbb3ddb6383a10d41f.json&#39;, 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>]...
Copy after login

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
Copy after login

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):
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template