Google Client API - Missing require parameter: redirect_uri
<p>So I followed the <a href="https://developers.google.com/google-apps/calendar/quickstart/php" rel="noreferrer">quickstart</a> guide and decided to break it into a class called scheduler. I am working on the the authentication code, but I keep getting this: "Error 400 (OAuth 2 Error) Error Invalid Request Missing required Parameter: redirect_uri".</p>

<pre><code>class scheduler{

//The Google Client object
private $googleClient;

//the Google Calendar Service ojbect
private $calendarService;

/*
*   Google Calendar Setup
*
*   This creates a Google Client object so that you may create a Google Calendar object.
*
*/
function __construct(){
    //set the application name
    define("APPLICATION_NAME", "Web client 1");
    //
    define("CREDENTIALS_PATH", "~/scheduler/credentials.json");
    //
    define("CLIENT_SECRET_PATH", __DIR__ . "/scheduler/client_secret.json");
    //
    define("SCOPES", implode(" ", array(Google_Service_Calendar::CALENDAR_READONLY)));

    /*if(php_sapi_name() != "cli"){
        throw new Exception("This application must be run on the command line");    
    }*/

    //create the google client
    $this-&gt;googleClient = new Google_Client();

    //setup the client
    $this-&gt;googleClient-&gt;setApplicationName(APPLICATION_NAME);
    $this-&gt;googleClient-&gt;setDeveloperKey("AIzaSyBmJLvNdMYuFhVpWalkUdyStrEBoVEayYM");
    $this-&gt;googleClient-&gt;setScopes(SCOPES);
    $this-&gt;googleClient-&gt;setAuthConfigFile(CLIENT_SECRET_PATH);
    $this-&gt;googleClient-&gt;setAccessType("offline");

    //get the credentials file path
    $credentialsPath = expandHomeDirectory(CREDENTIALS_PATH);

    //if the file exists
    if(file_exists($credentialsPath)){

        //get the credentials from the file
        $accessToken = file_get_contents($credentialsPath); 

    }//if it does not
    else{

        //request the authorization url
        $authURL = $this-&gt;googleClient-&gt;createAuthUrl();
        //print the authorization ulr
        echo "&lt;a href=\"$authURL\"&gt;Press Me&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;";

        //prompt the user to enter the auth code
        print("Enter authentication code: ");

        //
        $authCode = trim(fgets(STDIN));

        //exchange authorization for an access token
        $accessToken = $this-&gt;googleClient-&gt;authenticate($authCode);

        //store credentials to disk
        if(!file_exists(dirname($credentialsPath))){
            mkdir(dirname($credentialsPath), 0700, true);   
        }

        //put the contents into the credential files
        file_put_contents($credentialsPath, $accessToken);
    }

    $this-&gt;googleClient-&gt;setAccessToken($accessToken);

    //refresh token if its expired
    if($this-&gt;googleClient-&gt;isAccessTokenExpired()){
        $this-&gt;googleClient-&gt;refreshToken($client-&gt;getRefreshToken());

        file_put_contents($credentialsPath, $this-&gt;googleClient-&gt;getAccessToken()); 
    }
}
</code></pre>

<p>I found the cause of the problem with no solution in sight. Under my Google Developer Console I tried putting "<a href="http://localhost/" rel="noreferrer">http://localhost/</a>" into the Authorized redirect URIs section. It gives me this error "Sorry, there’s a problem. If you entered information, check it and try again. Otherwise, the problem might clear up on its own, so check back later." Is there a way to make Google Developer Console to accept the redirect uri of a localhost server?</p>