Salim Trouve Posted April 28, 2022 Posted April 28, 2022 Hello everyone, I come to you because I have a question concerning my integration. I have User Control Panel made with Laravel (mydomain.com) And Invision Community as Forum (forum.mydomain.com). What I would like to accomplish : If the user is not logged in, he's redirected to the default Invision Community login handler. If the user is logged in, he's also logged in on Laravel (mydomain.com) and Forum (forum.mydomain.com) Have the ability to retrieve user informations (core_members) from the Laravel (username, avatar .. etc) How can I accomplish this? (and in a secure way) Thank you ! :)
Randy Calvert Posted April 28, 2022 Posted April 28, 2022 You would need some sort of custom third party development work to facilitate this. There is not any sort of native integration with Laravel today.
Marc Posted April 28, 2022 Posted April 28, 2022 As mentioned, you would require some SSO development in order to achieve this. You would need a 3rd party developer to do this, or we do offer this as a paid service on our creator pro and upward, which you can see on our packages page here https://invisioncommunity.com/buy Salim Trouve 1
Askancy Posted April 28, 2022 Posted April 28, 2022 I for my project with Laravel 9 decided to use the user management of IP.Board, the user logs in from the forum and has full access also to the portal in Laravel, like commenting articles. To make Laravel communicate with IP.Board just call the file init.php in AppServiceProvider.php class AppServiceProvider extends ServiceProvider { public function register() { // } public function boot() { $path = base_path('../forum.***.ext/'); require_once $path . 'init.php'; view()->composer('*', function ($view) { \IPS\Session\Front::i(); }); To get user data on a laravel blade I use: {{\IPS\Member::loggedIn()->name}} I hope this can be a starting point to help you develop what you want. Daniel F, The Old Man, SeNioR- and 2 others 4 1
Salim Trouve Posted April 29, 2022 Author Posted April 29, 2022 12 hours ago, Askancy said: I for my project with Laravel 9 decided to use the user management of IP.Board, the user logs in from the forum and has full access also to the portal in Laravel, like commenting articles. To make Laravel communicate with IP.Board just call the file init.php in AppServiceProvider.php class AppServiceProvider extends ServiceProvider { public function register() { // } public function boot() { $path = base_path('../forum.***.ext/'); require_once $path . 'init.php'; view()->composer('*', function ($view) { \IPS\Session\Front::i(); }); To get user data on a laravel blade I use: {{\IPS\Member::loggedIn()->name}} I hope this can be a starting point to help you develop what you want. Hi, thank you for your reply. I have already tested this solution : public function boot() { $path = base_path('../forum.vice/'); require_once $path . 'init.php'; view()->composer('*', function ($view) { \IPS\Session\Front::i(); }); } I'm logged in the forum but in Laravel blade I got token like "4d99edd69d5019629c6a37e13382fd0e" when I call : {{\IPS\Member::loggedIn()->name}} Do I have to do anything else ? About session or cookie domain ? Thank you 🙂 SeNioR- 1
Daniel F Posted April 29, 2022 Posted April 29, 2022 1. Keep in mind that Laravel won't take care of the proper output, so language string keys will be returned as hashes. 4d99edd69d5019629c6a37e13382fd0e is probably the hash for "Guest".
Salim Trouve Posted April 29, 2022 Author Posted April 29, 2022 6 minutes ago, Daniel F said: 1. Keep in mind that Laravel won't take care of the proper output, so language string keys will be returned as hashes. 4d99edd69d5019629c6a37e13382fd0e is probably the hash for "Guest". Yeah but it's the same in the AppServiceProvider like : dd(\IPS\Member::loggedIn()->name);
Marc Posted April 29, 2022 Posted April 29, 2022 I have moved this over to our developer forum, since its not general support this one. 🙂 Salim Trouve 1
Solution Askancy Posted April 29, 2022 Solution Posted April 29, 2022 2 hours ago, Salim Trouve said: I'm logged in the forum but in Laravel blade I got token like "4d99edd69d5019629c6a37e13382fd0e" when I call As Daniel said, that hash indicates that the user is not logged in. Check cookies if the cookie is saved correctly. I did the integration years ago so I don't remember precisely, but you will see on the IP.Board constants.php file you have to indicate the Cookie Domain and the path, here is my configuration: \define( 'COOKIE_DOMAIN', 'MainDomin.ext' ); \define( 'COOKIE_PATH', '/' ); Because otherwise IP.Board cookies will be only for the subdomain The Old Man, Salim Trouve and SeNioR- 3
Stuart Grimshaw Posted February 28 Posted February 28 Just a quick note, all these years later. I've just tried the above on our servers with PHP 8.3 & Laravel 10 and it works perfectly, the only real difference is I used a Facade and also typed the $view variable passed to the view composer, not that it's used. <?php namespace App\Providers; use Illuminate\Support\Facades; use Illuminate\Support\ServiceProvider; use Illuminate\View\View; class AppServiceProvider extends ServiceProvider { /** * Register any application services. */ public function register(): void { // } /** * Bootstrap any application services. */ public function boot(): void { require_once(base_path('../') . '/init.php'); Facades\View::Composer('*', function (View $view) { \IPS\Session\Front::i(); }); } }
Recommended Posts