ChainAccessTokenExtractor example

$request = new Request([][][][][]['HTTP_AUTHORIZATION' => 'BearerVALID_ACCESS_TOKEN']);
        yield [$request, 'Invalid credentials.', BadCredentialsException::class];

        $request = new Request([][][][][]['HTTP_AUTHORIZATION' => 'Bearer INVALID_ACCESS_TOKEN']);
        yield [$request, 'Invalid access token or invalid user.', BadCredentialsException::class];
    }

    private function setUpAuthenticator(): void
    {
        $this->authenticator = new AccessTokenAuthenticator(
            $this->accessTokenHandler,
            new ChainAccessTokenExtractor([
                new FormEncodedBodyExtractor(),
                new QueryAccessTokenExtractor(),
                new HeaderAccessTokenExtractor(),
            ]),
            $this->userProvider
        );
    }
}
Home | Imprint | This part of the site doesn't use cookies.