title: Google Analytics API with Ruby on Rails
body: <p>I am trying to add Google analytics API to my Rails Appication using Oauth.</p>
  
  <p>I am using <code>google-api-client</code> gem and using <code>http://readysteadycode.com/howto-access-the-google-analytics-api-with-ruby</code> as a reference.</p>
  
  <p>Am able to create to create <strong>Client Object</strong> but when I am trying to access data </p>
  
  <pre><code>class GoogleController &lt; ApplicationController
  
    def redirect
      client = Signet::OAuth2::Client.new({
        client_id: GOOGLE_API_CLIENT_ID,
        client_secret: GOOGLE_API_CLIENT_SECRET,
        authorization_uri: 'https://accounts.google.com/o/oauth2/auth',
        scope: Google::Apis::AnalyticsV3::AUTH_ANALYTICS_READONLY,
        redirect_uri: 'http://skreem.dev:3000/auth/google/callback'
      })
  
      redirect_to client.authorization_uri.to_s
    end
  
    def callback
      client = Signet::OAuth2::Client.new({
        client_id: GOOGLE_API_CLIENT_ID,
        client_secret: GOOGLE_API_CLIENT_SECRET,
        token_credential_uri: 'https://accounts.google.com/o/oauth2/token',
        redirect_uri: 'http://skreem.dev:3000/auth/google/callback',
        code: params[:code]
      })
  
      response = client.fetch_access_token!
      session[:access_token] = response['access_token']
  
      redirect_to url_for(:action =&gt; :analytics)
    end
  
    def analytics
      client = Signet::OAuth2::Client.new(access_token: session[:access_token])
  
      service = Google::Apis::AnalyticsV3::AnalyticsService.new
      service.authorization = client
  
      @account_summaries = service.list_account_summaries
    end
  
  end
  </code></pre>
  
  <p>and am using correct access token but getting following error</p>
  
  <pre><code>Sending HTTP get https://www.googleapis.com/analytics/v3/management/accountSummaries?
  Caught error Missing token endpoint URI.
  Error - #&lt;ArgumentError: Missing token endpoint URI.&gt;
  </code></pre>