DEV Community

Jose Godinez
Jose Godinez

Posted on

Your GitHub OAuth token for github.com contains invalid characters on composer install

If you're receiving this error when trying to composer install.

Your GitHub OAuth token for github.com contains invalid characters

The solution is to update Composer to the latest version, which supports the new token format. "Composer 1.10.21 and 2.0.12 (both released April 1st) added support for the new GitHub token format."

Go to getcomposer.org/download/
Follow the instructions to download the latest phar
As of this writing, the following command will install the latest version of Composer on your machine (i.e., 2.0.13). Note that future Composer updates will break the script as shown here, as the hash check won't pass.

Edit the composer authentication configuration file ~/.composer/auth.json.

nano ~/.composer/auth.json

Then replace the following.

"github-oauth": {
"github.com": "ghp_[YOUR-PERSONAL-TOKEN]"
}
With this (basic auth):

"http-basic": {
"github.com": {
"username": "[YOUR-GITHUB-USERNAME]",
"password": "ghp_[YOUR-PERSONAL-TOKEN]"
}
}

Top comments (0)