title: Get user login access token to use youtube API
body: <p>I am using youtube API for scheduling live events for user in my application.</p>
  
  <p>Once the user logged in my application i need to logged in the same user to our business google account(One google account for all user) without giving login credentials. and to get access token for scheduling the live events.</p>
  
  <p>Is it possible to login the user into google account without giving login credentials(User will not feel he is login to another account).</p>
  
  <p>Is it feasible with PHP?.Please give one example to get access token for youtube API access.</p>
  
  <p>I used the following code for getting access token but service account can't access the youtube service.</p>
  
  <p>My code for getting access token using service account:</p>
  
  <pre><code>&lt;?php
     require_once 'Google/autoload.php';
     session_start();     
  
      $client_id = '395540674667-p64tdfqdsfsdfdsf@dsfd.com';
      $Email_address = '54564-drgfdg1@developer.gserviceaccount.com';  
      $key_file_location = 'Youtube API-5czxczxc86.p12';      
  
      $client = new Google_Client();      
      $client-&gt;setApplicationName("Youtube API");
      $key = file_get_contents($key_file_location);    
  
      // seproate additional scopes with a comma   
      $scopes = array('https://www.googleapis.com/auth/sqlservice.admin','https://www.googleapis.com/auth/plus.login','https://www.googleapis.com/auth/youtube'); 
  
      $cred = new Google_Auth_AssertionCredentials($Email_address,         
                               $scopes,       
                               $key);  
  
      $client-&gt;setAssertionCredentials($cred);
      if($client-&gt;getAuth()-&gt;isAccessTokenExpired()) {        
           $client-&gt;getAuth()-&gt;refreshTokenWithAssertion($cred);      
      }   
      //print_r($client);
      echo $client-&gt;getAccessToken();
      ?&gt; 
  </code></pre>
  
  <p>I am expecting the answer is something like this.Any one please help</p>