Google Site Kit REST 403: why Analytics refuses an app password
This morning I asked Site Kit for last month’s sessions with an application password. It said no. Then I asked the same plugin, with the same password, for my Analytics settings. It said yes and handed me the property ID.
Short version for the skimmers. A Google Site Kit REST 403 on an Analytics data route, with missing_required_scopes in the body, does not mean you skipped a permission. Site Kit decides whose Google token to use on init. An application password is not checked until later, so at that moment you are user 0, and user 0 has no token. Settings routes still answer because they never touch the token. Reconnecting will not help. Read the data through a small route of your own instead.
KEY FACTS
I sent 7 requests to Site Kit 1.187.0 with one administrator’s application password. 5 answered 200. The 2 that asked Google for Analytics data answered 403.
In the same session, Site Kit’s own authentication route reported authenticated: false and 0 granted scopes, out of 9 it requires. That user’s Google account is connected.
Site Kit builds its per-user storage inside an init callback at priority -999, using get_current_user_id() at that moment.
Site Kit only switches that storage to a new user on wp_login. An application password never fires wp_login.
My workaround route has answered every Analytics request since 2026-09-08. It pulls 8 reports in 2 calls.
What the 403 looks like
Here is the request. The password belongs to the site’s administrator, the same person whose Google account Site Kit is connected to.
curl -u 'admin@example.com:APP PASSWORD' \
'https://example.com/wp-json/google-site-kit/v1/modules/analytics-4/data/report?metrics=sessions&startDate=2026-10-01&endDate=2026-10-31'
And the answer:
{"code":"missing_required_scopes",
"message":"Site Kit can’t access the relevant data from Analytics because you haven’t granted all permissions requested during setup.",
"data":{"status":403,"scopes":["https://www.googleapis.com/auth/analytics.readonly"]}}
The message tells you to go back and grant a permission. The scope it names, analytics.readonly, was granted when I connected Site Kit. The same stored token feeds my own Analytics route every day.
I have seen this exact shape before. Two months ago the Search Console route did the same thing to me, and I wrote up why Site Kit says you are missing scopes you already granted. This time I wanted to know something that post did not answer. Which parts of Site Kit work for an application password, and which do not?
Which Site Kit routes answer an application password?
So I asked seven of them. Same password, within a few minutes, Site Kit 1.187.0. Here is what came back.
| Route | Status | What it said |
|---|---|---|
modules/analytics-4/data/settings |
200 | Owner is user 1. Account, property, stream and measurement IDs, all correct. |
modules/search-console/data/settings |
200 | Owner is user 1, property is the site URL. |
core/site/data/connection |
200 | connected: true, hasConnectedAdmins: true |
core/user/data/permissions |
200 | Every Site Kit capability true, including viewing insights and managing options. |
core/user/data/authentication |
200 | authenticated: false, grantedScopes: [] |
modules/analytics-4/data/report |
403 | missing_required_scopes, names analytics.readonly |
modules/analytics-4/data/properties |
403 | Same error, same scope. |
For comparison, the report route with no credentials at all returns 401 rest_forbidden. So the 403 is not WordPress rejecting me. WordPress let me in. Site Kit is the one saying no.
Look at rows four and five together. One route says I hold every Site Kit capability. The next says I am not authenticated with Google and hold zero scopes. Both answers are about the same person, in the same second.
There is a smaller oddity in row five too. With zero scopes granted, unsatisfiedScopes comes back as an empty list. A payload that says nothing is missing, next to an error that says something is missing, does not help anyone debug.
Why settings work and data does not
The settings routes read values Site Kit keeps in the WordPress options table. Account ID, property ID, who the owner is. Those belong to the site, not to a person, so it does not matter whose request it is.
The data routes are different. They call Google. To do that, Site Kit needs an OAuth token, and it stores tokens per WordPress user, in user meta. So the question every data route has to answer first is: whose token?
The capability checks and the token lookup answer the question “who is this?” at two different moments. That is the whole bug.
| Check | When it reads the user | Who it sees on an app password request |
|---|---|---|
| Capability checks, like the permissions route | When the route runs | User 1 |
| Settings routes | When the route runs, and the answer does not depend on the user anyway | User 1 |
| Which Google token to use | Once, on init, stored for the rest of the request |
User 0 |
Where Site Kit picks the user
I read the source. In Site Kit’s Plugin.php, the per-user storage is built inside an init callback, at priority -999:
// Initiate the plugin on 'init' for relying on current user being set.
add_action(
'init',
function () use ( $options, $activation_flag ) {
$transients = new Core\Storage\Transients( $this->context );
$user_options = new Core\Storage\User_Options( $this->context, get_current_user_id() );
The comment states the assumption. By init, the current user is set. For a cookie login that is true. For an application password it is not.
WordPress only accepts an application password on an API request, and it learns that a request is a REST request when REST_REQUEST gets defined. That happens on parse_request, after init. Core even has a comment saying the check may happen too early. The full load order, with the core code, is in the Search Console version of this bug.
So on init, get_current_user_id() returns 0. Site Kit stores 0. Every token read for the rest of the request goes to user 0’s meta, finds nothing, and the scope check fails before anything is sent to Google. In Module.php that check throws Insufficient_Scopes_Exception, which turns into the 403 with the code you saw.
What I did not know two months ago is that Site Kit can switch users. Its storage class has a switch_user() method. But the plugin only calls it on wp_login:
add_action(
'wp_login',
function ( $username, $user ) use ( $user_options ) {
$user_options->switch_user( $user->ID );
},
-999,
2
);
wp_login fires when someone signs in through the login form. An application password does not sign in. It authenticates one request and is gone. So the switch never happens, and user 0 sticks.
Things that will not fix it
I tried most of these the first time round, on the Search Console route. None changed the response.
| What you try | What happens | Why |
|---|---|---|
| Reconnect Site Kit, or reset it | Same 403 | The token was never the problem. The lookup asks the wrong user. |
| Regenerate the application password | Same 403 | The password works. WordPress let you in; that is why you got a 403 and not a 401. |
Make the password count before init |
On my site, every REST route returned 500 | Authenticating earlier than core expects touches every plugin that reads the user during load. |
| Read the data from a route of your own | 200 | Your callback runs after the password is checked, so you can hand Site Kit the right user. |
If WordPress is not letting you in at all, that is a different problem with a different fix. Check that application passwords are enabled and that your server is not stripping the Authorization header. A browser script that gets a 403 with “Cookie check failed” is a nonce problem, not this one.
The route I use instead
The fix is to let the request finish arriving, then build Site Kit’s objects yourself, with the user ID that is finally correct. The two lines that matter:
// Inside your own REST route callback, not on init.
$context = new \Google\Site_Kit\Context( GOOGLESITEKIT_PLUGIN_MAIN_FILE );
$user_options = new \Google\Site_Kit\Core\Storage\User_Options( $context, get_current_user_id() );
From there, pass that storage to Site Kit’s Authentication class, ask it for its OAuth client, take the access token, and call the Google Analytics Data API’s runReport yourself. Lock the route to manage_options. Mine goes one step further and always reads as the Analytics module’s owner, which is user 1 on my site. It also retries once with a refreshed token on a 401.
I am not pasting my full route. I run it on my own site and have not tested it anywhere else, and a stranger’s mu-plugin is a bad thing to copy blind. The shape above is the part that matters. Everything after it is ordinary Google API code.
That route has answered every Analytics request my scripts have made since 2026-09-08. One call pulls 8 reports: channels, sources, landing pages, pages, countries, devices, a daily series and totals, in 2 batched requests to Google. Site Kit’s own data routes still return 403 to the same password today.
What I would want Site Kit to change
Two small things. The user switch could listen to set_current_user as well as wp_login, so a request that authenticates late still lands on the right token. I have not tested that, and there may be a reason they chose not to.
The cheaper one is the error text. “You haven’t granted all permissions” is the right sentence for a human who unticked a box. When there is no token at all for the current user, a different sentence would have saved me an afternoon.
FAQ
Why does Google Site Kit return a 403 to my REST request?
If you authenticate with an application password, Site Kit picks whose Google token to use on init, before WordPress has checked the password. It sees user 0, finds no token, and returns missing_required_scopes with status 403.
Why does the Site Kit settings route work but the data route does not?
Settings like the account and property ID live in the WordPress options table, so any admin request can read them. Data routes need a Google token, and Site Kit looks that token up for the user it saw on init, which is user 0 on an application password request.
Will reconnecting Site Kit fix missing_required_scopes on Analytics?
Not when the request uses an application password. The token is fine. Site Kit is looking for it under the wrong user, so reconnecting changes nothing.
Can I call the Site Kit REST API with an application password at all?
Yes, for settings and status routes. On my site the Analytics and Search Console settings, connection and permissions routes all answered 200. Anything that asks Google for data returned 403.
What is the fix for the Site Kit Analytics 403?
Read the data through a REST route of your own. Inside its callback, build Site Kit’s user storage with get_current_user_id(), take the OAuth token from it, and call the Google Analytics Data API directly.
The short version
Site Kit settled on user 0 before your application password counted. Its settings routes do not care. Its data routes do. Stop asking Site Kit’s data routes, and ask your own route that hands Site Kit the right user.
The rest of how this site runs itself, Analytics reads included, is in how I let Claude run this WordPress site.
Stay in the loop.
No spam, just signal.
I send one email when I publish something worth reading. Stock deep dives, new projects, tech breakdowns, and what I'm learning from building in public.
Free forever. Unsubscribe anytime. I respect your inbox.