Created
November 6, 2018 17:00
-
-
Save IgorDePaula/db305b18913ac4d12c1fd77f2ecbd878 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tandle\Http\Middleware; | |
use Closure; | |
use JWTAuth; | |
class RefreshTokenMiddleware | |
{ | |
/** | |
* Handle an incoming request. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \Closure $next | |
* @return mixed | |
*/ | |
public function handle($request, Closure $next) | |
{ | |
$token = JWTAuth::refresh(); | |
$response = $next($request); | |
$response->headers->set('NewToken',$token); | |
return $response; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment