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

laravel / php integration?

Discussion in 'XenForo Development Discussions' started by Trajan King, Aug 6, 2015.

  1. Trajan King

    Trajan King New Member

    My site is Laravel / PHP based. I'm trying to integrate xenforo into my site with a single login so people who login to my site can be auto-logged into xenforo without the need to login twice.
    Is there any documentation on that?
    Can you help me know how to do it?
  2. Sim

    Sim Well-Known Member

    I've been meaning to write a Laravel auth module for XenForo - I've already written one for WordPress.

    But mine would work the other way to what you described - log on to a Laravel application using XenForo user credentials. I figure that XenForo already has all the user management systems built in - why bother reproducing that in a separate application?

    Obviously if you already have an existing Laravel application and you want to add XenForo to it, that's a slightly different problem.

    It's on my todo list - I have a new XenForo based site I'm planning on building some additional largely stand-alone functionality for (ie not built on top of XenForo), but would want to have SSO with XenForo so users can use their existing credentials to access the application.
  3. Trajan King

    Trajan King New Member

    I'm moving my site to Wordpress to make it easier. Do I need an auth module for that if I'm just using WP as the outside non-logged sales page and then members login to the site and are taken to Xenforo?
  4. Sim

    Sim Well-Known Member

    If you just have WordPress as a standalone front-end for the site and no user logins required, then there is no need to do any auth integration.

    I will probably end up doing the same with my site - at the moment the home page redirects to /community, but I do plan on building a proper home page at some point - either something integrated directly with XenForo, or a WordPress front-end (with no auth integration).
  5. gabarba

    gabarba Member

    We currently just developed a community that has a base application built on Laravel and the community is nested within. I have made a bridge composer package but its still heavily in development will probably be completely refactored here in the next month or so.

    The package allows you to integrate directly with the Xenforo sessions and authenticate visitors through xenforo's authentication system instead. I have middleware designed to check authentication and redirect if they are not logged in. You can also use the package to render xenforo templates from within Laravel.

    UnderRatedBrilliance/XenforoBridge · GitHub

    The site using this is AstronomyConnect
    lol768 likes this.
  6. Jerry

    Jerry Well-Known Member

    That looks like something I'm working towards. We already have a site built in Laravel, but now want to add xF to it. I'm thinking we'll automatically create the users in xF via Laravel, generate a 2nd session for xF and run them site by side for now. Just working though it atm.
  7. gabarba

    gabarba Member

    So you would use laravel for authenticating and then once verified you would start a xf session with them logged in? Personally I have it reversed because it was much easier to let xf do the authentication, If you are creating users in both databases at the same time that should be fairly straight forward but if you need to migrate your existing user database into xf you will need to write your own authentication and some migration script to insert your existing hashes into xenforo. I would reconsidered using laravel for authentication and just use xenforo. There is a bunch of spam tools, checks, and logs that go into the registration and verification process in xenforo and writing that again would be a waste. Plus you need to consider how additional xenforo extensions would interact.
  8. Jerry

    Jerry Well-Known Member

    That's basically it.

    There are reasons we can't do that at the moment. We have very specific UUIDs for users, so would have to change xF using auto_inc to our own user id generation system.

    At the moment I'm investigating auto generating xF users and managing 2 sessions / cookies.
    Last edited: Oct 13, 2015

Share This Page