XF 2.1 Use XenForoAPI with VueJS

Eclixal

Member
I'm working on website external to XenForo, but I want to get the current user log on my xenforo forum.

Before use VueJS I use XF.php but on JS cannot add PHP :( How to ?

My code on my controller
Code:
 include_once('/var/forum2/src/XF.php');
        \XF::start('/var/forum2');
        $app = \XF::setupApp('XF\Pub\App');

        $session = $app->session();


        $uid = $session->get('userId');
        $finder = \XF::finder('XF:User');
        $user = $finder->where('user_id', $uid)->fetchOne();

And is possible to try to reconnect the user if he check the remember me ?
 
Top Bottom