Unable To Get Twitch API OAuth For PHP

What you are saying about EventSub makes sense.

I have a new problem. The error message has changed to:

{“status”:401,“message”:“invalid csrf token”}

Do you have any Twitch API insight as to why this might be occurring?

The current iteration of my PHP code is:

<?php

/* file_get_contents replaced with curl function - Add this function and replace any use of file_get_contents with file_get_contents_curl */

function file_get_contents_curl($url) {
    $curlField = [
        'client_id' => '"CLIENT ID"',
        'client_secret' => '"CLIENT SECRET"',
        'grant_type' => 'token',
    ];

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $curlField);
    $data = curl_exec($ch);

    curl_close($ch);
    return $data;
}

print_r( file_get_contents_curl( 'https://id.twitch.tv/oauth2/authorize' ) );