title: Youtube Data API v3 Account Service in PHP : 403 - Forbidden : YoutubeSignupRequired
body: <p>i'm banging my head over this for 4hours so I might need a little help.</p>
  
  <p>What I wanna do is to store videos on youtube, for a video contest we are having. I really prefer a 2 legged OAuth access through Service Account (I want users even without a gmail account to be able to send us a video and I want to put these videos in private or unlisted in our youtube account).</p>
  
  <p>But it seems not to work. My code right now is something like this :</p>
  
  <pre><code>function go()
  {
  require_once 'googleClient/Google_Client.php';
  require_once 'googleClient/contrib/Google_YoutubeService.php';
  
  define("CLIENT_ID",'xxxxxxx.apps.googleusercontent.com');
  define("SERVICE_ACCOUNT_NAME",'xxxxxxx@developer.gserviceaccount.com');
  define("KEY_FILE", 'googleClient/verylonghashtagprivacystuff-privatekey.p12');
  define("SECRET_FILE", 'client_secrets.json');
  
  $client = new Google_Client();
  $client-&gt;setApplicationName("My Contest App");
  
  $key = file_get_contents(KEY_FILE);
  $secret = file_get_contents(SECRET_FILE);
  
  
  $GAC = new Google_AssertionCredentials( SERVICE_ACCOUNT_NAME,
  array('https://www.googleapis.com/auth/youtube.upload',
              'https://www.googleapis.com/auth/youtube'), 
  $key ,'notasecret','http://oauth.net/grant_type/jwt/1.0/bearer');
  
  $client-&gt;setAssertionCredentials($GAC);
  
  $client::$auth-&gt;refreshTokenWithAssertion();
  $client-&gt;setClientId(CLIENT_ID); // Did tried to put that one sooner
  $client-&gt;setClientSecret($secret); // Did tried to put that one sooner
  $json = $client-&gt;getAccessToken();
  
  $accessToken = json_decode($json)-&gt;access_token;
  $video = array();
  $video["snippet"] = array();
  
  
  $snippet = new Google_VideoSnippet();
  $snippet-&gt;setTitle("Contest Video USERNAME");
  $snippet-&gt;setDescription("Video for contest 2013 USERNAME.");
  $snippet-&gt;setTags(array("Contest","Whatever","2013"));
  $snippet-&gt;setCategoryId("22"); //Did tried "Entertainment".
  
  $status = new Google_VideoStatus();
  $status-&gt;setPrivacyStatus("unlisted");
  
  $video = new Google_Video();
  $video-&gt;setSnippet($snippet);
  $video-&gt;setStatus($status);
  $client-&gt;setAccessToken($json);
  
  $youtube = new Google_YoutubeService($client);
  $url = '/projet_video.mp4';
  
  $response = $youtube-&gt;videos-&gt;insert(
  "status,snippet", 
  $video, 
  array(  'data' =&gt; file_get_contents($url),'mimeType' =&gt; "video/*")); 
  //Did tried video/mp4
  
  
  return $response ;}
  </code></pre>
  
  <p>And the result is :</p>
  
  <pre><code>error": {  "errors": [   {
      "domain": "youtube.header",
      "reason": "youtubeSignupRequired",
      "message": "Forbidden",
      "locationType": "header",
      "location": "Authorization"
  }], "code": 403,  "message": "Forbidden" }
  </code></pre>