AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

1.5K members online now
1.5K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
Guide Me

"error" : "invalid_grant" just started appearing

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

When I access the google analytics API account Im seeing this error:

Authorization failed.  Server message:
  "error" : "invalid_grant"
This started happening last friday-ish (Feb 12 2016). Any ideas?
Heres the code I have been successfully using for over a year:
      @@client =
      @@analytics = @@client.discovered_api('analytics', 'v3')
      key = Google::APIClient::KeyUtils.load_from_pkcs12('lib/certs/oauth/dfc-google-analytics.p12', 'passwordhere')
      @@client.authorization =
        :token_credential_uri => '',
        :audience => '',
        :scope => '',
        :issuer => '',
        :signing_key => key)
      rescue Exception => e
        $log.error("could not get google account access because: #{e}")
        @@client = nil
Now, the exception is thrown and caught with the error message:
Authorization failed.  Server message:
  "error" : "invalid_grant"
Any help is appreciated.