In the Add Google File dialog box, I just get the Google Error “Forbidden”
First, are you sure you followed all configuration instructions of the Google Apps Login plugin, including enabling Drive API…?
Google Apps’ user and permissions systems are complex, and there are many ways you could unintentionally forbid your users from using the Drive API.
You could have disabled API access completely, so take a look in your Google Apps admin panel and look for anything obvious.
One reason a lot have people have seen ‘forbidden’ in the past is because they have the following setting unchecked: go to Google Apps -> Drive, and then General Settings -> Allow users to install Google Drive apps.
After changing settings, you should logout of WordPress and Google, then refresh and try all over again.
Unverified App
When you first configure Google Drive Embedder, users may face the following screen when they attempt to ‘Add Google File’:
This is due to Google’s attempts to reduce malicious third-party applications. Please see further Unverified App details here.
Invalid Scope – 400 error
When you click ‘Add Google File’, or attempt to authorize with Google, you just see a window saying ‘400 – That’s an error. invalid_scope’:
Please see our invalid_scope instructions here.
In the Add Google File dialog box, I just see “Loading…”
If the plugin configuration is correct, most likely your site has opened another browser window in which it needs you to login to your Google account or confirm you grant permissions for the site to access your Drive account. So the first step is to double-check for that second browser window and follow the instructions there.
Otherwise, there may be a plugin configuration issue or a Javascript conflict.
Open your browser’s Developer Tools. If the Console tab has any red error messages, this may indicate a Javascript problem on your site – possibly from another plugin/theme, but which prevents any further Javascript from running (including the Add Google File dialog). You could try deactivating all other plugins and switching to a default theme to see if that helps track down the culprit. If in doubt, please contact support or try out the following possibility.
With your browser’s Developer Tools already open, reload the page and click the Network tab. Are there any red lines that refer to google.com? If so, you may be able to click into the Preview section of the red line to obtain an error message returned from Google. Most likely, the message will refer to an ‘invalid origin’. If you can’t obtain a message, please proceed anyway.
To fix this, you need to go back to the project you created in Google Developers Console when you first set up the plugin.
Under APIs & Auth (from the top-left three-bars menu), click the Credentials tab, then click into the OAuth 2.0 ID that you would have created. Inside, there is an Authorized Javascript Origin setting. You need to update this or add further URLs to match every possible URL for accessing your site – including http and https versions of your site URL, and also with/without the www at the front if it is possible to access with and without (although we would recommend choosing a canonical URL and have all others redirect to that URL).
In all cases, please just get in touch if you prefer for our support team to take a look, ideally providing an account on your site registered to [email protected] that will have permissions to ‘Add Google File’ in a new page/post.
Most users cannot see my embedded file
The Google viewer needs to have permission to show the file to whichever Google user is logged into the browser. The easiest way to ensure this is the case – and so even users who are logged out of Google can see the file – is to locate the file in Google Drive and click Share. Under ‘Advanced’, change to ‘Anyone with the link can view’ to be sure all users can see the file.
I don’t want users to need their own Google account to view folders – they keep being asked to authorize
(Enterprise version of Google Drive Embedder)
See our tutorial here for ensuring users do not need their own Google account to view files and folders.
I want users to grant Drive access at ‘Login with Google’ so they aren’t asked again when using ‘Add Google File’
By default, when you install the Google Drive Embedder plugin, whenever users ‘Login with Google’ to the site they will no longer be asked to grant Drive and/or Calendar permissions (as of Google Drive Embedder version 4.1).
This works well, especially if most users won’t need to interact with the Drive plugin, but they will then be prompted to grant permission for Drive access when they first ‘Add Google File’ to a post, or view in Enterprise-style embedded folder in Drive mode.
It is possible to prompt the user to grant access at the login stage instead by adding this code to your own plugin or your Theme’s functions.php file:
function dd_my_gather_scopes($scopes) { return array_merge( $scopes, Array( 'https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/drive.install', 'https://www.googleapis.com/auth/calendar.readonly' )); } add_filter('gal_gather_scopes', 'dd_my_gather_scopes', 20, 1);
Note if you are using the free version of Google Drive Embedder, you would only need the read-only Drive scope so use the following Array instead: Array( ‘https://www.googleapis.com/auth/drive.readonly’ )