Laravel + rocketchat


I want to log in from laravel app into rocket chat. As I have no idea what I am doing came here to ask.

So far I use noisim/rocket-chat package for laravel to play with rocketchat rest api.

Result is this, but I am stuck for now. Help please :slight_smile:

Edit: Can this be used with laravel?

Btw, I enabled Iframe option so my login now does not show.

Looking into example iframe auth I made some little progress. That is, I have this code and result.


Route::get('loginrc', 'LoginController@loginrc');
Route::post('sso', 'UserController@sso');

loginrc View:


				event: 'login-with-token',
				loginToken: '{{ $rcuser_authToken }}'
			}, 'http://localhost:3000'); //'s URL
<form method="post" action="sso">
<input type="text" name="username" />
<input type="password" name="password" />
<input type="submit" value="submit" />



namespace App\Http\Controllers;

use Illuminate\Http\Request;

class LoginController extends Controller
    public function loginrc()
	    return view('loginrc');

User Controller


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Noisim\RocketChat\Facades\User as RCUser;

class UserController extends Controller
    public function sso(Request $request)
	    $rcuser = new RCUser;
	    $rcuser = RCUser::setUsername($request->username);
	    $rcuser = RCUser::setPassword($request->password);
   	    $rcuser_id = $rcuser->id();
    $rcuser_authToken = $rcuser->authToken();

    return view('loginrc')->with('rcuser_id', $rcuser_id)->with('rcuser_authToken', $rcuser_authToken);