title: Google Analytics Embed API: How to retireve access token?
body: <p>I've used the code provided in <a href="https://stackoverflow.com/questions/25896826/using-google-analytics-to-show-subset-of-data-for-customers-of-web-application-u">this question</a> to gain access to the Google Analytics Embed API. I want to display the statistics from my website without the need for users with the correct privileges to log in (so no login screen).</p>
  
  <p>For that reason, I've created a service account and saved the p12 file. However, the following code displays an empty page.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Embed API Demo&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;section id="timeline"&gt;&lt;/section&gt;
  
  &lt;script&gt;
  (function(w,d,s,g,js,fjs){
    g=w.gapi||(w.gapi={});g.analytics={q:[],ready:function(cb){this.q.push(cb)}};
    js=d.createElement(s);fjs=d.getElementsByTagName(s)[0];
    js.src='https://apis.google.com/js/platform.js';
    fjs.parentNode.insertBefore(js,fjs);js.onload=function(){g.load('analytics')};
  }(window,document,'script'));
  &lt;/script&gt;
  
  &lt;script&gt;
  gapi.analytics.ready(function() {
  
    var IDS = 'ga:XXXX'; // I've hidden my personal ID for security purposes
    var ACCESS_TOKEN = 'key.p12'; // obtained from your service account
  
    gapi.analytics.auth.authorize({
      serverAuth: {
        access_token: ACCESS_TOKEN
      }
    });
  
    var timeline = new gapi.analytics.googleCharts.DataChart({
      reportType: 'ga',
      query: {
        'ids': IDS,
        'dimensions': 'ga:date',
        'metrics': 'ga:sessions',
        'start-date': '30daysAgo',
        'end-date': 'yesterday',
      },
      chart: {
        type: 'LINE',
        container: 'timeline'
      }
    }).execute();
  
  });
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Maybe the Access Token shouldn't be the p12 file? But if so, what <em>should</em> it be? I'm really lost.</p>