Theme My Login
If you use the Theme My Login plugin (TML) to create a custom styled login page on your site, please be aware that since TML adjusts the way the login process works in WordPress, plugins like Google Apps Login that are expecting WordPress standards may not work.
An approach that will not disturb WordPress’ standard login mechanism so much would be to use a plugin that styles the existing wp-login.php page instead of creating a new login page, but of course this might involve more work to achieve something that matches your Theme. Our recommended plugin for this approach is Admin Custom Login, and this is directly compatible with Google Apps Login.
If you would like to attempt to get TML to work on your site, here are the suggested steps:
1. Specify both Authorized Redirect URIs in the Google Developers Console Project when you configure Google Apps Login:
http://www.website.com/wp-login.php
http://www.website.com/login
http://www.website.com/login/
Above, I’ve added two versions of the /login URL just in case. You would add these under API’s & Services -> Credentials -> OAuth 2.0 IDs. Click into the ‘web application’ ID you set up when you first configured the plugin.
2. Add the below code in functions.php in the Child theme or similar – of course change for your site’s wp-login.php URL:
function my_gal_login_url($login_url) { return 'http://website.com/wp-login.php'; } add_filter('gal_login_url', 'my_gal_login_url', 10, 1);
The above steps may be enough, but if the ‘Login with google’ button doesn’t appear on the login form try step 3 below only (not step 4). If it appears but you sometimes get ‘session mismatch’ errors, please try both steps 3 and 4.
3. Add this link URL as ‘Login with Google’ on the TML login page (below theme_my_login shortcode):
http://website.com/wp-login.php?gaautologin=true
4. Hide the original ‘Login with Google’ button in Child theme CSS:
p.galogin, h3.galogin-or { display:none; }
Some users have found that ‘Login with Google’ just returns them to the wp-login.php page with no error message showing, but actually if they then visit /wp-admin/ they find they were actually logged in (just not redirected to the dashboard as expected). If this happens to you, follow step 5:
5. In TML settings, uncheck ‘Enable custom redirection’ and maybe some other security settings.
If you would like any help, or want to report your own findings, please contact support.
Of course if you aren’t in a position to get your hands dirty with the detailed configuration required, the short answer is that I don’t think TML works alongside Google Apps Login straight out of the box!
Troubleshooting
When a user tries to Login with Google, it says “user is not registered in WordPress”
The free version of the plugin allows existing WordPress accounts to login using Google credentials, but it will not create accounts if they do not already exist in WordPress. I presume there is no WordPress account with the email address that corresponds to the Google account attempting to login.
You would need to purchase the premium or enterprise versions of the plugin if you want to sync users from a Google Apps domain to WordPress – i.e. to auto-create WordPress users for anyone with a Google account on your company’s domain, and to ensure that users can no longer login to WordPress after their Google accounts are deactivated.
If you’re already using the Premium or Enterprise version, please ensure the Domain Control tab in Settings -> Google Apps Login is set up correctly, including the ‘Auto-create users on my domain’ checkbox being checked.
I can’t login to WordPress at all any more!
Plugins sometimes conflict with each other, or configuration is incomplete, so you find you can’t access your WordPress site. For that reason, it is important to have a way to remove plugins and perform other low-level resets if needed.
If Login with Google isn’t working, you should still be able to enter your regular WordPress username/password to access the site. (Unless you have selected the option to forbid this for accounts in your Google Apps domain, in the premium or enterprise versions.)
If you have set your site to automatically login with Google, you can override that behavior by going to the following URL on your site:
/wp-login.php?gaautologin=false&gahidewplogin=false
If you still can’t login, after resetting your WordPress username and password, you should start to disable some plugins that are likely to be causing a problem. Of course you can’t access your Plugins page in WordPress admin, so you will need access to your server’s database or file system.
Here is a useful guide explaining what to do, courtesy of WP Beginner.
If you have Google Apps Login Enterprise installed, and you have accidentally configured the Domain Control tab in a way that means none of your users is an admin user any longer, you may need to change your user back to being an admin via MySQL. See here for instructions.
I install the plugin, and my wp-login.php page is just blank
The only time we’ve seen users experience a blank screen has been because they don’t have CURL enabled on their server.
Read this article describing how you can debug and (hopefully) get an error message to see if that is the problem.
Or, since most often the problem is that CURL needs installing, it may be easier for you to jump straight to finding out whether CURL is installed, and enabling it if not. If that doesn’t solve the problem, you may need to debug as above.
Users sometimes can’t login because Google chooses their personal Gmail account
Here’s what happens whenever you click Login with Google, and it depends how many Google accounts are currently logged-in within the same browser:
- If currently logged in to 0 Google accounts, you will be asked to login to one and the plugin will attempt to login to WordPress against that account
- If currently logged in to exactly 1 Google account, Google will automatically return that account for the WordPress login attempt
- If currently logged in to 2 or more Google accounts, Google will show the user a list of current accounts and allow them to choose which one they want for the WordPress login
Then, if the selected Google account doesn’t match an existing WordPress account and doesn’t come from a Google Apps domain that is authorized in the plugin to have a WordPress account created for it, the user will be told:
Email address needs to be in mycompany.com. [email protected] is not authorized – Sign out of Google to switch accounts
If this is causing confusion, one possibility is to tick the option in Advanced Options of Settings -> Google Apps Login labelled ‘Force user to confirm Google permissions every time’. This adds an extra step to everyone’s login flow asking them to confirm they are happy for Google to connect to the WordPress site (by default, they only see this the very first time). The only reason for this option is to give the user a chance to see (in the top right corner) which Google account has been picked up, and give them the opportunity to change it.
When attempting ‘Login with Google’ I see Invalid JSON in service response
After clicking ‘Login with Google’, and authorizing your Google account, you are redirected back to the WordPress login page and see the error message: Invalid JSON in service response: <followed by a load of strange characters>
This is because Google has recently started compressing some of their responses from their API calls, and older servers are unable to interpret it.
Please ask your web host if they can update to a newer CURL version that has libz/gzip/idn enabled.
Server-side Caching no longer works on my site
Google Apps Login attempts to set its wordpress_google_apps_login cookie on every page of your site. This cookie is only really needed on the wp-login.php page, but many sites have unusual configuration of the login page, so by default the plugin sets the cookie on every page. This can affect some server-side caching systems which turn off caching because this cookie is different for each user.
You can instruct the plugin to only write the cookie on the wp-login.php page in the first place, and this should fix the cache for the rest of your site.
We have instructions providing code that you can add to your Theme’s functions.php file or similar.
Enterprise Multisite
If you are using Google Apps Login Enterprise version on a WordPress multisite installation, please get in touch with us. We have an extension plugin available that will allow you to override Group Role Rules on a sub-site basis.
Domain Control tab – multisite options
In a multisite installation, there are two extra settings on the Domain Control tab:
‘Add users to sub-sites if they are not yet members’ – if checked, this will always add all users as members to all sub-sites whenever the role mapping rules are processed for a user. In this case, the user will be added to each sub-site under the role determined by the rules you’ve set up. If not checked, the role will only be applied to the user in sub-sites of which they are already a member (which will likely be no sites for a new user, unless you have some other plugin to take care of sub-site membership assignment).
The point here is that under WordPress multisite, the user exists once globally (i.e. throughout the whole multisite), but can be added as a member to each sub-site independently of the others; and furthermore the user can have different roles in each sub-site. For example, the user could be a subscriber in sub-site 1, an admin of sub-site 2, and not a member at all of sub-site 3.
‘Demote existing Super Admins who do not have a Super Admin mapping above’ – if checked, the plugin will happily remove super admin privileges if the Domain Control rules determine that the user should have a role other than Super Admin. Leave checked (default) if you think that’s risky – i.e. it’s too easy to insert an extra rule that maps a super admin to something else. If it remains unchecked, you would have to manually demote any super admin that is no longer required on the multisite.
In WordPress multisite, super-admin is a different type of role to all the others – it applies globally, whereas the lesser roles can be assigned to any other member of any sub-site independently of the others.
Advanced Options – multisite Redirect URIs
In all versions of Google Apps Login, the Advanced Options tab contains an extra option related to multisite Redirect URIs. See here for more details.