$data = array('code' => $code,'client_id' => '...', 'client_secret' => '...','redirect_uri' => 'http://localhost/youtube/cookie_token.php','grant_type' => 'authorization_code');$ch = curl_init();curl_setopt($ch, CURLOPT_URL, 'https://accounts.google.com/o/oauth2/token');curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_POSTFIELDS, $data);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);$return = curl_exec($ch);curl_close($ch);echo $return;
As you can see in this screenshot from Google Console, the URL has been registered in the application.