I am developing both a blog with wordpress and a rather complex application with laravel. The problem is to integrate one in the other. I do not want the users to need to log into both services seperately. As I need to store more information about a user than just the wordpress basics I want to use Eloquent and everything from Laravel though.
I could include the Wordpress core and just use the wordpress authentication, but that would mean to load the whole WP environment everytime, if I am not mistaken.
I could also imagine to build some kind of API that allows one system to be able to retrieve the logged in user from the other application, but I have no idea how to build this.
Are there any common ways to solve this problem I have not stumbled upon?
The Hampel plugin uses wordpress as your authority, if you want to do it the other way around and use laravel or any other database as your authority you can swap out Wordpress authentication as described here
This has already been turned into a Wordpress plugin and is available here.
(If you still need this) Use this library, from Hampel:
https://packagist.org/packages/hampel/wordpress-auth-laravel
Docs and usage available at: https://bitbucket.org/hampel/wordpress-auth-driver-for-laravel.git
https://wordpress.org/plugins/oauth2-provider/faq/ works like a dream you can either use jquery or php to initiate the cleint