We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26503
    • 620 Posts
    Quote from: BobRay at May 19, 2015, 05:24 PM
    Can you instantiate MODX before hybridauth creates its session? Maybe you could get hybridauth to use MODX's session.

    Still digging into this, but found some [obvious] errors I have made, modx stores it's sessions in the database & not on disk, hybridauth is creating php sessions if it doesn't find one.

    I suppose what I have to do is get my hybridauth script to read the modx cookie[s] & grab the session information from the database .. then ... something... hmmm
      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

      Sean Kimball CLP, CLS.
      Technical Director / Sr. Developer | BigBlock Studios
      ._______________________________________________.
      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
      phone/fax: 905-426-5525
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      You do know there's a MODX package for HybridAuth, right?

      http://modx.com/extras/package/hybridauth
      http://rtfm.modx.com/extras/revo/hybridauth
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 26503
        • 620 Posts
        Quote from: markh at May 29, 2015, 09:14 AM
        You do know there's a MODX package for HybridAuth, right?

        http://modx.com/extras/package/hybridauth
        http://rtfm.modx.com/extras/revo/hybridauth

        It actually does a few nasty things:
        - changes the user classKey [or actually I think you have to do this manually - there are 6000 users!]
        - it actually changes the user's password if they already exist in the system!!
        [so it's not actually authenticating them, it's finding a match then changing their password and then logging them in using runProcessor
        - hybridauth package is out of date and does not work with several providers.
        - docs need work, actually it needs docs, the video "doc" is not helpful

        So it's not going to work out in my case
          *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

          Sean Kimball CLP, CLS.
          Technical Director / Sr. Developer | BigBlock Studios
          ._______________________________________________.
          Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
          27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
          phone/fax: 905-426-5525
          • 26503
          • 620 Posts
          Quote from: sottwell at May 14, 2015, 09:35 PM
          If there is no MODX user, then how can MODX get the user's ID and other non-existent properties? You'll have to use OnWebLogin to add the properties you want to the user's SESSION.

          That won't let you use the userinfo output modifier, though, since that uses a getProfile() on the user and your remote users don't have profiles in the MODX database.

          You can make your own output modifiers, though, to pull information from the SESSION - they are just specially crafted snippets.

          The only thing we actually have to match an existing modx user to an external source [facebook/google/etc] is their email address, which we have once hybridauth has authenticated the user [or rather returned the providers authentication result and profile if successful]

          So I am using the email address to backtrack & get the user id to create the user obj. Technically when they are in my hybridauth connector the browser has both a modx anonymous session and a hybridauth session until I create the modx user.... [then everything goes to hell]
            *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

            Sean Kimball CLP, CLS.
            Technical Director / Sr. Developer | BigBlock Studios
            ._______________________________________________.
            Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
            27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
            phone/fax: 905-426-5525
            • 40706
            • 128 Posts
            We are using links to log user in with their permissions, just simple:

            $modx->user = $modx->getObject('modUser', array('username' => $username)); 
            $modx->user->addSessionContext($modx->context->get('key'));
            $modx->sendRedirect($modx->makeUrl($modx->getOption('site_start')));


            I think you have to assign the user to $modx->user before adding the session context.
              • 26503
              • 620 Posts
              Quote from: m.engel at Jun 02, 2015, 02:29 AM
              We are using links to log user in with their permissions, just simple:

              $modx->user = $modx->getObject('modUser', array('username' => $username)); 
              $modx->user->addSessionContext($modx->context->get('key'));
              $modx->sendRedirect($modx->makeUrl($modx->getOption('site_start')));


              I think you have to assign the user to $modx->user before adding the session context.

              It will probably work like that too - but no, you don't need the $modx-> bit ...
                *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

                Sean Kimball CLP, CLS.
                Technical Director / Sr. Developer | BigBlock Studios
                ._______________________________________________.
                Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
                27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
                phone/fax: 905-426-5525