githubcomposer-php

Invalid GitHub OAuth Token Error During Laravel Installation via Composer


I wanted to install Laravel on Windows using the following command:

composer create-project laravel/laravel example-app

However, after running the command, I encountered this error:

In BaseIO.php line 140:

  Your GitHub OAuth token for github.com contains invalid characters: "صثقففعععغعلغغل555656"
create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--ask] [--] [<package> [<directory> [<version>]]]

What’s causing this error? How can I fix it?

Could this be related to GitHub’s authentication changes? I enabled GitHub’s two-factor authentication just today. I believe this token is a random and incorrect user with invalid characters shown in the error.

Composer version: 2.7.9 (updated)


Solution

  • This is how I solved the problem. First, I ran the following command:

    $ composer global about
    ------------------------------
    Changed current directory to C:/Users/user/AppData/Roaming/Composer
    Composer - Dependency Manager for PHP - version 2.7.9
    Composer is a dependency manager tracking local dependencies of your projects and libraries.
    See https://getcomposer.org/ for more information.
    

    Then according to the Composer path, I entered the Composer directory and opened the auth.json file. In this file, I encountered the following configuration and realized that the wrong token was set here:

    {
        "github-oauth": {
            "github.com": "صثقففعععغعلغغل555656"
        }
    }
    

    Finally, I replaced the token that I had created in my GitHub account and the problem was solved.