james david low

live / work / play / worship

3rd Party Authentication

3rd Party Authentication is a wordpress plugin that allows wordpress to authenticate against other authentication systems. These include:

  • Gmail / Google Apps
  • Any generic POP/IMAP email service
  • http://wordpress.org/extend/plugins/3rd-party-authentication/

    Known Issues
    There is a known issue related to the google login, sometimes it requires the user to enter a captcha (one of those pattern of fuzzy letters), especially if a user types the wrong password. At the moment the plugin doesn’t handle this, and may stop the user using this service. You can fix this by going here: https://www.google.com/accounts/DisplayUnlockCaptcha

    Change log
    0.2.3
    Fix so auto creating users populates email field allowing more than on user to be created! Thanks Cody!
    0.2.2
    Added text on login page to indicated regular logins work
    0.2.1
    Bug fix for when using default port
    0.2.0
    Remove blank from the list in 0.1.7
    0.1.9
    Fix for if wp_authenticate already declared
    0.1.8
    Added google apps domains to the list
    0.1.7
    Shows a list of domains that can be logged in using
    0.1.6
    Can now auto create users


    If you found any of the software useful, please consider supporting its further developement by donating.
    11:58am / Nov 24th / 08
    « Google Spreadsheet to iCal Post ToDo »

    58 Comments

      As far as I can read, your plugin seems to be the perfect match for my need. BUT do you know, if it works with WPMU 2.7? And if not, any ideas what is needed to get it to work?

      (I have some projects, where I can use this plugin, so if interested, I can test it on my WPMU installations and surely will donate you for the work!)

      7:00pm / Feb 20th / 09 henrik hammer

      I use it on some wordpress 2.7 blogs. But haven’t tested it on WPMU. I’ll quickly do a test and get back to you about it.

      10:42pm / Feb 20th / 09 James Low

      Hey,
      I’ve tried an initial version that should support WPMU. Give it a try here, and let me know if it works: http://downloads.wordpress.org/plugin/3rd-party-authentication.0.1.4.zip

      Also, in order to add logins with a @gmail.com address you’ll need to change the pregmatch in wp-includes/wpmu-functions.php on Line 897 (in wpmu 2.7) from:

      preg_match( “/[a-z0-9\]+/”, $user_name, $maybe );

      to:

      preg_match( “/[a-z0-9@\\.]+/”, $user_name, $maybe );

      1:26am / Feb 23rd / 09 James Low

      Cool – I will give it a try!

      THX a bunch!!

      3:43pm / Feb 23rd / 09 henrik hammer

      I just installed this into a fresh 2.7.1 installation and I’m not getting anything. I activated it, then went to the settings under 3rd Party Authentication (left all of that blank?). Is there something that I’m missing? My way of testing is just entering my email address (gmail) and password and it’s giving me a “invalid login” error. I did the clear captcha thing and I still got nothin’. New to WordPress, but not to PHP and web development. Let me know. Thanks!

      –Andrew

      3:36am / Mar 11th / 09 Andrew Ariotti

      Hi,
      errorwindow after login with googlemail password: – “Username not an email address”

      any idea?

      10:46pm / Mar 15th / 09 netze

      The current version of the plugin requires that you login and that the facebook username is set to the full @gmail.com or @googlemail.com email address.

      11:58pm / Mar 15th / 09 James Low

      By “facebook username” I assume that you meant “Google username,” right? That makes more sense now.

      10:02am / Mar 16th / 09 Andrew Ariotti

      haha, yes sorry, too many other things going through my head :-P

      10:03am / Mar 16th / 09 James Low

      I understand. I’ve always got both Facebook and Google going through my mind and tend to get them mixed up.

      One last question just for clarification: by activating this plug-in my users that have an @gmail.com or @googlemail.com will be authenticating using their Google Password, right? All my other users will be treated normally, right?

      10:48am / Mar 17th / 09 Andrew Ariotti

      Yes, unless you click the disable regular users checkbox.

      10:54am / Mar 17th / 09 James Low

      I installed this on a new site i am setting up and receiving the following error when I try to activate:Fatal error: Cannot redeclare class HTTPRequest in /home/ninedrag/public_html/jiulongpai.com/wp-content/plugins/3rd-party-authentication/httplib.php on line 12

      Any ideas?

      12:06am / Mar 25th / 09 Matt Talbert

      I am not able to set this up with WordPress 2.7.1. Is it known to work with this version? If so, does it work with Google Apps for your Domain? Any help would be greatly appreciated.

      12:34pm / Jun 9th / 09 Brandon Martinez

      any chance you will publish an update that supports WordPress 2.8.4? I’ve installed the plug-in and tried using cybersnac@gmail.com (my gmail address) as the user name and it’s telling me the login is invalid

      3:38am / Sep 2nd / 09 CyberSNAC

      sorry to bother.. but plug-in has disabled “admin” user to authenticate… Please advise…

      6:40am / Sep 3rd / 09 dghant

      CyberSNAC
      You must set up users in wordpress to have the user name the same as your full email address. I’ll have a look at testing on 2.8.4 soon

      dghant
      use FTP or the file manager of your hosting to delete the plugin so that you can login again. I’ll try get a version up that permits the admin to authenticate normally

      7:44am / Sep 3rd / 09 James Low

      Thanks James,

      I have another question , of course.
      would you happen to have the
      DNS’s and port for authenticated
      against hotmail, AOL and yahoo’s IMAP ??

      So we can provide authentication there too???

      9:31pm / Sep 3rd / 09 dghant

      James,

      So I have to register a user account for a user with their full @gmail.com address as their username and match their password as well?

      I was thinking I could just have a user log in using their gmail.com credentials without having to have a user in place already.

      the way I understand you are telling me this works, I would have to get the users to register on the site using the same credentials set that they use for gmail, prior to them actually being able to log into my site with their gmail.com credentials.

      Is this correct? Thanks again :)

      11:18pm / Sep 3rd / 09 CyberSNAC

      CyberSNAC
      You have to have the user already added to your blog, this is because you might want certain permissions for a user (editor/admin) and not just subscriber. Once you’ve done that, it authenticates the password against google, so if the user changes their password on google they will automatically just use their new password on your wordpress blog.

      I see what you mean about not adding users though if you just want them to be able to comment. I can add this as an option, that they just get the subscriber role.

      11:28pm / Sep 3rd / 09 James Low

      11:29pm / Sep 3rd / 09 James Low

      James,

      I think this plugin has alot of potential. I don’t like some of the other 3rd party plugins because they are too bulky. This one seems to be able to do it’s thing without having to add any major content to the login widget or page. I like streamlined.

      I’d like to see the plugin be able to register people using their google credentials with a default role of subscriber. I could then elevate their priveleges as I see fit. Can that be done?

      11:37pm / Sep 3rd / 09 CyberSNAC

      Can definitely be done. Just a question of time when I have other commitments.

      1:02am / Sep 8th / 09 James Low

      I hear ya! I’ll keep an eye out on the plugin upgrades page for when you get around to it.

      Thanks much :)

      8:30pm / Sep 8th / 09 CyberSNAC

      Added it!

      3:08pm / Oct 13th / 09 James Low

      James,

      When I tried installing the 3rd part authentication on my WordPress 2.8.4, it was giving this error
      “Parse error: parse error, unexpected T_CLASS in /blog1/wp-content/plugins/3rd-party-authentication/3rd-party-authentication.php on line 14″
      Please help me on this.

      5:26pm / Oct 15th / 09 Vinayak K

      James,

      Can I use it for mail ids of Yahoo for login?

      Thanks

      5:31pm / Oct 15th / 09 Vinayak K

      Hi James,
      Getting a plugin activate error with 0.1.8:
      Cannot redeclare wp_authenticate() (previously declared in /blahblah/wp-includes/pluggable.php:456) in /blahblah/wp-content/plugins/3rd-party-authentication/3rd-party-authentication.php on line 511
      Seem to get this with new installation from 0.16 upwards, 0.1.5 seems fine.
      Any ideas?
      Thanks
      YikYak

      8:49pm / Oct 15th / 09 YikYak

      Vinayak K
      - Not sure why that error is happening, the code should be syntax correct. I can only suggest trying the latest version.
      - There are two ways you can use yahoo logins. If the user is a UK user or a premium user and has POP3 mail access you can add the email address to the POP3 server access details to the list at the bottom of the plugin settings.
      - The other way is that you can sign up as a google user with yahoo email addresses, and add yahoo.com to the list of domains to authenticate as google logins in the long text box.

      YikYak
      - New version should fix that. That function is only required if you want users to be able to login on the fly, without going through the normal registration process.

      12:06am / Oct 16th / 09 James Low

      0.1.9 :) activate error indeed fixed, thanks

      3:21am / Oct 16th / 09 YikYak

      Matt Talbert asked about authentication using Google Apps for Your Domain – is this possible?

      1:41am / Oct 30th / 09 Josh

      Yep its possible. Just add your google apps domain to the text box. You can also check the checkbox to remove the gmail.com and googlmail.com domains if required. Your usernames for wordpress need to be the full google apps emails.

      7:48am / Oct 30th / 09 James Low

      Hi James,

      I’ve just installed your plug in on 2.8.6 and get the following error when trying to activate:

      Parse error: parse error in C:\webroot\wp-content\plugins\3rd-party-authentication\3rd-party-authentication.php on line 14

      I’m a newbie to WordPress but reasonable experience with PHP and cannot figure out what is causing this error. Any help would be great

      8:16am / Dec 3rd / 09 Matthew Stone

      I’ve not tried this plugin on windows, most people seem to use a linux distribution to run it. It could be that you’re using PHP 4 though?

      8:22am / Dec 3rd / 09 James Low

      Instead of PHP 5. I checked that line, I’m pretty sure its right and working on my websites.

      8:23am / Dec 3rd / 09 James Low

      Thanks James, I’m limited with my current hosting provider to PHP4 so I think its time I moved providers!

      8:01pm / Dec 3rd / 09 Matthew Stone

      James, I’ve just found this great plugin. I need to authenticate users against another -private- authn service which offers an easy REST API to do it. Looking at the googleclientlogin.php code I’m figuring whether your 3rd party plugin is strictly linked to those predefined Google and email services or it would be extensible enough to use other services, maybe writing a similar myprivateclientlogin.php module to do that.
      Thanks!

      2:54am / Dec 13th / 09 Nomikon

      Hi,
      While there is no plugin system in the current version, it is very easily extended to add other services. The current version also support authentication my POP3 or IMAP to non-google domains.

      Let me know if you need any help modifying it. If you look at the code, you’ll see there is an authentication class you can inherit from, and then just add suitable logic to authenticate your domain against that authenticator.

      8:13am / Dec 13th / 09 James Low

      Hi James,
      Great plugin, just what I needed for my students who all have GoogleApps accounts. I noticed though that if I turn off “regular logins” then I cannot get in as admin. I think even on one blog I activated the plugin, did not set 3rdpartyauthentication options and got a default setup that kept me out as admin. Do you think there is any merit in having an option (or a default) to treat the admin user separately?
      Thanks
      YikYak

      6:23am / Dec 18th / 09 YikYak

      Hmmm, I thought I had already had hard coded to include the admin user. I’ll check why its not working.

      10:26am / Dec 18th / 09 James Low

      Hmmm, worked for me. Is your admin user called ‘admin’ ?

      10:30am / Dec 18th / 09 James Low

      Hmm, tricky, yes my user is “admin”. I’ve definitely been locked out of a couple of my blogs, and end up having to delete the plugin, do a lost password recovery upload and reactivate your plugin.

      The error meesgae I get when it all goes wonky is something like “user name is not a valid email address” if that helps, although even when I delete your plugin, I still have to do lost password recovery as well…perhaps something else is going wrong?

      7:01am / Dec 20th / 09 YikYak

      I installed this on a new site i am receiving the following error when i try to login wiht a google apps account… Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://www.google.com:443 (Unable to find the socket transport “ssl” – did you forget to enable it when you configured PHP?) in /home3/mailjour/public_html/wp-content/plugins/3rd-party-authentication/httplib.php on line 111

      Warning: fwrite(): supplied argument is not a valid stream resource in /home3/mailjour/public_html/wp-content/plugins/3rd-party-authentication/httplib.php on line 112

      Warning: fclose(): supplied argument is not a valid stream resource in /home3/mailjour/public_html/wp-content/plugins/3rd-party-authentication/httplib.php on line 116

      2:17am / Mar 26th / 10 Xavier

      Hi James,

      Thanks for the gr8 plugin!

      After installing the plugin, the login window shows “login with your domain name address”

      Could you please advise on how to login with domain name to wordpress account.

      11:08am / Apr 17th / 10 Amit

      I can’t seem to get our wordpress to authenticate against our google apps account. I have tried every conceivable combination of settings, but could not get it to work. It looks pretty intuitive, but I might be missing something obvious.

      5:43pm / Aug 2nd / 10 Will

      Hi James,

      We’re using your great plugin for Google Apps authentication. However, We’d like to create users without domainname included in the plugin.
      e.g. For username@example.com, I’d like to create ‘username’ instead of usernameexample-com. Can you please help?
      If this problem is resolved, that would really help us a lot! If this is not possible, we’d need to request every member to register!! :(

      Please help..

      Thanks,
      Administrator,
      ECHO

      5:19am / Aug 8th / 10 ECHO Administrator

      It is possible to do, but I need some time to update the plugin. I’m very busy at the moment so not sure when I’ll be able to.

      7:32am / Aug 8th / 10 James Low

      Hi James,

      The auto create users functionality does not work. Logging in and auto-creating the first user succeeds. Thereafter, it shows the error message “Invalid username”. What is actually happening is the user is not being added, because wp_create_user checks the email for uniqueness [through email_exists()] and that is returning the error “This email address is already registered.” This is true, because your login_failed method attempts to register all users with an empty (“”) email address. The first one succeeds, simply registering the user without an email address (whereas it should be the email/username with which they’re signing in). On the second and subsequent attempts, the empty email address (“”) is taken and adding the user fails. This can be fixed simply in your login_failed() function, by updating the call to wp_create_user from

      $user_id = wp_create_user( $username, $random_password, ”);

      to

      $user_id = wp_create_user( $username, $random_password, $username );

      Note that since this plugin requires the username to be an email address (whether google or not), then we specify the username as the email address as well when creating the user. (Nasty for data normalization purposes, and it means that the email used for login could be out-of-sync from the email which wordpress uses, but it works)

      You might also consider bubbling up the WP_Errors thrown from lower in the call stack and displaying more accurate answers. (Such as ‘Email already registered’ versus ‘Invalid username’)

      - Cody

      PS – If this isn’t too clear, I rewrote it as a narrative tutorial on my blog: http://codyaray.com/2010/08/wordpress-authentication-via-google-apps

      7:14am / Aug 11th / 10 Cody A. Ray

      Ok thanks Code A. Ray, sorry it took me so long to fix this. I’ve been busy on so many things, and I didn’t realise it was such an easy fix!

      Its uploaded to the plugin directory version 0.2.3

      12:55am / Oct 2nd / 10 James Low

      Just installed the current version 0.2.3 on a new WordPress 3.0.1 install. I can’t find “settings” for the plugin anywhere. I then logged out and was unable to log back in, so edited the php file to allow regular logins, but this appears to be ignored. Deleted the plugin folder to be able to get back in. Am I missing something obvious?

      2:11am / Oct 15th / 10 David Smith

      *Bump* I’ve installed your authentication plugin after completely re-vamping my self-hosted wordpress site, and now I cannot login. Please tell me I do not have to reinstall the entire thing again! Help please!

      1:49pm / Dec 11th / 10 Rev. Jack

      The best thing you can do is FTP to your site and remove the plugin.

      If you want to try again, you can try again you can make sure “allow regular logins” is checked, so that your existing logins work.

      12:39am / Dec 12th / 10 James Low

      I have been trying to get this plugin to work for days now. I was getting a ‘Fatal error: Cannot redeclare class HTTPRequest’ In which I edited the ‘httplib.php’ file to work like this:

      if(class_exists(‘HTTPRequest’) != true)
      {
      //Class that implements the request on line 12
      }

      This allowed me to activate the plugin, I have then gone into the settings and made it so that users are automatically created and it is authenticateing against my domain. But it is still not working. I tried to login using my account, and it didn’t work. I tried to use another user that there was no account for and got this error:

      Fatal error: Call to undefined method HttpRequest::Post() in /opt/apps/intranet/wordpress/wp-content/plugins/3rd-party-authentication/googleclientlogin.php on line 15

      Are these issues related? Has anyone else run into this problem?

      Lou

      1:32am / Mar 2nd / 11 Lou

      I’ve got the same trouble. I was using wordpress 2.7 and when I activated this plugin (0.2.3) it would say that it crashed because of a fatal error but it didn’t show what the error was. After updating to 3.1 it shows the same error you describe above.

      3:03pm / Mar 29th / 11 Jason

      Ok I managed to fix it by changing the class name and every reference to HTTPRequest to HTTPRequest1. I’m now getting the error

      Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://www.google.com:443 (Connection timed out) in /var/www/blog/wp-content/plugins/3rd-party-authentication/httplib.php on line 112

      This could be a http proxy server issue as I have had to solve a similar error with akismet but I’m not a PHP programmer so I don’t know what changes to make for this plugin. Has anyone solved this?

      9:34am / Mar 30th / 11 Jason

      The plugin works great. But whenever a username is entered it creates an account for that username even if that user is not present in the google apps database. Is there anyway of stoping this?

      4:58pm / May 2nd / 11 Fsherratt

      Hey,

      Im running this plugin – works 80% … imap login is fine, user get created – but also if the imap login was not successfull!!! thats not very usefull. And im NOT able to login it just creates the user but he cant log finaly in. I would love to see this working.. tell me if i can help!

      7:09pm / May 31st / 11 sceptiQ

      another one… using google stuff works fine! but i cant auth vs my own imap… user get created… but he cant login … tells me bad password (setting the newly-created-wp users password to the imap password it is working ;) )

      7:17pm / May 31st / 11 sceptiQ

      Auto register users in login

      Hi

      Your plugin is very great and useful for me, but with a web that I make with wordpress, I have a problem with a little change : From your plugin, I only need the function that auto create users if they don’t exists, or refresh their data if they exists, all in the login page.

      I only need that this users are created or updated in the login, without go to register link because this people don’t know so much about web and technology.

      I have tried removing some functions from 3rd-party-authentication.php, but it does not work….

      I hope you can help me, thanks a lot for your time, regards from Mexico

      P.D. I’m learning English, excuse my errors

      4:07am / Oct 2nd / 11 Oscar