Service/GuzzleJWTMiddleware.php
public static function authTokenMiddleware(string $issuer, string $secret): callable
    {
        return Middleware::mapRequest(
            function (RequestInterface $request) use ($issuer, $secret) {
                return new Request(
                    $request->getMethod(),
                    $request->getUri(),
                    \array_merge($request->getHeaders(), ['Authorization' => 'JWT '.JWTGenerator::generate($request, $issuer, $secret)]),
                    $request->getBody()
                );
            }
        );
    }
public static function authTokenMiddleware(string $issuer, string $secret): callable
    {
        return Middleware::mapRequest(
            function (RequestInterface $request) use ($issuer, $secret) {
                return new Request(
                    $request->getMethod(),
                    $request->getUri(),
                    \array_merge($request->getHeaders(), ['Authorization' => 'JWT '.JWTGenerator::generate($request, $issuer, $secret)]),
                    $request->getBody()
                );
            }
        );
    }
public static function authTokenMiddleware ( string $ issuer , string $ secret ) : callable { return Middleware :: mapRequest ( function ( RequestInterface $ request ) use ( $ issuer , $ secret ) { return new Request ( $ request -> getMethod ( ) , $ request -> getUri ( ) , \ array_merge ( $ request -> getHeaders ( ) , [ 'Authorization' => 'JWT ' . JWTGenerator :: generate ( $ request , $ issuer , $ secret ) ] ) , $ request -> getBody ( ) ) ; } ) ; }
JWT Authentication middleware for Guzzle

@param string $issuer Add-on key in most cases
@param string $secret Shared secret

@return callable
JWT Authentication middleware for Guzzle