title: Google Analytics: User does not have sufficient permissions for this profile
body: <p>I am unable to access the Google Analytics API from rails. I keep getting insufficient permissions even though I have already set the service account.</p>
  <p>I have created a service account:</p>
  <ul>
  <li>Go to the project in console.developers.google.com/iam-admin/serviceaccounts</li>
  <li>I go to Service Accounts &gt; Create Service Accounts</li>
  <li>Then select account and add a key. This will download a JSON file with the service account.</li>
  </ul>
  <p>After having the service account and have the secret JSON file and the email. Then I go to Google Analytics:</p>
  <ul>
  <li>Go to Admin &gt; Select Property &gt; Property User Management &gt; Add User</li>
  <li>Copy the Service Account email and select Read &amp; Analyze</li>
  </ul>
  <p>Once I have that, pretty much use the following code: <a href="https://gist.github.com/CoryFoy/9edf1e039e174c00c209e930a1720ce0" rel="nofollow noreferrer">https://gist.github.com/CoryFoy/9edf1e039e174c00c209e930a1720ce0</a> to get the reports.</p>
  <p>But I keep getting <code>forbidden: User does not have sufficient permissions for this profile</code>. Even when I try to get the access_token and use it in javascript:</p>
  <pre><code>gapi.analytics.auth.authorize({
    serverAuth: {
      access_token: 'accessToken'
    }
  });
  </code></pre>
  <p>I get:</p>
  <pre><code>error:{
    code: 403
    errors: [  
      {  
        domain: &quot;global&quot;
        message: &quot;User does not have sufficient permissions for this profile.&quot;
        reason: &quot;insufficientPermissions&quot;
      }
    ]
  }
  </code></pre>
  <p>Am I missing something? This used to work and I never had a problem with it, but for some reason it stopped working. Any guidance will be appreciate it.</p>
  <p>Thank you!</p>