Laravel get token from header
You may check headers in laravel using the below methods.
<?php
use Illuminate\Http\Request;
class PageController extends Controller
{
public function checkHeaders(Request $request)
{
if ($request->hasHeader('Authorization')) {
$value = $request->header('Authorization');
}
//or use this
$token = $request->bearerToken();
}
public function otherHeaders(Request $request)
{
$value = $request->header('X-Header-Name', 'default_header_value');
}
}
click for more Laravel codes read about laravel headers