• V.J. August 7, 2013  

    Hey Maks,

    Thanks for this post. I was overthinking such a login system as well for an upcoming Phonegap app i’m going to make. It turns out to be a lot easier!

    What do you think about the Sentry package from Cartalyst? Would it be as easy to login somebody via this same approach?


  • Maks Surguy August 7, 2013  

    I am glad this helps! I was also doing the same mistake of overthinking this.

    Why do you need to use Sentry? What is the advantage of using it?

  • V.J August 8, 2013  

    I think the group and group permissions are a nice feature but i don’t know if i will eventually use it in the app..

  • Rahul Parekh September 18, 2013  

    Thanks for this. Helped a lot.

    Is there a way where I can do this for facebook login too?

  • Varun Nath September 27, 2013  

    I too had been over thinking this!.
    Thanks maks!

  • aditya menon March 6, 2014  

    Hi, what if this form *was* on a separate domain, and what if each request was creating a separate session with Laravel? This is the problem I have… solving that is proving to be way harder.

  • Maks Surguy March 7, 2014  

    Yeah for that you’d need a bit more ingenuity unfortunately… Have you checked out other tutorials online about this?

  • Camargo April 20, 2014  

    What about Laravel 4. It changes the rules.

  • Jaby April 20, 2014  

    having similar issue. I am able to log-in from a different domain (even local host) but the session will not persist across domains.

  • Maks Surguy April 20, 2014  

    Please note that this will work on different domains. If you use Phonegap – it will work because Phonegap makes some exceptions about cross domain stuff and it could even store cookies across domains. Regular browser would not allow you to host a website at http://mysite.com and login/store cookies via ajax while being on http://myothersite.com. For that you would need to use much more complicated authentication mechanism, token-based authentication. The example given in this post is what’s called “session-based authentication” and it only works on the same domain or in PhoneGap.

  • Maks Surguy April 21, 2014  

    Can you please elaborate on that a bit?

Leave a comment