Answer the question
In order to leave comments, you need to log in
How to correctly connect authorization with laravel to the forum?
Hello.
There is a site on laravel, a forum on XenForo 2 is uploaded to it in the public folder.
I decided to do authorization and registration through the forum, and then it started running.
The bottom line is that an authorized user on the forum can be obtained as follows, and I added what would authorize him on the site itself:
if( Auth::check() == null ) {
require ( public_path() .'/forum/src/XF.php');
\XF::start('/hc');
$app = \XF::setupApp('XF\Pub\App');
$s = $app->session();
$uid = $s->get('userId');
if ($uid){
$finder = \XF::finder('XF:User');
$user = $finder->where('user_id', $uid)->fetchOne();
$find_user = User::find($user->user_id);
if($find_user) {
Auth::loginUsingId($find_user->user_id);
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question