EzDevInfo.com

hybridauth

Open source social sign on PHP Library. HybridAuth goal is to act as an abstract api between your application and various social apis and identities providers such as Facebook, Twitter and Google. HybridAuth, Open Source Social Sign On PHP Library hybridauth a php library for authentication through facebook, twitter, google, yahoo, linkedin, aol, vimeo, foursquare, openid and other identity providers

HybridAuth not authenticating when using custom php session path

I have an issue when using the HybridAuth plugin. I have included the plugin as a popup in in my home page. When clicking on the login button from home page the plugin will load in colorbox.

In my server I can't use default php session save path so that I have set it as php temp path for saving session like below in index.php of my root folder.

$dir = sys_get_temp_dir();
session_save_path($dir);

After updating this code, the plugin is authenticating the social media that customer selecting successfully and return back to my site, but it is not passing the below condition,

$hybridauth->isConnectedWith( $_GET["connected_with"] ) // it is always return false

In second case I have updated the session save path in index.php of plugin folder also, but at at that time in the login popup instead of showing login UI it is directly showing an error page like below

"You cannot access this page directly."

Any help would be appreciated. Thanks in advance.


Source: (StackOverflow)

"You cannot access this page directly" - Hybrid Auth

I'm hosting my PHP Yii application on AWS Elastic Beanstalk and hence using the database to store sessions. I've successfully implemented facebook login using Hybridauth on a shared hosting environment. When I host on Elastic Beanstalk facebook login gives the error:

"You cannot access this page directly"

The URL ends up as:

http://mydomain.com/hybridauth/default/callback?hauth.start=Facebook&hauth.time=1393106016

I've learnt from here that this is related to facebook calling back to the application but finding a different session. Endpoint.php then throws the error:

            # Init Hybrid_Auth
        try {
            // Check if Hybrid_Auth session already exist
            if ( ! isset( $_SESSION["HA::CONFIG"] ) ) { 
                header( "HTTP/1.0 404 Not Found" );
                die( "You cannot access this page directly." );
            }

How can I ensure facebook calls back to the same session and successfully signs in with hybridauth?


Source: (StackOverflow)

Advertisements

How to get the Twitter user's email using Hybridauth?

Can any body help how to get the Twitter email I am using this link in php codeigniter here i am getting my information except email. Then how to fetch the email? is there any scope shall we specified in config file?


Source: (StackOverflow)

'Offline' access with HybridAuth

I have already authorized a user in my Facebook application using HybridAuth and stored his access_token in my database.

Days later, when the user is not online, I want to get his new Facebook friends, also using HybridAuth.

Can I 'recreate' that user from his access_token to get his friends, send notifications, etc.?

Thanks!


Source: (StackOverflow)

PHP HybridAuth social signin not working at all. Redirecting to ?hauth.start=Facebook&hauth.time

I'm a CodeIgniter developer. But currently forced to work on a simple php site and integrate social login in it..

I was trying to make HybridAuth Social Login work on this simple php site. Downloaded HybridAuth and installed it. Then found that even the examples does not work for social login (tried on remote server too. Please check www.appwizards.biz/rifat/ .

The normal signin_signup example works fine. But whenever I click the link to login to a social network (i.e, facebook,twitter) it redirects me to (MY_BASE_URL/index.php?hauth.start=Facebook&hauth.time) without showing any login window/error messages at all.

I've carefully read the documentations and other solutions posted here. Adjusted my config.php to have a base url like http://mysite.com/index.php . But it just does not respond. Is there something I'm missing? I've spent 2 days already on it.

here is my config.php

return 
    array(
        "base_url" => "http://mysite.com/index.php", 

        "providers" => array ( 
            // openid providers
            "OpenID" => array (
                "enabled" => false
            ),

            "AOL"  => array ( 
                "enabled" => false 
            ),

            "Yahoo" => array ( 
                "enabled" => false,
                "keys"    => array ( "id" => "", "secret" => "" )
            ),

            "Google" => array ( 
                "enabled" => true,
                "keys"    => array ( "id" => "", "secret" => "" )
            ),

            "Facebook" => array ( 
                "enabled" => true,
                "keys"    => array ( "id" => "xxxxxxxxx", "secret" => "xxxxxxx" )
            ),

            "Twitter" => array ( 
                "enabled" => true,
                "keys"    => array ( "key" => "xxxxxxxx", "secret" => "xxxxxxxx" ) 
            ),

            // windows live
            "Live" => array ( 
                "enabled" => false,
                "keys"    => array ( "id" => "", "secret" => "" ) 
            ),

            "MySpace" => array ( 
                "enabled" => false,
                "keys"    => array ( "key" => "", "secret" => "" ) 
            ),

            "LinkedIn" => array ( 
                "enabled" => true,
                "keys"    => array ( "key" => "xxxxxxxx", "secret" => "xxxxxxx" ) 
            ),

            "Foursquare" => array (
                "enabled" => false,
                "keys"    => array ( "id" => "", "secret" => "" ) 
            ),
        ),

        // if you want to enable logging, set 'debug_mode' to true  then provide a writable file by the web server on "debug_file"
        "debug_mode" => false,

        "debug_file" => ""
    );

Can someone please help me? I got a feeling that it does not work very good at all after searching the internet for quite a long. If that's the case, can someone point to a better alternative opensource/free social signin library?

Thanks a lot in advance...


Source: (StackOverflow)

Hybridauth - PHP - Facebook returned an invalid user id

Well I had hybridauth working and login correctly using facebook since 2 weeks ago, I did not any change and this morning I found that it was not working. I tried to switch the facebook app (id and secret key) to another one which was also working before, but is still happening the same. I also tried to run the examples which comes with hybridauth, and they are not working neither, so i know is not per a configuration from my side, and neither from the facebook app configuration.

This is what is telling me when i try to login:

Error! Authentification failed. The user has canceled the authentication or the provider refused the connection.

Original error message: Authentification failed! Facebook returned an invalide user id.

  • Can be happening per something related with my server?
  • Has facebook done any change on their API during the last 24 hours?
  • Any one has experimented something similar?

UPDATED: I have it working just since 1 week ago, to get it working I found other people with the same problem before (less than 1 month ago), they fixed it 17 days ago by updating the Facebook PHP SDK.

Here is the link to GitHub where you can see the changes to fix this problem:

https://github.com/F21/hybridauth/commit/3b115ee3abb5afbf44c37082e63aa8b056bf550c

With this, I managed to get everything working, but now is happening the same error even with these changes (after one week working).


Source: (StackOverflow)

Hybrid Auth with Codeigniter

I downloaded the codeigniter extension of HybridAuth here:

https://github.com/andacata/HybridIgniter

I followed instructions on its use. When I try to login via any provider at: www.mydomainname.com/hauth/login/twitter it loads a page saying:

HybridAuth
Open Source Social Sign On PHP Library. 
hybridauth.sourceforge.net/

It never works. I have valid API credentials for Twitter and Facebook but both load this page and nothing else happens. Any tips would be greatly appreciated.

UPDATE

My log says:

Hybrid_Provider_Adapter::login( facebook ), redirect the user to login_start URL. -- Array
(
    [hauth_return_to] => http://www.sitename.com/hauth/login/facebook
    [hauth_token] => 6vjglu8usmsjqsi74cku8o85j3
    [hauth_time] => 1335997302
    [login_start] => http://sitename.com/hauth/endpoint?hauth.start=facebook&hauth.time=1335997302
    [login_done] => http://sitename.com/hauth/endpoint?hauth.done=facebook
)

INFO -- 127.0.0.1 -- 2012-05-03T00:21:42+02:00 -- Enter Hybrid_Auth::redirect( http://sitename.com/hauth/endpoint?hauth.start=facebook&hauth.time=1335997302, PHP )

UPDATE

Here is a link to the controller

https://github.com/andacata/HybridIgniter/blob/master/application/controllers/hauth.php


Source: (StackOverflow)

Laravel 4, Composer and hybridauth - How to load additional providers

I'm using Laravel 4 and have loaded hybridauth via composer and got it working just fine with Facebook and Twitter. Now i'm trying to get it working with Steam, which is listed as an additional provider, however I keep getting the following error:

require_once(vendor/hybridauth/hybridauth/hybridauth/Hybrid/Providers/Steam.php) [function.require-once]: failed to open stream: No such file or directory

Clearly it's looking in the wrong place, the actual class resides in this location:

vendor/hybridauth/hybridauth/additional-providers/hybridauth-steam/Providers/Steam.php

There's very little documentation that I can find on this, my only guess is that the author of hybridauth only offered these additional providers as optional extras and expects you to move the location of the class to the proper place, however with composer this isn't the way to do things and will cause problems anytime I run composer update.

I can't find anyone having a similar problem via Google, which seems strange so i'm worried i'm missing obvious. Is there a way to use the additional providers, to have them autoload, while using hybridauth with Composer?

The only solution I can think to do is to manually include the correct file before it tries to autoload. I don't mind doing that, but i'm assuming there must be a proper way to do this otherwise using Composer with Hybridauth is fairly useless.


Source: (StackOverflow)

How to manage users account from multi-provider (facebook, twitter) in my website?

I'm about to use one of those multi-provider authentication frameworks Opauth or Hybridauth (don't know which is the best but I had a little preference for the second one) so the consequence is that I have to manage multi account.

In fact I already have my own account management (login+password+email) and I had last year facebook users. Now I will have to deal with Twitter account, linkedin account, etc... So the question is easy : how to manage the username ? For instance, John create a account on my site. So "John" login/username is taken. But if another John from Facebook then another one from Twitter arrive, what i'm supposed to do ? In Stackoverflow (or elsewhere), what is the practice ?

I don't want a John write on the behalf of another John. Today with my own system, I verify that the login (username) is unique. If not I reject the user. But now ?

I thought that I can check the email but... I learnt that email address can't be the key because of Twitter that doesn't give it to you.

Hope I'm clear enough :)

regards


Source: (StackOverflow)

Hybridauth Facebook login on mobile devices using native app

I have a wordpress site using hybridauth to allow users to login with Facebook. However, on mobile devices, it opens a new mobile browser asking for the facebook login data.

Is there a way to use the native Facebook app on the iphone / android for hybridauth social login instead of opening a browser tab?

One way would be to have them download an iphone app that is just an iframe browsing my repsonsive website and then sign up.

Is there a better way e.g. using sencha touch or some jquery library?


Source: (StackOverflow)

laravel4 hybridauth facebook Authentication failed! Facebook returned an invalid user id

OK, I'm trying to use Hybridauth with laravel 4. However I seem to be getting the very common when trying to log in with facebook:

Authentication failed! Facebook returned an invalid user id.

I have read all the other posts, and have had no luck, so just hoping someone may be able to help me.

I followed this tutorial: http://www.mrcasual.com/on/coding/laravel4-package-management-with-composer/

And have tried several other configurations to no success.

Here is my config/hybridauth.php

<?php
return array(
    "base_url"   => "http://myapp.dev/social/auth/",
    "providers"  => array (
        "Facebook"   => array (
            "enabled"    => true,
            "keys"       => array ( "id" => "****", "secret" => "****" ),

        ),
    ),
);

And here is my route:

Route::get('social/{action?}', array("as" => "hybridauth", function($action = "")
{
    // check URL segment
    if ($action == "auth") {
        // process authentication
        try {
            Hybrid_Endpoint::process();
        }

        catch (Exception $e) {
            // redirect back to http://URL/social/
            return Redirect::route('hybridauth');
        }
        return;
    }

    try {
        // create a HybridAuth object
        $socialAuth = new Hybrid_Auth(app_path() . '/config/hybridauth.php');
        // authenticate with Facebook
        $provider = $socialAuth->authenticate("Facebook");
        // fetch user profile
        $userProfile = $provider->getUserProfile();
    }

    catch(Exception $e) {
        // exception codes can be found on HybBridAuth's web site
        return $e->getMessage();
    }

    // access user profile data
    echo "Connected with: <b>{$provider->id}</b><br />";
    echo "As: <b>{$userProfile->displayName}</b><br />";
    echo "<pre>" . print_r( $userProfile, true ) . "</pre><br />";

    // logout
    $provider->logout();
}));

So, when I access "myapp.dev/social" I'm brought to the facebook sign up page everthing seems to work fine, asks me to allow permissions to myadd.dev. After I click OK I am brought to the following URL: http://myapp.ie/social#_=_ where the error is displayed.

Not sure if this is relevant: Just from observing other sites that in-cooperate a facebook login.. the redirect URL looks something like http://somesite.dev/subdomain/#_=_ . In other words they have a slash before the #=. Is this my problem, how do I fix it?? Very new to hybridauth so any help greatly appreciated thanks.

Oh I do realize that this post is very similar to other posts but I have yet to find a solution.

UPDATE: the exact error: Authentification failed. The user has canceled the authentication or the provider refused the connection.


Source: (StackOverflow)

Understanding base_url parameter when using HybridAuth

I'm trying to use the hybridauth library to authenticate and get access to the users profiles of my corporate OpenID provider.

I'm trying to configure all the parameters but i don't understand some of them:

  • What exactly is the base_url parameter ?? the help says: 'base_url' the url that point to HybridAuth Endpoint (where index.php and config.php are found) But i'm having troubles to find this files or figure out what it means.

  • What exactly i need to ask to my provider to configure properly my OpenID adapter using the hybridauth library ??

Sorry by my poor English.
Any help appreciated.


Source: (StackOverflow)

HybridAuth Twitter Failure 401

THE PROBLEM I was able to connect to Twitter the the HybridAuth library, and it stopped working. Posting to a Twitter account was also functional.

WHAT I HAVE TRIED Resetting my Twitter app access tokens. Creating an All new Twitter app. Using the HybridAuth debug mode to troubleshoot.

THE ERROR MESSAGE "Authentification failed. The user has canceled the authentication or the provider refused the connection.

Original error message: Authentification failed! Twitter returned an error. 401 Unauthorized."

MY RESEARCH This seems to be attributed to the lack of the key and secret, but I set these in the Twitter config file.

THE CODE

            $hybridauth = new Hybrid_Auth( $config );

            $adapter = $hybridauth->authenticate( "Twitter" );
            $hybridauth_session_data = $hybridauth->getSessionData();
            store_session_data($hybridauth_session_data);

            // get the user profile 
            $user_profile = $adapter->getUserProfile();

The exception is being thrown by the authenticate method. Before it would ask me to allow access via the app and now it throws the error.

If you need more information, please let me know. Rick


Source: (StackOverflow)

Integration of hybrid_auth in laravel 5

I am new to laravel framework any help would appreciate

When i try to execute the below code i get this error FatalErrorException in SocialController.php line 27: Class 'App\Http\Controllers\Hybrid_Auth' not found in SocialController.php line 27

when i remove the namespace from SocialController.php i get this error saying BaseController not found.

onclick this button

 <a rel='nofollow' href="{{action("SocialController@getFacebookLogin")}}" class="submit-button btn btn-block btn-primary"><i class="fa fa-facebook"></i>&nbsp;&nbsp;Facebook</a>

SocialController.php

       <?php
        namespace App\Http\Controllers;
        use App\Http\Controllers\Controller; 
        use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;

    class SocialController extends BaseController
    {


//this is the code for facebook Login
public function getFacebookLogin($auth=NULL)
{
    if ($auth == 'auth')
    {
        try
        {
            Hybrid_Endpoint::process();
        }
        catch (Exception $e)
        {
            return Redirect::to('fbauth');
        }
        return;
    }

    $oauth = new Hybrid_Auth(app_path(). '/config/fb_auth.php');
    $provider = $oauth->authenticate('Facebook');
    $profile = $provider->getUserProfile();
    return var_dump($profile).'<a rel='nofollow' href="logout">Log Out</a>';
}



   public function getLoggedOut()
{
    $fauth = new Hybrid_auth(app_path().'/config/fb_auth.php');
    $fauth->logoutAllProviders();
    return view::make('/');
}


 }

fb_auth.php

    <?php

   return array(
   "base_url" => "http://urmk.com/fbauth/auth",
   "providers" => array (
  "Facebook" => array (
  "enabled" => true,
  "keys"    => array ( "id" => "APP_ID", "secret" =>  "APP_SECRET" ),
  "scope"   => "email"
)
    )
     );

Routes.php

    Route::get('fbauth/{auth?}' ,array('as'=>'facebook',   'uses'=>'SocialController@getFacebookLogin'));                                                                                                          
    Route::get('logout',array('as'=>'logout','uses'=>'SocialController@getLoggedOut'));

Source: (StackOverflow)

Social sign in Android/iPhone app with server side [closed]

I'm evaluating HybridAuth and socialAuth-android, but I'm not restricted to those platforms only. Till now I only read the documentation of the 2 libraries and didn't play with the code itself.

The requirements:

  1. Letting the user, through an Android/iPhone app, giving permission to gather some data from his profile/s (Facebook, Twitter, Linkedin...). Should act as the standard user experience. If it's possible the user should not enter his username and password of his profile. I thought of using the sign-in API, even that the user is not actually signing in to my app with those profiles.
  2. The server should be able to gather the information from time to time from the different profiles that the user gave access to.

I prefer using only one library to accomplish my needs, but from reading the HybridAuth and socialAuth-android, it looks that it won't going to work.

I thought of doing the following (still not sure if it can be done)

  1. Use the socialAuth-android on the Android app, and asking the user for permission
  2. Sending the token from the Android app to the server.
  3. On the server using the HybridAuto Sessions 'restoreSessionData'. This is the tricky part, since the restore session is looking for the serialized array from 'getSessionData'. I thought on looking on the array and to try constructing it by myself from the information I can gather from the socialAuth-android.

And the question:

  1. Did I miss anything? can it be done only by one library?
  2. If you have better recommendations for other libraries, it would be great to hear about.
  3. Would I be able to implement my thoughts, or the data between the 2 libraries is too different to achieve this, at the end of the day I believe that we are talking mainly on access token, so at first glance it looks doable.
  4. If you have better practices to achieve it, I'll be glad to hear.

Thanks


Source: (StackOverflow)