You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OAuth 2.0 authentication fails when trying to connect to Google Drive #277
I've been testing a couple of plugins I created that connect to Google Drive. One of them is just for getting information about storage space, the folder tree, and their respective sizes. The other creates backups directly to Google Drive. The problem is that when I try to connect them while in Desktop Mode, I get a Google 403 error. I have to switch to Classic Mode to connect, and then I can go back to Desktop Mode and use them. This problem occurs with both plugins. Here are screenshots of the issue with one of them.
Before attempting to make the connection in Desktop Mode:
Here's the 403 Google error message in Desktop Mode:
Now, trying to make the connection in Classic Mode:
Then it takes me to the account selection screen:
Getting the succesfully connected to Google Drive message in Classic Mode:
Finally, switching to the Desktop Mode with the plugin connected and working:
The report: connecting a plugin to Google Drive from inside a window ends on a Google 403, and only works after switching to classic admin.
The cause is known: Google's sign-in page refuses to load inside a frame, and every admin screen in the desktop is a frame.
Since this was reported, two of the ways a plugin can send the browser to Google have been handled. Three others still load Google inside the window.
Which one your plugins use decides whether there is anything left to fix and what the fix is, so there are three short questions before anything is built.
Scope
Nothing will be built yet. It waits on the answers below.
Why
A window is an iframe, and Google answers a framed sign-in request with a 403, so the flow can only work when the shell gets the browser out of the frame first. Today it does that in two cases. A plain link to another site opens in a new browser tab (the click interceptor in src/chromeless-bridge.js, the offsite branch). A PHP wp_redirect() to another site is handed to the shell, which closes the window, follows the redirect in the tab like classic admin does, and brings you back to the desktop when Google returns you to wp-admin (openstation_chromeless_hand_off_offsite_redirect() in includes/core/routing.php). Three cases are not handled and still land on the 403: a form whose action is the Google URL (the submit interceptor only rewrites wp-admin URLs), a redirect sent with a raw header( 'Location: ...' ) instead of wp_redirect(), and JavaScript that sets window.location. Each of those needs a different fix in code that runs inside every window, and I could not open the screenshots to tell which one applies, so I would rather ask than guess.
If you need it working right now: switching the redirect to wp_redirect() is handled today, and the plugin also ships an OAuth helper that runs the sign-in in a popup (openstation_register_oauth_relay() with wp.os.startOAuth(), see docs/examples/oauth-relay.md).
Questions
Does this still happen on the current OpenStation release? (The plugin was called Desktop Mode when you reported it.)
How does your Connect button send the browser to Google: (a) a plain link to accounts.google.com, (b) a form whose action is the Google URL, (c) PHP wp_redirect(), (d) PHP header( 'Location: ...' ), or (e) JavaScript setting window.location?
Is either plugin public? A link to it, or the few lines that start the connection, would let us reproduce this.
Activity
epeicher commentedon Nov 21, 2026
Factory intake: NEEDS-INFO
Summary
Scope
Nothing will be built yet. It waits on the answers below.
Why
A window is an iframe, and Google answers a framed sign-in request with a 403, so the flow can only work when the shell gets the browser out of the frame first. Today it does that in two cases. A plain link to another site opens in a new browser tab (the click interceptor in
src/chromeless-bridge.js, theoffsitebranch). A PHPwp_redirect()to another site is handed to the shell, which closes the window, follows the redirect in the tab like classic admin does, and brings you back to the desktop when Google returns you to wp-admin (openstation_chromeless_hand_off_offsite_redirect()inincludes/core/routing.php). Three cases are not handled and still land on the 403: a form whoseactionis the Google URL (the submit interceptor only rewrites wp-admin URLs), a redirect sent with a rawheader( 'Location: ...' )instead ofwp_redirect(), and JavaScript that setswindow.location. Each of those needs a different fix in code that runs inside every window, and I could not open the screenshots to tell which one applies, so I would rather ask than guess.If you need it working right now: switching the redirect to
wp_redirect()is handled today, and the plugin also ships an OAuth helper that runs the sign-in in a popup (openstation_register_oauth_relay()withwp.os.startOAuth(), seedocs/examples/oauth-relay.md).Questions
actionis the Google URL, (c) PHPwp_redirect(), (d) PHPheader( 'Location: ...' ), or (e) JavaScript settingwindow.location?