Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 14:24
    simmonspaul commented #1126
  • Dec 06 12:45
    nightw0lv opened #1127
  • Dec 03 10:43
    harshalone commented #1126
  • Dec 03 10:42
    harshalone opened #1126
  • Nov 25 10:53
    ApacheEx labeled #1123
  • Nov 25 10:53
    ApacheEx labeled #1123
  • Nov 25 10:52
    ApacheEx labeled #1121
  • Nov 25 10:52
    ApacheEx labeled #1121
  • Nov 25 10:52
    ApacheEx labeled #1121
  • Nov 25 10:52
    ApacheEx labeled #1121
  • Nov 25 10:52
    ApacheEx unlabeled #1125
  • Nov 25 10:52
    ApacheEx labeled #1125
  • Nov 25 10:50
    ApacheEx milestoned #1124
  • Nov 25 10:50
    ApacheEx labeled #1124
  • Nov 25 10:50

    ApacheEx on master

    Add support for PATCH requests … Add support for PATCH requests … (compare)

  • Nov 25 10:50
    ApacheEx closed #1124
  • Nov 25 10:45
    ApacheEx labeled #1125
  • Nov 25 10:45
    ApacheEx commented #1125
  • Nov 25 10:34
    elcreator commented #1125
  • Nov 25 06:53
    ApacheEx labeled #1125
Adrien Crivelli
@PowerKiKi

@cookieman768 what's been working for us, with v3, is storing data in identity and user tables. Something like:

CREATE TABLE `identity` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `provider` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `provider_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

where user_id would be a foreign key to user tables where you store whatever is needed for your app. Then the Hybrid callback would look something like:

    public function callbackAction()
    {
        $provider = $this->getProvider();
        $provider->authenticate();
        $profile = $provider->getUserProfile();
        $providerName = mb_strtolower($this->getRequest()->getQuery('provider'));

        /** @var User $user */
        $user = $this->entityManager->getRepository(User::class)->createOrUpdate($providerName, $profile);
        $this->entityManager->flush();

        $token = $this->tokenManager->create($user);

        $uri = $this->getRequest()->getUri();
        $base = sprintf('%s://%s', $uri->getScheme(), $uri->getHost());

        return $this->redirect()->toUrl($base . '/receive.html?token=' . $token);
    }

And finally:

    public function createOrUpdate(string $provider, Profile $profile): User
    {
        // First, look for pre-existing identity
        $identityRepository = $this->getEntityManager()->getRepository(Identity::class);
        $identity = $identityRepository->findOneBy([
            'provider' => $provider,
            'providerId' => $profile->identifier,
        ]);

        $userByIdentity = $identity ? $identity->getUser() : null;
        $userByEmail = $profile->email ? $this->findOneByEmail($profile->email) : null;

        if ($userByIdentity && $userByEmail && $userByEmail !== $userByIdentity) {
            $user = $this->mergeUser($userByEmail, $userByIdentity, $identity);
        } elseif ($userByIdentity) {
            $user = $userByIdentity;
        } else {
            $user = $userByEmail;
        }

        // If we still couldn't find a user yet, create a brand new one
        if (!$user) {
            $user = new User();
            $this->getEntityManager()->persist($user);
            $country = $this->getEntityManager()->getRepository(\Application\Model\Country::class)->findOneByCode($profile->country);
            $user->fromProfile($profile, $country);
        }

        // Also create an identity if we couldn't find one at the beginning
        if (!$identity) {
            $identity = new Identity();
            $identity->setUser($user);
            $identity->setProvider($provider);
            $identity->setProviderId((string) $profile->identifier);
            $this->getEntityManager()->persist($identity);
        }

        // Mark as logged in
        $user->setLastLogin(new CarbonImmutable());
        if (!$user->getFirstLogin()) {
            $user->setFirstLogin(new CarbonImmutable());
        }

        return $user;
    }
This is using Doctrine, but it should give you ideas even for other DB lib...
Saish
@Saish13
Hi
I am new to using hybridauth so I followed the examples in the documentation and it worked but not completely the authentication goes through, but I am not able to get back the person user profile could any one please help understand what is it that I am doing wrong
Saish
@Saish13

public function fbSignUp($request, $response) {

            $config = [
                'callback' => \Hybridauth\HttpClient\Util::getCurrentUrl(),
                'keys'     => [ 'id' => '*****', 'secret' => '*****' ]
            ];

            $adapter = new \Hybridauth\Provider\Facebook( $config );

            try {
                $adapter->authenticate();

                $userProfile = $adapter->getUserProfile();
                $tokens = $adapter->getAccessToken();
                $_SESSION['user'] = $userProfile;
            }
            catch( Exception $e ){
                echo $e->getMessage() ;
            }
}
this is the authentication function, I am using HybridAuth v3. Could any one please point me in the right direction ?
cookieman768
@cookieman768
@PowerKiKi
Thank you for the response.
Yamakasi
@Yamakasi
Hi guys, I'm confused about V2 vs V3 now
Oleg Kuzava
@ApacheEx
pls use v3. That's it ;) v2 is no longer supported (only critical fixes)
Yamakasi
@Yamakasi
@ApacheEx I know but the examples ae they V2 or V3 now ?
*are
Adrien Crivelli
@PowerKiKi
@ApacheEx v3.0.0-rc.1 has been released more than 1 year ago. I think it's time to make a final release, even if doc is incomplete. The current situation is really confusing for new users
I've been using v3 branch for more than 3 years without any issue. The v3 is stable and production ready, even if feature-incomplete, and the releases should reflect that
Yamakasi
@Yamakasi
@PowerKiKi indeed, I use V3 but it stays confusing indeed
I try to disconnect but it doesn't, how can I debug that ?
Yamakasi
@Yamakasi
this is pretty odd, we cannot import that much userdata anymore from linkedin
Yamakasi
@Yamakasi
ok it seems to be pretty clear, now MS owns linkedin the login sucks
Yamakasi
@Yamakasi
morning guys! are there issues with the LinkedIn V2 API ? I get not enough permissions in any way
Yamakasi
@Yamakasi
anyone alive ?
Yamakasi
@Yamakasi
why are PR's and tickets processed that slow on github ?
Yamakasi
@Yamakasi
hello ?
Zahid Shaikh
@zahidshaikh
I want to contribute and make the documentation better
its incomplete
and i cant get to display the user profile fields even after successful login
jeez no one's here
AshAlom
@AshAlom
Has anyone had any luck adapting this to work with the new "Sign in with Apple" feature?
Lioxor64
@lioxor64

Hello, my name is Liora and I am currently hunting open source projects for company NeuraLegion (www.neuralegion.com)
We just launched a free annual subscription for open source projects for our AIAST tool NexPloit.

If you are interested, please, reach us on opensource@neuralegion.com!

Thank you for your time and consideration! If you have any questions, please do not hesitate to contact us!

Best,

agbarbosa
@agbarbosa
Hey guys… first of all, whoever created the hybridauth plugin, I am a fan already!
I need some support for making it work for an wordpress site trying to authenticate users for the EVE Online game
I need to validate some users in the website and provide access permission depending on their participation on the game
the problem I'm facing is when EVE SSO return the Response to the hybridauth base_url (EVE Callback URL).
agbarbosa
@agbarbosa
"PHP Fatal error: Uncaught Hybrid_Exception: You cannot access this page directly."
test
@test63587011_twitter
hello
vzangloo
@vzangloo
Hi all
having problems using the algorithm from example 07 (multiple providers), unable to login facebook
Bertrand Gorge
@bertrandgorge

Hello all, I'm trying to migrate a project from HybridAuth 2.xx to 3.00, and I'm facing an issue with the following call to "Hybrid_Endpoint":

    require_once( "Hybrid/Auth.php" );
    require_once( "Hybrid/Endpoint.php" );
    Hybrid_Endpoint::process();

I haven't seen that too much in the 2.xx documentation, but it appears quite a lot in many examples on the web, as well as in the code I try to migrate.

Apparently, in my code, there's either a login or process (the first calls authenticate(...) and the second process(...)
Should I just comment that part ? Not clear from the migration guide!
Thanks for any help !
Bertrand Gorge
@bertrandgorge
^^ Fixed - thanks !
HLonare
@hlonare_twitter

Hi I added hybridauth to my library folder and included it like this:
//Include Hybridauth's basic autoloader
include APPPATH.'libraries/hybridauth/src/autoload.php';

//Import Hybridauth's namespace
use Hybridauth\Hybridauth;

but when I create an object of hybridauth class like this:
$hybridauth = new Hybridauth\Hybridauth($config);
its throwing an error
Class 'Hybridauth\Hybridauth\Hybridauth' not found
HLonare
@hlonare_twitter
hi anyone here
can help me with this issue
@ApacheEx ?