Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RMS Single SignOn with Invoicing
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Dashboard</div>
<div class="panel-body">
<form method="POST" action="{{url('invoicing_login')}}" target="_blank">
{{csrf_field()}}
<button type="submit" class="btn btn-primary">Enter Invoicing</button>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Cookie;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('home');
}
public function invoicingLogin()
{
$cookie_name = 'pwp_invoicing_ck';
$expire = time()+3600; /* expire in 1 hour */
$ck_path = '/picwpost_invoicing/public/'; //optional, but I set it, to be able to catch it in Invoicing
$invoicing_app_url = 'http://localhost/picwpost_invoicing/public/auth_line';
$token_cookie = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjI3YzU4NzQ2MjRlYmQ4ZjE4NGI5OTNhYTVjMDY3MGFlZDUxNzNkYjIxZTg3N2FlNThhZGE4YjQxMDFlMTcxYjNkODU4M2ZhZTVlZTQxNTk2In0.eyJhdWQiOiI0OCIsImp0aSI6IjI3YzU4NzQ2MjRlYmQ4ZjE4NGI5OTNhYTVjMDY3MGFlZDUxNzNkYjIxZTg3N2FlNThhZGE4YjQxMDFlMTcxYjNkODU4M2ZhZTVlZTQxNTk2IiwiaWF0IjoxNTYwMjY3NTA3LCJuYmYiOjE1NjAyNjc1MDcsImV4cCI6MTU5MTg4OTkwNywic3ViIjoiMzkiLCJzY29wZXMiOltdfQ.KeM_pDdHPdX-3jC-MkHgpLOxlge8iUOiYibJ5yAZ3IfQfFIkP2Ti5BEwf5RoGftL6xSkml-qmAvwBoTn3MJ7Go2cHj352V-DSrLYghc0I23WzT9Ts_loo0MJ-2lI9ggm6nEtr88Hrn6OA9rMfwXcR0ip58twxGO8VGj4BocM-7gmO6n7-okQWu-dv7asQgT_nl2n78fbupOfYLfLcM8PeCUTy62dOxwQh2sIIDdcYKvOMEn21OdXnMCAzvI0DG5UnZT_AQVCm_6yncUkI7pvSZPBP_Jw6KaJY7-yDYAaEOxccA-6NjDAfej1nlO4IwZzAoSk6v9syUitAwm_FhEueUqiERNhEnL8fwigrY4MloHR9-PxS12HELkpksyyMT75qg5hUE2VEFm615P9ajJFEnEm3-FJTkpTDU8D596ybWXC2lE0S0YFUmy8nGlJoCw8DbYObqi_1NfDL6seGjNGjkgl2S5ZxB0gMx9_WfrVp6PGYkewbkiZ-EOM-TTJvPCFShAtprIqaoRUYqafVWKEN1glGYGWkvIeRL9DDFs3pP41bPKbbLjOcnnvMzI7q8qn9enaFQjB50_XL0rm-M4_3svJ__3sIh6xW47wGZ0JtDTn4dXp4RuZKinjUYiBeSmmWW3WDQyvoF9J8MONqNNwvvjvXp1okJlKrXRWHHvLvWI";
setcookie($cookie_name, $token_cookie, $expire, $ck_path);
return redirect()->to($invoicing_app_url);
}
}
<?php
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::post('/invoicing_login', 'HomeController@invoicingLogin');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.