English 中文(简体)
请求缺乏必要的认证。 预期OAuth 2 Access token,login cookie or other laravel google/apiclient
原标题:Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other laravel google/apiclient

我试图访问谷歌分析,以便了解我的现场的页面访问,但由于GA4 Im的更新无法通过客户——秘密查阅。 I m 发现这一错误:

"
"error": {
    "code": 401,
    "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "errors": [
        { "message": "Login Required.",
          "domain": "global",
          "reason": "required",
          "location": "Authorization",
          "locationType": "header"
        }
    ],
    "status": "UNAUTHENTICATED",
    "details": [
        { 
          "@type": "type.googleapis.com/google.rpc.ErrorInfo",
          "reason": "CREDENTIALS_MISSING",
          "domain": "googleapis.com",
          "metadata": {
              "service": "analyticsreporting.googleapis.com",
              "method": "google.analytics.reporting.v4.Reporting.GetReports"
            }
        }
    ]
}
}"

我必须做些什么,我如何利用这种财产,而不是 view眼? 我只需要看到我所有网页的页面浏览。


my php-v 7.3

laravel平台 7

问题回答
  1. Create google service account https://cloud.google.com/iam/docs/service-accounts-create
  2. Download file auth json
  3. Config laravel env GOOGLE_APPLICATION_CREDENTIALS=/path-to-file-auth

I hope I can help you





相关问题
Track page views

I am looking for a C# code which tracks number of times a page is visited by unique users (as like tracking IP address) per day and display it to my site. Apart from using Google Analytics, is there ...

How to track page views

What is the best way to track page views? For instance: SO has how many views a Question has, yet hitting refresh doesn t up the view count. I ve read that using cookies is a pretty good way to do so,...

"pageview" term in web world

I m building a web app and need to implement "how many times the item is being viewed". What is the term of "being viewed"? is it every time someone goes to that page or being counted once for the ...

Basic site analytics doesn t tally with Google data

After being stumped by an earlier quesiton: SO google-analytics-domain-data-without-filtering I ve been experimenting with a very basic analytics system of my own. MySQL table: hit_id, subsite_id, ...

热门标签