QueryAccessTokenExtractor example

$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
        );
    }
}
yield [$request, 'Invalid credentials.', BadCredentialsException::class];

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

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