PHP Using the GitHub API with PHP Creating a GitHub Client Authenticate with OAuth

Shoko Ishigaki
Shoko Ishigaki
18,918 Points

Problem with showing Authorize Application GitHub page

I'm following the video using the localhost. When I click Search and log in to the GitHub, I got the GitHub Rate limit page and it says "You have triggered an abuse detection mechanism. Please wait a few minutes before you try again.". I tried again after a few minutes with no success. I also tried using the different browser, but it didn't work either.

Here's the code of the authenticate.php

require_once __DIR__ . '/../vendor/autoload.php';

$appUrl = 'http://localhost';

// Omitted as I don't want to share these on the forum
$clientUrl = '';
$clientSecret = '';

$config = new Milo\Github\OAuth\Configuration(
    $clientUrl, $clientSecret, ['user', 'repo']
$storage = new Milo\Github\Storages\SessionStorage;
$login = new Milo\Github\OAuth\Login($config, $storage);
$api = new Milo\Github\Api;

if ($login->hasToken()) {
    $token = $login->getToken();
} else {
    if (isset($_GET['redirect'])) {
        $login->obtainToken($_GET['code'], $_GET['state']);
        header("Location: " . filter_input(INPUT_GET, 'redirect'));
    } else {
            "$appUrl/inc/authenticate.php?redirect=" . $_SERVER['REQUEST_URI']);

Could someone give me some suggestion about how I can fix the problem?