1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

HybridAuth 0.2

Discussion in 'Plugins' started by Graeme, Aug 3, 2013.

  1. Graeme

    Graeme Member

    HybridAuth Social Login
    Version: 0.1
    Author: Graeme
    Created on: 2013/08/03
    Last Updated: 2013/08/03
    Tested on: Hotaru 1.5.0~
    Plugins Required: users
    Plug & Play: There's a bit of configuration needed, no coding though.
    Supported: Yea

    What is HybridAuth?

    The main goal of HybridAuth library is to act as an abstract api between your application and various social apis and identities providers such as Facebook, Twitter, MySpace, LinkedIn, Google and Yahoo.

    Over all, HybridAuth can be used for many purposes, such as:

    enable users to sign-in/sign-up using popular social service accounts like Facebook, Twitter, Google and others,
    allow users to share their comments, reviews and other activities from your site to their friends via social networks,
    build social applications which can be integrated on your blog, web site, web application, ERP or CRM,
    etc.

    ------------

    Instructions
    1. Drop the hybridauth folder into your plugin directory, and install the plugin from your admin page.
    2. Go to admin settings and read the instructions!
    3. Create your social apps, and input the details as instructed on the hybridauth install page
    4. Put the users_account.php into the following directory: plugins/users/templates/
    5. I think that's all - it should work but no garuantees as it's not been tested much!

    It still needs a quick bit of testing.

    ------------------
    Changelog:
    ------------------
    0.3 - fixed logging in error
    0.2 - updated colorbox widget
    0.1 - First version

    ----------------------
    Known Issue: If you are redirected to your home page when trying to authenticate a user, try this fix in "config.php" file of Hybridauth:
    on line 16: "base_url" => "http://yoursite.com/content/plugins/hybridauth/hybridauth/", just add "index.php" to the end, so it read: "base_url" => "http://yoursite.com/content/plugins/hybridauth/hybridauth/index.php",
    ----------------------
     

    Attached Files:

    Last edited: Aug 14, 2013
    tin9h, Markovki, valMETNG and 2 others like this.
  2. Graeme

    Graeme Member

    Today I've managed to get the user's social login profile picture to be used as their profile pic...had to hack into gravatar.php a bit to do it...yey
     
    nothingman likes this.
  3. nothingman

    nothingman Active Member

    Tested. Clicking Sign in with your Social ID (Facebook, Twitter, LinkedIn, etc...) loads the mobile version(?) on the pop-up window. Here's a screen shot.

    [​IMG]

    EDIT: Also, users cannot login as they normally do - The dreaded "CSRF error. Please try again." error show up.
    EDIT2: Getting the following error on the setting page.

    Notice: Undefined index: hybridauth_settings_header in /SERVERPATH/html/content/plugins/hybridauth/hybridauth_settings.php on line 37
     
    Last edited: Aug 5, 2013
    Graeme likes this.
  4. Graeme

    Graeme Member

    uff thanks! That's strange, it's all working for me on my local machine..apart from that undefined index, does the admin settings page actually work for you? does it show the install button?

    I'll be looking into these other issues - does the screenshot issue only occur when you use the login page? or the same issue for on the register page?
     
  5. nothingman

    nothingman Active Member

    Yes, the install button shows up and the admin settings page show up too. I didn't try it out with the register page though, I clicked the link on the login page and the Screen shot is what showed up.
     
  6. nothingman

    nothingman Active Member

    Line 37 of the hybridauth_settings.php talks about the falling language file and there doesn't seem to be any language folder, perhaps this is the reason?

    PHP:
    echo "<h1>" $h->lang["hybridauth_settings_header"] . "</h1>\n";
    Also the folder structure has two hybridauth folders: /plugins/hybridauth/hybridauth - is this normal?
     
  7. Graeme

    Graeme Member

    yes that is the reason..I've just got a server online, so I can check it all properly now..you can just delete the line
     
  8. nothingman

    nothingman Active Member

    Hey greame, deleting this line solved the previous issue. But this issue still persists -> http://i.imgur.com/OLI685C.png
     
  9. shibuya246

    shibuya246 Hotaru Developer Staff Member Admin

    From v.1.5.0 you can now use round brackets on lang code to make it return a value rather than an error

    e.g.

    Code:
    echo "<h1>" . $h->lang("hybridauth_settings_header") . "</h1>\n";  
    
     
    nothingman likes this.
  10. Graeme

    Graeme Member

    Great improvement thank you

    ... I have an updated version of this plugin for anyone to test, I will reupload soon as I get the chance this weekend...
    this version is working 100% for me ..I've had no problems at all
     
    nothingman, valMETNG and shibuya246 like this.
  11. nothingman

    nothingman Active Member

    Hey Graeme, update please :D
     
  12. Graeme

    Graeme Member

    I'll get it on here today, you're very interested in the social aspects of the web no? me too lol

    I've also been meddling with the Disqus plugin, so there is an awesome upgrade to come, that was actually quite simple to implement..I've added this:
    HTML:
    http://help.disqus.com/customer/portal/articles/684744-getting-started-with-single-sign-on
    It's the SSO- Single Sign-On...so when a user registers to your Hotaru site, they can comment on Disqus straight away using their Hotaru profile, no need to sign up separately to Disqus...they are automatically logged in when they sign into your site, and even their avatar is used within disqus...pretty cool...so we can then use the Disqus widgets in the sidebar such as user with most comments, etc..! cool eh (that's why I didnt get round to this Hybridauth one)
     
    nothingman and angolanmade like this.
  13. Graeme

    Graeme Member

    Here, this works fine for me...it should work, if it doesn't it's just something small like jquery includes that arent needed...so I will sort that if required
     

    Attached Files:

    nothingman and valMETNG like this.
  14. nothingman

    nothingman Active Member

    Tested. I still haven't tried logging in but after installing, it seems to 'breaks' the 'vote' link for stories -> http://i.imgur.com/1qCUivg.png

    EDIT1: Ok, the above issue goes away when I clear the cache - not sure why I needed to do this as installing a plugin automatically clears the cache.

    EDIT2: The pop up (that shows the google/FB icons etc) shows up but when I click on say the g+ icon, it says "Contacting google..." but I don't see any google login at all (you know the one that says "allow google to access your account" etc), all that happens is that the home page is loaded. Same case with twitter and FB.
     
    Last edited: Aug 14, 2013
    Graeme likes this.
  15. Graeme

    Graeme Member

    When the homepage is loaded, has it already logged you in? Is the config.php for Hybridauth set up? Can I try it?

    It sounds like it's working since it's contacting google, does it redirect you to a homepage or a profile page?
    I think if you authenticated with google before (I remember we tested it last time), it won't ask for "allow google to access your account" if it already has access..

    Otherwise make sure the config is correct in the Hybridauth folder. Open it up and see if the has your site name (even try removing www.)...also if you are not using a service, check if it is disabled, for example if you aren't using AOL, the AOL bit should say:

    PHP:
    "AOL"  => array ( 
                    
    "enabled" => false 
                
    ),
     
    Last edited: Aug 14, 2013
  16. nothingman

    nothingman Active Member

    I tried it on incognito mode, so I was not already logged in. It redirects me to home on the pop up window that shows up. I've reinstalled the plugin and send you details of my site so you can check it out.
     
  17. Graeme

    Graeme Member

    Hey try your site, I found the problem...it was in the config.php file of Hybridauth.

    it is on this line (16):
    PHP:
            "base_url" => "http://yoursite.com/content/plugins/hybridauth/hybridauth/" 
    I just added "index.php" to the end, so it read:

    PHP:
    "base_url" => "http://yoursite.com/content/plugins/hybridauth/hybridauth/index.php"
    Not sure why this was needed, but it is more a problem with Hybridauth itself rather than the work I had done..I found the solution here:

    http://stackoverflow.com/questions/15478131/php-hybridauth-social-signin-not-working-at-all-redirecting-to-hauth-start-fac

    Have a read, I noticed the twitter button gave an error..I'm quite confident that this will be something to do with the Hybridauth endpoint- something to do with that base_url, and what is present in your twitter app settings. If you want to remove the linkedIn button, or add different buttons, open "unauth.php" from the Hybridauth widget folder:

    Code:
    /content/plugins/hybridauth/widget/unauth.php
    
    Scroll right to the bottom, and you will see a table with facebook.png, twitter.png, google.png etc...you can just delete the line for linkedin.png. Alternatively, here is the original code that includes every icon:

    HTML:
    <table width="100%" border="0">
    		  <tr>
    			<td align="center"><img class="idpico" idp="google" src="images/icons/google.png" title="google" /></td>
    			<td align="center"><img class="idpico" idp="twitter" src="images/icons/twitter.png" title="twitter" /></td>
    			<td align="center"><img class="idpico" idp="facebook" src="images/icons/facebook.png" title="facebook" /></td>
    			<td align="center"><img class="idpico" idp="openid" src="images/icons/openid.png" title="openid" /></td>  
    		  </tr>
    		  <tr>
    			<td align="center"><img class="idpico" idp="yahoo" src="images/icons/yahoo.png" title="yahoo" /></td>
    			<td align="center"><img class="idpico" idp="flickr" src="images/icons/flickr.png" title="flickr" /></td>
    			<td align="center"><img class="idpico" idp="myspace" src="images/icons/myspace.png" title="myspace" /></td>  
    			<td align="center"><img class="idpico" idp="linkedin" src="images/icons/linkedin.png" title="linkedin" /></td>
    		  </tr>
    		  <tr> 
    			<td align="center"><img class="idpico" idp="blogger" src="images/icons/blogger.png" title="blogger" /></td> 
    			<td align="center"><img class="idpico" idp="wordpress" src="images/icons/wordpress.png" title="wordpress" /></td>
    			<td align="center"><img class="idpico" idp="livejournal" src="images/icons/livejournal.png" title="livejournal" /></td>  
    		  </tr>
    		</table> 
    I know the widget isn't ideal, but I was just copying an example...this would be good if you can activate/deactivate from hotaru plugin manager - something for the future...for now we'll have to edit this html...if you need me to help let me know.


    ;)
     
    alfbrand likes this.
  18. nothingman

    nothingman Active Member

    Hey thanks! I tried it out and things seem to be looking fine. But now I'm getting the following error (tested only with g+ as FB/Twitter etc are blocked at work) :D

    Code:
    Error:redirect_uri_mismatch
    
    The redirect URI in the request: http://mysite.com/content/plugins/hybridauth/hybridauth/index.php?hauth.done=Google did not match a registered redirect URI
    
    Learn more
    Request Details
    
        cookie_policy_enforce=false
        scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.google.com/m8/feeds/
        response_type=code
        redirect_uri=http://mysite.com/content/plugins/hybridauth/hybridauth/index.php?hauth.done=Google
        access_type=offline
        display=page
     
  19. Graeme

    Graeme Member

    Hey, I've just had to wrestle with it a bit! I've now made some more changes, and it works on your site 100% with facebook..I registered, logged out and logged in...check your database users table, you'll have my facebook info now hahaha I'm exposed! I better hide, you can track me down...You'll have to try hard to find me though, look at the tangled web of code I spin, I even totally lose myself in the mess lol

    The google problem will therefore now be something to do with the Hybridauth config file...maybe in your google app..Read this, I found in the stackoverflow thread:
    http://stackoverflow.com/questions/15478131/php-hybridauth-social-signin-not-working-at-all-redirecting-to-hauth-start-fac
    If all is good, I'll update this to v0.3 with the fixes
     
  20. nothingman

    nothingman Active Member

Share This Page