0

I have my project in magento 2.3.3 and I am upgrading it to Magento 2.4.2. In auth.json file I want to add github token generated from the link https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+NTZ-CPU-155+2021-04-09+1517. But the token is not working when I am adding the same in mu auth.json file.

Error I am getting:

Your github oauth token for github.com contains invalid characters: "ghp_1nKdhaeIbUzRN2DsrMDkB2kbLXzFcn0jwjhdwhaQyEt"

James Z
  • 12,209
  • 10
  • 24
  • 44
rashi
  • 125
  • 1
  • 14
  • 1
    Does this answer your question? [Composer \[UnexpectedValueException\] error will trying to use composer to install a github project](https://stackoverflow.com/questions/26691681/composer-unexpectedvalueexception-error-will-trying-to-use-composer-to-install) – miken32 Sep 20 '21 at 20:24

1 Answers1

3

As mentioned in "Authentication token format updates are generally available", the format of GitHub authentication tokens has changed.

Notably, the token formats now include the following updates:

  • The character set changed from [a-f0-9] to [A-Za-z0-9_]
  • The format now includes a prefix for each token type, including ghp_ for Personal Access Tokens.

That is why composer has issue 9800: "Please release a version with updated GitHub token regex"

The resolution is to upgrade composer to 2.0.12 and 1.10.21, which include commit dc83ba9.

 # old regexp
 {^[.a-z0-9]+$}

 # new one
 {^[.A-Za-z0-9_]+$}
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250