Github Auth token not working in auth.json file Magento 2.4.2

3.8k views Asked by At

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"

1

There are 1 answers

0
VonC On BEST ANSWER

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_]+$}