src/Guards/TokenGuard.php
protected function getPsrRequestViaBearerToken($request)
    {
        // First, we will convert the Symfony request to a PSR-7 implementation which will
        // be compatible with the base OAuth2 library. The Symfony bridge can perform a
        // conversion for us to a Zend Diactoros implementation of the PSR-7 request.
        $psr = (new DiactorosFactory)->createRequest($request);

        try {
            return $this->server->validateAuthenticatedRequest($psr);
        } catch (OAuthServerException $e) {
            $request->headers->set('Authorization', '', true);

            Container::getInstance()->make(
                ExceptionHandler::class
            )->report($e);
        }
    }
protected function getPsrRequestViaBearerToken($request)
    {
        // First, we will convert the Symfony request to a PSR-7 implementation which will
        // be compatible with the base OAuth2 library. The Symfony bridge can perform a
        // conversion for us to a Zend Diactoros implementation of the PSR-7 request.
        $psr = (new DiactorosFactory)->createRequest($request);

        try {
            return $this->server->validateAuthenticatedRequest($psr);
        } catch (OAuthServerException $e) {
            $request->headers->set('Authorization', '', true);

            Container::getInstance()->make(
                ExceptionHandler::class
            )->report($e);
        }
    }
protected function getPsrRequestViaBearerToken ( $ request ) { // First, we will convert the Symfony request to a PSR-7 implementation which will // be compatible with the base OAuth2 library. The Symfony bridge can perform a // conversion for us to a Zend Diactoros implementation of the PSR-7 request. $ psr = ( new DiactorosFactory ) -> createRequest ( $ request ) ; try { return $ this -> server -> validateAuthenticatedRequest ( $ psr ) ; } catch ( OAuthServerException $ e ) { $ request -> headers -> set ( 'Authorization' , '' , true ) ; Container :: getInstance ( ) -> make ( ExceptionHandler :: class ) -> report ( $ e ) ; } }
Authenticate and get the incoming PSR-7 request via the Bearer token.

@param  \Illuminate\Http\Request  $request
@return \Psr\Http\Message\ServerRequestInterface
Authenticate and get the incoming PSR - 7 request via the Bearer token .